diff --git a/.env b/.env index 8634bf0..e807f8b 100644 --- a/.env +++ b/.env @@ -17,3 +17,19 @@ APP_ENV=dev APP_SECRET=406ccaa0c76a451fdcc2307ea146cbef ###< symfony/framework-bundle ### + +# string pour la requête sql qui va récupérer le mot de passe +queryHashPassword="SELECT password from USER WHERE email =" +# l'url de connexion à la bdd avec PDO +urlDatabase="mysql:host=db;port=3306;dbname=remote;" +dbUser="remote" +dbPassword="remote" + +# liste des urls pour communiquer avec hydra +url_login_challenge_accept="http://sso.mse.local:4445/oauth2/auth/requests/login/accept?login_challenge=" +url_login_challenge="http://sso.mse.local:4445/oauth2/auth/requests/login?login_challenge=" +url_login_challenge_reject="http://sso.mse.local:4445/oauth2/auth/requests/login/reject?login_challenge=" + +url_consent_challenge_reject="http://sso.mse.local:4445/oauth2/auth/requests/consent/reject?consent_challenge=" +url_consent_challenge="http://sso.mse.local:4445/oauth2/auth/requests/consent?consent_challenge=" +url_consent_challenge_accept="http://sso.mse.local:4445/oauth2/auth/requests/consent/accept?consent_challenge=" \ No newline at end of file diff --git a/Makefile b/Makefile index c484a9d..cd0a513 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CI_COMPOSE=FIXUID=$(shell id -u) FIXGID=$(shell id -g) docker-compose -f docker-compose.yml -LOGINAPP_SHELL_USER ?= www-data: +loginappsql_SHELL_USER ?= www-data: up: FIXUID=$(shell id -u) FIXGID=$(shell id -g) docker-compose up --build @@ -10,8 +10,8 @@ down: purge: docker-compose down -v --remove-orphans --rmi local -loginapp-shell: +loginappsql-shell: $(CI_COMPOSE) exec \ - -u "$(LOGINAPP_SHELL_USER)" \ - loginapp \ + -u "$(loginappsql_SHELL_USER)" \ + loginappsql \ /bin/bash \ No newline at end of file diff --git a/composer.json b/composer.json index 9e9067c..200072b 100644 --- a/composer.json +++ b/composer.json @@ -7,12 +7,19 @@ "php": ">=7.2.5", "ext-ctype": "*", "ext-iconv": "*", + "doctrine/annotations": "^1.13", "symfony/apache-pack": "^1.0", "symfony/console": "5.4.*", "symfony/dotenv": "5.4.*", "symfony/flex": "^1.17|^2", + "symfony/form": "5.4.*", "symfony/framework-bundle": "5.4.*", + "symfony/http-client": "5.4.*", "symfony/runtime": "5.4.*", + "symfony/security-bundle": "5.4.*", + "symfony/twig-bundle": "5.4.*", + "symfony/validator": "5.4.*", + "symfony/web-profiler-bundle": "5.4.*", "symfony/yaml": "5.4.*" }, "config": { diff --git a/composer.lock b/composer.lock index 857052d..7229ec3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,156 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "32af6839ed7dc1a45c978ad0feeccabd", + "content-hash": "90cbb93fd73462f1836880cd629e8594", "packages": [ + { + "name": "doctrine/annotations", + "version": "1.13.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.13.2" + }, + "time": "2021-08-05T19:00:23+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-02-28T11:07:21+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1237,6 +1385,109 @@ ], "time": "2022-02-16T17:26:46+00:00" }, + { + "name": "symfony/form", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/form.git", + "reference": "7d1bd919be530e8071314a54bd5ae786452a81bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/form/zipball/7d1bd919be530e8071314a54bd5ae786452a81bf", + "reference": "7d1bd919be530e8071314a54bd5ae786452a81bf", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/options-resolver": "^5.1|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.23", + "symfony/property-access": "^5.0.8|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<4.4", + "symfony/doctrine-bridge": "<4.4", + "symfony/error-handler": "<4.4.5", + "symfony/framework-bundle": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<4.4", + "symfony/translation-contracts": "<1.1.7", + "symfony/twig-bridge": "<4.4" + }, + "require-dev": { + "doctrine/collections": "~1.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", + "symfony/validator": "^4.4.17|^5.1.9|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/security-csrf": "For protecting forms against CSRF attacks.", + "symfony/twig-bridge": "For templating with Twig.", + "symfony/validator": "For form validation." + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Form\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows to easily create, process and reuse HTML forms", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/form/tree/v5.4.8" + }, + "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-04-23T15:25:10+00:00" + }, { "name": "symfony/framework-bundle", "version": "v5.4.7", @@ -1388,6 +1639,171 @@ ], "time": "2022-04-01T06:09:41+00:00" }, + { + "name": "symfony/http-client", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/0dabec4e3898d3e00451dd47b5ef839168f9bbf5", + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-client-contracts": "^2.4", + "symfony/polyfill-php73": "^1.11", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.0|^2|^3" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "2.4" + }, + "require-dev": { + "amphp/amp": "^2.5", + "amphp/http-client": "^4.2.1", + "amphp/http-tunnel": "^1.0", + "amphp/socket": "^1.1", + "guzzlehttp/promises": "^1.4", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4.13|^5.1.5|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-client/tree/v5.4.8" + }, + "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-04-12T16:02:29+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/1a4f708e4e87f335d1b1be6148060739152f0bd5", + "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.1" + }, + "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-03-13T20:07:29+00:00" + }, { "name": "symfony/http-foundation", "version": "v5.4.6", @@ -1573,6 +1989,148 @@ ], "time": "2022-04-02T06:04:20+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" + }, + "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-01-02T09:53:40+00:00" + }, + { + "name": "symfony/password-hasher", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/password-hasher.git", + "reference": "bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f", + "reference": "bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" + }, + "conflict": { + "symfony/security-core": "<5.3" + }, + "require-dev": { + "symfony/console": "^5.3|^6.0", + "symfony/security-core": "^5.3|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PasswordHasher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides password hashing utilities", + "homepage": "https://symfony.com", + "keywords": [ + "hashing", + "password" + ], + "support": { + "source": "https://github.com/symfony/password-hasher/tree/v5.4.8" + }, + "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-04-15T13:57:25+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.25.0", @@ -1654,6 +2212,93 @@ ], "time": "2021-11-23T21:10:46+00:00" }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "c023a439b8551e320cc3c8433b198e408a623af1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/c023a439b8551e320cc3c8433b198e408a623af1", + "reference": "c023a439b8551e320cc3c8433b198e408a623af1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance and support of other locales than \"en\"" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Icu\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.25.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": "2021-10-26T17:16:04+00:00" + }, { "name": "symfony/polyfill-intl-normalizer", "version": "v1.25.0", @@ -2062,6 +2707,178 @@ ], "time": "2021-09-13T13:58:11+00:00" }, + { + "name": "symfony/property-access", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/property-info": "^5.2|^6.0" + }, + "require-dev": { + "symfony/cache": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property path", + "reflection" + ], + "support": { + "source": "https://github.com/symfony/property-access/tree/v5.4.8" + }, + "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-04-12T15:48:08+00:00" + }, + { + "name": "symfony/property-info", + "version": "v5.4.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-info.git", + "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-info/zipball/0fc07795712972b9792f203d0fe0e77c26c3281d", + "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/dependency-injection": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0" + }, + "suggest": { + "phpdocumentor/reflection-docblock": "To use the PHPDoc", + "psr/cache-implementation": "To cache results", + "symfony/doctrine-bridge": "To use Doctrine metadata", + "symfony/serializer": "To use Serializer metadata" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyInfo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Extracts information about PHP class' properties using metadata of popular sources", + "homepage": "https://symfony.com", + "keywords": [ + "doctrine", + "phpdoc", + "property", + "symfony", + "type", + "validator" + ], + "support": { + "source": "https://github.com/symfony/property-info/tree/v5.4.7" + }, + "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-03-30T13:40:48+00:00" + }, { "name": "symfony/routing", "version": "v5.4.3", @@ -2229,6 +3046,425 @@ ], "time": "2022-03-08T15:36:36+00:00" }, + { + "name": "symfony/security-bundle", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-bundle.git", + "reference": "9806c9d491584e14a4444ea861a15428ab4b00be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/9806c9d491584e14a4444ea861a15428ab4b00be", + "reference": "9806c9d491584e14a4444ea861a15428ab4b00be", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^5.1|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/password-hasher": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^5.4|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-guard": "^5.3", + "symfony/security-http": "^5.4|^6.0" + }, + "conflict": { + "symfony/browser-kit": "<4.4", + "symfony/console": "<4.4", + "symfony/framework-bundle": "<4.4", + "symfony/ldap": "<5.1", + "symfony/twig-bundle": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/dom-crawler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/ldap": "^5.3|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/twig-bridge": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "symfony/validator": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\SecurityBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-bundle/tree/v5.4.8" + }, + "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-04-15T11:48:31+00:00" + }, + { + "name": "symfony/security-core", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-core.git", + "reference": "4540ecb8ae82cc46d9580672888597f481ff0440" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-core/zipball/4540ecb8ae82cc46d9580672888597f481ff0440", + "reference": "4540ecb8ae82cc46d9580672888597f481ff0440", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^1.1|^2|^3", + "symfony/password-hasher": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1.6|^2|^3" + }, + "conflict": { + "symfony/event-dispatcher": "<4.4", + "symfony/http-foundation": "<5.3", + "symfony/ldap": "<4.4", + "symfony/security-guard": "<4.4", + "symfony/validator": "<5.2" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "psr/container": "^1.0|^2.0", + "psr/log": "^1|^2|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/ldap": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/validator": "^5.2|^6.0" + }, + "suggest": { + "psr/container-implementation": "To instantiate the Security class", + "symfony/event-dispatcher": "", + "symfony/expression-language": "For using the expression voter", + "symfony/http-foundation": "", + "symfony/ldap": "For using LDAP integration", + "symfony/validator": "For using the user password constraint" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Core\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Core Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-core/tree/v5.4.8" + }, + "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-04-15T08:07:45+00:00" + }, + { + "name": "symfony/security-csrf", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-csrf.git", + "reference": "57c1c252ca756289c2b61327e08fb10be3936956" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/57c1c252ca756289c2b61327e08fb10be3936956", + "reference": "57c1c252ca756289c2b61327e08fb10be3936956", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^4.4|^5.0|^6.0" + }, + "conflict": { + "symfony/http-foundation": "<5.3" + }, + "require-dev": { + "symfony/http-foundation": "^5.3|^6.0" + }, + "suggest": { + "symfony/http-foundation": "For using the class SessionTokenStorage." + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Csrf\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - CSRF Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-csrf/tree/v5.4.3" + }, + "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-01-02T09:53:40+00:00" + }, + { + "name": "symfony/security-guard", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-guard.git", + "reference": "3d68d9f8e162f6655eb0a0237b9f333a82a19da9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-guard/zipball/3d68d9f8e162f6655eb0a0237b9f333a82a19da9", + "reference": "3d68d9f8e162f6655eb0a0237b9f333a82a19da9", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15", + "symfony/security-core": "^5.0", + "symfony/security-http": "^5.3" + }, + "require-dev": { + "psr/log": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Guard\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Guard", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-guard/tree/v5.4.3" + }, + "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-01-02T09:53:40+00:00" + }, + { + "name": "symfony/security-http", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-http.git", + "reference": "3d4b612da3a278285e6fd16fc2e5233820eeba0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-http/zipball/3d4b612da3a278285e6fd16fc2e5233820eeba0d", + "reference": "3d4b612da3a278285e6fd16fc2e5233820eeba0d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/security-core": "^5.4|^6.0" + }, + "conflict": { + "symfony/event-dispatcher": "<4.3", + "symfony/security-bundle": "<5.3", + "symfony/security-csrf": "<4.4" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", + "symfony/security-csrf": "For using tokens to protect authentication/logout attempts" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Http\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - HTTP Integration", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-http/tree/v5.4.8" + }, + "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-04-16T13:32:04+00:00" + }, { "name": "symfony/service-contracts", "version": "v2.5.1", @@ -2398,6 +3634,407 @@ ], "time": "2022-01-02T09:53:40+00:00" }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.1" + }, + "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-01-02T09:53:40+00:00" + }, + { + "name": "symfony/twig-bridge", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "f68dbdb80c9ce425f503512dfa8c8c01cf789e43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/f68dbdb80c9ce425f503512dfa8c8c01cf789e43", + "reference": "f68dbdb80c9ce425f503512dfa8c8c01cf789e43", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1|^2|^3", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/console": "<5.3", + "symfony/form": "<5.3", + "symfony/http-foundation": "<5.3", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<5.2", + "symfony/workflow": "<5.2" + }, + "require-dev": { + "doctrine/annotations": "^1.12", + "egulias/email-validator": "^2.1.10|^3", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/console": "^5.3|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^5.3|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^5.2|^6.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/security-acl": "^2.8|^3.0", + "symfony/security-core": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-http": "^4.4|^5.0|^6.0", + "symfony/serializer": "^5.2|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.2|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "symfony/workflow": "^5.2|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "twig/cssinliner-extra": "^2.12|^3", + "twig/inky-extra": "^2.12|^3", + "twig/markdown-extra": "^2.12|^3" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security-core": "For using the SecurityExtension", + "symfony/security-csrf": "For using the CsrfExtension", + "symfony/security-http": "For using the LogoutUrlExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides integration for Twig with various Symfony components", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bridge/tree/v5.4.8" + }, + "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-04-12T15:48:08+00:00" + }, + { + "name": "symfony/twig-bundle", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bundle.git", + "reference": "c992b4474c3a31f3c40a1ca593d213833f91b818" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/c992b4474c3a31f3c40a1ca593d213833f91b818", + "reference": "c992b4474c3a31f3c40a1ca593d213833f91b818", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/twig-bridge": "^5.3|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/dependency-injection": "<5.3", + "symfony/framework-bundle": "<5.0", + "symfony/service-contracts": ">=3.0", + "symfony/translation": "<5.0" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "doctrine/cache": "^1.0|^2.0", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.0|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.0|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\TwigBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a tight integration of Twig into the Symfony full-stack framework", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bundle/tree/v5.4.8" + }, + "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-04-03T13:03:10+00:00" + }, + { + "name": "symfony/validator", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad", + "reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22", + "symfony/translation-contracts": "^1.1|^2|^3" + }, + "conflict": { + "doctrine/annotations": "<1.13", + "doctrine/cache": "<1.11", + "doctrine/lexer": "<1.1", + "phpunit/phpunit": "<5.4.3", + "symfony/dependency-injection": "<4.4", + "symfony/expression-language": "<5.1", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/property-info": "<5.3", + "symfony/translation": "<4.4", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.13", + "doctrine/cache": "^1.11|^2.0", + "egulias/email-validator": "^2.1.10|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^5.1|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/property-info": "^5.3|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the mapping cache.", + "symfony/config": "", + "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/translation": "For translating validation errors.", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Validator\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to validate values", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/validator/tree/v5.4.8" + }, + "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-04-15T08:07:45+00:00" + }, { "name": "symfony/var-dumper", "version": "v5.4.6", @@ -2560,6 +4197,86 @@ ], "time": "2022-03-31T17:09:19+00:00" }, + { + "name": "symfony/web-profiler-bundle", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "909c6eea7815066a80d0a362ed41abd7924e376a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/909c6eea7815066a80d0a362ed41abd7924e376a", + "reference": "909c6eea7815066a80d0a362ed41abd7924e376a", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/dependency-injection": "<5.2", + "symfony/form": "<4.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<4.4" + }, + "require-dev": { + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\WebProfilerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a development tool that gives detailed information about the execution of any request", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.4.8" + }, + "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-04-22T08:14:12+00:00" + }, { "name": "symfony/yaml", "version": "v5.4.3", @@ -2634,6 +4351,82 @@ } ], "time": "2022-01-26T16:32:32+00:00" + }, + { + "name": "twig/twig", + "version": "v3.3.10", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "8442df056c51b706793adf80a9fd363406dd3674" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674", + "reference": "8442df056c51b706793adf80a9fd363406dd3674", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.10" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2022-04-06T06:47:41+00:00" } ], "packages-dev": [], diff --git a/config/bundles.php b/config/bundles.php index 49d3fb6..5f2b11b 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,4 +2,7 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], ]; diff --git a/config/packages/security.yaml b/config/packages/security.yaml new file mode 100644 index 0000000..789a9ac --- /dev/null +++ b/config/packages/security.yaml @@ -0,0 +1,40 @@ +security: + enable_authenticator_manager: true + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider + providers: + users_in_memory: { memory: null } + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + lazy: true + provider: users_in_memory + + # activate different ways to authenticate + # https://symfony.com/doc/current/security.html#the-firewall + + # https://symfony.com/doc/current/security/impersonating_user.html + # switch_user: true + + # Easy way to control access for large sections of your site + # Note: Only the *first* access control that matches will be used + access_control: + # - { path: ^/admin, roles: ROLE_ADMIN } + # - { path: ^/profile, roles: ROLE_USER } + +when@test: + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # are not important, waste resources and increase test times. The following + # reduces the work factor to the lowest possible values. + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml new file mode 100644 index 0000000..882df72 --- /dev/null +++ b/config/packages/twig.yaml @@ -0,0 +1,7 @@ +twig: + default_path: '%kernel.project_dir%/templates' + form_themes: + - 'bootstrap_5_layout.html.twig' +when@test: + twig: + strict_variables: true diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml new file mode 100644 index 0000000..0201281 --- /dev/null +++ b/config/packages/validator.yaml @@ -0,0 +1,13 @@ +framework: + validation: + email_validation_mode: html5 + + # Enables validator auto-mapping support. + # For instance, basic validation constraints will be inferred from Doctrine's metadata. + #auto_mapping: + # App\Entity\: [] + +when@test: + framework: + validation: + not_compromised_password: false diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml new file mode 100644 index 0000000..17893da --- /dev/null +++ b/config/packages/web_profiler.yaml @@ -0,0 +1,15 @@ +when@dev: + web_profiler: + toolbar: true + intercept_redirects: false + + framework: + profiler: { only_exceptions: false } + +when@test: + web_profiler: + toolbar: false + intercept_redirects: false + + framework: + profiler: { collect: false } diff --git a/config/routes/annotations.yaml b/config/routes/annotations.yaml new file mode 100644 index 0000000..e92efc5 --- /dev/null +++ b/config/routes/annotations.yaml @@ -0,0 +1,7 @@ +controllers: + resource: ../../src/Controller/ + type: annotation + +kernel: + resource: ../../src/Kernel.php + type: annotation diff --git a/config/routes/web_profiler.yaml b/config/routes/web_profiler.yaml new file mode 100644 index 0000000..8d85319 --- /dev/null +++ b/config/routes/web_profiler.yaml @@ -0,0 +1,8 @@ +when@dev: + web_profiler_wdt: + resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' + prefix: /_wdt + + web_profiler_profiler: + resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' + prefix: /_profiler diff --git a/config/services.yaml b/config/services.yaml index 2d6a76f..f81b2c1 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,7 +4,23 @@ # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: + fetchDatas: "lastname, firstname, email, random " + # Paramètres de connexion base de données: "nome du serveur", "nom utilisateur", "mot de passe", "nom de la bdd", "port" + urlDatabase: "%env(resolve:urlDatabase)%" + dbUser: "%env(resolve:dbUser)%" + dbPassword: "%env(resolve:dbPassword)%" + queryHashPassword: "%env(resolve:queryHashPassword)%" + hashMethod: + passwordColumnName: "password" + userTableName: "USER" + emailColumnName: "email" + url_login_challenge: '%env(resolve:url_login_challenge)%' + url_login_challenge_reject: '%env(resolve:url_login_challenge_reject)%' + url_login_challenge_accept: '%env(resolve:url_login_challenge_accept)%' + url_consent_challenge_reject: '%env(resolve:url_consent_challenge_reject)%' + url_consent_challenge: '%env(resolve:url_consent_challenge)%' + url_consent_challenge_accept: '%env(resolve:url_consent_challenge_accept)%' services: # default configuration for services in *this* file _defaults: diff --git a/containers/loginapp/fixuid.yml b/containers/loginapp/fixuid.yml deleted file mode 100644 index dede9c3..0000000 --- a/containers/loginapp/fixuid.yml +++ /dev/null @@ -1,7 +0,0 @@ -user: www-data -group: www-data -paths: - - /loginapp/node_modules - - /loginapp/vendor - - /loginapp - - /var/www \ No newline at end of file diff --git a/containers/loginapp/000-default.conf b/containers/loginappsql/000-default.conf similarity index 94% rename from containers/loginapp/000-default.conf rename to containers/loginappsql/000-default.conf index 1b2b300..7e63e3d 100644 --- a/containers/loginapp/000-default.conf +++ b/containers/loginappsql/000-default.conf @@ -20,8 +20,8 @@ # regular expression must be changed accordingly: # ProxyPassMatch ^/path-to-app/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/public/$1 - DocumentRoot /loginapp/public - + DocumentRoot /loginappsql/public + # enable the .htaccess rewrites AllowOverride All Require all granted diff --git a/containers/loginapp/Dockerfile b/containers/loginappsql/Dockerfile similarity index 88% rename from containers/loginapp/Dockerfile rename to containers/loginappsql/Dockerfile index 94c11eb..8bf4fe5 100644 --- a/containers/loginapp/Dockerfile +++ b/containers/loginappsql/Dockerfile @@ -23,6 +23,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \ php${PHP_VERSION}-zip php${PHP_VERSION}-fpm \ php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-pdo-mysql \ php${PHP_VERSION}-ssh2 libxml2-utils \ locales \ apache2 \ @@ -46,15 +48,15 @@ RUN wget -q -O /usr/local/bin/waitforit https://github.com/maxcnunes/waitforit/r # Install superfsmon to restart supervisor programs on file changes RUN pip3 install wheel superfsmon -VOLUME /loginapp -VOLUME /loginapp/var/logs -VOLUME /loginapp/var/cache +VOLUME /loginappsql +VOLUME /loginappsql/var/logs +VOLUME /loginappsql/var/cache # Install composer -COPY install-composer.sh /loginapp/install-composer.sh -RUN chmod +x /loginapp/install-composer.sh &&\ - /loginapp/install-composer.sh &&\ - rm -f /loginapp/install-composer.sh +COPY install-composer.sh /loginappsql/install-composer.sh +RUN chmod +x /loginappsql/install-composer.sh &&\ + /loginappsql/install-composer.sh &&\ + rm -f /loginappsql/install-composer.sh # On active les mods d'apache nécessaires RUN a2enmod rewrite @@ -71,7 +73,7 @@ COPY www.conf /etc/php/8.1/fpm/pool.d/www.conf EXPOSE 5000 EXPOSE 80 -WORKDIR /loginapp +WORKDIR /loginappsql # On démarre php-fpm une fois pour créer les sockets RUN service php8.1-fpm start @@ -88,7 +90,7 @@ RUN chmod +x /root/first-run.sh RUN sed -i 's/^\$\(PrivDropTo.*\)$/#\1/' /etc/rsyslog.conf RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf -COPY rsyslog.conf /etc/rsyslog.d/loginapp.conf +COPY rsyslog.conf /etc/rsyslog.d/loginappsql.conf COPY supervisor.ini /etc/supervisor/supervisor.ini COPY php.ini /etc/php/8.1/fpm/php.ini diff --git a/containers/loginapp/composer-wrapper.sh b/containers/loginappsql/composer-wrapper.sh similarity index 100% rename from containers/loginapp/composer-wrapper.sh rename to containers/loginappsql/composer-wrapper.sh diff --git a/containers/loginapp/docker-entrypoint.sh b/containers/loginappsql/docker-entrypoint.sh similarity index 86% rename from containers/loginapp/docker-entrypoint.sh rename to containers/loginappsql/docker-entrypoint.sh index 1a5d8b4..5ba02a7 100644 --- a/containers/loginapp/docker-entrypoint.sh +++ b/containers/loginappsql/docker-entrypoint.sh @@ -3,7 +3,7 @@ set -eo pipefail if [ ! -e /container-lifecycle/first_run ]; then - echo "First loginapp run detected. Initializing environment..." + echo "First loginappsql run detected. Initializing environment..." sudo -E /root/first-run.sh sudo touch /container-lifecycle/first_run fi diff --git a/containers/loginapp/first-run.sh b/containers/loginappsql/first-run.sh similarity index 88% rename from containers/loginapp/first-run.sh rename to containers/loginappsql/first-run.sh index 37dad39..fe11369 100644 --- a/containers/loginapp/first-run.sh +++ b/containers/loginappsql/first-run.sh @@ -8,4 +8,4 @@ set -xeo pipefail [ ! -d /var/www/.cache ] && sudo mkdir -p /var/www/.cache [ -d /var/www/.cache ] && sudo chown -R www-data: /var/www/.cache -sudo chown -R www-data: /loginapp +sudo chown -R www-data: /loginappsql diff --git a/containers/loginappsql/fixuid.yml b/containers/loginappsql/fixuid.yml new file mode 100644 index 0000000..2d35a05 --- /dev/null +++ b/containers/loginappsql/fixuid.yml @@ -0,0 +1,7 @@ +user: www-data +group: www-data +paths: + - /loginappsql/node_modules + - /loginappsql/vendor + - /loginappsql + - /var/www \ No newline at end of file diff --git a/containers/loginapp/install-composer.sh b/containers/loginappsql/install-composer.sh similarity index 100% rename from containers/loginapp/install-composer.sh rename to containers/loginappsql/install-composer.sh diff --git a/containers/loginapp/php.ini b/containers/loginappsql/php.ini similarity index 99% rename from containers/loginapp/php.ini rename to containers/loginappsql/php.ini index 9cd475f..0894fb9 100644 --- a/containers/loginapp/php.ini +++ b/containers/loginappsql/php.ini @@ -922,7 +922,7 @@ default_socket_timeout = 60 ;extension=odbc ;extension=openssl ;extension=pdo_firebird -;extension=pdo_mysql +extension=pdo_mysql ;extension=pdo_oci ;extension=pdo_odbc ;extension=pdo_pgsql diff --git a/containers/loginapp/rsyslog.conf b/containers/loginappsql/rsyslog.conf similarity index 100% rename from containers/loginapp/rsyslog.conf rename to containers/loginappsql/rsyslog.conf diff --git a/containers/loginapp/supervisor.ini b/containers/loginappsql/supervisor.ini similarity index 92% rename from containers/loginapp/supervisor.ini rename to containers/loginappsql/supervisor.ini index 4da9bc5..2fe6403 100644 --- a/containers/loginapp/supervisor.ini +++ b/containers/loginappsql/supervisor.ini @@ -16,7 +16,7 @@ stderr_logfile_maxbytes=0 [program:apache2] environment=HOSTNAME="%(ENV_HOSTNAME)s" command = apachectl -D "FOREGROUND" -directory = /loginapp +directory = /loginappsql user = root autostart = true stdout_logfile=/dev/stdout @@ -29,7 +29,7 @@ environment=HOSTNAME="%(ENV_HOSTNAME)s" command = /usr/sbin/php-fpm8.1 -F autostart = true autorestart = true -directory = /loginapp +directory = /loginappsql user = root stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 diff --git a/containers/loginapp/www.conf b/containers/loginappsql/www.conf similarity index 100% rename from containers/loginapp/www.conf rename to containers/loginappsql/www.conf diff --git a/docker-compose.yml b/docker-compose.yml index d0603d7..e6f7db8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ -version: "2.4" +version: "3.8" services: - loginapp: - container_name: loginapp + loginappsql: + container_name: loginappsql build: - context: ./containers/loginapp + context: ./containers/loginappsql args: - HTTP_PROXY=${HTTP_PROXY} - HTTPS_PROXY=${HTTPS_PROXY} @@ -11,19 +11,20 @@ services: - https_proxy=${https_proxy} user: ${FIXUID:-1000}:${FIXGID:-1000} ports: - - 5000:80 + - 5002:80 volumes: - - .:/loginapp + - .:/loginappsql - /etc/localtime:/etc/localtime:ro - $HOME/.ssh:/root/.host-ssh:ro tmpfs: - - /loginapp/var/logs:uid=${FIXUID:-1000},gid=${FIXGID:-1000} - - /loginapp/var/cache:uid=${FIXUID:-1000},gid=${FIXGID:-1000} - - /loginapp/public/build:uid=${FIXUID:-1000},gid=${FIXGID:-1000} + - /loginappsql/var/logs:uid=${FIXUID:-1000},gid=${FIXGID:-1000} + - /loginappsql/var/cache:uid=${FIXUID:-1000},gid=${FIXGID:-1000} + - /loginappsql/public/build:uid=${FIXUID:-1000},gid=${FIXGID:-1000} - /tmp extra_hosts: - - "loginapp.mse.local:127.0.0.1" + - "loginappsql.local:127.0.0.1" + - "sso.mse.local:host-gateway" - "host.docker.internal:host-gateway" environment: - HTTP_PROXY=${HTTP_PROXY} @@ -31,3 +32,10 @@ services: - http_proxy=${http_proxy} - https_proxy=${https_proxy} - TZ=Europe/Paris + networks: + - mse-network + +networks: + mse-network: + external: + name: mse_default diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index e4fc5ba..ce9f3dd 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -3,11 +3,163 @@ namespace App\Controller; +use PDO; +use App\Entity\User; +use App\Form\UserType; +use App\Services\PdoServices; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Exception\BadRequestException; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; class MainController extends AbstractController { + /** + * @var Session + */ + private $session; + /** + * @var HttpClientInterface + */ + public $client; + private $pdoServices; + public function __construct(PdoServices $pdoServices, HttpClientInterface $client, SessionInterface $session) + { + $this->pdoServices = $pdoServices; + $this->session = $session; + $this->client = $client; + } + + /** + * @Route("/oauth/login", name="app_login") + */ + public function loginOidc(Request $request) + { + $challenge = $request->query->get('login_challenge'); + // S'il n'y a pas de challenge, on déclenche une bad request + if(!$challenge){ + throw new BadRequestException('pas de challenge'); + } + //On vérifie que la requête d'identification provient bien de hydra + $response = $this->client->request('GET', $this->getParameter('url_login_challenge').$challenge, [ + 'headers' => [ + 'Content-Type: application/json', + ], + ]); + if (200 !== $response->getStatusCode()) { + $this->session->clear(); + throw new BadRequestException('pa de code 200'); + } + // si le challenge est validé par hydra, on le stocke en session pour l'utiliser par la suite et on redirige vers une route interne protégée qui va déclencher l'identification FranceConnect + $this->session->set('challenge', $challenge); + + return $this->redirectToRoute('oauth_login'); + } + + /** + * @Route("/oauth/connect", name="oauth_login") + */ + public function oauth(Request $request) + { + $user = new User(); + $loginForm = $this->createForm(UserType::class, $user); + $loginForm->handleRequest($request); + if($loginForm->isSubmitted() && $loginForm->isValid()){ + $email = $loginForm->get('email')->getData(); + $dbh = $this->pdoServices->connection(); + try { + //requête préparée + $query = $dbh->prepare($this->getParameter("queryHashPassword")."'".$email ."';"); + $query->execute(); + $hashPassword = $query->fetch(PDO::FETCH_ASSOC); + + if(!$hashPassword){ + // Si le hash du password n'est pas trouvé, c'est que l'email n'existe pas, on retourne la page de login avec une erreur + return $this->render('login.html.twig', [ + 'form'=>$loginForm->createView(), + "error"=> "mail non trouvé", + + ]); + } + $hashPassword = array_values($hashPassword)[0]; + $password = $loginForm->get('password')->getData(); + + if($this->pdoServices->verifyPassword($password, $hashPassword)){ + $this->session->set('datas', $this->pdoServices->fetchDatas($email)); + $response = $this->client->request('PUT', $this->getParameter('url_login_challenge_accept').$this->session->get('challenge'), [ + 'json' => [ + 'subject' => $email, + ], + ]); + // On initie l'acceptation du login challenge émis par hydra et on récupère l'url de redirection + // dd($response->toArray()); + $redirect_to = $response->toArray()['redirect_to']; + return $this->redirect($redirect_to, 301); + + }else{ + return $this->render('login.html.twig', [ + 'form'=>$loginForm->createView(), + "error"=> "Le mot de passe est incorrect" + + ]); + } + + }catch (\Exception $e){ + dd($e); + } + // $rememberMe = $loginForm->get('rememberMe')->getData(); + + } + + return $this->render('login.html.twig', [ + 'form'=>$loginForm->createView(), + "error_mail"=>false, + "error_password"=>false + ]); + } + + /** + * @Route("/oauth/consent", name="consent") + */ + public function consent(Request $request) + { + $challenge = $request->query->get('consent_challenge'); + if (!$challenge) { + throw new BadRequestException("Le challenge n'est pas disponible"); + } + + // Vérification du consent_challenge avec hydra + $response = $this->client->request('GET', $this->getParameter('url_consent_challenge').$challenge, [ + 'headers' => [ + 'Content-Type: application/json', + ], + ]); + if(200!== $response->getStatusCode()){ + $this->session->clear(); + throw new BadRequestException("Le challenge n'est pas authorisé"); + } + $response = $this->client->request('PUT', $this->getParameter('url_consent_challenge_accept').$challenge, [ + 'headers' => [ + 'Content-Type: application/json', + ], + 'json' => [ + 'grant_scope' => ['openid', 'offline_access'], + 'session' => [ + 'id_token' => [ + 'user' => $this->session->get('datas'), + ], + ], + ], + ]); + $redirect_to = $response->toArray()['redirect_to']; + + return $this->redirect($redirect_to, 301); + + } } \ No newline at end of file diff --git a/src/Entity/User.php b/src/Entity/User.php new file mode 100644 index 0000000..e333398 --- /dev/null +++ b/src/Entity/User.php @@ -0,0 +1,102 @@ +email; + } + + public function setEmail(string $email): self + { + $this->email = $email; + + return $this; + } + + + public function getPassword(): string + { + return $this->password; + } + + public function setPassword(string $password): self + { + $this->password = $password; + + return $this; + } + + public function addData($data): self + { + if (!$this->datas->contains($data)) { + $this->datas[] = $data; + } + + return $this; + } + + public function getDatas() + { + return $this->datas; + } + + public function getRememberMe(): string + { + return $this->rememberMe; + } + + public function setRememberMe(bool $rememberMe): self + { + $this->rememberMe = $rememberMe; + + return $this; + } + public function getUserIdentifier() + { + return $this->email; + } + + public function getRoles(){ + return $this->roles; + } + + public function setRoles(array $roles): self + { + $this->roles = $roles; + + return $this; + } + + public function getSalt(){ + return ''; + } + + public function eraseCredentials(){ + return $this; + } + + public function getUsername(){ + return $this->email; + } + + public function __toString() + { + return $this->email; + } +} \ No newline at end of file diff --git a/src/Form/UserType.php b/src/Form/UserType.php new file mode 100644 index 0000000..d5f6c88 --- /dev/null +++ b/src/Form/UserType.php @@ -0,0 +1,40 @@ +add('email', EmailType::class, [ + ]) + ->add("password", PasswordType::class, [ + "attr" => ["class" => "password-field"], + "required" => true, + "label"=>"Mot de passe" + ]) + ->add('rememberMe', CheckboxType::class, [ + "required"=> false, + "label"=> "Se souvenir de moi" + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + "data_class" => User::class, + ]); + } +} \ No newline at end of file diff --git a/src/Services/PdoServices.php b/src/Services/PdoServices.php new file mode 100644 index 0000000..7b53cc9 --- /dev/null +++ b/src/Services/PdoServices.php @@ -0,0 +1,57 @@ +params = $params; + } + + public function connection() + { + return new PDO($this->params->get('urlDatabase'), $this->params->get('dbUser'), $this->params->get('dbPassword')); + } + + public function fetchDatas($email) + { + try { + $dbh = $this->connection(); + $datas = $dbh->query("SELECT " . $this->getParameter('fetchDatas'). " from USER where email = '" . $email . "';")->fetch(PDO::FETCH_ASSOC); + + } catch (PDOException $e) { + print "Erreur !: " . $e->getMessage() . "
"; + die(); + } + return $datas; + } + + public function verifyPassword($password, $hashedPassword) + { + $hashMethod = $this->params->get('hashMethod'); + switch ($hashMethod){ + case "sha1": + return $hashedPassword === sha1($password, false); + break; + case "md5": + return $hashedPassword === md5($password); + break; + case "BCRYPT": + default: + return password_verify($password, $hashedPassword); + break; + + + + } + } + +} \ No newline at end of file diff --git a/src/Validator/ExistingEmail.php b/src/Validator/ExistingEmail.php new file mode 100644 index 0000000..0ba5942 --- /dev/null +++ b/src/Validator/ExistingEmail.php @@ -0,0 +1,18 @@ +pdoServices = $pdoServices; + $this->params = $params; + } + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof ExistingEmail) { + throw new UnexpectedTypeException($constraint, ExistingEmail::class); + } + + // custom constraints should ignore null and empty values to allow + // other constraints (NotBlank, NotNull, etc.) to take care of that + if (null === $value || '' === $value) { + return; + } + $dbh = $this->pdoServices->connection(); + + $query = $dbh->prepare($this->params->get("queryHashPassword")."'".$value ."';"); + $query->execute(); + $hashPassword = $query->fetch(PDO::FETCH_ASSOC); + + if(!$hashPassword){ + $this->context->buildViolation( + $constraint->message + )->setParameter('{{ string }}', $value) + ->addViolation() + ; + } + } +} \ No newline at end of file diff --git a/supervisord.log b/supervisord.log index 24ae795..67fd959 100644 --- a/supervisord.log +++ b/supervisord.log @@ -4032,3 +4032,219 @@ 2022-04-07 14:27:08,292 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-04-07 14:27:08,292 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-04-07 14:27:08,292 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 08:59:51,785 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 08:59:51,794 INFO RPC interface 'supervisor' initialized +2022-04-29 08:59:51,794 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 08:59:51,794 INFO supervisord started with pid 26 +2022-04-29 08:59:52,797 INFO spawned: 'apache2' with pid 27 +2022-04-29 08:59:52,799 INFO spawned: 'php-fpm' with pid 28 +2022-04-29 08:59:52,801 INFO spawned: 'rsyslog' with pid 29 +2022-04-29 08:59:53,819 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 08:59:53,819 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 08:59:53,819 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:10:53,562 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:10:53,883 INFO RPC interface 'supervisor' initialized +2022-04-29 11:10:53,883 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:10:53,883 INFO supervisord started with pid 12 +2022-04-29 11:10:54,886 INFO spawned: 'apache2' with pid 13 +2022-04-29 11:10:54,888 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 11:10:54,891 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 11:10:55,985 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:10:55,986 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:10:55,986 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:28:01,828 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:28:01,830 INFO RPC interface 'supervisor' initialized +2022-04-29 11:28:01,830 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:28:01,830 INFO supervisord started with pid 13 +2022-04-29 11:28:02,833 INFO spawned: 'apache2' with pid 14 +2022-04-29 11:28:02,835 INFO spawned: 'php-fpm' with pid 15 +2022-04-29 11:28:02,837 INFO spawned: 'rsyslog' with pid 16 +2022-04-29 11:28:03,864 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:28:03,865 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:28:03,865 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:30:18,160 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:30:18,465 INFO RPC interface 'supervisor' initialized +2022-04-29 11:30:18,465 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:30:18,466 INFO supervisord started with pid 13 +2022-04-29 11:30:19,469 INFO spawned: 'apache2' with pid 14 +2022-04-29 11:30:19,471 INFO spawned: 'php-fpm' with pid 15 +2022-04-29 11:30:19,472 INFO spawned: 'rsyslog' with pid 16 +2022-04-29 11:30:19,483 INFO exited: rsyslog (exit status 1; not expected) +2022-04-29 11:30:20,490 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:30:20,490 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:30:20,492 INFO spawned: 'rsyslog' with pid 78 +2022-04-29 11:30:21,499 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:33:08,467 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:33:08,468 INFO RPC interface 'supervisor' initialized +2022-04-29 11:33:08,468 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:33:08,468 INFO supervisord started with pid 12 +2022-04-29 11:33:09,472 INFO spawned: 'apache2' with pid 13 +2022-04-29 11:33:09,473 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 11:33:09,474 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 11:33:10,494 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:33:10,494 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:33:10,494 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:52:00,856 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:52:00,857 INFO RPC interface 'supervisor' initialized +2022-04-29 11:52:00,858 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:52:00,858 INFO supervisord started with pid 12 +2022-04-29 11:52:01,861 INFO spawned: 'apache2' with pid 13 +2022-04-29 11:52:01,864 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 11:52:01,865 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 11:52:02,890 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:52:02,890 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:52:02,890 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:54:40,793 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 11:54:40,794 INFO RPC interface 'supervisor' initialized +2022-04-29 11:54:40,800 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 11:54:40,800 INFO supervisord started with pid 12 +2022-04-29 11:54:41,804 INFO spawned: 'apache2' with pid 13 +2022-04-29 11:54:41,806 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 11:54:41,808 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 11:54:42,825 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:54:42,825 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 11:54:42,825 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 12:16:05,529 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 12:16:05,834 INFO RPC interface 'supervisor' initialized +2022-04-29 12:16:05,834 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 12:16:05,835 INFO supervisord started with pid 11 +2022-04-29 12:16:06,838 INFO spawned: 'apache2' with pid 12 +2022-04-29 12:16:06,841 INFO spawned: 'php-fpm' with pid 13 +2022-04-29 12:16:06,843 INFO spawned: 'rsyslog' with pid 14 +2022-04-29 12:16:07,871 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 12:16:07,871 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 12:16:07,871 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:29:16,643 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 13:29:16,645 INFO RPC interface 'supervisor' initialized +2022-04-29 13:29:16,645 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 13:29:16,645 INFO supervisord started with pid 12 +2022-04-29 13:29:17,648 INFO spawned: 'apache2' with pid 13 +2022-04-29 13:29:17,651 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 13:29:17,652 INFO spawned: 'rsyslog' with pid 16 +2022-04-29 13:29:18,670 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:29:18,670 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:29:18,670 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:34:13,393 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 13:34:13,395 INFO RPC interface 'supervisor' initialized +2022-04-29 13:34:13,395 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 13:34:13,396 INFO supervisord started with pid 12 +2022-04-29 13:34:14,400 INFO spawned: 'apache2' with pid 13 +2022-04-29 13:34:14,403 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 13:34:14,403 INFO spawned: 'rsyslog' with pid 16 +2022-04-29 13:34:15,425 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:34:15,425 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:34:15,425 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:42:21,055 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 13:42:21,056 INFO RPC interface 'supervisor' initialized +2022-04-29 13:42:21,056 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 13:42:21,057 INFO supervisord started with pid 12 +2022-04-29 13:42:22,060 INFO spawned: 'apache2' with pid 13 +2022-04-29 13:42:22,063 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 13:42:22,065 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 13:42:23,094 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:42:23,094 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:42:23,101 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:51:41,034 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 13:51:41,036 INFO RPC interface 'supervisor' initialized +2022-04-29 13:51:41,036 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 13:51:41,036 INFO supervisord started with pid 12 +2022-04-29 13:51:42,039 INFO spawned: 'apache2' with pid 13 +2022-04-29 13:51:42,042 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 13:51:42,044 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 13:51:43,075 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:51:43,075 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:51:43,075 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:54:49,000 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 13:54:49,304 INFO RPC interface 'supervisor' initialized +2022-04-29 13:54:49,305 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 13:54:49,305 INFO supervisord started with pid 12 +2022-04-29 13:54:50,309 INFO spawned: 'apache2' with pid 13 +2022-04-29 13:54:50,310 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 13:54:50,311 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 13:54:50,314 INFO exited: rsyslog (exit status 1; not expected) +2022-04-29 13:54:51,329 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:54:51,329 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 13:54:51,331 INFO spawned: 'rsyslog' with pid 77 +2022-04-29 13:54:52,340 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 14:15:57,474 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-04-29 14:15:57,779 INFO RPC interface 'supervisor' initialized +2022-04-29 14:15:57,779 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-04-29 14:15:57,780 INFO supervisord started with pid 12 +2022-04-29 14:15:58,783 INFO spawned: 'apache2' with pid 13 +2022-04-29 14:15:58,786 INFO spawned: 'php-fpm' with pid 14 +2022-04-29 14:15:58,787 INFO spawned: 'rsyslog' with pid 15 +2022-04-29 14:15:59,807 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 14:15:59,807 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-04-29 14:15:59,808 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 09:01:39,177 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 09:01:39,498 INFO RPC interface 'supervisor' initialized +2022-05-02 09:01:39,498 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 09:01:39,498 INFO supervisord started with pid 12 +2022-05-02 09:01:40,501 INFO spawned: 'apache2' with pid 13 +2022-05-02 09:01:40,504 INFO spawned: 'php-fpm' with pid 14 +2022-05-02 09:01:40,506 INFO spawned: 'rsyslog' with pid 15 +2022-05-02 09:01:40,527 INFO exited: rsyslog (exit status 1; not expected) +2022-05-02 09:01:41,589 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 09:01:41,594 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 09:01:41,596 INFO spawned: 'rsyslog' with pid 77 +2022-05-02 09:01:42,615 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 13:59:20,394 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 13:59:20,397 INFO RPC interface 'supervisor' initialized +2022-05-02 13:59:20,397 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 13:59:20,397 INFO supervisord started with pid 12 +2022-05-02 13:59:21,400 INFO spawned: 'apache2' with pid 13 +2022-05-02 13:59:21,402 INFO spawned: 'php-fpm' with pid 14 +2022-05-02 13:59:21,404 INFO spawned: 'rsyslog' with pid 15 +2022-05-02 13:59:22,431 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 13:59:22,431 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 13:59:22,431 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:27:42,423 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 14:27:42,425 INFO RPC interface 'supervisor' initialized +2022-05-02 14:27:42,425 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 14:27:42,425 INFO supervisord started with pid 27 +2022-05-02 14:27:43,427 INFO spawned: 'apache2' with pid 28 +2022-05-02 14:27:43,428 INFO spawned: 'php-fpm' with pid 29 +2022-05-02 14:27:43,429 INFO spawned: 'rsyslog' with pid 30 +2022-05-02 14:27:44,448 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:27:44,448 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:27:44,448 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:58:40,400 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 14:58:40,401 INFO RPC interface 'supervisor' initialized +2022-05-02 14:58:40,401 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 14:58:40,402 INFO supervisord started with pid 26 +2022-05-02 14:58:41,404 INFO spawned: 'apache2' with pid 27 +2022-05-02 14:58:41,405 INFO spawned: 'php-fpm' with pid 28 +2022-05-02 14:58:41,406 INFO spawned: 'rsyslog' with pid 29 +2022-05-02 14:58:42,425 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:58:42,425 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 14:58:42,425 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:03:32,785 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 15:03:33,088 INFO RPC interface 'supervisor' initialized +2022-05-02 15:03:33,088 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 15:03:33,088 INFO supervisord started with pid 12 +2022-05-02 15:03:34,090 INFO spawned: 'apache2' with pid 13 +2022-05-02 15:03:34,091 INFO spawned: 'php-fpm' with pid 14 +2022-05-02 15:03:34,092 INFO spawned: 'rsyslog' with pid 15 +2022-05-02 15:03:35,111 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:03:35,111 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:03:35,111 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:11:40,588 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 15:11:40,591 INFO RPC interface 'supervisor' initialized +2022-05-02 15:11:40,592 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 15:11:40,592 INFO supervisord started with pid 26 +2022-05-02 15:11:41,595 INFO spawned: 'apache2' with pid 27 +2022-05-02 15:11:41,597 INFO spawned: 'php-fpm' with pid 28 +2022-05-02 15:11:41,598 INFO spawned: 'rsyslog' with pid 29 +2022-05-02 15:11:42,624 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:11:42,624 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:11:42,624 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:14:42,749 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. +2022-05-02 15:14:42,751 INFO RPC interface 'supervisor' initialized +2022-05-02 15:14:42,751 CRIT Server 'unix_http_server' running without any HTTP authentication checking +2022-05-02 15:14:42,751 INFO supervisord started with pid 25 +2022-05-02 15:14:43,753 INFO spawned: 'apache2' with pid 26 +2022-05-02 15:14:43,754 INFO spawned: 'php-fpm' with pid 27 +2022-05-02 15:14:43,755 INFO spawned: 'rsyslog' with pid 28 +2022-05-02 15:14:44,772 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:14:44,773 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) +2022-05-02 15:14:44,773 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) diff --git a/supervisord.pid b/supervisord.pid index 6f4247a..7273c0f 100644 --- a/supervisord.pid +++ b/supervisord.pid @@ -1 +1 @@ -26 +25 diff --git a/symfony.lock b/symfony.lock index a80c4e8..d40af52 100644 --- a/symfony.lock +++ b/symfony.lock @@ -1,4 +1,19 @@ { + "doctrine/annotations": { + "version": "1.13", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "1.0", + "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457" + }, + "files": [ + "config/routes/annotations.yaml" + ] + }, + "doctrine/lexer": { + "version": "1.2.3" + }, "psr/cache": { "version": "2.0.0" }, @@ -80,6 +95,9 @@ ".env" ] }, + "symfony/form": { + "version": "v5.4.8" + }, "symfony/framework-bundle": { "version": "5.4", "recipe": { @@ -99,15 +117,30 @@ "src/Kernel.php" ] }, + "symfony/http-client": { + "version": "v5.4.8" + }, + "symfony/http-client-contracts": { + "version": "v2.5.1" + }, "symfony/http-foundation": { "version": "v5.4.6" }, "symfony/http-kernel": { "version": "v5.4.7" }, + "symfony/options-resolver": { + "version": "v5.4.3" + }, + "symfony/password-hasher": { + "version": "v5.4.8" + }, "symfony/polyfill-intl-grapheme": { "version": "v1.25.0" }, + "symfony/polyfill-intl-icu": { + "version": "v1.25.0" + }, "symfony/polyfill-intl-normalizer": { "version": "v1.25.0" }, @@ -123,6 +156,12 @@ "symfony/polyfill-php81": { "version": "v1.25.0" }, + "symfony/property-access": { + "version": "v5.4.8" + }, + "symfony/property-info": { + "version": "v5.4.7" + }, "symfony/routing": { "version": "5.4", "recipe": { @@ -139,19 +178,90 @@ "symfony/runtime": { "version": "v5.4.7" }, + "symfony/security-bundle": { + "version": "5.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "5.3", + "ref": "98f1f2b0d635908c2b40f3675da2d23b1a069d30" + }, + "files": [ + "config/packages/security.yaml" + ] + }, + "symfony/security-core": { + "version": "v5.4.8" + }, + "symfony/security-csrf": { + "version": "v5.4.3" + }, + "symfony/security-guard": { + "version": "v5.4.3" + }, + "symfony/security-http": { + "version": "v5.4.8" + }, "symfony/service-contracts": { "version": "v2.5.1" }, "symfony/string": { "version": "v5.4.3" }, + "symfony/translation-contracts": { + "version": "v2.5.1" + }, + "symfony/twig-bridge": { + "version": "v5.4.8" + }, + "symfony/twig-bundle": { + "version": "5.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "5.4", + "ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387" + }, + "files": [ + "config/packages/twig.yaml", + "templates/base.html.twig" + ] + }, + "symfony/validator": { + "version": "5.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "5.3", + "ref": "c32cfd98f714894c4f128bb99aa2530c1227603c" + }, + "files": [ + "config/packages/validator.yaml" + ] + }, "symfony/var-dumper": { "version": "v5.4.6" }, "symfony/var-exporter": { "version": "v5.4.7" }, + "symfony/web-profiler-bundle": { + "version": "5.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "5.3", + "ref": "24bbc3d84ef2f427f82104f766014e799eefcc3e" + }, + "files": [ + "config/packages/web_profiler.yaml", + "config/routes/web_profiler.yaml" + ] + }, "symfony/yaml": { "version": "v5.4.3" + }, + "twig/twig": { + "version": "v3.3.10" } } diff --git a/templates/base.html.twig b/templates/base.html.twig new file mode 100644 index 0000000..99ba656 --- /dev/null +++ b/templates/base.html.twig @@ -0,0 +1,21 @@ + + + + + {% block title %}Welcome!{% endblock %} + + + + {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} + {% block stylesheets %} + {{ encore_entry_link_tags('app') }} + {% endblock %} + + {% block javascripts %} + {{ encore_entry_script_tags('app') }} + {% endblock %} + + + {% block body %}{% endblock %} + + diff --git a/templates/login.html.twig b/templates/login.html.twig new file mode 100644 index 0000000..157f992 --- /dev/null +++ b/templates/login.html.twig @@ -0,0 +1,44 @@ +{% extends "base.html.twig" %} +{% block stylesheets %} + +{% endblock %} + +{% block body %} +
+ {{ form_start(form)}} +
+ {% if error is defined %}{{ error }}{% endif %} +
+ {{ form_widget(form)}} + + + {{ form_end(form)}} +
+ +{% endblock %} \ No newline at end of file diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 4efaf4e..41bd9bc 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,11 +7,42 @@ $baseDir = dirname($vendorDir); return array( 'App\\Controller\\MainController' => $baseDir . '/src/Controller/MainController.php', + 'App\\Entity\\User' => $baseDir . '/src/Entity/User.php', + 'App\\Form\\UserType' => $baseDir . '/src/Form/UserType.php', 'App\\Kernel' => $baseDir . '/src/Kernel.php', + 'App\\Services\\PdoServices' => $baseDir . '/src/Services/PdoServices.php', 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Collator' => $vendorDir . '/symfony/polyfill-intl-icu/Resources/stubs/Collator.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'Doctrine\\Common\\Annotations\\Annotation' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php', + 'Doctrine\\Common\\Annotations\\AnnotationException' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php', + 'Doctrine\\Common\\Annotations\\AnnotationReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php', + 'Doctrine\\Common\\Annotations\\AnnotationRegistry' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Attribute' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Attributes' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Enum' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php', + 'Doctrine\\Common\\Annotations\\Annotation\\IgnoreAnnotation' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php', + 'Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Required' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Target' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php', + 'Doctrine\\Common\\Annotations\\CachedReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php', + 'Doctrine\\Common\\Annotations\\DocLexer' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php', + 'Doctrine\\Common\\Annotations\\DocParser' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php', + 'Doctrine\\Common\\Annotations\\FileCacheReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php', + 'Doctrine\\Common\\Annotations\\ImplicitlyIgnoredAnnotationNames' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php', + 'Doctrine\\Common\\Annotations\\IndexedReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php', + 'Doctrine\\Common\\Annotations\\NamedArgumentConstructorAnnotation' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php', + 'Doctrine\\Common\\Annotations\\PhpParser' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php', + 'Doctrine\\Common\\Annotations\\PsrCachedReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php', + 'Doctrine\\Common\\Annotations\\Reader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php', + 'Doctrine\\Common\\Annotations\\SimpleAnnotationReader' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php', + 'Doctrine\\Common\\Annotations\\TokenParser' => $vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php', + 'Doctrine\\Common\\Lexer\\AbstractLexer' => $vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', + 'IntlDateFormatter' => $vendorDir . '/symfony/polyfill-intl-icu/Resources/stubs/IntlDateFormatter.php', 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Locale' => $vendorDir . '/symfony/polyfill-intl-icu/Resources/stubs/Locale.php', 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'NumberFormatter' => $vendorDir . '/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php', 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Psr\\Cache\\CacheException' => $vendorDir . '/psr/cache/src/CacheException.php', 'Psr\\Cache\\CacheItemInterface' => $vendorDir . '/psr/cache/src/CacheItemInterface.php', @@ -36,6 +67,54 @@ return array( 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php', 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'Symfony\\Bridge\\Twig\\AppVariable' => $vendorDir . '/symfony/twig-bridge/AppVariable.php', + 'Symfony\\Bridge\\Twig\\Command\\DebugCommand' => $vendorDir . '/symfony/twig-bridge/Command/DebugCommand.php', + 'Symfony\\Bridge\\Twig\\Command\\LintCommand' => $vendorDir . '/symfony/twig-bridge/Command/LintCommand.php', + 'Symfony\\Bridge\\Twig\\DataCollector\\TwigDataCollector' => $vendorDir . '/symfony/twig-bridge/DataCollector/TwigDataCollector.php', + 'Symfony\\Bridge\\Twig\\ErrorRenderer\\TwigErrorRenderer' => $vendorDir . '/symfony/twig-bridge/ErrorRenderer/TwigErrorRenderer.php', + 'Symfony\\Bridge\\Twig\\Extension\\AssetExtension' => $vendorDir . '/symfony/twig-bridge/Extension/AssetExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CodeExtension' => $vendorDir . '/symfony/twig-bridge/Extension/CodeExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CsrfExtension' => $vendorDir . '/symfony/twig-bridge/Extension/CsrfExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CsrfRuntime' => $vendorDir . '/symfony/twig-bridge/Extension/CsrfRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\DumpExtension' => $vendorDir . '/symfony/twig-bridge/Extension/DumpExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\ExpressionExtension' => $vendorDir . '/symfony/twig-bridge/Extension/ExpressionExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\FormExtension' => $vendorDir . '/symfony/twig-bridge/Extension/FormExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpFoundationExtension' => $vendorDir . '/symfony/twig-bridge/Extension/HttpFoundationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelExtension' => $vendorDir . '/symfony/twig-bridge/Extension/HttpKernelExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelRuntime' => $vendorDir . '/symfony/twig-bridge/Extension/HttpKernelRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\LogoutUrlExtension' => $vendorDir . '/symfony/twig-bridge/Extension/LogoutUrlExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension' => $vendorDir . '/symfony/twig-bridge/Extension/ProfilerExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\RoutingExtension' => $vendorDir . '/symfony/twig-bridge/Extension/RoutingExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SecurityExtension' => $vendorDir . '/symfony/twig-bridge/Extension/SecurityExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SerializerExtension' => $vendorDir . '/symfony/twig-bridge/Extension/SerializerExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SerializerRuntime' => $vendorDir . '/symfony/twig-bridge/Extension/SerializerRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\StopwatchExtension' => $vendorDir . '/symfony/twig-bridge/Extension/StopwatchExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\TranslationExtension' => $vendorDir . '/symfony/twig-bridge/Extension/TranslationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WebLinkExtension' => $vendorDir . '/symfony/twig-bridge/Extension/WebLinkExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WorkflowExtension' => $vendorDir . '/symfony/twig-bridge/Extension/WorkflowExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\YamlExtension' => $vendorDir . '/symfony/twig-bridge/Extension/YamlExtension.php', + 'Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine' => $vendorDir . '/symfony/twig-bridge/Form/TwigRendererEngine.php', + 'Symfony\\Bridge\\Twig\\Mime\\BodyRenderer' => $vendorDir . '/symfony/twig-bridge/Mime/BodyRenderer.php', + 'Symfony\\Bridge\\Twig\\Mime\\NotificationEmail' => $vendorDir . '/symfony/twig-bridge/Mime/NotificationEmail.php', + 'Symfony\\Bridge\\Twig\\Mime\\TemplatedEmail' => $vendorDir . '/symfony/twig-bridge/Mime/TemplatedEmail.php', + 'Symfony\\Bridge\\Twig\\Mime\\WrappedTemplatedEmail' => $vendorDir . '/symfony/twig-bridge/Mime/WrappedTemplatedEmail.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\Scope' => $vendorDir . '/symfony/twig-bridge/NodeVisitor/Scope.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationDefaultDomainNodeVisitor' => $vendorDir . '/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationNodeVisitor' => $vendorDir . '/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php', + 'Symfony\\Bridge\\Twig\\Node\\DumpNode' => $vendorDir . '/symfony/twig-bridge/Node/DumpNode.php', + 'Symfony\\Bridge\\Twig\\Node\\FormThemeNode' => $vendorDir . '/symfony/twig-bridge/Node/FormThemeNode.php', + 'Symfony\\Bridge\\Twig\\Node\\RenderBlockNode' => $vendorDir . '/symfony/twig-bridge/Node/RenderBlockNode.php', + 'Symfony\\Bridge\\Twig\\Node\\SearchAndRenderBlockNode' => $vendorDir . '/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php', + 'Symfony\\Bridge\\Twig\\Node\\StopwatchNode' => $vendorDir . '/symfony/twig-bridge/Node/StopwatchNode.php', + 'Symfony\\Bridge\\Twig\\Node\\TransDefaultDomainNode' => $vendorDir . '/symfony/twig-bridge/Node/TransDefaultDomainNode.php', + 'Symfony\\Bridge\\Twig\\Node\\TransNode' => $vendorDir . '/symfony/twig-bridge/Node/TransNode.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\DumpTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/DumpTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\FormThemeTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\StopwatchTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\TransDefaultDomainTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/TransTokenParser.php', + 'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => $vendorDir . '/symfony/twig-bridge/Translation/TwigExtractor.php', + 'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => $vendorDir . '/symfony/twig-bridge/UndefinedCallableHandler.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AbstractPhpFileCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AnnotationsCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\CachePoolClearerCacheWarmer' => $vendorDir . '/symfony/framework-bundle/CacheWarmer/CachePoolClearerCacheWarmer.php', @@ -127,6 +206,85 @@ return array( 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestAssertionsTrait' => $vendorDir . '/symfony/framework-bundle/Test/WebTestAssertionsTrait.php', 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => $vendorDir . '/symfony/framework-bundle/Test/WebTestCase.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\Translator' => $vendorDir . '/symfony/framework-bundle/Translation/Translator.php', + 'Symfony\\Bundle\\SecurityBundle\\CacheWarmer\\ExpressionCacheWarmer' => $vendorDir . '/symfony/security-bundle/CacheWarmer/ExpressionCacheWarmer.php', + 'Symfony\\Bundle\\SecurityBundle\\Command\\DebugFirewallCommand' => $vendorDir . '/symfony/security-bundle/Command/DebugFirewallCommand.php', + 'Symfony\\Bundle\\SecurityBundle\\Command\\UserPasswordEncoderCommand' => $vendorDir . '/symfony/security-bundle/Command/UserPasswordEncoderCommand.php', + 'Symfony\\Bundle\\SecurityBundle\\DataCollector\\SecurityDataCollector' => $vendorDir . '/symfony/security-bundle/DataCollector/SecurityDataCollector.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener' => $vendorDir . '/symfony/security-bundle/Debug/TraceableFirewallListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableListenerTrait' => $vendorDir . '/symfony/security-bundle/Debug/TraceableListenerTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\WrappedLazyListener' => $vendorDir . '/symfony/security-bundle/Debug/WrappedLazyListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\WrappedListener' => $vendorDir . '/symfony/security-bundle/Debug/WrappedListener.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddExpressionLanguageProvidersPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddSecurityVotersPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/AddSecurityVotersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddSessionDomainConstraintPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\CleanRememberMeVerifierPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/CleanRememberMeVerifierPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterCsrfFeaturesPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterCsrfTokenClearingLogoutHandlerPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterEntryPointPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterEntryPointPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterGlobalSecurityEventListenersPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterLdapLocatorPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterLdapLocatorPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterTokenUsageTrackingPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\ReplaceDecoratedRememberMeHandlerPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\SortFirewallListenersPass' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Compiler/SortFirewallListenersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\MainConfiguration' => $vendorDir . '/symfony/security-bundle/DependencyInjection/MainConfiguration.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\SecurityExtension' => $vendorDir . '/symfony/security-bundle/DependencyInjection/SecurityExtension.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AbstractFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/AbstractFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AnonymousFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/AnonymousFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AuthenticatorFactoryInterface' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\CustomAuthenticatorFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FirewallListenerFactoryInterface' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/FirewallListenerFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FormLoginFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FormLoginLdapFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\GuardAuthenticationFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\HttpBasicFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\HttpBasicLdapFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\JsonLoginFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\JsonLoginLdapFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LdapFactoryTrait' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LoginLinkFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/LoginLinkFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LoginThrottlingFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\RememberMeFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/RememberMeFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\RemoteUserFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/RemoteUserFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\SecurityFactoryInterface' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\X509Factory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/Factory/X509Factory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\InMemoryFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\LdapFactory' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/LdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\UserProviderFactoryInterface' => $vendorDir . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\EventListener\\FirewallListener' => $vendorDir . '/symfony/security-bundle/EventListener/FirewallListener.php', + 'Symfony\\Bundle\\SecurityBundle\\EventListener\\VoteListener' => $vendorDir . '/symfony/security-bundle/EventListener/VoteListener.php', + 'Symfony\\Bundle\\SecurityBundle\\LoginLink\\FirewallAwareLoginLinkHandler' => $vendorDir . '/symfony/security-bundle/LoginLink/FirewallAwareLoginLinkHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\RememberMe\\DecoratedRememberMeHandler' => $vendorDir . '/symfony/security-bundle/RememberMe/DecoratedRememberMeHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\RememberMe\\FirewallAwareRememberMeHandler' => $vendorDir . '/symfony/security-bundle/RememberMe/FirewallAwareRememberMeHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\SecurityBundle' => $vendorDir . '/symfony/security-bundle/SecurityBundle.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallAwareTrait' => $vendorDir . '/symfony/security-bundle/Security/FirewallAwareTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallConfig' => $vendorDir . '/symfony/security-bundle/Security/FirewallConfig.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallContext' => $vendorDir . '/symfony/security-bundle/Security/FirewallContext.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallMap' => $vendorDir . '/symfony/security-bundle/Security/FirewallMap.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\LazyFirewallContext' => $vendorDir . '/symfony/security-bundle/Security/LazyFirewallContext.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\LegacyLogoutHandlerListener' => $vendorDir . '/symfony/security-bundle/Security/LegacyLogoutHandlerListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\UserAuthenticator' => $vendorDir . '/symfony/security-bundle/Security/UserAuthenticator.php', + 'Symfony\\Bundle\\TwigBundle\\CacheWarmer\\TemplateCacheWarmer' => $vendorDir . '/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php', + 'Symfony\\Bundle\\TwigBundle\\Command\\LintCommand' => $vendorDir . '/symfony/twig-bundle/Command/LintCommand.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\ExtensionPass' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\RuntimeLoaderPass' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\TwigEnvironmentPass' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\TwigLoaderPass' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Configuration' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Configuration.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Configurator\\EnvironmentConfigurator' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/Configurator/EnvironmentConfigurator.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => $vendorDir . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php', + 'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => $vendorDir . '/symfony/twig-bundle/TemplateIterator.php', + 'Symfony\\Bundle\\TwigBundle\\TwigBundle' => $vendorDir . '/symfony/twig-bundle/TwigBundle.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ExceptionPanelController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/ProfilerController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\RouterController' => $vendorDir . '/symfony/web-profiler-bundle/Controller/RouterController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Csp\\ContentSecurityPolicyHandler' => $vendorDir . '/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Csp\\NonceGenerator' => $vendorDir . '/symfony/web-profiler-bundle/Csp/NonceGenerator.php', + 'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\Configuration' => $vendorDir . '/symfony/web-profiler-bundle/DependencyInjection/Configuration.php', + 'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\WebProfilerExtension' => $vendorDir . '/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php', + 'Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener' => $vendorDir . '/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Profiler\\TemplateManager' => $vendorDir . '/symfony/web-profiler-bundle/Profiler/TemplateManager.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension' => $vendorDir . '/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php', + 'Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle' => $vendorDir . '/symfony/web-profiler-bundle/WebProfilerBundle.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/cache/Adapter/AdapterInterface.php', @@ -607,6 +765,296 @@ return array( 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Iterator/SortableIterator.php', 'Symfony\\Component\\Finder\\Iterator\\VcsIgnoredFilterIterator' => $vendorDir . '/symfony/finder/Iterator/VcsIgnoredFilterIterator.php', 'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/SplFileInfo.php', + 'Symfony\\Component\\Form\\AbstractExtension' => $vendorDir . '/symfony/form/AbstractExtension.php', + 'Symfony\\Component\\Form\\AbstractRendererEngine' => $vendorDir . '/symfony/form/AbstractRendererEngine.php', + 'Symfony\\Component\\Form\\AbstractType' => $vendorDir . '/symfony/form/AbstractType.php', + 'Symfony\\Component\\Form\\AbstractTypeExtension' => $vendorDir . '/symfony/form/AbstractTypeExtension.php', + 'Symfony\\Component\\Form\\Button' => $vendorDir . '/symfony/form/Button.php', + 'Symfony\\Component\\Form\\ButtonBuilder' => $vendorDir . '/symfony/form/ButtonBuilder.php', + 'Symfony\\Component\\Form\\ButtonTypeInterface' => $vendorDir . '/symfony/form/ButtonTypeInterface.php', + 'Symfony\\Component\\Form\\CallbackTransformer' => $vendorDir . '/symfony/form/CallbackTransformer.php', + 'Symfony\\Component\\Form\\ChoiceList\\ArrayChoiceList' => $vendorDir . '/symfony/form/ChoiceList/ArrayChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\ChoiceList' => $vendorDir . '/symfony/form/ChoiceList/ChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\ChoiceListInterface' => $vendorDir . '/symfony/form/ChoiceList/ChoiceListInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\AbstractStaticOption' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/AbstractStaticOption.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceAttr' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceAttr.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceFieldName' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceFieldName.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceFilter' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceFilter.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceLabel' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceLabel.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceLoader' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceTranslationParameters' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceTranslationParameters.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceValue' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/ChoiceValue.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\GroupBy' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/GroupBy.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\PreferredChoice' => $vendorDir . '/symfony/form/ChoiceList/Factory/Cache/PreferredChoice.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\CachingFactoryDecorator' => $vendorDir . '/symfony/form/ChoiceList/Factory/CachingFactoryDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\ChoiceListFactoryInterface' => $vendorDir . '/symfony/form/ChoiceList/Factory/ChoiceListFactoryInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\DefaultChoiceListFactory' => $vendorDir . '/symfony/form/ChoiceList/Factory/DefaultChoiceListFactory.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\PropertyAccessDecorator' => $vendorDir . '/symfony/form/ChoiceList/Factory/PropertyAccessDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\LazyChoiceList' => $vendorDir . '/symfony/form/ChoiceList/LazyChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\AbstractChoiceLoader' => $vendorDir . '/symfony/form/ChoiceList/Loader/AbstractChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\CallbackChoiceLoader' => $vendorDir . '/symfony/form/ChoiceList/Loader/CallbackChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\ChoiceLoaderInterface' => $vendorDir . '/symfony/form/ChoiceList/Loader/ChoiceLoaderInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\FilterChoiceLoaderDecorator' => $vendorDir . '/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\IntlCallbackChoiceLoader' => $vendorDir . '/symfony/form/ChoiceList/Loader/IntlCallbackChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceGroupView' => $vendorDir . '/symfony/form/ChoiceList/View/ChoiceGroupView.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceListView' => $vendorDir . '/symfony/form/ChoiceList/View/ChoiceListView.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceView' => $vendorDir . '/symfony/form/ChoiceList/View/ChoiceView.php', + 'Symfony\\Component\\Form\\ClearableErrorsInterface' => $vendorDir . '/symfony/form/ClearableErrorsInterface.php', + 'Symfony\\Component\\Form\\ClickableInterface' => $vendorDir . '/symfony/form/ClickableInterface.php', + 'Symfony\\Component\\Form\\Command\\DebugCommand' => $vendorDir . '/symfony/form/Command/DebugCommand.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/form/Console/Descriptor/Descriptor.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/form/Console/Descriptor/JsonDescriptor.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/form/Console/Descriptor/TextDescriptor.php', + 'Symfony\\Component\\Form\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/form/Console/Helper/DescriptorHelper.php', + 'Symfony\\Component\\Form\\DataAccessorInterface' => $vendorDir . '/symfony/form/DataAccessorInterface.php', + 'Symfony\\Component\\Form\\DataMapperInterface' => $vendorDir . '/symfony/form/DataMapperInterface.php', + 'Symfony\\Component\\Form\\DataTransformerInterface' => $vendorDir . '/symfony/form/DataTransformerInterface.php', + 'Symfony\\Component\\Form\\DependencyInjection\\FormPass' => $vendorDir . '/symfony/form/DependencyInjection/FormPass.php', + 'Symfony\\Component\\Form\\Event\\PostSetDataEvent' => $vendorDir . '/symfony/form/Event/PostSetDataEvent.php', + 'Symfony\\Component\\Form\\Event\\PostSubmitEvent' => $vendorDir . '/symfony/form/Event/PostSubmitEvent.php', + 'Symfony\\Component\\Form\\Event\\PreSetDataEvent' => $vendorDir . '/symfony/form/Event/PreSetDataEvent.php', + 'Symfony\\Component\\Form\\Event\\PreSubmitEvent' => $vendorDir . '/symfony/form/Event/PreSubmitEvent.php', + 'Symfony\\Component\\Form\\Event\\SubmitEvent' => $vendorDir . '/symfony/form/Event/SubmitEvent.php', + 'Symfony\\Component\\Form\\Exception\\AccessException' => $vendorDir . '/symfony/form/Exception/AccessException.php', + 'Symfony\\Component\\Form\\Exception\\AlreadySubmittedException' => $vendorDir . '/symfony/form/Exception/AlreadySubmittedException.php', + 'Symfony\\Component\\Form\\Exception\\BadMethodCallException' => $vendorDir . '/symfony/form/Exception/BadMethodCallException.php', + 'Symfony\\Component\\Form\\Exception\\ErrorMappingException' => $vendorDir . '/symfony/form/Exception/ErrorMappingException.php', + 'Symfony\\Component\\Form\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/form/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Form\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/form/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Form\\Exception\\InvalidConfigurationException' => $vendorDir . '/symfony/form/Exception/InvalidConfigurationException.php', + 'Symfony\\Component\\Form\\Exception\\LogicException' => $vendorDir . '/symfony/form/Exception/LogicException.php', + 'Symfony\\Component\\Form\\Exception\\OutOfBoundsException' => $vendorDir . '/symfony/form/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\Form\\Exception\\RuntimeException' => $vendorDir . '/symfony/form/Exception/RuntimeException.php', + 'Symfony\\Component\\Form\\Exception\\StringCastException' => $vendorDir . '/symfony/form/Exception/StringCastException.php', + 'Symfony\\Component\\Form\\Exception\\TransformationFailedException' => $vendorDir . '/symfony/form/Exception/TransformationFailedException.php', + 'Symfony\\Component\\Form\\Exception\\UnexpectedTypeException' => $vendorDir . '/symfony/form/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\Form\\Extension\\Core\\CoreExtension' => $vendorDir . '/symfony/form/Extension/Core/CoreExtension.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\CallbackAccessor' => $vendorDir . '/symfony/form/Extension/Core/DataAccessor/CallbackAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\ChainAccessor' => $vendorDir . '/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\PropertyPathAccessor' => $vendorDir . '/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\CheckboxListMapper' => $vendorDir . '/symfony/form/Extension/Core/DataMapper/CheckboxListMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\DataMapper' => $vendorDir . '/symfony/form/Extension/Core/DataMapper/DataMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\PropertyPathMapper' => $vendorDir . '/symfony/form/Extension/Core/DataMapper/PropertyPathMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\RadioListMapper' => $vendorDir . '/symfony/form/Extension/Core/DataMapper/RadioListMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ArrayToPartsTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\BaseDateTimeTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\BooleanToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/BooleanToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ChoiceToValueTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ChoicesToValuesTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DataTransformerChain' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DataTransformerChain.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateIntervalToArrayTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateIntervalToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeImmutableToDateTimeTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToArrayTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToHtml5LocalDateTimeTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToLocalizedStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToRfc3339Transformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToTimestampTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeZoneToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntegerToLocalizedStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntlTimeZoneToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\MoneyToLocalizedStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\PercentToLocalizedStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\StringToFloatTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/StringToFloatTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\UlidToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/UlidToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\UuidToStringTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/UuidToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ValueToDuplicatesTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\WeekToArrayTransformer' => $vendorDir . '/symfony/form/Extension/Core/DataTransformer/WeekToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\FixUrlProtocolListener' => $vendorDir . '/symfony/form/Extension/Core/EventListener/FixUrlProtocolListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\MergeCollectionListener' => $vendorDir . '/symfony/form/Extension/Core/EventListener/MergeCollectionListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\ResizeFormListener' => $vendorDir . '/symfony/form/Extension/Core/EventListener/ResizeFormListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\TransformationFailureListener' => $vendorDir . '/symfony/form/Extension/Core/EventListener/TransformationFailureListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\TrimListener' => $vendorDir . '/symfony/form/Extension/Core/EventListener/TrimListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType' => $vendorDir . '/symfony/form/Extension/Core/Type/BaseType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType' => $vendorDir . '/symfony/form/Extension/Core/Type/BirthdayType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType' => $vendorDir . '/symfony/form/Extension/Core/Type/ButtonType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType' => $vendorDir . '/symfony/form/Extension/Core/Type/CheckboxType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType' => $vendorDir . '/symfony/form/Extension/Core/Type/ChoiceType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType' => $vendorDir . '/symfony/form/Extension/Core/Type/CollectionType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType' => $vendorDir . '/symfony/form/Extension/Core/Type/ColorType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType' => $vendorDir . '/symfony/form/Extension/Core/Type/CountryType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType' => $vendorDir . '/symfony/form/Extension/Core/Type/CurrencyType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType' => $vendorDir . '/symfony/form/Extension/Core/Type/DateIntervalType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType' => $vendorDir . '/symfony/form/Extension/Core/Type/DateTimeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType' => $vendorDir . '/symfony/form/Extension/Core/Type/DateType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType' => $vendorDir . '/symfony/form/Extension/Core/Type/EmailType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EnumType' => $vendorDir . '/symfony/form/Extension/Core/Type/EnumType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType' => $vendorDir . '/symfony/form/Extension/Core/Type/FileType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType' => $vendorDir . '/symfony/form/Extension/Core/Type/FormType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType' => $vendorDir . '/symfony/form/Extension/Core/Type/HiddenType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType' => $vendorDir . '/symfony/form/Extension/Core/Type/IntegerType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType' => $vendorDir . '/symfony/form/Extension/Core/Type/LanguageType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType' => $vendorDir . '/symfony/form/Extension/Core/Type/LocaleType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType' => $vendorDir . '/symfony/form/Extension/Core/Type/MoneyType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType' => $vendorDir . '/symfony/form/Extension/Core/Type/NumberType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType' => $vendorDir . '/symfony/form/Extension/Core/Type/PasswordType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType' => $vendorDir . '/symfony/form/Extension/Core/Type/PercentType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType' => $vendorDir . '/symfony/form/Extension/Core/Type/RadioType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType' => $vendorDir . '/symfony/form/Extension/Core/Type/RangeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType' => $vendorDir . '/symfony/form/Extension/Core/Type/RepeatedType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType' => $vendorDir . '/symfony/form/Extension/Core/Type/ResetType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType' => $vendorDir . '/symfony/form/Extension/Core/Type/SearchType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType' => $vendorDir . '/symfony/form/Extension/Core/Type/SubmitType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType' => $vendorDir . '/symfony/form/Extension/Core/Type/TelType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType' => $vendorDir . '/symfony/form/Extension/Core/Type/TextType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType' => $vendorDir . '/symfony/form/Extension/Core/Type/TextareaType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType' => $vendorDir . '/symfony/form/Extension/Core/Type/TimeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType' => $vendorDir . '/symfony/form/Extension/Core/Type/TimezoneType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TransformationFailureExtension' => $vendorDir . '/symfony/form/Extension/Core/Type/TransformationFailureExtension.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UlidType' => $vendorDir . '/symfony/form/Extension/Core/Type/UlidType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType' => $vendorDir . '/symfony/form/Extension/Core/Type/UrlType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UuidType' => $vendorDir . '/symfony/form/Extension/Core/Type/UuidType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\WeekType' => $vendorDir . '/symfony/form/Extension/Core/Type/WeekType.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\CsrfExtension' => $vendorDir . '/symfony/form/Extension/Csrf/CsrfExtension.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\EventListener\\CsrfValidationListener' => $vendorDir . '/symfony/form/Extension/Csrf/EventListener/CsrfValidationListener.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\Type\\FormTypeCsrfExtension' => $vendorDir . '/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\DataCollectorExtension' => $vendorDir . '/symfony/form/Extension/DataCollector/DataCollectorExtension.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\EventListener\\DataCollectorListener' => $vendorDir . '/symfony/form/Extension/DataCollector/EventListener/DataCollectorListener.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataCollector' => $vendorDir . '/symfony/form/Extension/DataCollector/FormDataCollector.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataCollectorInterface' => $vendorDir . '/symfony/form/Extension/DataCollector/FormDataCollectorInterface.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataExtractor' => $vendorDir . '/symfony/form/Extension/DataCollector/FormDataExtractor.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataExtractorInterface' => $vendorDir . '/symfony/form/Extension/DataCollector/FormDataExtractorInterface.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Proxy\\ResolvedTypeDataCollectorProxy' => $vendorDir . '/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Proxy\\ResolvedTypeFactoryDataCollectorProxy' => $vendorDir . '/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Type\\DataCollectorTypeExtension' => $vendorDir . '/symfony/form/Extension/DataCollector/Type/DataCollectorTypeExtension.php', + 'Symfony\\Component\\Form\\Extension\\DependencyInjection\\DependencyInjectionExtension' => $vendorDir . '/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationExtension' => $vendorDir . '/symfony/form/Extension/HttpFoundation/HttpFoundationExtension.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler' => $vendorDir . '/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\Type\\FormTypeHttpFoundationExtension' => $vendorDir . '/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Constraints\\Form' => $vendorDir . '/symfony/form/Extension/Validator/Constraints/Form.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Constraints\\FormValidator' => $vendorDir . '/symfony/form/Extension/Validator/Constraints/FormValidator.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\EventListener\\ValidationListener' => $vendorDir . '/symfony/form/Extension/Validator/EventListener/ValidationListener.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\BaseValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/Type/BaseValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\FormTypeValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/Type/FormTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\RepeatedTypeValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\SubmitTypeValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/Type/SubmitTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\UploadValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/Type/UploadValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Util\\ServerParams' => $vendorDir . '/symfony/form/Extension/Validator/Util/ServerParams.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ValidatorExtension' => $vendorDir . '/symfony/form/Extension/Validator/ValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ValidatorTypeGuesser' => $vendorDir . '/symfony/form/Extension/Validator/ValidatorTypeGuesser.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\MappingRule' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/MappingRule.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\RelativePath' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/RelativePath.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationMapper' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/ViolationMapper.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationMapperInterface' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationPath' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/ViolationPath.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationPathIterator' => $vendorDir . '/symfony/form/Extension/Validator/ViolationMapper/ViolationPathIterator.php', + 'Symfony\\Component\\Form\\FileUploadError' => $vendorDir . '/symfony/form/FileUploadError.php', + 'Symfony\\Component\\Form\\Form' => $vendorDir . '/symfony/form/Form.php', + 'Symfony\\Component\\Form\\FormBuilder' => $vendorDir . '/symfony/form/FormBuilder.php', + 'Symfony\\Component\\Form\\FormBuilderInterface' => $vendorDir . '/symfony/form/FormBuilderInterface.php', + 'Symfony\\Component\\Form\\FormConfigBuilder' => $vendorDir . '/symfony/form/FormConfigBuilder.php', + 'Symfony\\Component\\Form\\FormConfigBuilderInterface' => $vendorDir . '/symfony/form/FormConfigBuilderInterface.php', + 'Symfony\\Component\\Form\\FormConfigInterface' => $vendorDir . '/symfony/form/FormConfigInterface.php', + 'Symfony\\Component\\Form\\FormError' => $vendorDir . '/symfony/form/FormError.php', + 'Symfony\\Component\\Form\\FormErrorIterator' => $vendorDir . '/symfony/form/FormErrorIterator.php', + 'Symfony\\Component\\Form\\FormEvent' => $vendorDir . '/symfony/form/FormEvent.php', + 'Symfony\\Component\\Form\\FormEvents' => $vendorDir . '/symfony/form/FormEvents.php', + 'Symfony\\Component\\Form\\FormExtensionInterface' => $vendorDir . '/symfony/form/FormExtensionInterface.php', + 'Symfony\\Component\\Form\\FormFactory' => $vendorDir . '/symfony/form/FormFactory.php', + 'Symfony\\Component\\Form\\FormFactoryBuilder' => $vendorDir . '/symfony/form/FormFactoryBuilder.php', + 'Symfony\\Component\\Form\\FormFactoryBuilderInterface' => $vendorDir . '/symfony/form/FormFactoryBuilderInterface.php', + 'Symfony\\Component\\Form\\FormFactoryInterface' => $vendorDir . '/symfony/form/FormFactoryInterface.php', + 'Symfony\\Component\\Form\\FormInterface' => $vendorDir . '/symfony/form/FormInterface.php', + 'Symfony\\Component\\Form\\FormRegistry' => $vendorDir . '/symfony/form/FormRegistry.php', + 'Symfony\\Component\\Form\\FormRegistryInterface' => $vendorDir . '/symfony/form/FormRegistryInterface.php', + 'Symfony\\Component\\Form\\FormRenderer' => $vendorDir . '/symfony/form/FormRenderer.php', + 'Symfony\\Component\\Form\\FormRendererEngineInterface' => $vendorDir . '/symfony/form/FormRendererEngineInterface.php', + 'Symfony\\Component\\Form\\FormRendererInterface' => $vendorDir . '/symfony/form/FormRendererInterface.php', + 'Symfony\\Component\\Form\\FormTypeExtensionInterface' => $vendorDir . '/symfony/form/FormTypeExtensionInterface.php', + 'Symfony\\Component\\Form\\FormTypeGuesserChain' => $vendorDir . '/symfony/form/FormTypeGuesserChain.php', + 'Symfony\\Component\\Form\\FormTypeGuesserInterface' => $vendorDir . '/symfony/form/FormTypeGuesserInterface.php', + 'Symfony\\Component\\Form\\FormTypeInterface' => $vendorDir . '/symfony/form/FormTypeInterface.php', + 'Symfony\\Component\\Form\\FormView' => $vendorDir . '/symfony/form/FormView.php', + 'Symfony\\Component\\Form\\Forms' => $vendorDir . '/symfony/form/Forms.php', + 'Symfony\\Component\\Form\\Guess\\Guess' => $vendorDir . '/symfony/form/Guess/Guess.php', + 'Symfony\\Component\\Form\\Guess\\TypeGuess' => $vendorDir . '/symfony/form/Guess/TypeGuess.php', + 'Symfony\\Component\\Form\\Guess\\ValueGuess' => $vendorDir . '/symfony/form/Guess/ValueGuess.php', + 'Symfony\\Component\\Form\\NativeRequestHandler' => $vendorDir . '/symfony/form/NativeRequestHandler.php', + 'Symfony\\Component\\Form\\PreloadedExtension' => $vendorDir . '/symfony/form/PreloadedExtension.php', + 'Symfony\\Component\\Form\\RequestHandlerInterface' => $vendorDir . '/symfony/form/RequestHandlerInterface.php', + 'Symfony\\Component\\Form\\ResolvedFormType' => $vendorDir . '/symfony/form/ResolvedFormType.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeFactory' => $vendorDir . '/symfony/form/ResolvedFormTypeFactory.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeFactoryInterface' => $vendorDir . '/symfony/form/ResolvedFormTypeFactoryInterface.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeInterface' => $vendorDir . '/symfony/form/ResolvedFormTypeInterface.php', + 'Symfony\\Component\\Form\\ReversedTransformer' => $vendorDir . '/symfony/form/ReversedTransformer.php', + 'Symfony\\Component\\Form\\SubmitButton' => $vendorDir . '/symfony/form/SubmitButton.php', + 'Symfony\\Component\\Form\\SubmitButtonBuilder' => $vendorDir . '/symfony/form/SubmitButtonBuilder.php', + 'Symfony\\Component\\Form\\SubmitButtonTypeInterface' => $vendorDir . '/symfony/form/SubmitButtonTypeInterface.php', + 'Symfony\\Component\\Form\\Test\\FormBuilderInterface' => $vendorDir . '/symfony/form/Test/FormBuilderInterface.php', + 'Symfony\\Component\\Form\\Test\\FormIntegrationTestCase' => $vendorDir . '/symfony/form/Test/FormIntegrationTestCase.php', + 'Symfony\\Component\\Form\\Test\\FormInterface' => $vendorDir . '/symfony/form/Test/FormInterface.php', + 'Symfony\\Component\\Form\\Test\\FormPerformanceTestCase' => $vendorDir . '/symfony/form/Test/FormPerformanceTestCase.php', + 'Symfony\\Component\\Form\\Test\\Traits\\ValidatorExtensionTrait' => $vendorDir . '/symfony/form/Test/Traits/ValidatorExtensionTrait.php', + 'Symfony\\Component\\Form\\Test\\TypeTestCase' => $vendorDir . '/symfony/form/Test/TypeTestCase.php', + 'Symfony\\Component\\Form\\Util\\FormUtil' => $vendorDir . '/symfony/form/Util/FormUtil.php', + 'Symfony\\Component\\Form\\Util\\InheritDataAwareIterator' => $vendorDir . '/symfony/form/Util/InheritDataAwareIterator.php', + 'Symfony\\Component\\Form\\Util\\OptionsResolverWrapper' => $vendorDir . '/symfony/form/Util/OptionsResolverWrapper.php', + 'Symfony\\Component\\Form\\Util\\OrderedHashMap' => $vendorDir . '/symfony/form/Util/OrderedHashMap.php', + 'Symfony\\Component\\Form\\Util\\OrderedHashMapIterator' => $vendorDir . '/symfony/form/Util/OrderedHashMapIterator.php', + 'Symfony\\Component\\Form\\Util\\ServerParams' => $vendorDir . '/symfony/form/Util/ServerParams.php', + 'Symfony\\Component\\Form\\Util\\StringUtil' => $vendorDir . '/symfony/form/Util/StringUtil.php', + 'Symfony\\Component\\HttpClient\\AmpHttpClient' => $vendorDir . '/symfony/http-client/AmpHttpClient.php', + 'Symfony\\Component\\HttpClient\\AsyncDecoratorTrait' => $vendorDir . '/symfony/http-client/AsyncDecoratorTrait.php', + 'Symfony\\Component\\HttpClient\\CachingHttpClient' => $vendorDir . '/symfony/http-client/CachingHttpClient.php', + 'Symfony\\Component\\HttpClient\\Chunk\\DataChunk' => $vendorDir . '/symfony/http-client/Chunk/DataChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\ErrorChunk' => $vendorDir . '/symfony/http-client/Chunk/ErrorChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\FirstChunk' => $vendorDir . '/symfony/http-client/Chunk/FirstChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\InformationalChunk' => $vendorDir . '/symfony/http-client/Chunk/InformationalChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\LastChunk' => $vendorDir . '/symfony/http-client/Chunk/LastChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\ServerSentEvent' => $vendorDir . '/symfony/http-client/Chunk/ServerSentEvent.php', + 'Symfony\\Component\\HttpClient\\CurlHttpClient' => $vendorDir . '/symfony/http-client/CurlHttpClient.php', + 'Symfony\\Component\\HttpClient\\DataCollector\\HttpClientDataCollector' => $vendorDir . '/symfony/http-client/DataCollector/HttpClientDataCollector.php', + 'Symfony\\Component\\HttpClient\\DecoratorTrait' => $vendorDir . '/symfony/http-client/DecoratorTrait.php', + 'Symfony\\Component\\HttpClient\\DependencyInjection\\HttpClientPass' => $vendorDir . '/symfony/http-client/DependencyInjection/HttpClientPass.php', + 'Symfony\\Component\\HttpClient\\EventSourceHttpClient' => $vendorDir . '/symfony/http-client/EventSourceHttpClient.php', + 'Symfony\\Component\\HttpClient\\Exception\\ClientException' => $vendorDir . '/symfony/http-client/Exception/ClientException.php', + 'Symfony\\Component\\HttpClient\\Exception\\EventSourceException' => $vendorDir . '/symfony/http-client/Exception/EventSourceException.php', + 'Symfony\\Component\\HttpClient\\Exception\\HttpExceptionTrait' => $vendorDir . '/symfony/http-client/Exception/HttpExceptionTrait.php', + 'Symfony\\Component\\HttpClient\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/http-client/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\HttpClient\\Exception\\JsonException' => $vendorDir . '/symfony/http-client/Exception/JsonException.php', + 'Symfony\\Component\\HttpClient\\Exception\\RedirectionException' => $vendorDir . '/symfony/http-client/Exception/RedirectionException.php', + 'Symfony\\Component\\HttpClient\\Exception\\ServerException' => $vendorDir . '/symfony/http-client/Exception/ServerException.php', + 'Symfony\\Component\\HttpClient\\Exception\\TimeoutException' => $vendorDir . '/symfony/http-client/Exception/TimeoutException.php', + 'Symfony\\Component\\HttpClient\\Exception\\TransportException' => $vendorDir . '/symfony/http-client/Exception/TransportException.php', + 'Symfony\\Component\\HttpClient\\HttpClient' => $vendorDir . '/symfony/http-client/HttpClient.php', + 'Symfony\\Component\\HttpClient\\HttpClientTrait' => $vendorDir . '/symfony/http-client/HttpClientTrait.php', + 'Symfony\\Component\\HttpClient\\HttpOptions' => $vendorDir . '/symfony/http-client/HttpOptions.php', + 'Symfony\\Component\\HttpClient\\HttplugClient' => $vendorDir . '/symfony/http-client/HttplugClient.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpBody' => $vendorDir . '/symfony/http-client/Internal/AmpBody.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpClientState' => $vendorDir . '/symfony/http-client/Internal/AmpClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpListener' => $vendorDir . '/symfony/http-client/Internal/AmpListener.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpResolver' => $vendorDir . '/symfony/http-client/Internal/AmpResolver.php', + 'Symfony\\Component\\HttpClient\\Internal\\Canary' => $vendorDir . '/symfony/http-client/Internal/Canary.php', + 'Symfony\\Component\\HttpClient\\Internal\\ClientState' => $vendorDir . '/symfony/http-client/Internal/ClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\CurlClientState' => $vendorDir . '/symfony/http-client/Internal/CurlClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\DnsCache' => $vendorDir . '/symfony/http-client/Internal/DnsCache.php', + 'Symfony\\Component\\HttpClient\\Internal\\HttplugWaitLoop' => $vendorDir . '/symfony/http-client/Internal/HttplugWaitLoop.php', + 'Symfony\\Component\\HttpClient\\Internal\\NativeClientState' => $vendorDir . '/symfony/http-client/Internal/NativeClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\PushedResponse' => $vendorDir . '/symfony/http-client/Internal/PushedResponse.php', + 'Symfony\\Component\\HttpClient\\MockHttpClient' => $vendorDir . '/symfony/http-client/MockHttpClient.php', + 'Symfony\\Component\\HttpClient\\NativeHttpClient' => $vendorDir . '/symfony/http-client/NativeHttpClient.php', + 'Symfony\\Component\\HttpClient\\NoPrivateNetworkHttpClient' => $vendorDir . '/symfony/http-client/NoPrivateNetworkHttpClient.php', + 'Symfony\\Component\\HttpClient\\Psr18Client' => $vendorDir . '/symfony/http-client/Psr18Client.php', + 'Symfony\\Component\\HttpClient\\Response\\AmpResponse' => $vendorDir . '/symfony/http-client/Response/AmpResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\AsyncContext' => $vendorDir . '/symfony/http-client/Response/AsyncContext.php', + 'Symfony\\Component\\HttpClient\\Response\\AsyncResponse' => $vendorDir . '/symfony/http-client/Response/AsyncResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\CommonResponseTrait' => $vendorDir . '/symfony/http-client/Response/CommonResponseTrait.php', + 'Symfony\\Component\\HttpClient\\Response\\CurlResponse' => $vendorDir . '/symfony/http-client/Response/CurlResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\HttplugPromise' => $vendorDir . '/symfony/http-client/Response/HttplugPromise.php', + 'Symfony\\Component\\HttpClient\\Response\\MockResponse' => $vendorDir . '/symfony/http-client/Response/MockResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\NativeResponse' => $vendorDir . '/symfony/http-client/Response/NativeResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\ResponseStream' => $vendorDir . '/symfony/http-client/Response/ResponseStream.php', + 'Symfony\\Component\\HttpClient\\Response\\StreamWrapper' => $vendorDir . '/symfony/http-client/Response/StreamWrapper.php', + 'Symfony\\Component\\HttpClient\\Response\\StreamableInterface' => $vendorDir . '/symfony/http-client/Response/StreamableInterface.php', + 'Symfony\\Component\\HttpClient\\Response\\TraceableResponse' => $vendorDir . '/symfony/http-client/Response/TraceableResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\TransportResponseTrait' => $vendorDir . '/symfony/http-client/Response/TransportResponseTrait.php', + 'Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy' => $vendorDir . '/symfony/http-client/Retry/GenericRetryStrategy.php', + 'Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface' => $vendorDir . '/symfony/http-client/Retry/RetryStrategyInterface.php', + 'Symfony\\Component\\HttpClient\\RetryableHttpClient' => $vendorDir . '/symfony/http-client/RetryableHttpClient.php', + 'Symfony\\Component\\HttpClient\\ScopingHttpClient' => $vendorDir . '/symfony/http-client/ScopingHttpClient.php', + 'Symfony\\Component\\HttpClient\\TraceableHttpClient' => $vendorDir . '/symfony/http-client/TraceableHttpClient.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => $vendorDir . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => $vendorDir . '/symfony/http-foundation/AcceptHeaderItem.php', 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => $vendorDir . '/symfony/http-foundation/BinaryFileResponse.php', @@ -844,6 +1292,81 @@ return array( 'Symfony\\Component\\HttpKernel\\RebootableInterface' => $vendorDir . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => $vendorDir . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => $vendorDir . '/symfony/options-resolver/Exception/AccessException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/options-resolver/Exception/ExceptionInterface.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/MissingOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => $vendorDir . '/symfony/options-resolver/Exception/NoConfigurationException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => $vendorDir . '/symfony/options-resolver/Exception/NoSuchOptionException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => $vendorDir . '/symfony/options-resolver/Exception/OptionDefinitionException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/UndefinedOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\OptionConfigurator' => $vendorDir . '/symfony/options-resolver/OptionConfigurator.php', + 'Symfony\\Component\\OptionsResolver\\Options' => $vendorDir . '/symfony/options-resolver/Options.php', + 'Symfony\\Component\\OptionsResolver\\OptionsResolver' => $vendorDir . '/symfony/options-resolver/OptionsResolver.php', + 'Symfony\\Component\\PasswordHasher\\Command\\UserPasswordHashCommand' => $vendorDir . '/symfony/password-hasher/Command/UserPasswordHashCommand.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/password-hasher/Exception/ExceptionInterface.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\InvalidPasswordException' => $vendorDir . '/symfony/password-hasher/Exception/InvalidPasswordException.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\LogicException' => $vendorDir . '/symfony/password-hasher/Exception/LogicException.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\CheckPasswordLengthTrait' => $vendorDir . '/symfony/password-hasher/Hasher/CheckPasswordLengthTrait.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\MessageDigestPasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/MessageDigestPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\MigratingPasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/MigratingPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\NativePasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/NativePasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherAwareInterface' => $vendorDir . '/symfony/password-hasher/Hasher/PasswordHasherAwareInterface.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactory' => $vendorDir . '/symfony/password-hasher/Hasher/PasswordHasherFactory.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactoryInterface' => $vendorDir . '/symfony/password-hasher/Hasher/PasswordHasherFactoryInterface.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\Pbkdf2PasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/Pbkdf2PasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PlaintextPasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/PlaintextPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\SodiumPasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/SodiumPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\UserPasswordHasher' => $vendorDir . '/symfony/password-hasher/Hasher/UserPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\UserPasswordHasherInterface' => $vendorDir . '/symfony/password-hasher/Hasher/UserPasswordHasherInterface.php', + 'Symfony\\Component\\PasswordHasher\\LegacyPasswordHasherInterface' => $vendorDir . '/symfony/password-hasher/LegacyPasswordHasherInterface.php', + 'Symfony\\Component\\PasswordHasher\\PasswordHasherInterface' => $vendorDir . '/symfony/password-hasher/PasswordHasherInterface.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\AccessException' => $vendorDir . '/symfony/property-access/Exception/AccessException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/property-access/Exception/ExceptionInterface.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/property-access/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\InvalidPropertyPathException' => $vendorDir . '/symfony/property-access/Exception/InvalidPropertyPathException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\NoSuchIndexException' => $vendorDir . '/symfony/property-access/Exception/NoSuchIndexException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\NoSuchPropertyException' => $vendorDir . '/symfony/property-access/Exception/NoSuchPropertyException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\OutOfBoundsException' => $vendorDir . '/symfony/property-access/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\RuntimeException' => $vendorDir . '/symfony/property-access/Exception/RuntimeException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\UnexpectedTypeException' => $vendorDir . '/symfony/property-access/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\UninitializedPropertyException' => $vendorDir . '/symfony/property-access/Exception/UninitializedPropertyException.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccess' => $vendorDir . '/symfony/property-access/PropertyAccess.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessor' => $vendorDir . '/symfony/property-access/PropertyAccessor.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessorBuilder' => $vendorDir . '/symfony/property-access/PropertyAccessorBuilder.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface' => $vendorDir . '/symfony/property-access/PropertyAccessorInterface.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPath' => $vendorDir . '/symfony/property-access/PropertyPath.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathBuilder' => $vendorDir . '/symfony/property-access/PropertyPathBuilder.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathInterface' => $vendorDir . '/symfony/property-access/PropertyPathInterface.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathIterator' => $vendorDir . '/symfony/property-access/PropertyPathIterator.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathIteratorInterface' => $vendorDir . '/symfony/property-access/PropertyPathIteratorInterface.php', + 'Symfony\\Component\\PropertyInfo\\DependencyInjection\\PropertyInfoConstructorPass' => $vendorDir . '/symfony/property-info/DependencyInjection/PropertyInfoConstructorPass.php', + 'Symfony\\Component\\PropertyInfo\\DependencyInjection\\PropertyInfoPass' => $vendorDir . '/symfony/property-info/DependencyInjection/PropertyInfoPass.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ConstructorArgumentTypeExtractorInterface' => $vendorDir . '/symfony/property-info/Extractor/ConstructorArgumentTypeExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ConstructorExtractor' => $vendorDir . '/symfony/property-info/Extractor/ConstructorExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor' => $vendorDir . '/symfony/property-info/Extractor/PhpDocExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\PhpStanExtractor' => $vendorDir . '/symfony/property-info/Extractor/PhpStanExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ReflectionExtractor' => $vendorDir . '/symfony/property-info/Extractor/ReflectionExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\SerializerExtractor' => $vendorDir . '/symfony/property-info/Extractor/SerializerExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PhpStan\\NameScope' => $vendorDir . '/symfony/property-info/PhpStan/NameScope.php', + 'Symfony\\Component\\PropertyInfo\\PhpStan\\NameScopeFactory' => $vendorDir . '/symfony/property-info/PhpStan/NameScopeFactory.php', + 'Symfony\\Component\\PropertyInfo\\PropertyAccessExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyAccessExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyDescriptionExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyDescriptionExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoCacheExtractor' => $vendorDir . '/symfony/property-info/PropertyInfoCacheExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor' => $vendorDir . '/symfony/property-info/PropertyInfoExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInitializableExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyInitializableExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyListExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyListExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyReadInfo' => $vendorDir . '/symfony/property-info/PropertyReadInfo.php', + 'Symfony\\Component\\PropertyInfo\\PropertyReadInfoExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyReadInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyTypeExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyWriteInfo' => $vendorDir . '/symfony/property-info/PropertyWriteInfo.php', + 'Symfony\\Component\\PropertyInfo\\PropertyWriteInfoExtractorInterface' => $vendorDir . '/symfony/property-info/PropertyWriteInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\Type' => $vendorDir . '/symfony/property-info/Type.php', + 'Symfony\\Component\\PropertyInfo\\Util\\PhpDocTypeHelper' => $vendorDir . '/symfony/property-info/Util/PhpDocTypeHelper.php', + 'Symfony\\Component\\PropertyInfo\\Util\\PhpStanTypeHelper' => $vendorDir . '/symfony/property-info/Util/PhpStanTypeHelper.php', 'Symfony\\Component\\Routing\\Alias' => $vendorDir . '/symfony/routing/Alias.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/CompiledRoute.php', @@ -923,6 +1446,281 @@ return array( 'Symfony\\Component\\Runtime\\Runner\\Symfony\\ResponseRunner' => $vendorDir . '/symfony/runtime/Runner/Symfony/ResponseRunner.php', 'Symfony\\Component\\Runtime\\RuntimeInterface' => $vendorDir . '/symfony/runtime/RuntimeInterface.php', 'Symfony\\Component\\Runtime\\SymfonyRuntime' => $vendorDir . '/symfony/runtime/SymfonyRuntime.php', + 'Symfony\\Component\\Security\\Core\\AuthenticationEvents' => $vendorDir . '/symfony/security-core/AuthenticationEvents.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationManagerInterface' => $vendorDir . '/symfony/security-core/Authentication/AuthenticationManagerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager' => $vendorDir . '/symfony/security-core/Authentication/AuthenticationProviderManager.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolver' => $vendorDir . '/symfony/security-core/Authentication/AuthenticationTrustResolver.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface' => $vendorDir . '/symfony/security-core/Authentication/AuthenticationTrustResolverInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AnonymousAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AuthenticationProviderInterface' => $vendorDir . '/symfony/security-core/Authentication/Provider/AuthenticationProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\LdapBindAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/LdapBindAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\PreAuthenticatedAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\RememberMeAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/RememberMeAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\UserAuthenticationProvider' => $vendorDir . '/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\CacheTokenVerifier' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/CacheTokenVerifier.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\InMemoryTokenProvider' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/InMemoryTokenProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentToken' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/PersistentToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentTokenInterface' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/PersistentTokenInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\TokenProviderInterface' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/TokenProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\TokenVerifierInterface' => $vendorDir . '/symfony/security-core/Authentication/RememberMe/TokenVerifierInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AbstractToken' => $vendorDir . '/symfony/security-core/Authentication/Token/AbstractToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken' => $vendorDir . '/symfony/security-core/Authentication/Token/AnonymousToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken' => $vendorDir . '/symfony/security-core/Authentication/Token/NullToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\PreAuthenticatedToken' => $vendorDir . '/symfony/security-core/Authentication/Token/PreAuthenticatedToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\RememberMeToken' => $vendorDir . '/symfony/security-core/Authentication/Token/RememberMeToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorage' => $vendorDir . '/symfony/security-core/Authentication/Token/Storage/TokenStorage.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface' => $vendorDir . '/symfony/security-core/Authentication/Token/Storage/TokenStorageInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\UsageTrackingTokenStorage' => $vendorDir . '/symfony/security-core/Authentication/Token/Storage/UsageTrackingTokenStorage.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\SwitchUserToken' => $vendorDir . '/symfony/security-core/Authentication/Token/SwitchUserToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface' => $vendorDir . '/symfony/security-core/Authentication/Token/TokenInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken' => $vendorDir . '/symfony/security-core/Authentication/Token/UsernamePasswordToken.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManager' => $vendorDir . '/symfony/security-core/Authorization/AccessDecisionManager.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface' => $vendorDir . '/symfony/security-core/Authorization/AccessDecisionManagerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationChecker' => $vendorDir . '/symfony/security-core/Authorization/AuthorizationChecker.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface' => $vendorDir . '/symfony/security-core/Authorization/AuthorizationCheckerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguage' => $vendorDir . '/symfony/security-core/Authorization/ExpressionLanguage.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguageProvider' => $vendorDir . '/symfony/security-core/Authorization/ExpressionLanguageProvider.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\AccessDecisionStrategyInterface' => $vendorDir . '/symfony/security-core/Authorization/Strategy/AccessDecisionStrategyInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\AffirmativeStrategy' => $vendorDir . '/symfony/security-core/Authorization/Strategy/AffirmativeStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\ConsensusStrategy' => $vendorDir . '/symfony/security-core/Authorization/Strategy/ConsensusStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\PriorityStrategy' => $vendorDir . '/symfony/security-core/Authorization/Strategy/PriorityStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\UnanimousStrategy' => $vendorDir . '/symfony/security-core/Authorization/Strategy/UnanimousStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\TraceableAccessDecisionManager' => $vendorDir . '/symfony/security-core/Authorization/TraceableAccessDecisionManager.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter' => $vendorDir . '/symfony/security-core/Authorization/Voter/AuthenticatedVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\CacheableVoterInterface' => $vendorDir . '/symfony/security-core/Authorization/Voter/CacheableVoterInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\ExpressionVoter' => $vendorDir . '/symfony/security-core/Authorization/Voter/ExpressionVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleHierarchyVoter' => $vendorDir . '/symfony/security-core/Authorization/Voter/RoleHierarchyVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleVoter' => $vendorDir . '/symfony/security-core/Authorization/Voter/RoleVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\TraceableVoter' => $vendorDir . '/symfony/security-core/Authorization/Voter/TraceableVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\Voter' => $vendorDir . '/symfony/security-core/Authorization/Voter/Voter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface' => $vendorDir . '/symfony/security-core/Authorization/Voter/VoterInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\BasePasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/BasePasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderAwareInterface' => $vendorDir . '/symfony/security-core/Encoder/EncoderAwareInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactory' => $vendorDir . '/symfony/security-core/Encoder/EncoderFactory.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface' => $vendorDir . '/symfony/security-core/Encoder/EncoderFactoryInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\LegacyEncoderTrait' => $vendorDir . '/symfony/security-core/Encoder/LegacyEncoderTrait.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\LegacyPasswordHasherEncoder' => $vendorDir . '/symfony/security-core/Encoder/LegacyPasswordHasherEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/MessageDigestPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\MigratingPasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/MigratingPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\NativePasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/NativePasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface' => $vendorDir . '/symfony/security-core/Encoder/PasswordEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordHasherAdapter' => $vendorDir . '/symfony/security-core/Encoder/PasswordHasherAdapter.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordHasherEncoder' => $vendorDir . '/symfony/security-core/Encoder/PasswordHasherEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\Pbkdf2PasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/Pbkdf2PasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PlaintextPasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/PlaintextPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\SelfSaltingEncoderInterface' => $vendorDir . '/symfony/security-core/Encoder/SelfSaltingEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\SodiumPasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/SodiumPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoder' => $vendorDir . '/symfony/security-core/Encoder/UserPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface' => $vendorDir . '/symfony/security-core/Encoder/UserPasswordEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationEvent' => $vendorDir . '/symfony/security-core/Event/AuthenticationEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent' => $vendorDir . '/symfony/security-core/Event/AuthenticationFailureEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationSuccessEvent' => $vendorDir . '/symfony/security-core/Event/AuthenticationSuccessEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\VoteEvent' => $vendorDir . '/symfony/security-core/Event/VoteEvent.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/security-core/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccountExpiredException' => $vendorDir . '/symfony/security-core/Exception/AccountExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException' => $vendorDir . '/symfony/security-core/Exception/AccountStatusException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException' => $vendorDir . '/symfony/security-core/Exception/AuthenticationCredentialsNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationException' => $vendorDir . '/symfony/security-core/Exception/AuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExpiredException' => $vendorDir . '/symfony/security-core/Exception/AuthenticationExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException' => $vendorDir . '/symfony/security-core/Exception/AuthenticationServiceException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException' => $vendorDir . '/symfony/security-core/Exception/BadCredentialsException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CookieTheftException' => $vendorDir . '/symfony/security-core/Exception/CookieTheftException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CredentialsExpiredException' => $vendorDir . '/symfony/security-core/Exception/CredentialsExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CustomUserMessageAccountStatusException' => $vendorDir . '/symfony/security-core/Exception/CustomUserMessageAccountStatusException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CustomUserMessageAuthenticationException' => $vendorDir . '/symfony/security-core/Exception/CustomUserMessageAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\DisabledException' => $vendorDir . '/symfony/security-core/Exception/DisabledException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/security-core/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InsufficientAuthenticationException' => $vendorDir . '/symfony/security-core/Exception/InsufficientAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/security-core/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException' => $vendorDir . '/symfony/security-core/Exception/InvalidCsrfTokenException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LazyResponseException' => $vendorDir . '/symfony/security-core/Exception/LazyResponseException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LockedException' => $vendorDir . '/symfony/security-core/Exception/LockedException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LogicException' => $vendorDir . '/symfony/security-core/Exception/LogicException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LogoutException' => $vendorDir . '/symfony/security-core/Exception/LogoutException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\ProviderNotFoundException' => $vendorDir . '/symfony/security-core/Exception/ProviderNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\RuntimeException' => $vendorDir . '/symfony/security-core/Exception/RuntimeException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\SessionUnavailableException' => $vendorDir . '/symfony/security-core/Exception/SessionUnavailableException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\TokenNotFoundException' => $vendorDir . '/symfony/security-core/Exception/TokenNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\TooManyLoginAttemptsAuthenticationException' => $vendorDir . '/symfony/security-core/Exception/TooManyLoginAttemptsAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UnsupportedUserException' => $vendorDir . '/symfony/security-core/Exception/UnsupportedUserException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UserNotFoundException' => $vendorDir . '/symfony/security-core/Exception/UserNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException' => $vendorDir . '/symfony/security-core/Exception/UsernameNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Role\\Role' => $vendorDir . '/symfony/security-core/Role/Role.php', + 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchy' => $vendorDir . '/symfony/security-core/Role/RoleHierarchy.php', + 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface' => $vendorDir . '/symfony/security-core/Role/RoleHierarchyInterface.php', + 'Symfony\\Component\\Security\\Core\\Role\\SwitchUserRole' => $vendorDir . '/symfony/security-core/Role/SwitchUserRole.php', + 'Symfony\\Component\\Security\\Core\\Security' => $vendorDir . '/symfony/security-core/Security.php', + 'Symfony\\Component\\Security\\Core\\Signature\\Exception\\ExpiredSignatureException' => $vendorDir . '/symfony/security-core/Signature/Exception/ExpiredSignatureException.php', + 'Symfony\\Component\\Security\\Core\\Signature\\Exception\\InvalidSignatureException' => $vendorDir . '/symfony/security-core/Signature/Exception/InvalidSignatureException.php', + 'Symfony\\Component\\Security\\Core\\Signature\\ExpiredSignatureStorage' => $vendorDir . '/symfony/security-core/Signature/ExpiredSignatureStorage.php', + 'Symfony\\Component\\Security\\Core\\Signature\\SignatureHasher' => $vendorDir . '/symfony/security-core/Signature/SignatureHasher.php', + 'Symfony\\Component\\Security\\Core\\Test\\AccessDecisionStrategyTestCase' => $vendorDir . '/symfony/security-core/Test/AccessDecisionStrategyTestCase.php', + 'Symfony\\Component\\Security\\Core\\User\\ChainUserProvider' => $vendorDir . '/symfony/security-core/User/ChainUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\EquatableInterface' => $vendorDir . '/symfony/security-core/User/EquatableInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUser' => $vendorDir . '/symfony/security-core/User/InMemoryUser.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUserChecker' => $vendorDir . '/symfony/security-core/User/InMemoryUserChecker.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUserProvider' => $vendorDir . '/symfony/security-core/User/InMemoryUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\LegacyPasswordAuthenticatedUserInterface' => $vendorDir . '/symfony/security-core/User/LegacyPasswordAuthenticatedUserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\MissingUserProvider' => $vendorDir . '/symfony/security-core/User/MissingUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\PasswordAuthenticatedUserInterface' => $vendorDir . '/symfony/security-core/User/PasswordAuthenticatedUserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\PasswordUpgraderInterface' => $vendorDir . '/symfony/security-core/User/PasswordUpgraderInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\User' => $vendorDir . '/symfony/security-core/User/User.php', + 'Symfony\\Component\\Security\\Core\\User\\UserChecker' => $vendorDir . '/symfony/security-core/User/UserChecker.php', + 'Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface' => $vendorDir . '/symfony/security-core/User/UserCheckerInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\UserInterface' => $vendorDir . '/symfony/security-core/User/UserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\UserProviderInterface' => $vendorDir . '/symfony/security-core/User/UserProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword' => $vendorDir . '/symfony/security-core/Validator/Constraints/UserPassword.php', + 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator' => $vendorDir . '/symfony/security-core/Validator/Constraints/UserPasswordValidator.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfToken' => $vendorDir . '/symfony/security-csrf/CsrfToken.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManager' => $vendorDir . '/symfony/security-csrf/CsrfTokenManager.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface' => $vendorDir . '/symfony/security-csrf/CsrfTokenManagerInterface.php', + 'Symfony\\Component\\Security\\Csrf\\Exception\\TokenNotFoundException' => $vendorDir . '/symfony/security-csrf/Exception/TokenNotFoundException.php', + 'Symfony\\Component\\Security\\Csrf\\TokenGenerator\\TokenGeneratorInterface' => $vendorDir . '/symfony/security-csrf/TokenGenerator/TokenGeneratorInterface.php', + 'Symfony\\Component\\Security\\Csrf\\TokenGenerator\\UriSafeTokenGenerator' => $vendorDir . '/symfony/security-csrf/TokenGenerator/UriSafeTokenGenerator.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\ClearableTokenStorageInterface' => $vendorDir . '/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\NativeSessionTokenStorage' => $vendorDir . '/symfony/security-csrf/TokenStorage/NativeSessionTokenStorage.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\SessionTokenStorage' => $vendorDir . '/symfony/security-csrf/TokenStorage/SessionTokenStorage.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\TokenStorageInterface' => $vendorDir . '/symfony/security-csrf/TokenStorage/TokenStorageInterface.php', + 'Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator' => $vendorDir . '/symfony/security-guard/AbstractGuardAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\AuthenticatorInterface' => $vendorDir . '/symfony/security-guard/AuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Guard\\Authenticator\\AbstractFormLoginAuthenticator' => $vendorDir . '/symfony/security-guard/Authenticator/AbstractFormLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\Authenticator\\GuardBridgeAuthenticator' => $vendorDir . '/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\Firewall\\GuardAuthenticationListener' => $vendorDir . '/symfony/security-guard/Firewall/GuardAuthenticationListener.php', + 'Symfony\\Component\\Security\\Guard\\GuardAuthenticatorHandler' => $vendorDir . '/symfony/security-guard/GuardAuthenticatorHandler.php', + 'Symfony\\Component\\Security\\Guard\\PasswordAuthenticatedInterface' => $vendorDir . '/symfony/security-guard/PasswordAuthenticatedInterface.php', + 'Symfony\\Component\\Security\\Guard\\Provider\\GuardAuthenticationProvider' => $vendorDir . '/symfony/security-guard/Provider/GuardAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Guard\\Token\\GuardTokenInterface' => $vendorDir . '/symfony/security-guard/Token/GuardTokenInterface.php', + 'Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken' => $vendorDir . '/symfony/security-guard/Token/PostAuthenticationGuardToken.php', + 'Symfony\\Component\\Security\\Guard\\Token\\PreAuthenticationGuardToken' => $vendorDir . '/symfony/security-guard/Token/PreAuthenticationGuardToken.php', + 'Symfony\\Component\\Security\\Http\\AccessMap' => $vendorDir . '/symfony/security-http/AccessMap.php', + 'Symfony\\Component\\Security\\Http\\AccessMapInterface' => $vendorDir . '/symfony/security-http/AccessMapInterface.php', + 'Symfony\\Component\\Security\\Http\\Attribute\\CurrentUser' => $vendorDir . '/symfony/security-http/Attribute/CurrentUser.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationFailureHandlerInterface' => $vendorDir . '/symfony/security-http/Authentication/AuthenticationFailureHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationSuccessHandlerInterface' => $vendorDir . '/symfony/security-http/Authentication/AuthenticationSuccessHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationUtils' => $vendorDir . '/symfony/security-http/Authentication/AuthenticationUtils.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticatorManager' => $vendorDir . '/symfony/security-http/Authentication/AuthenticatorManager.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticatorManagerInterface' => $vendorDir . '/symfony/security-http/Authentication/AuthenticatorManagerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\CustomAuthenticationFailureHandler' => $vendorDir . '/symfony/security-http/Authentication/CustomAuthenticationFailureHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\CustomAuthenticationSuccessHandler' => $vendorDir . '/symfony/security-http/Authentication/CustomAuthenticationSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\DefaultAuthenticationFailureHandler' => $vendorDir . '/symfony/security-http/Authentication/DefaultAuthenticationFailureHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\DefaultAuthenticationSuccessHandler' => $vendorDir . '/symfony/security-http/Authentication/DefaultAuthenticationSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\NoopAuthenticationManager' => $vendorDir . '/symfony/security-http/Authentication/NoopAuthenticationManager.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\UserAuthenticatorInterface' => $vendorDir . '/symfony/security-http/Authentication/UserAuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/AbstractAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractLoginFormAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/AbstractLoginFormAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractPreAuthenticatedAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/AbstractPreAuthenticatedAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AuthenticatorInterface' => $vendorDir . '/symfony/security-http/Authenticator/AuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticatorManagerListener' => $vendorDir . '/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/FormLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\HttpBasicAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/HttpBasicAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\InteractiveAuthenticatorInterface' => $vendorDir . '/symfony/security-http/Authenticator/InteractiveAuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\JsonLoginAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/JsonLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\LoginLinkAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/LoginLinkAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\BadgeInterface' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/BadgeInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\CsrfTokenBadge' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/CsrfTokenBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\PasswordUpgradeBadge' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\PreAuthenticatedUserBadge' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/PreAuthenticatedUserBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\RememberMeBadge' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/RememberMeBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\UserBadge' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\CredentialsInterface' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Credentials/CredentialsInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\CustomCredentials' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Credentials/CustomCredentials.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\PasswordCredentials' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Passport' => $vendorDir . '/symfony/security-http/Authenticator/Passport/Passport.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\PassportInterface' => $vendorDir . '/symfony/security-http/Authenticator/Passport/PassportInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\PassportTrait' => $vendorDir . '/symfony/security-http/Authenticator/Passport/PassportTrait.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\SelfValidatingPassport' => $vendorDir . '/symfony/security-http/Authenticator/Passport/SelfValidatingPassport.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\UserPassportInterface' => $vendorDir . '/symfony/security-http/Authenticator/Passport/UserPassportInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\RememberMeAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/RememberMeAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\RemoteUserAuthenticator' => $vendorDir . '/symfony/security-http/Authenticator/RemoteUserAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Token\\PostAuthenticationToken' => $vendorDir . '/symfony/security-http/Authenticator/Token/PostAuthenticationToken.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\X509Authenticator' => $vendorDir . '/symfony/security-http/Authenticator/X509Authenticator.php', + 'Symfony\\Component\\Security\\Http\\Authorization\\AccessDeniedHandlerInterface' => $vendorDir . '/symfony/security-http/Authorization/AccessDeniedHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Controller\\UserValueResolver' => $vendorDir . '/symfony/security-http/Controller/UserValueResolver.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\AuthenticationEntryPointInterface' => $vendorDir . '/symfony/security-http/EntryPoint/AuthenticationEntryPointInterface.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\BasicAuthenticationEntryPoint' => $vendorDir . '/symfony/security-http/EntryPoint/BasicAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\Exception\\NotAnEntryPointException' => $vendorDir . '/symfony/security-http/EntryPoint/Exception/NotAnEntryPointException.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\FormAuthenticationEntryPoint' => $vendorDir . '/symfony/security-http/EntryPoint/FormAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\RetryAuthenticationEntryPoint' => $vendorDir . '/symfony/security-http/EntryPoint/RetryAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CheckCredentialsListener' => $vendorDir . '/symfony/security-http/EventListener/CheckCredentialsListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CheckRememberMeConditionsListener' => $vendorDir . '/symfony/security-http/EventListener/CheckRememberMeConditionsListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CookieClearingLogoutListener' => $vendorDir . '/symfony/security-http/EventListener/CookieClearingLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CsrfProtectionListener' => $vendorDir . '/symfony/security-http/EventListener/CsrfProtectionListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CsrfTokenClearingLogoutListener' => $vendorDir . '/symfony/security-http/EventListener/CsrfTokenClearingLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\DefaultLogoutListener' => $vendorDir . '/symfony/security-http/EventListener/DefaultLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\LoginThrottlingListener' => $vendorDir . '/symfony/security-http/EventListener/LoginThrottlingListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\PasswordMigratingListener' => $vendorDir . '/symfony/security-http/EventListener/PasswordMigratingListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\RememberMeListener' => $vendorDir . '/symfony/security-http/EventListener/RememberMeListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\RememberMeLogoutListener' => $vendorDir . '/symfony/security-http/EventListener/RememberMeLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\SessionLogoutListener' => $vendorDir . '/symfony/security-http/EventListener/SessionLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\SessionStrategyListener' => $vendorDir . '/symfony/security-http/EventListener/SessionStrategyListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\UserCheckerListener' => $vendorDir . '/symfony/security-http/EventListener/UserCheckerListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\UserProviderListener' => $vendorDir . '/symfony/security-http/EventListener/UserProviderListener.php', + 'Symfony\\Component\\Security\\Http\\Event\\AuthenticationTokenCreatedEvent' => $vendorDir . '/symfony/security-http/Event/AuthenticationTokenCreatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\CheckPassportEvent' => $vendorDir . '/symfony/security-http/Event/CheckPassportEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\DeauthenticatedEvent' => $vendorDir . '/symfony/security-http/Event/DeauthenticatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent' => $vendorDir . '/symfony/security-http/Event/InteractiveLoginEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LazyResponseEvent' => $vendorDir . '/symfony/security-http/Event/LazyResponseEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LoginFailureEvent' => $vendorDir . '/symfony/security-http/Event/LoginFailureEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LoginSuccessEvent' => $vendorDir . '/symfony/security-http/Event/LoginSuccessEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LogoutEvent' => $vendorDir . '/symfony/security-http/Event/LogoutEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent' => $vendorDir . '/symfony/security-http/Event/SwitchUserEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\TokenDeauthenticatedEvent' => $vendorDir . '/symfony/security-http/Event/TokenDeauthenticatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Firewall' => $vendorDir . '/symfony/security-http/Firewall.php', + 'Symfony\\Component\\Security\\Http\\FirewallMap' => $vendorDir . '/symfony/security-http/FirewallMap.php', + 'Symfony\\Component\\Security\\Http\\FirewallMapInterface' => $vendorDir . '/symfony/security-http/FirewallMapInterface.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/AbstractAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractListener' => $vendorDir . '/symfony/security-http/Firewall/AbstractListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractPreAuthenticatedListener' => $vendorDir . '/symfony/security-http/Firewall/AbstractPreAuthenticatedListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AccessListener' => $vendorDir . '/symfony/security-http/Firewall/AccessListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AnonymousAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/AnonymousAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AuthenticatorManagerListener' => $vendorDir . '/symfony/security-http/Firewall/AuthenticatorManagerListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\BasicAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/BasicAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ChannelListener' => $vendorDir . '/symfony/security-http/Firewall/ChannelListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ContextListener' => $vendorDir . '/symfony/security-http/Firewall/ContextListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener' => $vendorDir . '/symfony/security-http/Firewall/ExceptionListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\FirewallListenerInterface' => $vendorDir . '/symfony/security-http/Firewall/FirewallListenerInterface.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\LogoutListener' => $vendorDir . '/symfony/security-http/Firewall/LogoutListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\RememberMeListener' => $vendorDir . '/symfony/security-http/Firewall/RememberMeListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\RemoteUserAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/RemoteUserAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\SwitchUserListener' => $vendorDir . '/symfony/security-http/Firewall/SwitchUserListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/UsernamePasswordFormAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordJsonAuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\X509AuthenticationListener' => $vendorDir . '/symfony/security-http/Firewall/X509AuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\HttpUtils' => $vendorDir . '/symfony/security-http/HttpUtils.php', + 'Symfony\\Component\\Security\\Http\\Impersonate\\ImpersonateUrlGenerator' => $vendorDir . '/symfony/security-http/Impersonate/ImpersonateUrlGenerator.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\ExpiredLoginLinkException' => $vendorDir . '/symfony/security-http/LoginLink/Exception/ExpiredLoginLinkException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkAuthenticationException' => $vendorDir . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkAuthenticationException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkException' => $vendorDir . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkExceptionInterface' => $vendorDir . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkExceptionInterface.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkDetails' => $vendorDir . '/symfony/security-http/LoginLink/LoginLinkDetails.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkHandler' => $vendorDir . '/symfony/security-http/LoginLink/LoginLinkHandler.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkHandlerInterface' => $vendorDir . '/symfony/security-http/LoginLink/LoginLinkHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkNotification' => $vendorDir . '/symfony/security-http/LoginLink/LoginLinkNotification.php', + 'Symfony\\Component\\Security\\Http\\Logout\\CookieClearingLogoutHandler' => $vendorDir . '/symfony/security-http/Logout/CookieClearingLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\CsrfTokenClearingLogoutHandler' => $vendorDir . '/symfony/security-http/Logout/CsrfTokenClearingLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\DefaultLogoutSuccessHandler' => $vendorDir . '/symfony/security-http/Logout/DefaultLogoutSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutHandlerInterface' => $vendorDir . '/symfony/security-http/Logout/LogoutHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutSuccessHandlerInterface' => $vendorDir . '/symfony/security-http/Logout/LogoutSuccessHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutUrlGenerator' => $vendorDir . '/symfony/security-http/Logout/LogoutUrlGenerator.php', + 'Symfony\\Component\\Security\\Http\\Logout\\SessionLogoutHandler' => $vendorDir . '/symfony/security-http/Logout/SessionLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\ParameterBagUtils' => $vendorDir . '/symfony/security-http/ParameterBagUtils.php', + 'Symfony\\Component\\Security\\Http\\RateLimiter\\DefaultLoginRateLimiter' => $vendorDir . '/symfony/security-http/RateLimiter/DefaultLoginRateLimiter.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\AbstractRememberMeHandler' => $vendorDir . '/symfony/security-http/RememberMe/AbstractRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\AbstractRememberMeServices' => $vendorDir . '/symfony/security-http/RememberMe/AbstractRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\PersistentRememberMeHandler' => $vendorDir . '/symfony/security-http/RememberMe/PersistentRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\PersistentTokenBasedRememberMeServices' => $vendorDir . '/symfony/security-http/RememberMe/PersistentTokenBasedRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeDetails' => $vendorDir . '/symfony/security-http/RememberMe/RememberMeDetails.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeHandlerInterface' => $vendorDir . '/symfony/security-http/RememberMe/RememberMeHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeServicesInterface' => $vendorDir . '/symfony/security-http/RememberMe/RememberMeServicesInterface.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\ResponseListener' => $vendorDir . '/symfony/security-http/RememberMe/ResponseListener.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\SignatureRememberMeHandler' => $vendorDir . '/symfony/security-http/RememberMe/SignatureRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\TokenBasedRememberMeServices' => $vendorDir . '/symfony/security-http/RememberMe/TokenBasedRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\SecurityEvents' => $vendorDir . '/symfony/security-http/SecurityEvents.php', + 'Symfony\\Component\\Security\\Http\\Session\\SessionAuthenticationStrategy' => $vendorDir . '/symfony/security-http/Session/SessionAuthenticationStrategy.php', + 'Symfony\\Component\\Security\\Http\\Session\\SessionAuthenticationStrategyInterface' => $vendorDir . '/symfony/security-http/Session/SessionAuthenticationStrategyInterface.php', + 'Symfony\\Component\\Security\\Http\\Util\\TargetPathTrait' => $vendorDir . '/symfony/security-http/Util/TargetPathTrait.php', 'Symfony\\Component\\String\\AbstractString' => $vendorDir . '/symfony/string/AbstractString.php', 'Symfony\\Component\\String\\AbstractUnicodeString' => $vendorDir . '/symfony/string/AbstractUnicodeString.php', 'Symfony\\Component\\String\\ByteString' => $vendorDir . '/symfony/string/ByteString.php', @@ -937,6 +1735,217 @@ return array( 'Symfony\\Component\\String\\Slugger\\AsciiSlugger' => $vendorDir . '/symfony/string/Slugger/AsciiSlugger.php', 'Symfony\\Component\\String\\Slugger\\SluggerInterface' => $vendorDir . '/symfony/string/Slugger/SluggerInterface.php', 'Symfony\\Component\\String\\UnicodeString' => $vendorDir . '/symfony/string/UnicodeString.php', + 'Symfony\\Component\\Validator\\Command\\DebugCommand' => $vendorDir . '/symfony/validator/Command/DebugCommand.php', + 'Symfony\\Component\\Validator\\Constraint' => $vendorDir . '/symfony/validator/Constraint.php', + 'Symfony\\Component\\Validator\\ConstraintValidator' => $vendorDir . '/symfony/validator/ConstraintValidator.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorFactory' => $vendorDir . '/symfony/validator/ConstraintValidatorFactory.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorFactoryInterface' => $vendorDir . '/symfony/validator/ConstraintValidatorFactoryInterface.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorInterface' => $vendorDir . '/symfony/validator/ConstraintValidatorInterface.php', + 'Symfony\\Component\\Validator\\ConstraintViolation' => $vendorDir . '/symfony/validator/ConstraintViolation.php', + 'Symfony\\Component\\Validator\\ConstraintViolationInterface' => $vendorDir . '/symfony/validator/ConstraintViolationInterface.php', + 'Symfony\\Component\\Validator\\ConstraintViolationList' => $vendorDir . '/symfony/validator/ConstraintViolationList.php', + 'Symfony\\Component\\Validator\\ConstraintViolationListInterface' => $vendorDir . '/symfony/validator/ConstraintViolationListInterface.php', + 'Symfony\\Component\\Validator\\Constraints\\AbstractComparison' => $vendorDir . '/symfony/validator/Constraints/AbstractComparison.php', + 'Symfony\\Component\\Validator\\Constraints\\AbstractComparisonValidator' => $vendorDir . '/symfony/validator/Constraints/AbstractComparisonValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\All' => $vendorDir . '/symfony/validator/Constraints/All.php', + 'Symfony\\Component\\Validator\\Constraints\\AllValidator' => $vendorDir . '/symfony/validator/Constraints/AllValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\AtLeastOneOf' => $vendorDir . '/symfony/validator/Constraints/AtLeastOneOf.php', + 'Symfony\\Component\\Validator\\Constraints\\AtLeastOneOfValidator' => $vendorDir . '/symfony/validator/Constraints/AtLeastOneOfValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Bic' => $vendorDir . '/symfony/validator/Constraints/Bic.php', + 'Symfony\\Component\\Validator\\Constraints\\BicValidator' => $vendorDir . '/symfony/validator/Constraints/BicValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Blank' => $vendorDir . '/symfony/validator/Constraints/Blank.php', + 'Symfony\\Component\\Validator\\Constraints\\BlankValidator' => $vendorDir . '/symfony/validator/Constraints/BlankValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Callback' => $vendorDir . '/symfony/validator/Constraints/Callback.php', + 'Symfony\\Component\\Validator\\Constraints\\CallbackValidator' => $vendorDir . '/symfony/validator/Constraints/CallbackValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\CardScheme' => $vendorDir . '/symfony/validator/Constraints/CardScheme.php', + 'Symfony\\Component\\Validator\\Constraints\\CardSchemeValidator' => $vendorDir . '/symfony/validator/Constraints/CardSchemeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Cascade' => $vendorDir . '/symfony/validator/Constraints/Cascade.php', + 'Symfony\\Component\\Validator\\Constraints\\Choice' => $vendorDir . '/symfony/validator/Constraints/Choice.php', + 'Symfony\\Component\\Validator\\Constraints\\ChoiceValidator' => $vendorDir . '/symfony/validator/Constraints/ChoiceValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Cidr' => $vendorDir . '/symfony/validator/Constraints/Cidr.php', + 'Symfony\\Component\\Validator\\Constraints\\CidrValidator' => $vendorDir . '/symfony/validator/Constraints/CidrValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Collection' => $vendorDir . '/symfony/validator/Constraints/Collection.php', + 'Symfony\\Component\\Validator\\Constraints\\CollectionValidator' => $vendorDir . '/symfony/validator/Constraints/CollectionValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Composite' => $vendorDir . '/symfony/validator/Constraints/Composite.php', + 'Symfony\\Component\\Validator\\Constraints\\Compound' => $vendorDir . '/symfony/validator/Constraints/Compound.php', + 'Symfony\\Component\\Validator\\Constraints\\CompoundValidator' => $vendorDir . '/symfony/validator/Constraints/CompoundValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Count' => $vendorDir . '/symfony/validator/Constraints/Count.php', + 'Symfony\\Component\\Validator\\Constraints\\CountValidator' => $vendorDir . '/symfony/validator/Constraints/CountValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Country' => $vendorDir . '/symfony/validator/Constraints/Country.php', + 'Symfony\\Component\\Validator\\Constraints\\CountryValidator' => $vendorDir . '/symfony/validator/Constraints/CountryValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\CssColor' => $vendorDir . '/symfony/validator/Constraints/CssColor.php', + 'Symfony\\Component\\Validator\\Constraints\\CssColorValidator' => $vendorDir . '/symfony/validator/Constraints/CssColorValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Currency' => $vendorDir . '/symfony/validator/Constraints/Currency.php', + 'Symfony\\Component\\Validator\\Constraints\\CurrencyValidator' => $vendorDir . '/symfony/validator/Constraints/CurrencyValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Date' => $vendorDir . '/symfony/validator/Constraints/Date.php', + 'Symfony\\Component\\Validator\\Constraints\\DateTime' => $vendorDir . '/symfony/validator/Constraints/DateTime.php', + 'Symfony\\Component\\Validator\\Constraints\\DateTimeValidator' => $vendorDir . '/symfony/validator/Constraints/DateTimeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\DateValidator' => $vendorDir . '/symfony/validator/Constraints/DateValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\DisableAutoMapping' => $vendorDir . '/symfony/validator/Constraints/DisableAutoMapping.php', + 'Symfony\\Component\\Validator\\Constraints\\DivisibleBy' => $vendorDir . '/symfony/validator/Constraints/DivisibleBy.php', + 'Symfony\\Component\\Validator\\Constraints\\DivisibleByValidator' => $vendorDir . '/symfony/validator/Constraints/DivisibleByValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Email' => $vendorDir . '/symfony/validator/Constraints/Email.php', + 'Symfony\\Component\\Validator\\Constraints\\EmailValidator' => $vendorDir . '/symfony/validator/Constraints/EmailValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\EnableAutoMapping' => $vendorDir . '/symfony/validator/Constraints/EnableAutoMapping.php', + 'Symfony\\Component\\Validator\\Constraints\\EqualTo' => $vendorDir . '/symfony/validator/Constraints/EqualTo.php', + 'Symfony\\Component\\Validator\\Constraints\\EqualToValidator' => $vendorDir . '/symfony/validator/Constraints/EqualToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Existence' => $vendorDir . '/symfony/validator/Constraints/Existence.php', + 'Symfony\\Component\\Validator\\Constraints\\Expression' => $vendorDir . '/symfony/validator/Constraints/Expression.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntax' => $vendorDir . '/symfony/validator/Constraints/ExpressionLanguageSyntax.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntaxValidator' => $vendorDir . '/symfony/validator/Constraints/ExpressionLanguageSyntaxValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionValidator' => $vendorDir . '/symfony/validator/Constraints/ExpressionValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\File' => $vendorDir . '/symfony/validator/Constraints/File.php', + 'Symfony\\Component\\Validator\\Constraints\\FileValidator' => $vendorDir . '/symfony/validator/Constraints/FileValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThan' => $vendorDir . '/symfony/validator/Constraints/GreaterThan.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqual' => $vendorDir . '/symfony/validator/Constraints/GreaterThanOrEqual.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqualValidator' => $vendorDir . '/symfony/validator/Constraints/GreaterThanOrEqualValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanValidator' => $vendorDir . '/symfony/validator/Constraints/GreaterThanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GroupSequence' => $vendorDir . '/symfony/validator/Constraints/GroupSequence.php', + 'Symfony\\Component\\Validator\\Constraints\\GroupSequenceProvider' => $vendorDir . '/symfony/validator/Constraints/GroupSequenceProvider.php', + 'Symfony\\Component\\Validator\\Constraints\\Hostname' => $vendorDir . '/symfony/validator/Constraints/Hostname.php', + 'Symfony\\Component\\Validator\\Constraints\\HostnameValidator' => $vendorDir . '/symfony/validator/Constraints/HostnameValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Iban' => $vendorDir . '/symfony/validator/Constraints/Iban.php', + 'Symfony\\Component\\Validator\\Constraints\\IbanValidator' => $vendorDir . '/symfony/validator/Constraints/IbanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IdenticalTo' => $vendorDir . '/symfony/validator/Constraints/IdenticalTo.php', + 'Symfony\\Component\\Validator\\Constraints\\IdenticalToValidator' => $vendorDir . '/symfony/validator/Constraints/IdenticalToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Image' => $vendorDir . '/symfony/validator/Constraints/Image.php', + 'Symfony\\Component\\Validator\\Constraints\\ImageValidator' => $vendorDir . '/symfony/validator/Constraints/ImageValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Ip' => $vendorDir . '/symfony/validator/Constraints/Ip.php', + 'Symfony\\Component\\Validator\\Constraints\\IpValidator' => $vendorDir . '/symfony/validator/Constraints/IpValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsFalse' => $vendorDir . '/symfony/validator/Constraints/IsFalse.php', + 'Symfony\\Component\\Validator\\Constraints\\IsFalseValidator' => $vendorDir . '/symfony/validator/Constraints/IsFalseValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsNull' => $vendorDir . '/symfony/validator/Constraints/IsNull.php', + 'Symfony\\Component\\Validator\\Constraints\\IsNullValidator' => $vendorDir . '/symfony/validator/Constraints/IsNullValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsTrue' => $vendorDir . '/symfony/validator/Constraints/IsTrue.php', + 'Symfony\\Component\\Validator\\Constraints\\IsTrueValidator' => $vendorDir . '/symfony/validator/Constraints/IsTrueValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Isbn' => $vendorDir . '/symfony/validator/Constraints/Isbn.php', + 'Symfony\\Component\\Validator\\Constraints\\IsbnValidator' => $vendorDir . '/symfony/validator/Constraints/IsbnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Isin' => $vendorDir . '/symfony/validator/Constraints/Isin.php', + 'Symfony\\Component\\Validator\\Constraints\\IsinValidator' => $vendorDir . '/symfony/validator/Constraints/IsinValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Issn' => $vendorDir . '/symfony/validator/Constraints/Issn.php', + 'Symfony\\Component\\Validator\\Constraints\\IssnValidator' => $vendorDir . '/symfony/validator/Constraints/IssnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Json' => $vendorDir . '/symfony/validator/Constraints/Json.php', + 'Symfony\\Component\\Validator\\Constraints\\JsonValidator' => $vendorDir . '/symfony/validator/Constraints/JsonValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Language' => $vendorDir . '/symfony/validator/Constraints/Language.php', + 'Symfony\\Component\\Validator\\Constraints\\LanguageValidator' => $vendorDir . '/symfony/validator/Constraints/LanguageValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Length' => $vendorDir . '/symfony/validator/Constraints/Length.php', + 'Symfony\\Component\\Validator\\Constraints\\LengthValidator' => $vendorDir . '/symfony/validator/Constraints/LengthValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThan' => $vendorDir . '/symfony/validator/Constraints/LessThan.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanOrEqual' => $vendorDir . '/symfony/validator/Constraints/LessThanOrEqual.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanOrEqualValidator' => $vendorDir . '/symfony/validator/Constraints/LessThanOrEqualValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanValidator' => $vendorDir . '/symfony/validator/Constraints/LessThanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Locale' => $vendorDir . '/symfony/validator/Constraints/Locale.php', + 'Symfony\\Component\\Validator\\Constraints\\LocaleValidator' => $vendorDir . '/symfony/validator/Constraints/LocaleValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Luhn' => $vendorDir . '/symfony/validator/Constraints/Luhn.php', + 'Symfony\\Component\\Validator\\Constraints\\LuhnValidator' => $vendorDir . '/symfony/validator/Constraints/LuhnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Negative' => $vendorDir . '/symfony/validator/Constraints/Negative.php', + 'Symfony\\Component\\Validator\\Constraints\\NegativeOrZero' => $vendorDir . '/symfony/validator/Constraints/NegativeOrZero.php', + 'Symfony\\Component\\Validator\\Constraints\\NotBlank' => $vendorDir . '/symfony/validator/Constraints/NotBlank.php', + 'Symfony\\Component\\Validator\\Constraints\\NotBlankValidator' => $vendorDir . '/symfony/validator/Constraints/NotBlankValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotCompromisedPassword' => $vendorDir . '/symfony/validator/Constraints/NotCompromisedPassword.php', + 'Symfony\\Component\\Validator\\Constraints\\NotCompromisedPasswordValidator' => $vendorDir . '/symfony/validator/Constraints/NotCompromisedPasswordValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotEqualTo' => $vendorDir . '/symfony/validator/Constraints/NotEqualTo.php', + 'Symfony\\Component\\Validator\\Constraints\\NotEqualToValidator' => $vendorDir . '/symfony/validator/Constraints/NotEqualToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotIdenticalTo' => $vendorDir . '/symfony/validator/Constraints/NotIdenticalTo.php', + 'Symfony\\Component\\Validator\\Constraints\\NotIdenticalToValidator' => $vendorDir . '/symfony/validator/Constraints/NotIdenticalToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotNull' => $vendorDir . '/symfony/validator/Constraints/NotNull.php', + 'Symfony\\Component\\Validator\\Constraints\\NotNullValidator' => $vendorDir . '/symfony/validator/Constraints/NotNullValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NumberConstraintTrait' => $vendorDir . '/symfony/validator/Constraints/NumberConstraintTrait.php', + 'Symfony\\Component\\Validator\\Constraints\\Optional' => $vendorDir . '/symfony/validator/Constraints/Optional.php', + 'Symfony\\Component\\Validator\\Constraints\\Positive' => $vendorDir . '/symfony/validator/Constraints/Positive.php', + 'Symfony\\Component\\Validator\\Constraints\\PositiveOrZero' => $vendorDir . '/symfony/validator/Constraints/PositiveOrZero.php', + 'Symfony\\Component\\Validator\\Constraints\\Range' => $vendorDir . '/symfony/validator/Constraints/Range.php', + 'Symfony\\Component\\Validator\\Constraints\\RangeValidator' => $vendorDir . '/symfony/validator/Constraints/RangeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Regex' => $vendorDir . '/symfony/validator/Constraints/Regex.php', + 'Symfony\\Component\\Validator\\Constraints\\RegexValidator' => $vendorDir . '/symfony/validator/Constraints/RegexValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Required' => $vendorDir . '/symfony/validator/Constraints/Required.php', + 'Symfony\\Component\\Validator\\Constraints\\Sequentially' => $vendorDir . '/symfony/validator/Constraints/Sequentially.php', + 'Symfony\\Component\\Validator\\Constraints\\SequentiallyValidator' => $vendorDir . '/symfony/validator/Constraints/SequentiallyValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Time' => $vendorDir . '/symfony/validator/Constraints/Time.php', + 'Symfony\\Component\\Validator\\Constraints\\TimeValidator' => $vendorDir . '/symfony/validator/Constraints/TimeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Timezone' => $vendorDir . '/symfony/validator/Constraints/Timezone.php', + 'Symfony\\Component\\Validator\\Constraints\\TimezoneValidator' => $vendorDir . '/symfony/validator/Constraints/TimezoneValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Traverse' => $vendorDir . '/symfony/validator/Constraints/Traverse.php', + 'Symfony\\Component\\Validator\\Constraints\\Type' => $vendorDir . '/symfony/validator/Constraints/Type.php', + 'Symfony\\Component\\Validator\\Constraints\\TypeValidator' => $vendorDir . '/symfony/validator/Constraints/TypeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Ulid' => $vendorDir . '/symfony/validator/Constraints/Ulid.php', + 'Symfony\\Component\\Validator\\Constraints\\UlidValidator' => $vendorDir . '/symfony/validator/Constraints/UlidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Unique' => $vendorDir . '/symfony/validator/Constraints/Unique.php', + 'Symfony\\Component\\Validator\\Constraints\\UniqueValidator' => $vendorDir . '/symfony/validator/Constraints/UniqueValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Url' => $vendorDir . '/symfony/validator/Constraints/Url.php', + 'Symfony\\Component\\Validator\\Constraints\\UrlValidator' => $vendorDir . '/symfony/validator/Constraints/UrlValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Uuid' => $vendorDir . '/symfony/validator/Constraints/Uuid.php', + 'Symfony\\Component\\Validator\\Constraints\\UuidValidator' => $vendorDir . '/symfony/validator/Constraints/UuidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Valid' => $vendorDir . '/symfony/validator/Constraints/Valid.php', + 'Symfony\\Component\\Validator\\Constraints\\ValidValidator' => $vendorDir . '/symfony/validator/Constraints/ValidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\ZeroComparisonConstraintTrait' => $vendorDir . '/symfony/validator/Constraints/ZeroComparisonConstraintTrait.php', + 'Symfony\\Component\\Validator\\ContainerConstraintValidatorFactory' => $vendorDir . '/symfony/validator/ContainerConstraintValidatorFactory.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContext' => $vendorDir . '/symfony/validator/Context/ExecutionContext.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextFactory' => $vendorDir . '/symfony/validator/Context/ExecutionContextFactory.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextFactoryInterface' => $vendorDir . '/symfony/validator/Context/ExecutionContextFactoryInterface.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextInterface' => $vendorDir . '/symfony/validator/Context/ExecutionContextInterface.php', + 'Symfony\\Component\\Validator\\DataCollector\\ValidatorDataCollector' => $vendorDir . '/symfony/validator/DataCollector/ValidatorDataCollector.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddAutoMappingConfigurationPass' => $vendorDir . '/symfony/validator/DependencyInjection/AddAutoMappingConfigurationPass.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddConstraintValidatorsPass' => $vendorDir . '/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddValidatorInitializersPass' => $vendorDir . '/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php', + 'Symfony\\Component\\Validator\\Exception\\BadMethodCallException' => $vendorDir . '/symfony/validator/Exception/BadMethodCallException.php', + 'Symfony\\Component\\Validator\\Exception\\ConstraintDefinitionException' => $vendorDir . '/symfony/validator/Exception/ConstraintDefinitionException.php', + 'Symfony\\Component\\Validator\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/validator/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Validator\\Exception\\GroupDefinitionException' => $vendorDir . '/symfony/validator/Exception/GroupDefinitionException.php', + 'Symfony\\Component\\Validator\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/validator/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Validator\\Exception\\InvalidOptionsException' => $vendorDir . '/symfony/validator/Exception/InvalidOptionsException.php', + 'Symfony\\Component\\Validator\\Exception\\LogicException' => $vendorDir . '/symfony/validator/Exception/LogicException.php', + 'Symfony\\Component\\Validator\\Exception\\MappingException' => $vendorDir . '/symfony/validator/Exception/MappingException.php', + 'Symfony\\Component\\Validator\\Exception\\MissingOptionsException' => $vendorDir . '/symfony/validator/Exception/MissingOptionsException.php', + 'Symfony\\Component\\Validator\\Exception\\NoSuchMetadataException' => $vendorDir . '/symfony/validator/Exception/NoSuchMetadataException.php', + 'Symfony\\Component\\Validator\\Exception\\OutOfBoundsException' => $vendorDir . '/symfony/validator/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\Validator\\Exception\\RuntimeException' => $vendorDir . '/symfony/validator/Exception/RuntimeException.php', + 'Symfony\\Component\\Validator\\Exception\\UnexpectedTypeException' => $vendorDir . '/symfony/validator/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\Validator\\Exception\\UnexpectedValueException' => $vendorDir . '/symfony/validator/Exception/UnexpectedValueException.php', + 'Symfony\\Component\\Validator\\Exception\\UnsupportedMetadataException' => $vendorDir . '/symfony/validator/Exception/UnsupportedMetadataException.php', + 'Symfony\\Component\\Validator\\Exception\\ValidationFailedException' => $vendorDir . '/symfony/validator/Exception/ValidationFailedException.php', + 'Symfony\\Component\\Validator\\Exception\\ValidatorException' => $vendorDir . '/symfony/validator/Exception/ValidatorException.php', + 'Symfony\\Component\\Validator\\GroupSequenceProviderInterface' => $vendorDir . '/symfony/validator/GroupSequenceProviderInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\AutoMappingStrategy' => $vendorDir . '/symfony/validator/Mapping/AutoMappingStrategy.php', + 'Symfony\\Component\\Validator\\Mapping\\CascadingStrategy' => $vendorDir . '/symfony/validator/Mapping/CascadingStrategy.php', + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata' => $vendorDir . '/symfony/validator/Mapping/ClassMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadataInterface' => $vendorDir . '/symfony/validator/Mapping/ClassMetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\BlackHoleMetadataFactory' => $vendorDir . '/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\LazyLoadingMetadataFactory' => $vendorDir . '/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\MetadataFactoryInterface' => $vendorDir . '/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\GenericMetadata' => $vendorDir . '/symfony/validator/Mapping/GenericMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\GetterMetadata' => $vendorDir . '/symfony/validator/Mapping/GetterMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AbstractLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/AbstractLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/AnnotationLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AutoMappingTrait' => $vendorDir . '/symfony/validator/Mapping/Loader/AutoMappingTrait.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\FileLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/FileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\FilesLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/FilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\LoaderChain' => $vendorDir . '/symfony/validator/Mapping/Loader/LoaderChain.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\LoaderInterface' => $vendorDir . '/symfony/validator/Mapping/Loader/LoaderInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\PropertyInfoLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/PropertyInfoLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\StaticMethodLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/StaticMethodLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/XmlFileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\XmlFilesLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/XmlFilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\YamlFilesLoader' => $vendorDir . '/symfony/validator/Mapping/Loader/YamlFilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\MemberMetadata' => $vendorDir . '/symfony/validator/Mapping/MemberMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\MetadataInterface' => $vendorDir . '/symfony/validator/Mapping/MetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\PropertyMetadata' => $vendorDir . '/symfony/validator/Mapping/PropertyMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\PropertyMetadataInterface' => $vendorDir . '/symfony/validator/Mapping/PropertyMetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\TraversalStrategy' => $vendorDir . '/symfony/validator/Mapping/TraversalStrategy.php', + 'Symfony\\Component\\Validator\\ObjectInitializerInterface' => $vendorDir . '/symfony/validator/ObjectInitializerInterface.php', + 'Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase' => $vendorDir . '/symfony/validator/Test/ConstraintValidatorTestCase.php', + 'Symfony\\Component\\Validator\\Util\\PropertyPath' => $vendorDir . '/symfony/validator/Util/PropertyPath.php', + 'Symfony\\Component\\Validator\\Validation' => $vendorDir . '/symfony/validator/Validation.php', + 'Symfony\\Component\\Validator\\ValidatorBuilder' => $vendorDir . '/symfony/validator/ValidatorBuilder.php', + 'Symfony\\Component\\Validator\\Validator\\ContextualValidatorInterface' => $vendorDir . '/symfony/validator/Validator/ContextualValidatorInterface.php', + 'Symfony\\Component\\Validator\\Validator\\LazyProperty' => $vendorDir . '/symfony/validator/Validator/LazyProperty.php', + 'Symfony\\Component\\Validator\\Validator\\RecursiveContextualValidator' => $vendorDir . '/symfony/validator/Validator/RecursiveContextualValidator.php', + 'Symfony\\Component\\Validator\\Validator\\RecursiveValidator' => $vendorDir . '/symfony/validator/Validator/RecursiveValidator.php', + 'Symfony\\Component\\Validator\\Validator\\TraceableValidator' => $vendorDir . '/symfony/validator/Validator/TraceableValidator.php', + 'Symfony\\Component\\Validator\\Validator\\ValidatorInterface' => $vendorDir . '/symfony/validator/Validator/ValidatorInterface.php', + 'Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilder' => $vendorDir . '/symfony/validator/Violation/ConstraintViolationBuilder.php', + 'Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface' => $vendorDir . '/symfony/validator/Violation/ConstraintViolationBuilderInterface.php', 'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => $vendorDir . '/symfony/var-dumper/Caster/AmqpCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ArgsStub' => $vendorDir . '/symfony/var-dumper/Caster/ArgsStub.php', 'Symfony\\Component\\VarDumper\\Caster\\Caster' => $vendorDir . '/symfony/var-dumper/Caster/Caster.php', @@ -1029,6 +2038,20 @@ return array( 'Symfony\\Contracts\\Cache\\TagAwareCacheInterface' => $vendorDir . '/symfony/cache-contracts/TagAwareCacheInterface.php', 'Symfony\\Contracts\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher-contracts/Event.php', 'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher-contracts/EventDispatcherInterface.php', + 'Symfony\\Contracts\\HttpClient\\ChunkInterface' => $vendorDir . '/symfony/http-client-contracts/ChunkInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ClientExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/ClientExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\DecodingExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/ExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/HttpExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\RedirectionExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ServerExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/ServerExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\TimeoutExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\TransportExceptionInterface' => $vendorDir . '/symfony/http-client-contracts/Exception/TransportExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\HttpClientInterface' => $vendorDir . '/symfony/http-client-contracts/HttpClientInterface.php', + 'Symfony\\Contracts\\HttpClient\\ResponseInterface' => $vendorDir . '/symfony/http-client-contracts/ResponseInterface.php', + 'Symfony\\Contracts\\HttpClient\\ResponseStreamInterface' => $vendorDir . '/symfony/http-client-contracts/ResponseStreamInterface.php', + 'Symfony\\Contracts\\HttpClient\\Test\\HttpClientTestCase' => $vendorDir . '/symfony/http-client-contracts/Test/HttpClientTestCase.php', + 'Symfony\\Contracts\\HttpClient\\Test\\TestHttpServer' => $vendorDir . '/symfony/http-client-contracts/Test/TestHttpServer.php', 'Symfony\\Contracts\\Service\\Attribute\\Required' => $vendorDir . '/symfony/service-contracts/Attribute/Required.php', 'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => $vendorDir . '/symfony/service-contracts/Attribute/SubscribedService.php', 'Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/service-contracts/ResetInterface.php', @@ -1037,6 +2060,11 @@ return array( 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php', 'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => $vendorDir . '/symfony/service-contracts/Test/ServiceLocatorTest.php', + 'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => $vendorDir . '/symfony/translation-contracts/LocaleAwareInterface.php', + 'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => $vendorDir . '/symfony/translation-contracts/Test/TranslatorTest.php', + 'Symfony\\Contracts\\Translation\\TranslatableInterface' => $vendorDir . '/symfony/translation-contracts/TranslatableInterface.php', + 'Symfony\\Contracts\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/translation-contracts/TranslatorInterface.php', + 'Symfony\\Contracts\\Translation\\TranslatorTrait' => $vendorDir . '/symfony/translation-contracts/TranslatorTrait.php', 'Symfony\\Flex\\Cache' => $vendorDir . '/symfony/flex/src/Cache.php', 'Symfony\\Flex\\Command\\DumpEnvCommand' => $vendorDir . '/symfony/flex/src/Command/DumpEnvCommand.php', 'Symfony\\Flex\\Command\\GenerateIdCommand' => $vendorDir . '/symfony/flex/src/Command/GenerateIdCommand.php', @@ -1086,6 +2114,35 @@ return array( 'Symfony\\Flex\\Update\\RecipePatcher' => $vendorDir . '/symfony/flex/src/Update/RecipePatcher.php', 'Symfony\\Flex\\Update\\RecipeUpdate' => $vendorDir . '/symfony/flex/src/Update/RecipeUpdate.php', 'Symfony\\Polyfill\\Intl\\Grapheme\\Grapheme' => $vendorDir . '/symfony/polyfill-intl-grapheme/Grapheme.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Collator' => $vendorDir . '/symfony/polyfill-intl-icu/Collator.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Currencies' => $vendorDir . '/symfony/polyfill-intl-icu/Currencies.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\AmPmTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/AmPmTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayOfWeekTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/DayOfWeekTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayOfYearTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/DayOfYearTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/DayTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\FullTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/FullTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour1200Transformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/Hour1200Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour1201Transformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/Hour1201Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour2400Transformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/Hour2400Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour2401Transformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/Hour2401Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\HourTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/HourTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\MinuteTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/MinuteTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\MonthTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/MonthTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\QuarterTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/QuarterTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\SecondTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/SecondTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\TimezoneTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/TimezoneTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Transformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\YearTransformer' => $vendorDir . '/symfony/polyfill-intl-icu/DateFormat/YearTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/ExceptionInterface.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodArgumentNotImplementedException' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/MethodArgumentNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodArgumentValueNotImplementedException' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/MethodArgumentValueNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodNotImplementedException' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/MethodNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\NotImplementedException' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/NotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\RuntimeException' => $vendorDir . '/symfony/polyfill-intl-icu/Exception/RuntimeException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Icu' => $vendorDir . '/symfony/polyfill-intl-icu/Icu.php', + 'Symfony\\Polyfill\\Intl\\Icu\\IntlDateFormatter' => $vendorDir . '/symfony/polyfill-intl-icu/IntlDateFormatter.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Locale' => $vendorDir . '/symfony/polyfill-intl-icu/Locale.php', + 'Symfony\\Polyfill\\Intl\\Icu\\NumberFormatter' => $vendorDir . '/symfony/polyfill-intl-icu/NumberFormatter.php', 'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Normalizer.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php', 'Symfony\\Polyfill\\Php73\\Php73' => $vendorDir . '/symfony/polyfill-php73/Php73.php', @@ -1099,6 +2156,180 @@ return array( 'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\RequestRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpFoundation/RequestRuntime.php', 'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\ResponseRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpFoundation/ResponseRuntime.php', 'Symfony\\Runtime\\Symfony\\Component\\HttpKernel\\HttpKernelInterfaceRuntime' => $vendorDir . '/symfony/runtime/Internal/HttpKernel/HttpKernelInterfaceRuntime.php', + 'Twig\\Cache\\CacheInterface' => $vendorDir . '/twig/twig/src/Cache/CacheInterface.php', + 'Twig\\Cache\\FilesystemCache' => $vendorDir . '/twig/twig/src/Cache/FilesystemCache.php', + 'Twig\\Cache\\NullCache' => $vendorDir . '/twig/twig/src/Cache/NullCache.php', + 'Twig\\Compiler' => $vendorDir . '/twig/twig/src/Compiler.php', + 'Twig\\Environment' => $vendorDir . '/twig/twig/src/Environment.php', + 'Twig\\Error\\Error' => $vendorDir . '/twig/twig/src/Error/Error.php', + 'Twig\\Error\\LoaderError' => $vendorDir . '/twig/twig/src/Error/LoaderError.php', + 'Twig\\Error\\RuntimeError' => $vendorDir . '/twig/twig/src/Error/RuntimeError.php', + 'Twig\\Error\\SyntaxError' => $vendorDir . '/twig/twig/src/Error/SyntaxError.php', + 'Twig\\ExpressionParser' => $vendorDir . '/twig/twig/src/ExpressionParser.php', + 'Twig\\ExtensionSet' => $vendorDir . '/twig/twig/src/ExtensionSet.php', + 'Twig\\Extension\\AbstractExtension' => $vendorDir . '/twig/twig/src/Extension/AbstractExtension.php', + 'Twig\\Extension\\CoreExtension' => $vendorDir . '/twig/twig/src/Extension/CoreExtension.php', + 'Twig\\Extension\\DebugExtension' => $vendorDir . '/twig/twig/src/Extension/DebugExtension.php', + 'Twig\\Extension\\EscaperExtension' => $vendorDir . '/twig/twig/src/Extension/EscaperExtension.php', + 'Twig\\Extension\\ExtensionInterface' => $vendorDir . '/twig/twig/src/Extension/ExtensionInterface.php', + 'Twig\\Extension\\GlobalsInterface' => $vendorDir . '/twig/twig/src/Extension/GlobalsInterface.php', + 'Twig\\Extension\\OptimizerExtension' => $vendorDir . '/twig/twig/src/Extension/OptimizerExtension.php', + 'Twig\\Extension\\ProfilerExtension' => $vendorDir . '/twig/twig/src/Extension/ProfilerExtension.php', + 'Twig\\Extension\\RuntimeExtensionInterface' => $vendorDir . '/twig/twig/src/Extension/RuntimeExtensionInterface.php', + 'Twig\\Extension\\SandboxExtension' => $vendorDir . '/twig/twig/src/Extension/SandboxExtension.php', + 'Twig\\Extension\\StagingExtension' => $vendorDir . '/twig/twig/src/Extension/StagingExtension.php', + 'Twig\\Extension\\StringLoaderExtension' => $vendorDir . '/twig/twig/src/Extension/StringLoaderExtension.php', + 'Twig\\FileExtensionEscapingStrategy' => $vendorDir . '/twig/twig/src/FileExtensionEscapingStrategy.php', + 'Twig\\Lexer' => $vendorDir . '/twig/twig/src/Lexer.php', + 'Twig\\Loader\\ArrayLoader' => $vendorDir . '/twig/twig/src/Loader/ArrayLoader.php', + 'Twig\\Loader\\ChainLoader' => $vendorDir . '/twig/twig/src/Loader/ChainLoader.php', + 'Twig\\Loader\\FilesystemLoader' => $vendorDir . '/twig/twig/src/Loader/FilesystemLoader.php', + 'Twig\\Loader\\LoaderInterface' => $vendorDir . '/twig/twig/src/Loader/LoaderInterface.php', + 'Twig\\Markup' => $vendorDir . '/twig/twig/src/Markup.php', + 'Twig\\NodeTraverser' => $vendorDir . '/twig/twig/src/NodeTraverser.php', + 'Twig\\NodeVisitor\\AbstractNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php', + 'Twig\\NodeVisitor\\EscaperNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php', + 'Twig\\NodeVisitor\\MacroAutoImportNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php', + 'Twig\\NodeVisitor\\NodeVisitorInterface' => $vendorDir . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php', + 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php', + 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php', + 'Twig\\NodeVisitor\\SandboxNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php', + 'Twig\\Node\\AutoEscapeNode' => $vendorDir . '/twig/twig/src/Node/AutoEscapeNode.php', + 'Twig\\Node\\BlockNode' => $vendorDir . '/twig/twig/src/Node/BlockNode.php', + 'Twig\\Node\\BlockReferenceNode' => $vendorDir . '/twig/twig/src/Node/BlockReferenceNode.php', + 'Twig\\Node\\BodyNode' => $vendorDir . '/twig/twig/src/Node/BodyNode.php', + 'Twig\\Node\\CheckSecurityCallNode' => $vendorDir . '/twig/twig/src/Node/CheckSecurityCallNode.php', + 'Twig\\Node\\CheckSecurityNode' => $vendorDir . '/twig/twig/src/Node/CheckSecurityNode.php', + 'Twig\\Node\\CheckToStringNode' => $vendorDir . '/twig/twig/src/Node/CheckToStringNode.php', + 'Twig\\Node\\DeprecatedNode' => $vendorDir . '/twig/twig/src/Node/DeprecatedNode.php', + 'Twig\\Node\\DoNode' => $vendorDir . '/twig/twig/src/Node/DoNode.php', + 'Twig\\Node\\EmbedNode' => $vendorDir . '/twig/twig/src/Node/EmbedNode.php', + 'Twig\\Node\\Expression\\AbstractExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AbstractExpression.php', + 'Twig\\Node\\Expression\\ArrayExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrayExpression.php', + 'Twig\\Node\\Expression\\ArrowFunctionExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php', + 'Twig\\Node\\Expression\\AssignNameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AssignNameExpression.php', + 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php', + 'Twig\\Node\\Expression\\Binary\\AddBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AddBinary.php', + 'Twig\\Node\\Expression\\Binary\\AndBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AndBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php', + 'Twig\\Node\\Expression\\Binary\\ConcatBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/ConcatBinary.php', + 'Twig\\Node\\Expression\\Binary\\DivBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/DivBinary.php', + 'Twig\\Node\\Expression\\Binary\\EndsWithBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php', + 'Twig\\Node\\Expression\\Binary\\EqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/EqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\FloorDivBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php', + 'Twig\\Node\\Expression\\Binary\\GreaterBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/GreaterBinary.php', + 'Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\InBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/InBinary.php', + 'Twig\\Node\\Expression\\Binary\\LessBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/LessBinary.php', + 'Twig\\Node\\Expression\\Binary\\LessEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\MatchesBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/MatchesBinary.php', + 'Twig\\Node\\Expression\\Binary\\ModBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/ModBinary.php', + 'Twig\\Node\\Expression\\Binary\\MulBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/MulBinary.php', + 'Twig\\Node\\Expression\\Binary\\NotEqualBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\NotInBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/NotInBinary.php', + 'Twig\\Node\\Expression\\Binary\\OrBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/OrBinary.php', + 'Twig\\Node\\Expression\\Binary\\PowerBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php', + 'Twig\\Node\\Expression\\Binary\\RangeBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php', + 'Twig\\Node\\Expression\\Binary\\SpaceshipBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php', + 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php', + 'Twig\\Node\\Expression\\Binary\\SubBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/SubBinary.php', + 'Twig\\Node\\Expression\\BlockReferenceExpression' => $vendorDir . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php', + 'Twig\\Node\\Expression\\CallExpression' => $vendorDir . '/twig/twig/src/Node/Expression/CallExpression.php', + 'Twig\\Node\\Expression\\ConditionalExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ConditionalExpression.php', + 'Twig\\Node\\Expression\\ConstantExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ConstantExpression.php', + 'Twig\\Node\\Expression\\FilterExpression' => $vendorDir . '/twig/twig/src/Node/Expression/FilterExpression.php', + 'Twig\\Node\\Expression\\Filter\\DefaultFilter' => $vendorDir . '/twig/twig/src/Node/Expression/Filter/DefaultFilter.php', + 'Twig\\Node\\Expression\\FunctionExpression' => $vendorDir . '/twig/twig/src/Node/Expression/FunctionExpression.php', + 'Twig\\Node\\Expression\\GetAttrExpression' => $vendorDir . '/twig/twig/src/Node/Expression/GetAttrExpression.php', + 'Twig\\Node\\Expression\\InlinePrint' => $vendorDir . '/twig/twig/src/Node/Expression/InlinePrint.php', + 'Twig\\Node\\Expression\\MethodCallExpression' => $vendorDir . '/twig/twig/src/Node/Expression/MethodCallExpression.php', + 'Twig\\Node\\Expression\\NameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/NameExpression.php', + 'Twig\\Node\\Expression\\NullCoalesceExpression' => $vendorDir . '/twig/twig/src/Node/Expression/NullCoalesceExpression.php', + 'Twig\\Node\\Expression\\ParentExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ParentExpression.php', + 'Twig\\Node\\Expression\\TempNameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/TempNameExpression.php', + 'Twig\\Node\\Expression\\TestExpression' => $vendorDir . '/twig/twig/src/Node/Expression/TestExpression.php', + 'Twig\\Node\\Expression\\Test\\ConstantTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/ConstantTest.php', + 'Twig\\Node\\Expression\\Test\\DefinedTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/DefinedTest.php', + 'Twig\\Node\\Expression\\Test\\DivisiblebyTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php', + 'Twig\\Node\\Expression\\Test\\EvenTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/EvenTest.php', + 'Twig\\Node\\Expression\\Test\\NullTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/NullTest.php', + 'Twig\\Node\\Expression\\Test\\OddTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/OddTest.php', + 'Twig\\Node\\Expression\\Test\\SameasTest' => $vendorDir . '/twig/twig/src/Node/Expression/Test/SameasTest.php', + 'Twig\\Node\\Expression\\Unary\\AbstractUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/AbstractUnary.php', + 'Twig\\Node\\Expression\\Unary\\NegUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NegUnary.php', + 'Twig\\Node\\Expression\\Unary\\NotUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NotUnary.php', + 'Twig\\Node\\Expression\\Unary\\PosUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/PosUnary.php', + 'Twig\\Node\\Expression\\VariadicExpression' => $vendorDir . '/twig/twig/src/Node/Expression/VariadicExpression.php', + 'Twig\\Node\\FlushNode' => $vendorDir . '/twig/twig/src/Node/FlushNode.php', + 'Twig\\Node\\ForLoopNode' => $vendorDir . '/twig/twig/src/Node/ForLoopNode.php', + 'Twig\\Node\\ForNode' => $vendorDir . '/twig/twig/src/Node/ForNode.php', + 'Twig\\Node\\IfNode' => $vendorDir . '/twig/twig/src/Node/IfNode.php', + 'Twig\\Node\\ImportNode' => $vendorDir . '/twig/twig/src/Node/ImportNode.php', + 'Twig\\Node\\IncludeNode' => $vendorDir . '/twig/twig/src/Node/IncludeNode.php', + 'Twig\\Node\\MacroNode' => $vendorDir . '/twig/twig/src/Node/MacroNode.php', + 'Twig\\Node\\ModuleNode' => $vendorDir . '/twig/twig/src/Node/ModuleNode.php', + 'Twig\\Node\\Node' => $vendorDir . '/twig/twig/src/Node/Node.php', + 'Twig\\Node\\NodeCaptureInterface' => $vendorDir . '/twig/twig/src/Node/NodeCaptureInterface.php', + 'Twig\\Node\\NodeOutputInterface' => $vendorDir . '/twig/twig/src/Node/NodeOutputInterface.php', + 'Twig\\Node\\PrintNode' => $vendorDir . '/twig/twig/src/Node/PrintNode.php', + 'Twig\\Node\\SandboxNode' => $vendorDir . '/twig/twig/src/Node/SandboxNode.php', + 'Twig\\Node\\SetNode' => $vendorDir . '/twig/twig/src/Node/SetNode.php', + 'Twig\\Node\\TextNode' => $vendorDir . '/twig/twig/src/Node/TextNode.php', + 'Twig\\Node\\WithNode' => $vendorDir . '/twig/twig/src/Node/WithNode.php', + 'Twig\\Parser' => $vendorDir . '/twig/twig/src/Parser.php', + 'Twig\\Profiler\\Dumper\\BaseDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/BaseDumper.php', + 'Twig\\Profiler\\Dumper\\BlackfireDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/BlackfireDumper.php', + 'Twig\\Profiler\\Dumper\\HtmlDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/HtmlDumper.php', + 'Twig\\Profiler\\Dumper\\TextDumper' => $vendorDir . '/twig/twig/src/Profiler/Dumper/TextDumper.php', + 'Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => $vendorDir . '/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php', + 'Twig\\Profiler\\Node\\EnterProfileNode' => $vendorDir . '/twig/twig/src/Profiler/Node/EnterProfileNode.php', + 'Twig\\Profiler\\Node\\LeaveProfileNode' => $vendorDir . '/twig/twig/src/Profiler/Node/LeaveProfileNode.php', + 'Twig\\Profiler\\Profile' => $vendorDir . '/twig/twig/src/Profiler/Profile.php', + 'Twig\\RuntimeLoader\\ContainerRuntimeLoader' => $vendorDir . '/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php', + 'Twig\\RuntimeLoader\\FactoryRuntimeLoader' => $vendorDir . '/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php', + 'Twig\\RuntimeLoader\\RuntimeLoaderInterface' => $vendorDir . '/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php', + 'Twig\\Sandbox\\SecurityError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityError.php', + 'Twig\\Sandbox\\SecurityNotAllowedFilterError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php', + 'Twig\\Sandbox\\SecurityNotAllowedFunctionError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php', + 'Twig\\Sandbox\\SecurityNotAllowedMethodError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php', + 'Twig\\Sandbox\\SecurityNotAllowedPropertyError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php', + 'Twig\\Sandbox\\SecurityNotAllowedTagError' => $vendorDir . '/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php', + 'Twig\\Sandbox\\SecurityPolicy' => $vendorDir . '/twig/twig/src/Sandbox/SecurityPolicy.php', + 'Twig\\Sandbox\\SecurityPolicyInterface' => $vendorDir . '/twig/twig/src/Sandbox/SecurityPolicyInterface.php', + 'Twig\\Source' => $vendorDir . '/twig/twig/src/Source.php', + 'Twig\\Template' => $vendorDir . '/twig/twig/src/Template.php', + 'Twig\\TemplateWrapper' => $vendorDir . '/twig/twig/src/TemplateWrapper.php', + 'Twig\\Test\\IntegrationTestCase' => $vendorDir . '/twig/twig/src/Test/IntegrationTestCase.php', + 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php', + 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php', + 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php', + 'Twig\\TokenParser\\AutoEscapeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', + 'Twig\\TokenParser\\BlockTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/BlockTokenParser.php', + 'Twig\\TokenParser\\DeprecatedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', + 'Twig\\TokenParser\\DoTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DoTokenParser.php', + 'Twig\\TokenParser\\EmbedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/EmbedTokenParser.php', + 'Twig\\TokenParser\\ExtendsTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ExtendsTokenParser.php', + 'Twig\\TokenParser\\FlushTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/FlushTokenParser.php', + 'Twig\\TokenParser\\ForTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ForTokenParser.php', + 'Twig\\TokenParser\\FromTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/FromTokenParser.php', + 'Twig\\TokenParser\\IfTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/IfTokenParser.php', + 'Twig\\TokenParser\\ImportTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ImportTokenParser.php', + 'Twig\\TokenParser\\IncludeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/IncludeTokenParser.php', + 'Twig\\TokenParser\\MacroTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/MacroTokenParser.php', + 'Twig\\TokenParser\\SandboxTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/SandboxTokenParser.php', + 'Twig\\TokenParser\\SetTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/SetTokenParser.php', + 'Twig\\TokenParser\\TokenParserInterface' => $vendorDir . '/twig/twig/src/TokenParser/TokenParserInterface.php', + 'Twig\\TokenParser\\UseTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/UseTokenParser.php', + 'Twig\\TokenParser\\WithTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/WithTokenParser.php', + 'Twig\\TokenStream' => $vendorDir . '/twig/twig/src/TokenStream.php', + 'Twig\\TwigFilter' => $vendorDir . '/twig/twig/src/TwigFilter.php', + 'Twig\\TwigFunction' => $vendorDir . '/twig/twig/src/TwigFunction.php', + 'Twig\\TwigTest' => $vendorDir . '/twig/twig/src/TwigTest.php', + 'Twig\\Util\\DeprecationCollector' => $vendorDir . '/twig/twig/src/Util/DeprecationCollector.php', + 'Twig\\Util\\TemplateDirIterator' => $vendorDir . '/twig/twig/src/Util/TemplateDirIterator.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 1d9054e..fe04e27 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -15,4 +15,5 @@ return array( '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php', 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', + '6a47392539ca2329373e0d33e1dba053' => $vendorDir . '/symfony/polyfill-intl-icu/bootstrap.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 55fa721..be6f9c4 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,25 +6,40 @@ $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'Twig\\' => array($vendorDir . '/twig/twig/src'), 'Symfony\\Runtime\\Symfony\\Component\\' => array($vendorDir . '/symfony/runtime/Internal'), 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'), 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'), + 'Symfony\\Polyfill\\Intl\\Icu\\' => array($vendorDir . '/symfony/polyfill-intl-icu'), 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'), 'Symfony\\Flex\\' => array($vendorDir . '/symfony/flex/src'), + 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), + 'Symfony\\Contracts\\HttpClient\\' => array($vendorDir . '/symfony/http-client-contracts'), 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), 'Symfony\\Contracts\\Cache\\' => array($vendorDir . '/symfony/cache-contracts'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'), 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'), 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'), + 'Symfony\\Component\\Security\\Http\\' => array($vendorDir . '/symfony/security-http'), + 'Symfony\\Component\\Security\\Guard\\' => array($vendorDir . '/symfony/security-guard'), + 'Symfony\\Component\\Security\\Csrf\\' => array($vendorDir . '/symfony/security-csrf'), + 'Symfony\\Component\\Security\\Core\\' => array($vendorDir . '/symfony/security-core'), 'Symfony\\Component\\Runtime\\' => array($vendorDir . '/symfony/runtime'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\PropertyInfo\\' => array($vendorDir . '/symfony/property-info'), + 'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'), + 'Symfony\\Component\\PasswordHasher\\' => array($vendorDir . '/symfony/password-hasher'), + 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), + 'Symfony\\Component\\HttpClient\\' => array($vendorDir . '/symfony/http-client'), + 'Symfony\\Component\\Form\\' => array($vendorDir . '/symfony/form'), 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), @@ -34,11 +49,17 @@ return array( 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), 'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'), + 'Symfony\\Bundle\\WebProfilerBundle\\' => array($vendorDir . '/symfony/web-profiler-bundle'), + 'Symfony\\Bundle\\TwigBundle\\' => array($vendorDir . '/symfony/twig-bundle'), + 'Symfony\\Bundle\\SecurityBundle\\' => array($vendorDir . '/symfony/security-bundle'), 'Symfony\\Bundle\\FrameworkBundle\\' => array($vendorDir . '/symfony/framework-bundle'), + 'Symfony\\Bridge\\Twig\\' => array($vendorDir . '/symfony/twig-bridge'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), + 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib/Doctrine/Common/Lexer'), + 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib/Doctrine/Common/Annotations'), 'App\\Tests\\' => array($baseDir . '/tests'), 'App\\' => array($baseDir . '/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a99669e..024e371 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -16,9 +16,14 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php', 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', + '6a47392539ca2329373e0d33e1dba053' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/bootstrap.php', ); public static $prefixLengthsPsr4 = array ( + 'T' => + array ( + 'Twig\\' => 5, + ), 'S' => array ( 'Symfony\\Runtime\\Symfony\\Component\\' => 34, @@ -27,19 +32,33 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Polyfill\\Php73\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33, + 'Symfony\\Polyfill\\Intl\\Icu\\' => 26, 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31, 'Symfony\\Flex\\' => 13, + 'Symfony\\Contracts\\Translation\\' => 30, 'Symfony\\Contracts\\Service\\' => 26, + 'Symfony\\Contracts\\HttpClient\\' => 29, 'Symfony\\Contracts\\EventDispatcher\\' => 34, 'Symfony\\Contracts\\Cache\\' => 24, 'Symfony\\Component\\Yaml\\' => 23, 'Symfony\\Component\\VarExporter\\' => 30, 'Symfony\\Component\\VarDumper\\' => 28, + 'Symfony\\Component\\Validator\\' => 28, 'Symfony\\Component\\String\\' => 25, + 'Symfony\\Component\\Security\\Http\\' => 32, + 'Symfony\\Component\\Security\\Guard\\' => 33, + 'Symfony\\Component\\Security\\Csrf\\' => 32, + 'Symfony\\Component\\Security\\Core\\' => 32, 'Symfony\\Component\\Runtime\\' => 26, 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\PropertyInfo\\' => 31, + 'Symfony\\Component\\PropertyAccess\\' => 33, + 'Symfony\\Component\\PasswordHasher\\' => 33, + 'Symfony\\Component\\OptionsResolver\\' => 34, 'Symfony\\Component\\HttpKernel\\' => 29, 'Symfony\\Component\\HttpFoundation\\' => 33, + 'Symfony\\Component\\HttpClient\\' => 29, + 'Symfony\\Component\\Form\\' => 23, 'Symfony\\Component\\Finder\\' => 25, 'Symfony\\Component\\Filesystem\\' => 29, 'Symfony\\Component\\EventDispatcher\\' => 34, @@ -49,7 +68,11 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Component\\Console\\' => 26, 'Symfony\\Component\\Config\\' => 25, 'Symfony\\Component\\Cache\\' => 24, + 'Symfony\\Bundle\\WebProfilerBundle\\' => 33, + 'Symfony\\Bundle\\TwigBundle\\' => 26, + 'Symfony\\Bundle\\SecurityBundle\\' => 30, 'Symfony\\Bundle\\FrameworkBundle\\' => 31, + 'Symfony\\Bridge\\Twig\\' => 20, ), 'P' => array ( @@ -58,6 +81,11 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Psr\\Container\\' => 14, 'Psr\\Cache\\' => 10, ), + 'D' => + array ( + 'Doctrine\\Common\\Lexer\\' => 22, + 'Doctrine\\Common\\Annotations\\' => 28, + ), 'A' => array ( 'App\\Tests\\' => 10, @@ -66,6 +94,10 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 ); public static $prefixDirsPsr4 = array ( + 'Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/twig/twig/src', + ), 'Symfony\\Runtime\\Symfony\\Component\\' => array ( 0 => __DIR__ . '/..' . '/symfony/runtime/Internal', @@ -90,6 +122,10 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer', ), + 'Symfony\\Polyfill\\Intl\\Icu\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-icu', + ), 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme', @@ -98,10 +134,18 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/flex/src', ), + 'Symfony\\Contracts\\Translation\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/translation-contracts', + ), 'Symfony\\Contracts\\Service\\' => array ( 0 => __DIR__ . '/..' . '/symfony/service-contracts', ), + 'Symfony\\Contracts\\HttpClient\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-client-contracts', + ), 'Symfony\\Contracts\\EventDispatcher\\' => array ( 0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts', @@ -122,10 +166,30 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/var-dumper', ), + 'Symfony\\Component\\Validator\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/validator', + ), 'Symfony\\Component\\String\\' => array ( 0 => __DIR__ . '/..' . '/symfony/string', ), + 'Symfony\\Component\\Security\\Http\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/security-http', + ), + 'Symfony\\Component\\Security\\Guard\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/security-guard', + ), + 'Symfony\\Component\\Security\\Csrf\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/security-csrf', + ), + 'Symfony\\Component\\Security\\Core\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/security-core', + ), 'Symfony\\Component\\Runtime\\' => array ( 0 => __DIR__ . '/..' . '/symfony/runtime', @@ -134,6 +198,22 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/routing', ), + 'Symfony\\Component\\PropertyInfo\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/property-info', + ), + 'Symfony\\Component\\PropertyAccess\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/property-access', + ), + 'Symfony\\Component\\PasswordHasher\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/password-hasher', + ), + 'Symfony\\Component\\OptionsResolver\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/options-resolver', + ), 'Symfony\\Component\\HttpKernel\\' => array ( 0 => __DIR__ . '/..' . '/symfony/http-kernel', @@ -142,6 +222,14 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/http-foundation', ), + 'Symfony\\Component\\HttpClient\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/http-client', + ), + 'Symfony\\Component\\Form\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/form', + ), 'Symfony\\Component\\Finder\\' => array ( 0 => __DIR__ . '/..' . '/symfony/finder', @@ -178,10 +266,26 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/symfony/cache', ), + 'Symfony\\Bundle\\WebProfilerBundle\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/web-profiler-bundle', + ), + 'Symfony\\Bundle\\TwigBundle\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/twig-bundle', + ), + 'Symfony\\Bundle\\SecurityBundle\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/security-bundle', + ), 'Symfony\\Bundle\\FrameworkBundle\\' => array ( 0 => __DIR__ . '/..' . '/symfony/framework-bundle', ), + 'Symfony\\Bridge\\Twig\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/twig-bridge', + ), 'Psr\\Log\\' => array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', @@ -198,6 +302,14 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 array ( 0 => __DIR__ . '/..' . '/psr/cache/src', ), + 'Doctrine\\Common\\Lexer\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer', + ), + 'Doctrine\\Common\\Annotations\\' => + array ( + 0 => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations', + ), 'App\\Tests\\' => array ( 0 => __DIR__ . '/../..' . '/tests', @@ -210,11 +322,42 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 public static $classMap = array ( 'App\\Controller\\MainController' => __DIR__ . '/../..' . '/src/Controller/MainController.php', + 'App\\Entity\\User' => __DIR__ . '/../..' . '/src/Entity/User.php', + 'App\\Form\\UserType' => __DIR__ . '/../..' . '/src/Form/UserType.php', 'App\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php', + 'App\\Services\\PdoServices' => __DIR__ . '/../..' . '/src/Services/PdoServices.php', 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', + 'Collator' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Resources/stubs/Collator.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'Doctrine\\Common\\Annotations\\Annotation' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php', + 'Doctrine\\Common\\Annotations\\AnnotationException' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php', + 'Doctrine\\Common\\Annotations\\AnnotationReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php', + 'Doctrine\\Common\\Annotations\\AnnotationRegistry' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Attribute' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Attributes' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Enum' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php', + 'Doctrine\\Common\\Annotations\\Annotation\\IgnoreAnnotation' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php', + 'Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Required' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php', + 'Doctrine\\Common\\Annotations\\Annotation\\Target' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php', + 'Doctrine\\Common\\Annotations\\CachedReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php', + 'Doctrine\\Common\\Annotations\\DocLexer' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php', + 'Doctrine\\Common\\Annotations\\DocParser' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php', + 'Doctrine\\Common\\Annotations\\FileCacheReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php', + 'Doctrine\\Common\\Annotations\\ImplicitlyIgnoredAnnotationNames' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php', + 'Doctrine\\Common\\Annotations\\IndexedReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php', + 'Doctrine\\Common\\Annotations\\NamedArgumentConstructorAnnotation' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php', + 'Doctrine\\Common\\Annotations\\PhpParser' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php', + 'Doctrine\\Common\\Annotations\\PsrCachedReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php', + 'Doctrine\\Common\\Annotations\\Reader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php', + 'Doctrine\\Common\\Annotations\\SimpleAnnotationReader' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php', + 'Doctrine\\Common\\Annotations\\TokenParser' => __DIR__ . '/..' . '/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php', + 'Doctrine\\Common\\Lexer\\AbstractLexer' => __DIR__ . '/..' . '/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php', + 'IntlDateFormatter' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Resources/stubs/IntlDateFormatter.php', 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php', + 'Locale' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Resources/stubs/Locale.php', 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', + 'NumberFormatter' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php', 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Psr\\Cache\\CacheException' => __DIR__ . '/..' . '/psr/cache/src/CacheException.php', 'Psr\\Cache\\CacheItemInterface' => __DIR__ . '/..' . '/psr/cache/src/CacheItemInterface.php', @@ -239,6 +382,54 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php', 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', + 'Symfony\\Bridge\\Twig\\AppVariable' => __DIR__ . '/..' . '/symfony/twig-bridge/AppVariable.php', + 'Symfony\\Bridge\\Twig\\Command\\DebugCommand' => __DIR__ . '/..' . '/symfony/twig-bridge/Command/DebugCommand.php', + 'Symfony\\Bridge\\Twig\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/twig-bridge/Command/LintCommand.php', + 'Symfony\\Bridge\\Twig\\DataCollector\\TwigDataCollector' => __DIR__ . '/..' . '/symfony/twig-bridge/DataCollector/TwigDataCollector.php', + 'Symfony\\Bridge\\Twig\\ErrorRenderer\\TwigErrorRenderer' => __DIR__ . '/..' . '/symfony/twig-bridge/ErrorRenderer/TwigErrorRenderer.php', + 'Symfony\\Bridge\\Twig\\Extension\\AssetExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/AssetExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CodeExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/CodeExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CsrfExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/CsrfExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\CsrfRuntime' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/CsrfRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\DumpExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/DumpExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\ExpressionExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/ExpressionExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\FormExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/FormExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpFoundationExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpFoundationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpKernelExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelRuntime' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpKernelRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\LogoutUrlExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/LogoutUrlExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/ProfilerExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\RoutingExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/RoutingExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SecurityExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/SecurityExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SerializerExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/SerializerExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\SerializerRuntime' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/SerializerRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\StopwatchExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/StopwatchExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\TranslationExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/TranslationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WebLinkExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/WebLinkExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WorkflowExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/WorkflowExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\YamlExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/YamlExtension.php', + 'Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine' => __DIR__ . '/..' . '/symfony/twig-bridge/Form/TwigRendererEngine.php', + 'Symfony\\Bridge\\Twig\\Mime\\BodyRenderer' => __DIR__ . '/..' . '/symfony/twig-bridge/Mime/BodyRenderer.php', + 'Symfony\\Bridge\\Twig\\Mime\\NotificationEmail' => __DIR__ . '/..' . '/symfony/twig-bridge/Mime/NotificationEmail.php', + 'Symfony\\Bridge\\Twig\\Mime\\TemplatedEmail' => __DIR__ . '/..' . '/symfony/twig-bridge/Mime/TemplatedEmail.php', + 'Symfony\\Bridge\\Twig\\Mime\\WrappedTemplatedEmail' => __DIR__ . '/..' . '/symfony/twig-bridge/Mime/WrappedTemplatedEmail.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\Scope' => __DIR__ . '/..' . '/symfony/twig-bridge/NodeVisitor/Scope.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationDefaultDomainNodeVisitor' => __DIR__ . '/..' . '/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php', + 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationNodeVisitor' => __DIR__ . '/..' . '/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php', + 'Symfony\\Bridge\\Twig\\Node\\DumpNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/DumpNode.php', + 'Symfony\\Bridge\\Twig\\Node\\FormThemeNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/FormThemeNode.php', + 'Symfony\\Bridge\\Twig\\Node\\RenderBlockNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/RenderBlockNode.php', + 'Symfony\\Bridge\\Twig\\Node\\SearchAndRenderBlockNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php', + 'Symfony\\Bridge\\Twig\\Node\\StopwatchNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/StopwatchNode.php', + 'Symfony\\Bridge\\Twig\\Node\\TransDefaultDomainNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/TransDefaultDomainNode.php', + 'Symfony\\Bridge\\Twig\\Node\\TransNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/TransNode.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\DumpTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/DumpTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\FormThemeTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\StopwatchTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\TransDefaultDomainTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php', + 'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/TransTokenParser.php', + 'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => __DIR__ . '/..' . '/symfony/twig-bridge/Translation/TwigExtractor.php', + 'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => __DIR__ . '/..' . '/symfony/twig-bridge/UndefinedCallableHandler.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AbstractPhpFileCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\AnnotationsCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/AnnotationsCacheWarmer.php', 'Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\CachePoolClearerCacheWarmer' => __DIR__ . '/..' . '/symfony/framework-bundle/CacheWarmer/CachePoolClearerCacheWarmer.php', @@ -330,6 +521,85 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestAssertionsTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestAssertionsTrait.php', 'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestCase.php', 'Symfony\\Bundle\\FrameworkBundle\\Translation\\Translator' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/Translator.php', + 'Symfony\\Bundle\\SecurityBundle\\CacheWarmer\\ExpressionCacheWarmer' => __DIR__ . '/..' . '/symfony/security-bundle/CacheWarmer/ExpressionCacheWarmer.php', + 'Symfony\\Bundle\\SecurityBundle\\Command\\DebugFirewallCommand' => __DIR__ . '/..' . '/symfony/security-bundle/Command/DebugFirewallCommand.php', + 'Symfony\\Bundle\\SecurityBundle\\Command\\UserPasswordEncoderCommand' => __DIR__ . '/..' . '/symfony/security-bundle/Command/UserPasswordEncoderCommand.php', + 'Symfony\\Bundle\\SecurityBundle\\DataCollector\\SecurityDataCollector' => __DIR__ . '/..' . '/symfony/security-bundle/DataCollector/SecurityDataCollector.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener' => __DIR__ . '/..' . '/symfony/security-bundle/Debug/TraceableFirewallListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableListenerTrait' => __DIR__ . '/..' . '/symfony/security-bundle/Debug/TraceableListenerTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\WrappedLazyListener' => __DIR__ . '/..' . '/symfony/security-bundle/Debug/WrappedLazyListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/security-bundle/Debug/WrappedListener.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddExpressionLanguageProvidersPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddSecurityVotersPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/AddSecurityVotersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\AddSessionDomainConstraintPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\CleanRememberMeVerifierPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/CleanRememberMeVerifierPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterCsrfFeaturesPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterCsrfTokenClearingLogoutHandlerPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterEntryPointPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterEntryPointPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterGlobalSecurityEventListenersPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterLdapLocatorPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterLdapLocatorPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\RegisterTokenUsageTrackingPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\ReplaceDecoratedRememberMeHandlerPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Compiler\\SortFirewallListenersPass' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Compiler/SortFirewallListenersPass.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\MainConfiguration' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/MainConfiguration.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\SecurityExtension' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/SecurityExtension.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AbstractFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/AbstractFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AnonymousFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/AnonymousFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\AuthenticatorFactoryInterface' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\CustomAuthenticatorFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FirewallListenerFactoryInterface' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/FirewallListenerFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FormLoginFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\FormLoginLdapFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\GuardAuthenticationFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\HttpBasicFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\HttpBasicLdapFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\JsonLoginFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\JsonLoginLdapFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LdapFactoryTrait' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LoginLinkFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/LoginLinkFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\LoginThrottlingFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\RememberMeFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/RememberMeFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\RemoteUserFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/RemoteUserFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\SecurityFactoryInterface' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\Factory\\X509Factory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/Factory/X509Factory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\InMemoryFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\LdapFactory' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/LdapFactory.php', + 'Symfony\\Bundle\\SecurityBundle\\DependencyInjection\\Security\\UserProvider\\UserProviderFactoryInterface' => __DIR__ . '/..' . '/symfony/security-bundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php', + 'Symfony\\Bundle\\SecurityBundle\\EventListener\\FirewallListener' => __DIR__ . '/..' . '/symfony/security-bundle/EventListener/FirewallListener.php', + 'Symfony\\Bundle\\SecurityBundle\\EventListener\\VoteListener' => __DIR__ . '/..' . '/symfony/security-bundle/EventListener/VoteListener.php', + 'Symfony\\Bundle\\SecurityBundle\\LoginLink\\FirewallAwareLoginLinkHandler' => __DIR__ . '/..' . '/symfony/security-bundle/LoginLink/FirewallAwareLoginLinkHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\RememberMe\\DecoratedRememberMeHandler' => __DIR__ . '/..' . '/symfony/security-bundle/RememberMe/DecoratedRememberMeHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\RememberMe\\FirewallAwareRememberMeHandler' => __DIR__ . '/..' . '/symfony/security-bundle/RememberMe/FirewallAwareRememberMeHandler.php', + 'Symfony\\Bundle\\SecurityBundle\\SecurityBundle' => __DIR__ . '/..' . '/symfony/security-bundle/SecurityBundle.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallAwareTrait' => __DIR__ . '/..' . '/symfony/security-bundle/Security/FirewallAwareTrait.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallConfig' => __DIR__ . '/..' . '/symfony/security-bundle/Security/FirewallConfig.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallContext' => __DIR__ . '/..' . '/symfony/security-bundle/Security/FirewallContext.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallMap' => __DIR__ . '/..' . '/symfony/security-bundle/Security/FirewallMap.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\LazyFirewallContext' => __DIR__ . '/..' . '/symfony/security-bundle/Security/LazyFirewallContext.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\LegacyLogoutHandlerListener' => __DIR__ . '/..' . '/symfony/security-bundle/Security/LegacyLogoutHandlerListener.php', + 'Symfony\\Bundle\\SecurityBundle\\Security\\UserAuthenticator' => __DIR__ . '/..' . '/symfony/security-bundle/Security/UserAuthenticator.php', + 'Symfony\\Bundle\\TwigBundle\\CacheWarmer\\TemplateCacheWarmer' => __DIR__ . '/..' . '/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php', + 'Symfony\\Bundle\\TwigBundle\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/twig-bundle/Command/LintCommand.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\ExtensionPass' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\RuntimeLoaderPass' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\TwigEnvironmentPass' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Compiler\\TwigLoaderPass' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Configuration.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\Configurator\\EnvironmentConfigurator' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/Configurator/EnvironmentConfigurator.php', + 'Symfony\\Bundle\\TwigBundle\\DependencyInjection\\TwigExtension' => __DIR__ . '/..' . '/symfony/twig-bundle/DependencyInjection/TwigExtension.php', + 'Symfony\\Bundle\\TwigBundle\\TemplateIterator' => __DIR__ . '/..' . '/symfony/twig-bundle/TemplateIterator.php', + 'Symfony\\Bundle\\TwigBundle\\TwigBundle' => __DIR__ . '/..' . '/symfony/twig-bundle/TwigBundle.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ExceptionPanelController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\ProfilerController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/ProfilerController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Controller\\RouterController' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Controller/RouterController.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Csp\\ContentSecurityPolicyHandler' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Csp\\NonceGenerator' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Csp/NonceGenerator.php', + 'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/DependencyInjection/Configuration.php', + 'Symfony\\Bundle\\WebProfilerBundle\\DependencyInjection\\WebProfilerExtension' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php', + 'Symfony\\Bundle\\WebProfilerBundle\\EventListener\\WebDebugToolbarListener' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Profiler\\TemplateManager' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Profiler/TemplateManager.php', + 'Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php', + 'Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle' => __DIR__ . '/..' . '/symfony/web-profiler-bundle/WebProfilerBundle.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AbstractTagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/AbstractTagAwareAdapter.php', 'Symfony\\Component\\Cache\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/cache/Adapter/AdapterInterface.php', @@ -810,6 +1080,296 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SortableIterator.php', 'Symfony\\Component\\Finder\\Iterator\\VcsIgnoredFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/VcsIgnoredFilterIterator.php', 'Symfony\\Component\\Finder\\SplFileInfo' => __DIR__ . '/..' . '/symfony/finder/SplFileInfo.php', + 'Symfony\\Component\\Form\\AbstractExtension' => __DIR__ . '/..' . '/symfony/form/AbstractExtension.php', + 'Symfony\\Component\\Form\\AbstractRendererEngine' => __DIR__ . '/..' . '/symfony/form/AbstractRendererEngine.php', + 'Symfony\\Component\\Form\\AbstractType' => __DIR__ . '/..' . '/symfony/form/AbstractType.php', + 'Symfony\\Component\\Form\\AbstractTypeExtension' => __DIR__ . '/..' . '/symfony/form/AbstractTypeExtension.php', + 'Symfony\\Component\\Form\\Button' => __DIR__ . '/..' . '/symfony/form/Button.php', + 'Symfony\\Component\\Form\\ButtonBuilder' => __DIR__ . '/..' . '/symfony/form/ButtonBuilder.php', + 'Symfony\\Component\\Form\\ButtonTypeInterface' => __DIR__ . '/..' . '/symfony/form/ButtonTypeInterface.php', + 'Symfony\\Component\\Form\\CallbackTransformer' => __DIR__ . '/..' . '/symfony/form/CallbackTransformer.php', + 'Symfony\\Component\\Form\\ChoiceList\\ArrayChoiceList' => __DIR__ . '/..' . '/symfony/form/ChoiceList/ArrayChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\ChoiceList' => __DIR__ . '/..' . '/symfony/form/ChoiceList/ChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\ChoiceListInterface' => __DIR__ . '/..' . '/symfony/form/ChoiceList/ChoiceListInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\AbstractStaticOption' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/AbstractStaticOption.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceAttr' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceAttr.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceFieldName' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceFieldName.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceFilter' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceFilter.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceLabel' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceLabel.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceLoader' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceTranslationParameters' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceTranslationParameters.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\ChoiceValue' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/ChoiceValue.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\GroupBy' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/GroupBy.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\Cache\\PreferredChoice' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/Cache/PreferredChoice.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\CachingFactoryDecorator' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/CachingFactoryDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\ChoiceListFactoryInterface' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/ChoiceListFactoryInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\DefaultChoiceListFactory' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/DefaultChoiceListFactory.php', + 'Symfony\\Component\\Form\\ChoiceList\\Factory\\PropertyAccessDecorator' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Factory/PropertyAccessDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\LazyChoiceList' => __DIR__ . '/..' . '/symfony/form/ChoiceList/LazyChoiceList.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\AbstractChoiceLoader' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Loader/AbstractChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\CallbackChoiceLoader' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Loader/CallbackChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\ChoiceLoaderInterface' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Loader/ChoiceLoaderInterface.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\FilterChoiceLoaderDecorator' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php', + 'Symfony\\Component\\Form\\ChoiceList\\Loader\\IntlCallbackChoiceLoader' => __DIR__ . '/..' . '/symfony/form/ChoiceList/Loader/IntlCallbackChoiceLoader.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceGroupView' => __DIR__ . '/..' . '/symfony/form/ChoiceList/View/ChoiceGroupView.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceListView' => __DIR__ . '/..' . '/symfony/form/ChoiceList/View/ChoiceListView.php', + 'Symfony\\Component\\Form\\ChoiceList\\View\\ChoiceView' => __DIR__ . '/..' . '/symfony/form/ChoiceList/View/ChoiceView.php', + 'Symfony\\Component\\Form\\ClearableErrorsInterface' => __DIR__ . '/..' . '/symfony/form/ClearableErrorsInterface.php', + 'Symfony\\Component\\Form\\ClickableInterface' => __DIR__ . '/..' . '/symfony/form/ClickableInterface.php', + 'Symfony\\Component\\Form\\Command\\DebugCommand' => __DIR__ . '/..' . '/symfony/form/Command/DebugCommand.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\Descriptor' => __DIR__ . '/..' . '/symfony/form/Console/Descriptor/Descriptor.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\JsonDescriptor' => __DIR__ . '/..' . '/symfony/form/Console/Descriptor/JsonDescriptor.php', + 'Symfony\\Component\\Form\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/form/Console/Descriptor/TextDescriptor.php', + 'Symfony\\Component\\Form\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/form/Console/Helper/DescriptorHelper.php', + 'Symfony\\Component\\Form\\DataAccessorInterface' => __DIR__ . '/..' . '/symfony/form/DataAccessorInterface.php', + 'Symfony\\Component\\Form\\DataMapperInterface' => __DIR__ . '/..' . '/symfony/form/DataMapperInterface.php', + 'Symfony\\Component\\Form\\DataTransformerInterface' => __DIR__ . '/..' . '/symfony/form/DataTransformerInterface.php', + 'Symfony\\Component\\Form\\DependencyInjection\\FormPass' => __DIR__ . '/..' . '/symfony/form/DependencyInjection/FormPass.php', + 'Symfony\\Component\\Form\\Event\\PostSetDataEvent' => __DIR__ . '/..' . '/symfony/form/Event/PostSetDataEvent.php', + 'Symfony\\Component\\Form\\Event\\PostSubmitEvent' => __DIR__ . '/..' . '/symfony/form/Event/PostSubmitEvent.php', + 'Symfony\\Component\\Form\\Event\\PreSetDataEvent' => __DIR__ . '/..' . '/symfony/form/Event/PreSetDataEvent.php', + 'Symfony\\Component\\Form\\Event\\PreSubmitEvent' => __DIR__ . '/..' . '/symfony/form/Event/PreSubmitEvent.php', + 'Symfony\\Component\\Form\\Event\\SubmitEvent' => __DIR__ . '/..' . '/symfony/form/Event/SubmitEvent.php', + 'Symfony\\Component\\Form\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/form/Exception/AccessException.php', + 'Symfony\\Component\\Form\\Exception\\AlreadySubmittedException' => __DIR__ . '/..' . '/symfony/form/Exception/AlreadySubmittedException.php', + 'Symfony\\Component\\Form\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/symfony/form/Exception/BadMethodCallException.php', + 'Symfony\\Component\\Form\\Exception\\ErrorMappingException' => __DIR__ . '/..' . '/symfony/form/Exception/ErrorMappingException.php', + 'Symfony\\Component\\Form\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/form/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Form\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/form/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Form\\Exception\\InvalidConfigurationException' => __DIR__ . '/..' . '/symfony/form/Exception/InvalidConfigurationException.php', + 'Symfony\\Component\\Form\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/form/Exception/LogicException.php', + 'Symfony\\Component\\Form\\Exception\\OutOfBoundsException' => __DIR__ . '/..' . '/symfony/form/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\Form\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/form/Exception/RuntimeException.php', + 'Symfony\\Component\\Form\\Exception\\StringCastException' => __DIR__ . '/..' . '/symfony/form/Exception/StringCastException.php', + 'Symfony\\Component\\Form\\Exception\\TransformationFailedException' => __DIR__ . '/..' . '/symfony/form/Exception/TransformationFailedException.php', + 'Symfony\\Component\\Form\\Exception\\UnexpectedTypeException' => __DIR__ . '/..' . '/symfony/form/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\Form\\Extension\\Core\\CoreExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Core/CoreExtension.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\CallbackAccessor' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataAccessor/CallbackAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\ChainAccessor' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataAccessor\\PropertyPathAccessor' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\CheckboxListMapper' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataMapper/CheckboxListMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\DataMapper' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataMapper/DataMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\PropertyPathMapper' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataMapper/PropertyPathMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\RadioListMapper' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataMapper/RadioListMapper.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ArrayToPartsTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\BaseDateTimeTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\BooleanToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/BooleanToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ChoiceToValueTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ChoicesToValuesTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DataTransformerChain' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DataTransformerChain.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateIntervalToArrayTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateIntervalToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeImmutableToDateTimeTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToArrayTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToHtml5LocalDateTimeTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToLocalizedStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToRfc3339Transformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeToTimestampTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\DateTimeZoneToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntegerToLocalizedStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntlTimeZoneToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\MoneyToLocalizedStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\PercentToLocalizedStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\StringToFloatTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/StringToFloatTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\UlidToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/UlidToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\UuidToStringTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/UuidToStringTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\ValueToDuplicatesTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\WeekToArrayTransformer' => __DIR__ . '/..' . '/symfony/form/Extension/Core/DataTransformer/WeekToArrayTransformer.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\FixUrlProtocolListener' => __DIR__ . '/..' . '/symfony/form/Extension/Core/EventListener/FixUrlProtocolListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\MergeCollectionListener' => __DIR__ . '/..' . '/symfony/form/Extension/Core/EventListener/MergeCollectionListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\ResizeFormListener' => __DIR__ . '/..' . '/symfony/form/Extension/Core/EventListener/ResizeFormListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\TransformationFailureListener' => __DIR__ . '/..' . '/symfony/form/Extension/Core/EventListener/TransformationFailureListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\EventListener\\TrimListener' => __DIR__ . '/..' . '/symfony/form/Extension/Core/EventListener/TrimListener.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/BaseType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/BirthdayType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/ButtonType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/CheckboxType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/ChoiceType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/CollectionType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/ColorType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/CountryType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/CurrencyType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/DateIntervalType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/DateTimeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/DateType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/EmailType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\EnumType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/EnumType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/FileType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/FormType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/HiddenType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/IntegerType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/LanguageType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/LocaleType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/MoneyType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/NumberType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/PasswordType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/PercentType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/RadioType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/RangeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/RepeatedType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/ResetType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/SearchType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/SubmitType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TelType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TextType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TextareaType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TimeType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TimezoneType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TransformationFailureExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/TransformationFailureExtension.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UlidType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/UlidType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/UrlType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UuidType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/UuidType.php', + 'Symfony\\Component\\Form\\Extension\\Core\\Type\\WeekType' => __DIR__ . '/..' . '/symfony/form/Extension/Core/Type/WeekType.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\CsrfExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Csrf/CsrfExtension.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\EventListener\\CsrfValidationListener' => __DIR__ . '/..' . '/symfony/form/Extension/Csrf/EventListener/CsrfValidationListener.php', + 'Symfony\\Component\\Form\\Extension\\Csrf\\Type\\FormTypeCsrfExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\DataCollectorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/DataCollectorExtension.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\EventListener\\DataCollectorListener' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/EventListener/DataCollectorListener.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataCollector' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/FormDataCollector.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataCollectorInterface' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/FormDataCollectorInterface.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataExtractor' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/FormDataExtractor.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\FormDataExtractorInterface' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/FormDataExtractorInterface.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Proxy\\ResolvedTypeDataCollectorProxy' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Proxy\\ResolvedTypeFactoryDataCollectorProxy' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php', + 'Symfony\\Component\\Form\\Extension\\DataCollector\\Type\\DataCollectorTypeExtension' => __DIR__ . '/..' . '/symfony/form/Extension/DataCollector/Type/DataCollectorTypeExtension.php', + 'Symfony\\Component\\Form\\Extension\\DependencyInjection\\DependencyInjectionExtension' => __DIR__ . '/..' . '/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationExtension' => __DIR__ . '/..' . '/symfony/form/Extension/HttpFoundation/HttpFoundationExtension.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler' => __DIR__ . '/..' . '/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php', + 'Symfony\\Component\\Form\\Extension\\HttpFoundation\\Type\\FormTypeHttpFoundationExtension' => __DIR__ . '/..' . '/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Constraints\\Form' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Constraints/Form.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Constraints\\FormValidator' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Constraints/FormValidator.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\EventListener\\ValidationListener' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/EventListener/ValidationListener.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\BaseValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Type/BaseValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\FormTypeValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Type/FormTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\RepeatedTypeValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\SubmitTypeValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Type/SubmitTypeValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Type\\UploadValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Type/UploadValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\Util\\ServerParams' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/Util/ServerParams.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ValidatorExtension' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ValidatorExtension.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ValidatorTypeGuesser' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ValidatorTypeGuesser.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\MappingRule' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/MappingRule.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\RelativePath' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/RelativePath.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationMapper' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/ViolationMapper.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationMapperInterface' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationPath' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/ViolationPath.php', + 'Symfony\\Component\\Form\\Extension\\Validator\\ViolationMapper\\ViolationPathIterator' => __DIR__ . '/..' . '/symfony/form/Extension/Validator/ViolationMapper/ViolationPathIterator.php', + 'Symfony\\Component\\Form\\FileUploadError' => __DIR__ . '/..' . '/symfony/form/FileUploadError.php', + 'Symfony\\Component\\Form\\Form' => __DIR__ . '/..' . '/symfony/form/Form.php', + 'Symfony\\Component\\Form\\FormBuilder' => __DIR__ . '/..' . '/symfony/form/FormBuilder.php', + 'Symfony\\Component\\Form\\FormBuilderInterface' => __DIR__ . '/..' . '/symfony/form/FormBuilderInterface.php', + 'Symfony\\Component\\Form\\FormConfigBuilder' => __DIR__ . '/..' . '/symfony/form/FormConfigBuilder.php', + 'Symfony\\Component\\Form\\FormConfigBuilderInterface' => __DIR__ . '/..' . '/symfony/form/FormConfigBuilderInterface.php', + 'Symfony\\Component\\Form\\FormConfigInterface' => __DIR__ . '/..' . '/symfony/form/FormConfigInterface.php', + 'Symfony\\Component\\Form\\FormError' => __DIR__ . '/..' . '/symfony/form/FormError.php', + 'Symfony\\Component\\Form\\FormErrorIterator' => __DIR__ . '/..' . '/symfony/form/FormErrorIterator.php', + 'Symfony\\Component\\Form\\FormEvent' => __DIR__ . '/..' . '/symfony/form/FormEvent.php', + 'Symfony\\Component\\Form\\FormEvents' => __DIR__ . '/..' . '/symfony/form/FormEvents.php', + 'Symfony\\Component\\Form\\FormExtensionInterface' => __DIR__ . '/..' . '/symfony/form/FormExtensionInterface.php', + 'Symfony\\Component\\Form\\FormFactory' => __DIR__ . '/..' . '/symfony/form/FormFactory.php', + 'Symfony\\Component\\Form\\FormFactoryBuilder' => __DIR__ . '/..' . '/symfony/form/FormFactoryBuilder.php', + 'Symfony\\Component\\Form\\FormFactoryBuilderInterface' => __DIR__ . '/..' . '/symfony/form/FormFactoryBuilderInterface.php', + 'Symfony\\Component\\Form\\FormFactoryInterface' => __DIR__ . '/..' . '/symfony/form/FormFactoryInterface.php', + 'Symfony\\Component\\Form\\FormInterface' => __DIR__ . '/..' . '/symfony/form/FormInterface.php', + 'Symfony\\Component\\Form\\FormRegistry' => __DIR__ . '/..' . '/symfony/form/FormRegistry.php', + 'Symfony\\Component\\Form\\FormRegistryInterface' => __DIR__ . '/..' . '/symfony/form/FormRegistryInterface.php', + 'Symfony\\Component\\Form\\FormRenderer' => __DIR__ . '/..' . '/symfony/form/FormRenderer.php', + 'Symfony\\Component\\Form\\FormRendererEngineInterface' => __DIR__ . '/..' . '/symfony/form/FormRendererEngineInterface.php', + 'Symfony\\Component\\Form\\FormRendererInterface' => __DIR__ . '/..' . '/symfony/form/FormRendererInterface.php', + 'Symfony\\Component\\Form\\FormTypeExtensionInterface' => __DIR__ . '/..' . '/symfony/form/FormTypeExtensionInterface.php', + 'Symfony\\Component\\Form\\FormTypeGuesserChain' => __DIR__ . '/..' . '/symfony/form/FormTypeGuesserChain.php', + 'Symfony\\Component\\Form\\FormTypeGuesserInterface' => __DIR__ . '/..' . '/symfony/form/FormTypeGuesserInterface.php', + 'Symfony\\Component\\Form\\FormTypeInterface' => __DIR__ . '/..' . '/symfony/form/FormTypeInterface.php', + 'Symfony\\Component\\Form\\FormView' => __DIR__ . '/..' . '/symfony/form/FormView.php', + 'Symfony\\Component\\Form\\Forms' => __DIR__ . '/..' . '/symfony/form/Forms.php', + 'Symfony\\Component\\Form\\Guess\\Guess' => __DIR__ . '/..' . '/symfony/form/Guess/Guess.php', + 'Symfony\\Component\\Form\\Guess\\TypeGuess' => __DIR__ . '/..' . '/symfony/form/Guess/TypeGuess.php', + 'Symfony\\Component\\Form\\Guess\\ValueGuess' => __DIR__ . '/..' . '/symfony/form/Guess/ValueGuess.php', + 'Symfony\\Component\\Form\\NativeRequestHandler' => __DIR__ . '/..' . '/symfony/form/NativeRequestHandler.php', + 'Symfony\\Component\\Form\\PreloadedExtension' => __DIR__ . '/..' . '/symfony/form/PreloadedExtension.php', + 'Symfony\\Component\\Form\\RequestHandlerInterface' => __DIR__ . '/..' . '/symfony/form/RequestHandlerInterface.php', + 'Symfony\\Component\\Form\\ResolvedFormType' => __DIR__ . '/..' . '/symfony/form/ResolvedFormType.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeFactory' => __DIR__ . '/..' . '/symfony/form/ResolvedFormTypeFactory.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeFactoryInterface' => __DIR__ . '/..' . '/symfony/form/ResolvedFormTypeFactoryInterface.php', + 'Symfony\\Component\\Form\\ResolvedFormTypeInterface' => __DIR__ . '/..' . '/symfony/form/ResolvedFormTypeInterface.php', + 'Symfony\\Component\\Form\\ReversedTransformer' => __DIR__ . '/..' . '/symfony/form/ReversedTransformer.php', + 'Symfony\\Component\\Form\\SubmitButton' => __DIR__ . '/..' . '/symfony/form/SubmitButton.php', + 'Symfony\\Component\\Form\\SubmitButtonBuilder' => __DIR__ . '/..' . '/symfony/form/SubmitButtonBuilder.php', + 'Symfony\\Component\\Form\\SubmitButtonTypeInterface' => __DIR__ . '/..' . '/symfony/form/SubmitButtonTypeInterface.php', + 'Symfony\\Component\\Form\\Test\\FormBuilderInterface' => __DIR__ . '/..' . '/symfony/form/Test/FormBuilderInterface.php', + 'Symfony\\Component\\Form\\Test\\FormIntegrationTestCase' => __DIR__ . '/..' . '/symfony/form/Test/FormIntegrationTestCase.php', + 'Symfony\\Component\\Form\\Test\\FormInterface' => __DIR__ . '/..' . '/symfony/form/Test/FormInterface.php', + 'Symfony\\Component\\Form\\Test\\FormPerformanceTestCase' => __DIR__ . '/..' . '/symfony/form/Test/FormPerformanceTestCase.php', + 'Symfony\\Component\\Form\\Test\\Traits\\ValidatorExtensionTrait' => __DIR__ . '/..' . '/symfony/form/Test/Traits/ValidatorExtensionTrait.php', + 'Symfony\\Component\\Form\\Test\\TypeTestCase' => __DIR__ . '/..' . '/symfony/form/Test/TypeTestCase.php', + 'Symfony\\Component\\Form\\Util\\FormUtil' => __DIR__ . '/..' . '/symfony/form/Util/FormUtil.php', + 'Symfony\\Component\\Form\\Util\\InheritDataAwareIterator' => __DIR__ . '/..' . '/symfony/form/Util/InheritDataAwareIterator.php', + 'Symfony\\Component\\Form\\Util\\OptionsResolverWrapper' => __DIR__ . '/..' . '/symfony/form/Util/OptionsResolverWrapper.php', + 'Symfony\\Component\\Form\\Util\\OrderedHashMap' => __DIR__ . '/..' . '/symfony/form/Util/OrderedHashMap.php', + 'Symfony\\Component\\Form\\Util\\OrderedHashMapIterator' => __DIR__ . '/..' . '/symfony/form/Util/OrderedHashMapIterator.php', + 'Symfony\\Component\\Form\\Util\\ServerParams' => __DIR__ . '/..' . '/symfony/form/Util/ServerParams.php', + 'Symfony\\Component\\Form\\Util\\StringUtil' => __DIR__ . '/..' . '/symfony/form/Util/StringUtil.php', + 'Symfony\\Component\\HttpClient\\AmpHttpClient' => __DIR__ . '/..' . '/symfony/http-client/AmpHttpClient.php', + 'Symfony\\Component\\HttpClient\\AsyncDecoratorTrait' => __DIR__ . '/..' . '/symfony/http-client/AsyncDecoratorTrait.php', + 'Symfony\\Component\\HttpClient\\CachingHttpClient' => __DIR__ . '/..' . '/symfony/http-client/CachingHttpClient.php', + 'Symfony\\Component\\HttpClient\\Chunk\\DataChunk' => __DIR__ . '/..' . '/symfony/http-client/Chunk/DataChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\ErrorChunk' => __DIR__ . '/..' . '/symfony/http-client/Chunk/ErrorChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\FirstChunk' => __DIR__ . '/..' . '/symfony/http-client/Chunk/FirstChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\InformationalChunk' => __DIR__ . '/..' . '/symfony/http-client/Chunk/InformationalChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\LastChunk' => __DIR__ . '/..' . '/symfony/http-client/Chunk/LastChunk.php', + 'Symfony\\Component\\HttpClient\\Chunk\\ServerSentEvent' => __DIR__ . '/..' . '/symfony/http-client/Chunk/ServerSentEvent.php', + 'Symfony\\Component\\HttpClient\\CurlHttpClient' => __DIR__ . '/..' . '/symfony/http-client/CurlHttpClient.php', + 'Symfony\\Component\\HttpClient\\DataCollector\\HttpClientDataCollector' => __DIR__ . '/..' . '/symfony/http-client/DataCollector/HttpClientDataCollector.php', + 'Symfony\\Component\\HttpClient\\DecoratorTrait' => __DIR__ . '/..' . '/symfony/http-client/DecoratorTrait.php', + 'Symfony\\Component\\HttpClient\\DependencyInjection\\HttpClientPass' => __DIR__ . '/..' . '/symfony/http-client/DependencyInjection/HttpClientPass.php', + 'Symfony\\Component\\HttpClient\\EventSourceHttpClient' => __DIR__ . '/..' . '/symfony/http-client/EventSourceHttpClient.php', + 'Symfony\\Component\\HttpClient\\Exception\\ClientException' => __DIR__ . '/..' . '/symfony/http-client/Exception/ClientException.php', + 'Symfony\\Component\\HttpClient\\Exception\\EventSourceException' => __DIR__ . '/..' . '/symfony/http-client/Exception/EventSourceException.php', + 'Symfony\\Component\\HttpClient\\Exception\\HttpExceptionTrait' => __DIR__ . '/..' . '/symfony/http-client/Exception/HttpExceptionTrait.php', + 'Symfony\\Component\\HttpClient\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/http-client/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\HttpClient\\Exception\\JsonException' => __DIR__ . '/..' . '/symfony/http-client/Exception/JsonException.php', + 'Symfony\\Component\\HttpClient\\Exception\\RedirectionException' => __DIR__ . '/..' . '/symfony/http-client/Exception/RedirectionException.php', + 'Symfony\\Component\\HttpClient\\Exception\\ServerException' => __DIR__ . '/..' . '/symfony/http-client/Exception/ServerException.php', + 'Symfony\\Component\\HttpClient\\Exception\\TimeoutException' => __DIR__ . '/..' . '/symfony/http-client/Exception/TimeoutException.php', + 'Symfony\\Component\\HttpClient\\Exception\\TransportException' => __DIR__ . '/..' . '/symfony/http-client/Exception/TransportException.php', + 'Symfony\\Component\\HttpClient\\HttpClient' => __DIR__ . '/..' . '/symfony/http-client/HttpClient.php', + 'Symfony\\Component\\HttpClient\\HttpClientTrait' => __DIR__ . '/..' . '/symfony/http-client/HttpClientTrait.php', + 'Symfony\\Component\\HttpClient\\HttpOptions' => __DIR__ . '/..' . '/symfony/http-client/HttpOptions.php', + 'Symfony\\Component\\HttpClient\\HttplugClient' => __DIR__ . '/..' . '/symfony/http-client/HttplugClient.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpBody' => __DIR__ . '/..' . '/symfony/http-client/Internal/AmpBody.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpClientState' => __DIR__ . '/..' . '/symfony/http-client/Internal/AmpClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpListener' => __DIR__ . '/..' . '/symfony/http-client/Internal/AmpListener.php', + 'Symfony\\Component\\HttpClient\\Internal\\AmpResolver' => __DIR__ . '/..' . '/symfony/http-client/Internal/AmpResolver.php', + 'Symfony\\Component\\HttpClient\\Internal\\Canary' => __DIR__ . '/..' . '/symfony/http-client/Internal/Canary.php', + 'Symfony\\Component\\HttpClient\\Internal\\ClientState' => __DIR__ . '/..' . '/symfony/http-client/Internal/ClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\CurlClientState' => __DIR__ . '/..' . '/symfony/http-client/Internal/CurlClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\DnsCache' => __DIR__ . '/..' . '/symfony/http-client/Internal/DnsCache.php', + 'Symfony\\Component\\HttpClient\\Internal\\HttplugWaitLoop' => __DIR__ . '/..' . '/symfony/http-client/Internal/HttplugWaitLoop.php', + 'Symfony\\Component\\HttpClient\\Internal\\NativeClientState' => __DIR__ . '/..' . '/symfony/http-client/Internal/NativeClientState.php', + 'Symfony\\Component\\HttpClient\\Internal\\PushedResponse' => __DIR__ . '/..' . '/symfony/http-client/Internal/PushedResponse.php', + 'Symfony\\Component\\HttpClient\\MockHttpClient' => __DIR__ . '/..' . '/symfony/http-client/MockHttpClient.php', + 'Symfony\\Component\\HttpClient\\NativeHttpClient' => __DIR__ . '/..' . '/symfony/http-client/NativeHttpClient.php', + 'Symfony\\Component\\HttpClient\\NoPrivateNetworkHttpClient' => __DIR__ . '/..' . '/symfony/http-client/NoPrivateNetworkHttpClient.php', + 'Symfony\\Component\\HttpClient\\Psr18Client' => __DIR__ . '/..' . '/symfony/http-client/Psr18Client.php', + 'Symfony\\Component\\HttpClient\\Response\\AmpResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/AmpResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\AsyncContext' => __DIR__ . '/..' . '/symfony/http-client/Response/AsyncContext.php', + 'Symfony\\Component\\HttpClient\\Response\\AsyncResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/AsyncResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\CommonResponseTrait' => __DIR__ . '/..' . '/symfony/http-client/Response/CommonResponseTrait.php', + 'Symfony\\Component\\HttpClient\\Response\\CurlResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/CurlResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\HttplugPromise' => __DIR__ . '/..' . '/symfony/http-client/Response/HttplugPromise.php', + 'Symfony\\Component\\HttpClient\\Response\\MockResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/MockResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\NativeResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/NativeResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\ResponseStream' => __DIR__ . '/..' . '/symfony/http-client/Response/ResponseStream.php', + 'Symfony\\Component\\HttpClient\\Response\\StreamWrapper' => __DIR__ . '/..' . '/symfony/http-client/Response/StreamWrapper.php', + 'Symfony\\Component\\HttpClient\\Response\\StreamableInterface' => __DIR__ . '/..' . '/symfony/http-client/Response/StreamableInterface.php', + 'Symfony\\Component\\HttpClient\\Response\\TraceableResponse' => __DIR__ . '/..' . '/symfony/http-client/Response/TraceableResponse.php', + 'Symfony\\Component\\HttpClient\\Response\\TransportResponseTrait' => __DIR__ . '/..' . '/symfony/http-client/Response/TransportResponseTrait.php', + 'Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy' => __DIR__ . '/..' . '/symfony/http-client/Retry/GenericRetryStrategy.php', + 'Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface' => __DIR__ . '/..' . '/symfony/http-client/Retry/RetryStrategyInterface.php', + 'Symfony\\Component\\HttpClient\\RetryableHttpClient' => __DIR__ . '/..' . '/symfony/http-client/RetryableHttpClient.php', + 'Symfony\\Component\\HttpClient\\ScopingHttpClient' => __DIR__ . '/..' . '/symfony/http-client/ScopingHttpClient.php', + 'Symfony\\Component\\HttpClient\\TraceableHttpClient' => __DIR__ . '/..' . '/symfony/http-client/TraceableHttpClient.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeaderItem.php', 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => __DIR__ . '/..' . '/symfony/http-foundation/BinaryFileResponse.php', @@ -1047,6 +1607,81 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Component\\HttpKernel\\RebootableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => __DIR__ . '/..' . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => __DIR__ . '/..' . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/AccessException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/ExceptionInterface.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/MissingOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoConfigurationException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoSuchOptionException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/OptionDefinitionException.php', + 'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/UndefinedOptionsException.php', + 'Symfony\\Component\\OptionsResolver\\OptionConfigurator' => __DIR__ . '/..' . '/symfony/options-resolver/OptionConfigurator.php', + 'Symfony\\Component\\OptionsResolver\\Options' => __DIR__ . '/..' . '/symfony/options-resolver/Options.php', + 'Symfony\\Component\\OptionsResolver\\OptionsResolver' => __DIR__ . '/..' . '/symfony/options-resolver/OptionsResolver.php', + 'Symfony\\Component\\PasswordHasher\\Command\\UserPasswordHashCommand' => __DIR__ . '/..' . '/symfony/password-hasher/Command/UserPasswordHashCommand.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/password-hasher/Exception/ExceptionInterface.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\InvalidPasswordException' => __DIR__ . '/..' . '/symfony/password-hasher/Exception/InvalidPasswordException.php', + 'Symfony\\Component\\PasswordHasher\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/password-hasher/Exception/LogicException.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\CheckPasswordLengthTrait' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/CheckPasswordLengthTrait.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\MessageDigestPasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/MessageDigestPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\MigratingPasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/MigratingPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\NativePasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/NativePasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherAwareInterface' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/PasswordHasherAwareInterface.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactory' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/PasswordHasherFactory.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactoryInterface' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/PasswordHasherFactoryInterface.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\Pbkdf2PasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/Pbkdf2PasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\PlaintextPasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/PlaintextPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\SodiumPasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/SodiumPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\UserPasswordHasher' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/UserPasswordHasher.php', + 'Symfony\\Component\\PasswordHasher\\Hasher\\UserPasswordHasherInterface' => __DIR__ . '/..' . '/symfony/password-hasher/Hasher/UserPasswordHasherInterface.php', + 'Symfony\\Component\\PasswordHasher\\LegacyPasswordHasherInterface' => __DIR__ . '/..' . '/symfony/password-hasher/LegacyPasswordHasherInterface.php', + 'Symfony\\Component\\PasswordHasher\\PasswordHasherInterface' => __DIR__ . '/..' . '/symfony/password-hasher/PasswordHasherInterface.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/property-access/Exception/AccessException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/property-access/Exception/ExceptionInterface.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/property-access/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\InvalidPropertyPathException' => __DIR__ . '/..' . '/symfony/property-access/Exception/InvalidPropertyPathException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\NoSuchIndexException' => __DIR__ . '/..' . '/symfony/property-access/Exception/NoSuchIndexException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\NoSuchPropertyException' => __DIR__ . '/..' . '/symfony/property-access/Exception/NoSuchPropertyException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\OutOfBoundsException' => __DIR__ . '/..' . '/symfony/property-access/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/property-access/Exception/RuntimeException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\UnexpectedTypeException' => __DIR__ . '/..' . '/symfony/property-access/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\PropertyAccess\\Exception\\UninitializedPropertyException' => __DIR__ . '/..' . '/symfony/property-access/Exception/UninitializedPropertyException.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccess' => __DIR__ . '/..' . '/symfony/property-access/PropertyAccess.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessor' => __DIR__ . '/..' . '/symfony/property-access/PropertyAccessor.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessorBuilder' => __DIR__ . '/..' . '/symfony/property-access/PropertyAccessorBuilder.php', + 'Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface' => __DIR__ . '/..' . '/symfony/property-access/PropertyAccessorInterface.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPath' => __DIR__ . '/..' . '/symfony/property-access/PropertyPath.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathBuilder' => __DIR__ . '/..' . '/symfony/property-access/PropertyPathBuilder.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathInterface' => __DIR__ . '/..' . '/symfony/property-access/PropertyPathInterface.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathIterator' => __DIR__ . '/..' . '/symfony/property-access/PropertyPathIterator.php', + 'Symfony\\Component\\PropertyAccess\\PropertyPathIteratorInterface' => __DIR__ . '/..' . '/symfony/property-access/PropertyPathIteratorInterface.php', + 'Symfony\\Component\\PropertyInfo\\DependencyInjection\\PropertyInfoConstructorPass' => __DIR__ . '/..' . '/symfony/property-info/DependencyInjection/PropertyInfoConstructorPass.php', + 'Symfony\\Component\\PropertyInfo\\DependencyInjection\\PropertyInfoPass' => __DIR__ . '/..' . '/symfony/property-info/DependencyInjection/PropertyInfoPass.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ConstructorArgumentTypeExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/Extractor/ConstructorArgumentTypeExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ConstructorExtractor' => __DIR__ . '/..' . '/symfony/property-info/Extractor/ConstructorExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor' => __DIR__ . '/..' . '/symfony/property-info/Extractor/PhpDocExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\PhpStanExtractor' => __DIR__ . '/..' . '/symfony/property-info/Extractor/PhpStanExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\ReflectionExtractor' => __DIR__ . '/..' . '/symfony/property-info/Extractor/ReflectionExtractor.php', + 'Symfony\\Component\\PropertyInfo\\Extractor\\SerializerExtractor' => __DIR__ . '/..' . '/symfony/property-info/Extractor/SerializerExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PhpStan\\NameScope' => __DIR__ . '/..' . '/symfony/property-info/PhpStan/NameScope.php', + 'Symfony\\Component\\PropertyInfo\\PhpStan\\NameScopeFactory' => __DIR__ . '/..' . '/symfony/property-info/PhpStan/NameScopeFactory.php', + 'Symfony\\Component\\PropertyInfo\\PropertyAccessExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyAccessExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyDescriptionExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyDescriptionExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoCacheExtractor' => __DIR__ . '/..' . '/symfony/property-info/PropertyInfoCacheExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor' => __DIR__ . '/..' . '/symfony/property-info/PropertyInfoExtractor.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInfoExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyInitializableExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyInitializableExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyListExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyListExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyReadInfo' => __DIR__ . '/..' . '/symfony/property-info/PropertyReadInfo.php', + 'Symfony\\Component\\PropertyInfo\\PropertyReadInfoExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyReadInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyTypeExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\PropertyWriteInfo' => __DIR__ . '/..' . '/symfony/property-info/PropertyWriteInfo.php', + 'Symfony\\Component\\PropertyInfo\\PropertyWriteInfoExtractorInterface' => __DIR__ . '/..' . '/symfony/property-info/PropertyWriteInfoExtractorInterface.php', + 'Symfony\\Component\\PropertyInfo\\Type' => __DIR__ . '/..' . '/symfony/property-info/Type.php', + 'Symfony\\Component\\PropertyInfo\\Util\\PhpDocTypeHelper' => __DIR__ . '/..' . '/symfony/property-info/Util/PhpDocTypeHelper.php', + 'Symfony\\Component\\PropertyInfo\\Util\\PhpStanTypeHelper' => __DIR__ . '/..' . '/symfony/property-info/Util/PhpStanTypeHelper.php', 'Symfony\\Component\\Routing\\Alias' => __DIR__ . '/..' . '/symfony/routing/Alias.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => __DIR__ . '/..' . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\CompiledRoute' => __DIR__ . '/..' . '/symfony/routing/CompiledRoute.php', @@ -1126,6 +1761,281 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Component\\Runtime\\Runner\\Symfony\\ResponseRunner' => __DIR__ . '/..' . '/symfony/runtime/Runner/Symfony/ResponseRunner.php', 'Symfony\\Component\\Runtime\\RuntimeInterface' => __DIR__ . '/..' . '/symfony/runtime/RuntimeInterface.php', 'Symfony\\Component\\Runtime\\SymfonyRuntime' => __DIR__ . '/..' . '/symfony/runtime/SymfonyRuntime.php', + 'Symfony\\Component\\Security\\Core\\AuthenticationEvents' => __DIR__ . '/..' . '/symfony/security-core/AuthenticationEvents.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationManagerInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/AuthenticationManagerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager' => __DIR__ . '/..' . '/symfony/security-core/Authentication/AuthenticationProviderManager.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolver' => __DIR__ . '/..' . '/symfony/security-core/Authentication/AuthenticationTrustResolver.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/AuthenticationTrustResolverInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AnonymousAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\AuthenticationProviderInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/AuthenticationProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\LdapBindAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/LdapBindAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\PreAuthenticatedAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\RememberMeAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/RememberMeAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Provider\\UserAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\CacheTokenVerifier' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/CacheTokenVerifier.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\InMemoryTokenProvider' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/InMemoryTokenProvider.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/PersistentToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\PersistentTokenInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/PersistentTokenInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\TokenProviderInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/TokenProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\RememberMe\\TokenVerifierInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/RememberMe/TokenVerifierInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AbstractToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/AbstractToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\AnonymousToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/AnonymousToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/NullToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\PreAuthenticatedToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/PreAuthenticatedToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\RememberMeToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/RememberMeToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorage' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/Storage/TokenStorage.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/Storage/TokenStorageInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\UsageTrackingTokenStorage' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/Storage/UsageTrackingTokenStorage.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\SwitchUserToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/SwitchUserToken.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/TokenInterface.php', + 'Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken' => __DIR__ . '/..' . '/symfony/security-core/Authentication/Token/UsernamePasswordToken.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManager' => __DIR__ . '/..' . '/symfony/security-core/Authorization/AccessDecisionManager.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface' => __DIR__ . '/..' . '/symfony/security-core/Authorization/AccessDecisionManagerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationChecker' => __DIR__ . '/..' . '/symfony/security-core/Authorization/AuthorizationChecker.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface' => __DIR__ . '/..' . '/symfony/security-core/Authorization/AuthorizationCheckerInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguage' => __DIR__ . '/..' . '/symfony/security-core/Authorization/ExpressionLanguage.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguageProvider' => __DIR__ . '/..' . '/symfony/security-core/Authorization/ExpressionLanguageProvider.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\AccessDecisionStrategyInterface' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Strategy/AccessDecisionStrategyInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\AffirmativeStrategy' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Strategy/AffirmativeStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\ConsensusStrategy' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Strategy/ConsensusStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\PriorityStrategy' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Strategy/PriorityStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Strategy\\UnanimousStrategy' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Strategy/UnanimousStrategy.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\TraceableAccessDecisionManager' => __DIR__ . '/..' . '/symfony/security-core/Authorization/TraceableAccessDecisionManager.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/AuthenticatedVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\CacheableVoterInterface' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/CacheableVoterInterface.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\ExpressionVoter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/ExpressionVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleHierarchyVoter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/RoleHierarchyVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\RoleVoter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/RoleVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\TraceableVoter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/TraceableVoter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\Voter' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/Voter.php', + 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface' => __DIR__ . '/..' . '/symfony/security-core/Authorization/Voter/VoterInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\BasePasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/BasePasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderAwareInterface' => __DIR__ . '/..' . '/symfony/security-core/Encoder/EncoderAwareInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactory' => __DIR__ . '/..' . '/symfony/security-core/Encoder/EncoderFactory.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface' => __DIR__ . '/..' . '/symfony/security-core/Encoder/EncoderFactoryInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\LegacyEncoderTrait' => __DIR__ . '/..' . '/symfony/security-core/Encoder/LegacyEncoderTrait.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\LegacyPasswordHasherEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/LegacyPasswordHasherEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\MessageDigestPasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/MessageDigestPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\MigratingPasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/MigratingPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\NativePasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/NativePasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface' => __DIR__ . '/..' . '/symfony/security-core/Encoder/PasswordEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordHasherAdapter' => __DIR__ . '/..' . '/symfony/security-core/Encoder/PasswordHasherAdapter.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PasswordHasherEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/PasswordHasherEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\Pbkdf2PasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/Pbkdf2PasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\PlaintextPasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/PlaintextPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\SelfSaltingEncoderInterface' => __DIR__ . '/..' . '/symfony/security-core/Encoder/SelfSaltingEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\SodiumPasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/SodiumPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoder' => __DIR__ . '/..' . '/symfony/security-core/Encoder/UserPasswordEncoder.php', + 'Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface' => __DIR__ . '/..' . '/symfony/security-core/Encoder/UserPasswordEncoderInterface.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationEvent' => __DIR__ . '/..' . '/symfony/security-core/Event/AuthenticationEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationFailureEvent' => __DIR__ . '/..' . '/symfony/security-core/Event/AuthenticationFailureEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\AuthenticationSuccessEvent' => __DIR__ . '/..' . '/symfony/security-core/Event/AuthenticationSuccessEvent.php', + 'Symfony\\Component\\Security\\Core\\Event\\VoteEvent' => __DIR__ . '/..' . '/symfony/security-core/Event/VoteEvent.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccountExpiredException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AccountExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AccountStatusException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationCredentialsNotFoundException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AuthenticationCredentialsNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExpiredException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AuthenticationExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException' => __DIR__ . '/..' . '/symfony/security-core/Exception/AuthenticationServiceException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException' => __DIR__ . '/..' . '/symfony/security-core/Exception/BadCredentialsException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CookieTheftException' => __DIR__ . '/..' . '/symfony/security-core/Exception/CookieTheftException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CredentialsExpiredException' => __DIR__ . '/..' . '/symfony/security-core/Exception/CredentialsExpiredException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CustomUserMessageAccountStatusException' => __DIR__ . '/..' . '/symfony/security-core/Exception/CustomUserMessageAccountStatusException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\CustomUserMessageAuthenticationException' => __DIR__ . '/..' . '/symfony/security-core/Exception/CustomUserMessageAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\DisabledException' => __DIR__ . '/..' . '/symfony/security-core/Exception/DisabledException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/security-core/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InsufficientAuthenticationException' => __DIR__ . '/..' . '/symfony/security-core/Exception/InsufficientAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/security-core/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException' => __DIR__ . '/..' . '/symfony/security-core/Exception/InvalidCsrfTokenException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LazyResponseException' => __DIR__ . '/..' . '/symfony/security-core/Exception/LazyResponseException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LockedException' => __DIR__ . '/..' . '/symfony/security-core/Exception/LockedException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/security-core/Exception/LogicException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\LogoutException' => __DIR__ . '/..' . '/symfony/security-core/Exception/LogoutException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\ProviderNotFoundException' => __DIR__ . '/..' . '/symfony/security-core/Exception/ProviderNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/security-core/Exception/RuntimeException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\SessionUnavailableException' => __DIR__ . '/..' . '/symfony/security-core/Exception/SessionUnavailableException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\TokenNotFoundException' => __DIR__ . '/..' . '/symfony/security-core/Exception/TokenNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\TooManyLoginAttemptsAuthenticationException' => __DIR__ . '/..' . '/symfony/security-core/Exception/TooManyLoginAttemptsAuthenticationException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UnsupportedUserException' => __DIR__ . '/..' . '/symfony/security-core/Exception/UnsupportedUserException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UserNotFoundException' => __DIR__ . '/..' . '/symfony/security-core/Exception/UserNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Exception\\UsernameNotFoundException' => __DIR__ . '/..' . '/symfony/security-core/Exception/UsernameNotFoundException.php', + 'Symfony\\Component\\Security\\Core\\Role\\Role' => __DIR__ . '/..' . '/symfony/security-core/Role/Role.php', + 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchy' => __DIR__ . '/..' . '/symfony/security-core/Role/RoleHierarchy.php', + 'Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface' => __DIR__ . '/..' . '/symfony/security-core/Role/RoleHierarchyInterface.php', + 'Symfony\\Component\\Security\\Core\\Role\\SwitchUserRole' => __DIR__ . '/..' . '/symfony/security-core/Role/SwitchUserRole.php', + 'Symfony\\Component\\Security\\Core\\Security' => __DIR__ . '/..' . '/symfony/security-core/Security.php', + 'Symfony\\Component\\Security\\Core\\Signature\\Exception\\ExpiredSignatureException' => __DIR__ . '/..' . '/symfony/security-core/Signature/Exception/ExpiredSignatureException.php', + 'Symfony\\Component\\Security\\Core\\Signature\\Exception\\InvalidSignatureException' => __DIR__ . '/..' . '/symfony/security-core/Signature/Exception/InvalidSignatureException.php', + 'Symfony\\Component\\Security\\Core\\Signature\\ExpiredSignatureStorage' => __DIR__ . '/..' . '/symfony/security-core/Signature/ExpiredSignatureStorage.php', + 'Symfony\\Component\\Security\\Core\\Signature\\SignatureHasher' => __DIR__ . '/..' . '/symfony/security-core/Signature/SignatureHasher.php', + 'Symfony\\Component\\Security\\Core\\Test\\AccessDecisionStrategyTestCase' => __DIR__ . '/..' . '/symfony/security-core/Test/AccessDecisionStrategyTestCase.php', + 'Symfony\\Component\\Security\\Core\\User\\ChainUserProvider' => __DIR__ . '/..' . '/symfony/security-core/User/ChainUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\EquatableInterface' => __DIR__ . '/..' . '/symfony/security-core/User/EquatableInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUser' => __DIR__ . '/..' . '/symfony/security-core/User/InMemoryUser.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUserChecker' => __DIR__ . '/..' . '/symfony/security-core/User/InMemoryUserChecker.php', + 'Symfony\\Component\\Security\\Core\\User\\InMemoryUserProvider' => __DIR__ . '/..' . '/symfony/security-core/User/InMemoryUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\LegacyPasswordAuthenticatedUserInterface' => __DIR__ . '/..' . '/symfony/security-core/User/LegacyPasswordAuthenticatedUserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\MissingUserProvider' => __DIR__ . '/..' . '/symfony/security-core/User/MissingUserProvider.php', + 'Symfony\\Component\\Security\\Core\\User\\PasswordAuthenticatedUserInterface' => __DIR__ . '/..' . '/symfony/security-core/User/PasswordAuthenticatedUserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\PasswordUpgraderInterface' => __DIR__ . '/..' . '/symfony/security-core/User/PasswordUpgraderInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\User' => __DIR__ . '/..' . '/symfony/security-core/User/User.php', + 'Symfony\\Component\\Security\\Core\\User\\UserChecker' => __DIR__ . '/..' . '/symfony/security-core/User/UserChecker.php', + 'Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface' => __DIR__ . '/..' . '/symfony/security-core/User/UserCheckerInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\UserInterface' => __DIR__ . '/..' . '/symfony/security-core/User/UserInterface.php', + 'Symfony\\Component\\Security\\Core\\User\\UserProviderInterface' => __DIR__ . '/..' . '/symfony/security-core/User/UserProviderInterface.php', + 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword' => __DIR__ . '/..' . '/symfony/security-core/Validator/Constraints/UserPassword.php', + 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator' => __DIR__ . '/..' . '/symfony/security-core/Validator/Constraints/UserPasswordValidator.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfToken' => __DIR__ . '/..' . '/symfony/security-csrf/CsrfToken.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManager' => __DIR__ . '/..' . '/symfony/security-csrf/CsrfTokenManager.php', + 'Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface' => __DIR__ . '/..' . '/symfony/security-csrf/CsrfTokenManagerInterface.php', + 'Symfony\\Component\\Security\\Csrf\\Exception\\TokenNotFoundException' => __DIR__ . '/..' . '/symfony/security-csrf/Exception/TokenNotFoundException.php', + 'Symfony\\Component\\Security\\Csrf\\TokenGenerator\\TokenGeneratorInterface' => __DIR__ . '/..' . '/symfony/security-csrf/TokenGenerator/TokenGeneratorInterface.php', + 'Symfony\\Component\\Security\\Csrf\\TokenGenerator\\UriSafeTokenGenerator' => __DIR__ . '/..' . '/symfony/security-csrf/TokenGenerator/UriSafeTokenGenerator.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\ClearableTokenStorageInterface' => __DIR__ . '/..' . '/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\NativeSessionTokenStorage' => __DIR__ . '/..' . '/symfony/security-csrf/TokenStorage/NativeSessionTokenStorage.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\SessionTokenStorage' => __DIR__ . '/..' . '/symfony/security-csrf/TokenStorage/SessionTokenStorage.php', + 'Symfony\\Component\\Security\\Csrf\\TokenStorage\\TokenStorageInterface' => __DIR__ . '/..' . '/symfony/security-csrf/TokenStorage/TokenStorageInterface.php', + 'Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator' => __DIR__ . '/..' . '/symfony/security-guard/AbstractGuardAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\AuthenticatorInterface' => __DIR__ . '/..' . '/symfony/security-guard/AuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Guard\\Authenticator\\AbstractFormLoginAuthenticator' => __DIR__ . '/..' . '/symfony/security-guard/Authenticator/AbstractFormLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\Authenticator\\GuardBridgeAuthenticator' => __DIR__ . '/..' . '/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php', + 'Symfony\\Component\\Security\\Guard\\Firewall\\GuardAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-guard/Firewall/GuardAuthenticationListener.php', + 'Symfony\\Component\\Security\\Guard\\GuardAuthenticatorHandler' => __DIR__ . '/..' . '/symfony/security-guard/GuardAuthenticatorHandler.php', + 'Symfony\\Component\\Security\\Guard\\PasswordAuthenticatedInterface' => __DIR__ . '/..' . '/symfony/security-guard/PasswordAuthenticatedInterface.php', + 'Symfony\\Component\\Security\\Guard\\Provider\\GuardAuthenticationProvider' => __DIR__ . '/..' . '/symfony/security-guard/Provider/GuardAuthenticationProvider.php', + 'Symfony\\Component\\Security\\Guard\\Token\\GuardTokenInterface' => __DIR__ . '/..' . '/symfony/security-guard/Token/GuardTokenInterface.php', + 'Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken' => __DIR__ . '/..' . '/symfony/security-guard/Token/PostAuthenticationGuardToken.php', + 'Symfony\\Component\\Security\\Guard\\Token\\PreAuthenticationGuardToken' => __DIR__ . '/..' . '/symfony/security-guard/Token/PreAuthenticationGuardToken.php', + 'Symfony\\Component\\Security\\Http\\AccessMap' => __DIR__ . '/..' . '/symfony/security-http/AccessMap.php', + 'Symfony\\Component\\Security\\Http\\AccessMapInterface' => __DIR__ . '/..' . '/symfony/security-http/AccessMapInterface.php', + 'Symfony\\Component\\Security\\Http\\Attribute\\CurrentUser' => __DIR__ . '/..' . '/symfony/security-http/Attribute/CurrentUser.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationFailureHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/Authentication/AuthenticationFailureHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationSuccessHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/Authentication/AuthenticationSuccessHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationUtils' => __DIR__ . '/..' . '/symfony/security-http/Authentication/AuthenticationUtils.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticatorManager' => __DIR__ . '/..' . '/symfony/security-http/Authentication/AuthenticatorManager.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\AuthenticatorManagerInterface' => __DIR__ . '/..' . '/symfony/security-http/Authentication/AuthenticatorManagerInterface.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\CustomAuthenticationFailureHandler' => __DIR__ . '/..' . '/symfony/security-http/Authentication/CustomAuthenticationFailureHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\CustomAuthenticationSuccessHandler' => __DIR__ . '/..' . '/symfony/security-http/Authentication/CustomAuthenticationSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\DefaultAuthenticationFailureHandler' => __DIR__ . '/..' . '/symfony/security-http/Authentication/DefaultAuthenticationFailureHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\DefaultAuthenticationSuccessHandler' => __DIR__ . '/..' . '/symfony/security-http/Authentication/DefaultAuthenticationSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\NoopAuthenticationManager' => __DIR__ . '/..' . '/symfony/security-http/Authentication/NoopAuthenticationManager.php', + 'Symfony\\Component\\Security\\Http\\Authentication\\UserAuthenticatorInterface' => __DIR__ . '/..' . '/symfony/security-http/Authentication/UserAuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/AbstractAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractLoginFormAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/AbstractLoginFormAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AbstractPreAuthenticatedAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/AbstractPreAuthenticatedAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\AuthenticatorInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/AuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticatorManagerListener' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/FormLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\HttpBasicAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/HttpBasicAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\InteractiveAuthenticatorInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/InteractiveAuthenticatorInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\JsonLoginAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/JsonLoginAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\LoginLinkAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/LoginLinkAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\BadgeInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/BadgeInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\CsrfTokenBadge' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/CsrfTokenBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\PasswordUpgradeBadge' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\PreAuthenticatedUserBadge' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/PreAuthenticatedUserBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\RememberMeBadge' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/RememberMeBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Badge\\UserBadge' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\CredentialsInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Credentials/CredentialsInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\CustomCredentials' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Credentials/CustomCredentials.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Credentials\\PasswordCredentials' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\Passport' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/Passport.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\PassportInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/PassportInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\PassportTrait' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/PassportTrait.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\SelfValidatingPassport' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/SelfValidatingPassport.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Passport\\UserPassportInterface' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Passport/UserPassportInterface.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\RememberMeAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/RememberMeAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\RemoteUserAuthenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/RemoteUserAuthenticator.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\Token\\PostAuthenticationToken' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/Token/PostAuthenticationToken.php', + 'Symfony\\Component\\Security\\Http\\Authenticator\\X509Authenticator' => __DIR__ . '/..' . '/symfony/security-http/Authenticator/X509Authenticator.php', + 'Symfony\\Component\\Security\\Http\\Authorization\\AccessDeniedHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/Authorization/AccessDeniedHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Controller\\UserValueResolver' => __DIR__ . '/..' . '/symfony/security-http/Controller/UserValueResolver.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\AuthenticationEntryPointInterface' => __DIR__ . '/..' . '/symfony/security-http/EntryPoint/AuthenticationEntryPointInterface.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\BasicAuthenticationEntryPoint' => __DIR__ . '/..' . '/symfony/security-http/EntryPoint/BasicAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\Exception\\NotAnEntryPointException' => __DIR__ . '/..' . '/symfony/security-http/EntryPoint/Exception/NotAnEntryPointException.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\FormAuthenticationEntryPoint' => __DIR__ . '/..' . '/symfony/security-http/EntryPoint/FormAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EntryPoint\\RetryAuthenticationEntryPoint' => __DIR__ . '/..' . '/symfony/security-http/EntryPoint/RetryAuthenticationEntryPoint.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CheckCredentialsListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/CheckCredentialsListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CheckRememberMeConditionsListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/CheckRememberMeConditionsListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CookieClearingLogoutListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/CookieClearingLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CsrfProtectionListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/CsrfProtectionListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\CsrfTokenClearingLogoutListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/CsrfTokenClearingLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\DefaultLogoutListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/DefaultLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\LoginThrottlingListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/LoginThrottlingListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\PasswordMigratingListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/PasswordMigratingListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\RememberMeListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/RememberMeListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\RememberMeLogoutListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/RememberMeLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\SessionLogoutListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/SessionLogoutListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\SessionStrategyListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/SessionStrategyListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\UserCheckerListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/UserCheckerListener.php', + 'Symfony\\Component\\Security\\Http\\EventListener\\UserProviderListener' => __DIR__ . '/..' . '/symfony/security-http/EventListener/UserProviderListener.php', + 'Symfony\\Component\\Security\\Http\\Event\\AuthenticationTokenCreatedEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/AuthenticationTokenCreatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\CheckPassportEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/CheckPassportEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\DeauthenticatedEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/DeauthenticatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\InteractiveLoginEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/InteractiveLoginEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LazyResponseEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/LazyResponseEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LoginFailureEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/LoginFailureEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LoginSuccessEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/LoginSuccessEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\LogoutEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/LogoutEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\SwitchUserEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/SwitchUserEvent.php', + 'Symfony\\Component\\Security\\Http\\Event\\TokenDeauthenticatedEvent' => __DIR__ . '/..' . '/symfony/security-http/Event/TokenDeauthenticatedEvent.php', + 'Symfony\\Component\\Security\\Http\\Firewall' => __DIR__ . '/..' . '/symfony/security-http/Firewall.php', + 'Symfony\\Component\\Security\\Http\\FirewallMap' => __DIR__ . '/..' . '/symfony/security-http/FirewallMap.php', + 'Symfony\\Component\\Security\\Http\\FirewallMapInterface' => __DIR__ . '/..' . '/symfony/security-http/FirewallMapInterface.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AbstractAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AbstractListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AbstractPreAuthenticatedListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AbstractPreAuthenticatedListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AccessListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AccessListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AnonymousAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AnonymousAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\AuthenticatorManagerListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/AuthenticatorManagerListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\BasicAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/BasicAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ChannelListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/ChannelListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ContextListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/ContextListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/ExceptionListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\FirewallListenerInterface' => __DIR__ . '/..' . '/symfony/security-http/Firewall/FirewallListenerInterface.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\LogoutListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/LogoutListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\RememberMeListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/RememberMeListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\RemoteUserAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/RemoteUserAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\SwitchUserListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/SwitchUserListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/UsernamePasswordFormAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordJsonAuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\Firewall\\X509AuthenticationListener' => __DIR__ . '/..' . '/symfony/security-http/Firewall/X509AuthenticationListener.php', + 'Symfony\\Component\\Security\\Http\\HttpUtils' => __DIR__ . '/..' . '/symfony/security-http/HttpUtils.php', + 'Symfony\\Component\\Security\\Http\\Impersonate\\ImpersonateUrlGenerator' => __DIR__ . '/..' . '/symfony/security-http/Impersonate/ImpersonateUrlGenerator.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\ExpiredLoginLinkException' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/Exception/ExpiredLoginLinkException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkAuthenticationException' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkAuthenticationException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkException' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkException.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\Exception\\InvalidLoginLinkExceptionInterface' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/Exception/InvalidLoginLinkExceptionInterface.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkDetails' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/LoginLinkDetails.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkHandler' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/LoginLinkHandler.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/LoginLinkHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkNotification' => __DIR__ . '/..' . '/symfony/security-http/LoginLink/LoginLinkNotification.php', + 'Symfony\\Component\\Security\\Http\\Logout\\CookieClearingLogoutHandler' => __DIR__ . '/..' . '/symfony/security-http/Logout/CookieClearingLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\CsrfTokenClearingLogoutHandler' => __DIR__ . '/..' . '/symfony/security-http/Logout/CsrfTokenClearingLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\DefaultLogoutSuccessHandler' => __DIR__ . '/..' . '/symfony/security-http/Logout/DefaultLogoutSuccessHandler.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/Logout/LogoutHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutSuccessHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/Logout/LogoutSuccessHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\Logout\\LogoutUrlGenerator' => __DIR__ . '/..' . '/symfony/security-http/Logout/LogoutUrlGenerator.php', + 'Symfony\\Component\\Security\\Http\\Logout\\SessionLogoutHandler' => __DIR__ . '/..' . '/symfony/security-http/Logout/SessionLogoutHandler.php', + 'Symfony\\Component\\Security\\Http\\ParameterBagUtils' => __DIR__ . '/..' . '/symfony/security-http/ParameterBagUtils.php', + 'Symfony\\Component\\Security\\Http\\RateLimiter\\DefaultLoginRateLimiter' => __DIR__ . '/..' . '/symfony/security-http/RateLimiter/DefaultLoginRateLimiter.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\AbstractRememberMeHandler' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/AbstractRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\AbstractRememberMeServices' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/AbstractRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\PersistentRememberMeHandler' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/PersistentRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\PersistentTokenBasedRememberMeServices' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/PersistentTokenBasedRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeDetails' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/RememberMeDetails.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeHandlerInterface' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/RememberMeHandlerInterface.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\RememberMeServicesInterface' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/RememberMeServicesInterface.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\ResponseListener' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/ResponseListener.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\SignatureRememberMeHandler' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/SignatureRememberMeHandler.php', + 'Symfony\\Component\\Security\\Http\\RememberMe\\TokenBasedRememberMeServices' => __DIR__ . '/..' . '/symfony/security-http/RememberMe/TokenBasedRememberMeServices.php', + 'Symfony\\Component\\Security\\Http\\SecurityEvents' => __DIR__ . '/..' . '/symfony/security-http/SecurityEvents.php', + 'Symfony\\Component\\Security\\Http\\Session\\SessionAuthenticationStrategy' => __DIR__ . '/..' . '/symfony/security-http/Session/SessionAuthenticationStrategy.php', + 'Symfony\\Component\\Security\\Http\\Session\\SessionAuthenticationStrategyInterface' => __DIR__ . '/..' . '/symfony/security-http/Session/SessionAuthenticationStrategyInterface.php', + 'Symfony\\Component\\Security\\Http\\Util\\TargetPathTrait' => __DIR__ . '/..' . '/symfony/security-http/Util/TargetPathTrait.php', 'Symfony\\Component\\String\\AbstractString' => __DIR__ . '/..' . '/symfony/string/AbstractString.php', 'Symfony\\Component\\String\\AbstractUnicodeString' => __DIR__ . '/..' . '/symfony/string/AbstractUnicodeString.php', 'Symfony\\Component\\String\\ByteString' => __DIR__ . '/..' . '/symfony/string/ByteString.php', @@ -1140,6 +2050,217 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Component\\String\\Slugger\\AsciiSlugger' => __DIR__ . '/..' . '/symfony/string/Slugger/AsciiSlugger.php', 'Symfony\\Component\\String\\Slugger\\SluggerInterface' => __DIR__ . '/..' . '/symfony/string/Slugger/SluggerInterface.php', 'Symfony\\Component\\String\\UnicodeString' => __DIR__ . '/..' . '/symfony/string/UnicodeString.php', + 'Symfony\\Component\\Validator\\Command\\DebugCommand' => __DIR__ . '/..' . '/symfony/validator/Command/DebugCommand.php', + 'Symfony\\Component\\Validator\\Constraint' => __DIR__ . '/..' . '/symfony/validator/Constraint.php', + 'Symfony\\Component\\Validator\\ConstraintValidator' => __DIR__ . '/..' . '/symfony/validator/ConstraintValidator.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorFactory' => __DIR__ . '/..' . '/symfony/validator/ConstraintValidatorFactory.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorFactoryInterface' => __DIR__ . '/..' . '/symfony/validator/ConstraintValidatorFactoryInterface.php', + 'Symfony\\Component\\Validator\\ConstraintValidatorInterface' => __DIR__ . '/..' . '/symfony/validator/ConstraintValidatorInterface.php', + 'Symfony\\Component\\Validator\\ConstraintViolation' => __DIR__ . '/..' . '/symfony/validator/ConstraintViolation.php', + 'Symfony\\Component\\Validator\\ConstraintViolationInterface' => __DIR__ . '/..' . '/symfony/validator/ConstraintViolationInterface.php', + 'Symfony\\Component\\Validator\\ConstraintViolationList' => __DIR__ . '/..' . '/symfony/validator/ConstraintViolationList.php', + 'Symfony\\Component\\Validator\\ConstraintViolationListInterface' => __DIR__ . '/..' . '/symfony/validator/ConstraintViolationListInterface.php', + 'Symfony\\Component\\Validator\\Constraints\\AbstractComparison' => __DIR__ . '/..' . '/symfony/validator/Constraints/AbstractComparison.php', + 'Symfony\\Component\\Validator\\Constraints\\AbstractComparisonValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/AbstractComparisonValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\All' => __DIR__ . '/..' . '/symfony/validator/Constraints/All.php', + 'Symfony\\Component\\Validator\\Constraints\\AllValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/AllValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\AtLeastOneOf' => __DIR__ . '/..' . '/symfony/validator/Constraints/AtLeastOneOf.php', + 'Symfony\\Component\\Validator\\Constraints\\AtLeastOneOfValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/AtLeastOneOfValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Bic' => __DIR__ . '/..' . '/symfony/validator/Constraints/Bic.php', + 'Symfony\\Component\\Validator\\Constraints\\BicValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/BicValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Blank' => __DIR__ . '/..' . '/symfony/validator/Constraints/Blank.php', + 'Symfony\\Component\\Validator\\Constraints\\BlankValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/BlankValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Callback' => __DIR__ . '/..' . '/symfony/validator/Constraints/Callback.php', + 'Symfony\\Component\\Validator\\Constraints\\CallbackValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CallbackValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\CardScheme' => __DIR__ . '/..' . '/symfony/validator/Constraints/CardScheme.php', + 'Symfony\\Component\\Validator\\Constraints\\CardSchemeValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CardSchemeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Cascade' => __DIR__ . '/..' . '/symfony/validator/Constraints/Cascade.php', + 'Symfony\\Component\\Validator\\Constraints\\Choice' => __DIR__ . '/..' . '/symfony/validator/Constraints/Choice.php', + 'Symfony\\Component\\Validator\\Constraints\\ChoiceValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/ChoiceValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Cidr' => __DIR__ . '/..' . '/symfony/validator/Constraints/Cidr.php', + 'Symfony\\Component\\Validator\\Constraints\\CidrValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CidrValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Collection' => __DIR__ . '/..' . '/symfony/validator/Constraints/Collection.php', + 'Symfony\\Component\\Validator\\Constraints\\CollectionValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CollectionValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Composite' => __DIR__ . '/..' . '/symfony/validator/Constraints/Composite.php', + 'Symfony\\Component\\Validator\\Constraints\\Compound' => __DIR__ . '/..' . '/symfony/validator/Constraints/Compound.php', + 'Symfony\\Component\\Validator\\Constraints\\CompoundValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CompoundValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Count' => __DIR__ . '/..' . '/symfony/validator/Constraints/Count.php', + 'Symfony\\Component\\Validator\\Constraints\\CountValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CountValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Country' => __DIR__ . '/..' . '/symfony/validator/Constraints/Country.php', + 'Symfony\\Component\\Validator\\Constraints\\CountryValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CountryValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\CssColor' => __DIR__ . '/..' . '/symfony/validator/Constraints/CssColor.php', + 'Symfony\\Component\\Validator\\Constraints\\CssColorValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CssColorValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Currency' => __DIR__ . '/..' . '/symfony/validator/Constraints/Currency.php', + 'Symfony\\Component\\Validator\\Constraints\\CurrencyValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/CurrencyValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Date' => __DIR__ . '/..' . '/symfony/validator/Constraints/Date.php', + 'Symfony\\Component\\Validator\\Constraints\\DateTime' => __DIR__ . '/..' . '/symfony/validator/Constraints/DateTime.php', + 'Symfony\\Component\\Validator\\Constraints\\DateTimeValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/DateTimeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\DateValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/DateValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\DisableAutoMapping' => __DIR__ . '/..' . '/symfony/validator/Constraints/DisableAutoMapping.php', + 'Symfony\\Component\\Validator\\Constraints\\DivisibleBy' => __DIR__ . '/..' . '/symfony/validator/Constraints/DivisibleBy.php', + 'Symfony\\Component\\Validator\\Constraints\\DivisibleByValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/DivisibleByValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Email' => __DIR__ . '/..' . '/symfony/validator/Constraints/Email.php', + 'Symfony\\Component\\Validator\\Constraints\\EmailValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/EmailValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\EnableAutoMapping' => __DIR__ . '/..' . '/symfony/validator/Constraints/EnableAutoMapping.php', + 'Symfony\\Component\\Validator\\Constraints\\EqualTo' => __DIR__ . '/..' . '/symfony/validator/Constraints/EqualTo.php', + 'Symfony\\Component\\Validator\\Constraints\\EqualToValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/EqualToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Existence' => __DIR__ . '/..' . '/symfony/validator/Constraints/Existence.php', + 'Symfony\\Component\\Validator\\Constraints\\Expression' => __DIR__ . '/..' . '/symfony/validator/Constraints/Expression.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntax' => __DIR__ . '/..' . '/symfony/validator/Constraints/ExpressionLanguageSyntax.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntaxValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/ExpressionLanguageSyntaxValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\ExpressionValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/ExpressionValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\File' => __DIR__ . '/..' . '/symfony/validator/Constraints/File.php', + 'Symfony\\Component\\Validator\\Constraints\\FileValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/FileValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThan' => __DIR__ . '/..' . '/symfony/validator/Constraints/GreaterThan.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqual' => __DIR__ . '/..' . '/symfony/validator/Constraints/GreaterThanOrEqual.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqualValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/GreaterThanOrEqualValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GreaterThanValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/GreaterThanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\GroupSequence' => __DIR__ . '/..' . '/symfony/validator/Constraints/GroupSequence.php', + 'Symfony\\Component\\Validator\\Constraints\\GroupSequenceProvider' => __DIR__ . '/..' . '/symfony/validator/Constraints/GroupSequenceProvider.php', + 'Symfony\\Component\\Validator\\Constraints\\Hostname' => __DIR__ . '/..' . '/symfony/validator/Constraints/Hostname.php', + 'Symfony\\Component\\Validator\\Constraints\\HostnameValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/HostnameValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Iban' => __DIR__ . '/..' . '/symfony/validator/Constraints/Iban.php', + 'Symfony\\Component\\Validator\\Constraints\\IbanValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IbanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IdenticalTo' => __DIR__ . '/..' . '/symfony/validator/Constraints/IdenticalTo.php', + 'Symfony\\Component\\Validator\\Constraints\\IdenticalToValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IdenticalToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Image' => __DIR__ . '/..' . '/symfony/validator/Constraints/Image.php', + 'Symfony\\Component\\Validator\\Constraints\\ImageValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/ImageValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Ip' => __DIR__ . '/..' . '/symfony/validator/Constraints/Ip.php', + 'Symfony\\Component\\Validator\\Constraints\\IpValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IpValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsFalse' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsFalse.php', + 'Symfony\\Component\\Validator\\Constraints\\IsFalseValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsFalseValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsNull' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsNull.php', + 'Symfony\\Component\\Validator\\Constraints\\IsNullValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsNullValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\IsTrue' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsTrue.php', + 'Symfony\\Component\\Validator\\Constraints\\IsTrueValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsTrueValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Isbn' => __DIR__ . '/..' . '/symfony/validator/Constraints/Isbn.php', + 'Symfony\\Component\\Validator\\Constraints\\IsbnValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsbnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Isin' => __DIR__ . '/..' . '/symfony/validator/Constraints/Isin.php', + 'Symfony\\Component\\Validator\\Constraints\\IsinValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IsinValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Issn' => __DIR__ . '/..' . '/symfony/validator/Constraints/Issn.php', + 'Symfony\\Component\\Validator\\Constraints\\IssnValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/IssnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Json' => __DIR__ . '/..' . '/symfony/validator/Constraints/Json.php', + 'Symfony\\Component\\Validator\\Constraints\\JsonValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/JsonValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Language' => __DIR__ . '/..' . '/symfony/validator/Constraints/Language.php', + 'Symfony\\Component\\Validator\\Constraints\\LanguageValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LanguageValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Length' => __DIR__ . '/..' . '/symfony/validator/Constraints/Length.php', + 'Symfony\\Component\\Validator\\Constraints\\LengthValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LengthValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThan' => __DIR__ . '/..' . '/symfony/validator/Constraints/LessThan.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanOrEqual' => __DIR__ . '/..' . '/symfony/validator/Constraints/LessThanOrEqual.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanOrEqualValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LessThanOrEqualValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\LessThanValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LessThanValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Locale' => __DIR__ . '/..' . '/symfony/validator/Constraints/Locale.php', + 'Symfony\\Component\\Validator\\Constraints\\LocaleValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LocaleValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Luhn' => __DIR__ . '/..' . '/symfony/validator/Constraints/Luhn.php', + 'Symfony\\Component\\Validator\\Constraints\\LuhnValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/LuhnValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Negative' => __DIR__ . '/..' . '/symfony/validator/Constraints/Negative.php', + 'Symfony\\Component\\Validator\\Constraints\\NegativeOrZero' => __DIR__ . '/..' . '/symfony/validator/Constraints/NegativeOrZero.php', + 'Symfony\\Component\\Validator\\Constraints\\NotBlank' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotBlank.php', + 'Symfony\\Component\\Validator\\Constraints\\NotBlankValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotBlankValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotCompromisedPassword' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotCompromisedPassword.php', + 'Symfony\\Component\\Validator\\Constraints\\NotCompromisedPasswordValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotCompromisedPasswordValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotEqualTo' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotEqualTo.php', + 'Symfony\\Component\\Validator\\Constraints\\NotEqualToValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotEqualToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotIdenticalTo' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotIdenticalTo.php', + 'Symfony\\Component\\Validator\\Constraints\\NotIdenticalToValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotIdenticalToValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NotNull' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotNull.php', + 'Symfony\\Component\\Validator\\Constraints\\NotNullValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/NotNullValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\NumberConstraintTrait' => __DIR__ . '/..' . '/symfony/validator/Constraints/NumberConstraintTrait.php', + 'Symfony\\Component\\Validator\\Constraints\\Optional' => __DIR__ . '/..' . '/symfony/validator/Constraints/Optional.php', + 'Symfony\\Component\\Validator\\Constraints\\Positive' => __DIR__ . '/..' . '/symfony/validator/Constraints/Positive.php', + 'Symfony\\Component\\Validator\\Constraints\\PositiveOrZero' => __DIR__ . '/..' . '/symfony/validator/Constraints/PositiveOrZero.php', + 'Symfony\\Component\\Validator\\Constraints\\Range' => __DIR__ . '/..' . '/symfony/validator/Constraints/Range.php', + 'Symfony\\Component\\Validator\\Constraints\\RangeValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/RangeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Regex' => __DIR__ . '/..' . '/symfony/validator/Constraints/Regex.php', + 'Symfony\\Component\\Validator\\Constraints\\RegexValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/RegexValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Required' => __DIR__ . '/..' . '/symfony/validator/Constraints/Required.php', + 'Symfony\\Component\\Validator\\Constraints\\Sequentially' => __DIR__ . '/..' . '/symfony/validator/Constraints/Sequentially.php', + 'Symfony\\Component\\Validator\\Constraints\\SequentiallyValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/SequentiallyValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Time' => __DIR__ . '/..' . '/symfony/validator/Constraints/Time.php', + 'Symfony\\Component\\Validator\\Constraints\\TimeValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/TimeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Timezone' => __DIR__ . '/..' . '/symfony/validator/Constraints/Timezone.php', + 'Symfony\\Component\\Validator\\Constraints\\TimezoneValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/TimezoneValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Traverse' => __DIR__ . '/..' . '/symfony/validator/Constraints/Traverse.php', + 'Symfony\\Component\\Validator\\Constraints\\Type' => __DIR__ . '/..' . '/symfony/validator/Constraints/Type.php', + 'Symfony\\Component\\Validator\\Constraints\\TypeValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/TypeValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Ulid' => __DIR__ . '/..' . '/symfony/validator/Constraints/Ulid.php', + 'Symfony\\Component\\Validator\\Constraints\\UlidValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/UlidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Unique' => __DIR__ . '/..' . '/symfony/validator/Constraints/Unique.php', + 'Symfony\\Component\\Validator\\Constraints\\UniqueValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/UniqueValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Url' => __DIR__ . '/..' . '/symfony/validator/Constraints/Url.php', + 'Symfony\\Component\\Validator\\Constraints\\UrlValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/UrlValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Uuid' => __DIR__ . '/..' . '/symfony/validator/Constraints/Uuid.php', + 'Symfony\\Component\\Validator\\Constraints\\UuidValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/UuidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\Valid' => __DIR__ . '/..' . '/symfony/validator/Constraints/Valid.php', + 'Symfony\\Component\\Validator\\Constraints\\ValidValidator' => __DIR__ . '/..' . '/symfony/validator/Constraints/ValidValidator.php', + 'Symfony\\Component\\Validator\\Constraints\\ZeroComparisonConstraintTrait' => __DIR__ . '/..' . '/symfony/validator/Constraints/ZeroComparisonConstraintTrait.php', + 'Symfony\\Component\\Validator\\ContainerConstraintValidatorFactory' => __DIR__ . '/..' . '/symfony/validator/ContainerConstraintValidatorFactory.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContext' => __DIR__ . '/..' . '/symfony/validator/Context/ExecutionContext.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextFactory' => __DIR__ . '/..' . '/symfony/validator/Context/ExecutionContextFactory.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextFactoryInterface' => __DIR__ . '/..' . '/symfony/validator/Context/ExecutionContextFactoryInterface.php', + 'Symfony\\Component\\Validator\\Context\\ExecutionContextInterface' => __DIR__ . '/..' . '/symfony/validator/Context/ExecutionContextInterface.php', + 'Symfony\\Component\\Validator\\DataCollector\\ValidatorDataCollector' => __DIR__ . '/..' . '/symfony/validator/DataCollector/ValidatorDataCollector.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddAutoMappingConfigurationPass' => __DIR__ . '/..' . '/symfony/validator/DependencyInjection/AddAutoMappingConfigurationPass.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddConstraintValidatorsPass' => __DIR__ . '/..' . '/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php', + 'Symfony\\Component\\Validator\\DependencyInjection\\AddValidatorInitializersPass' => __DIR__ . '/..' . '/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php', + 'Symfony\\Component\\Validator\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/symfony/validator/Exception/BadMethodCallException.php', + 'Symfony\\Component\\Validator\\Exception\\ConstraintDefinitionException' => __DIR__ . '/..' . '/symfony/validator/Exception/ConstraintDefinitionException.php', + 'Symfony\\Component\\Validator\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/validator/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Validator\\Exception\\GroupDefinitionException' => __DIR__ . '/..' . '/symfony/validator/Exception/GroupDefinitionException.php', + 'Symfony\\Component\\Validator\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/validator/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Validator\\Exception\\InvalidOptionsException' => __DIR__ . '/..' . '/symfony/validator/Exception/InvalidOptionsException.php', + 'Symfony\\Component\\Validator\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/validator/Exception/LogicException.php', + 'Symfony\\Component\\Validator\\Exception\\MappingException' => __DIR__ . '/..' . '/symfony/validator/Exception/MappingException.php', + 'Symfony\\Component\\Validator\\Exception\\MissingOptionsException' => __DIR__ . '/..' . '/symfony/validator/Exception/MissingOptionsException.php', + 'Symfony\\Component\\Validator\\Exception\\NoSuchMetadataException' => __DIR__ . '/..' . '/symfony/validator/Exception/NoSuchMetadataException.php', + 'Symfony\\Component\\Validator\\Exception\\OutOfBoundsException' => __DIR__ . '/..' . '/symfony/validator/Exception/OutOfBoundsException.php', + 'Symfony\\Component\\Validator\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/validator/Exception/RuntimeException.php', + 'Symfony\\Component\\Validator\\Exception\\UnexpectedTypeException' => __DIR__ . '/..' . '/symfony/validator/Exception/UnexpectedTypeException.php', + 'Symfony\\Component\\Validator\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/symfony/validator/Exception/UnexpectedValueException.php', + 'Symfony\\Component\\Validator\\Exception\\UnsupportedMetadataException' => __DIR__ . '/..' . '/symfony/validator/Exception/UnsupportedMetadataException.php', + 'Symfony\\Component\\Validator\\Exception\\ValidationFailedException' => __DIR__ . '/..' . '/symfony/validator/Exception/ValidationFailedException.php', + 'Symfony\\Component\\Validator\\Exception\\ValidatorException' => __DIR__ . '/..' . '/symfony/validator/Exception/ValidatorException.php', + 'Symfony\\Component\\Validator\\GroupSequenceProviderInterface' => __DIR__ . '/..' . '/symfony/validator/GroupSequenceProviderInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\AutoMappingStrategy' => __DIR__ . '/..' . '/symfony/validator/Mapping/AutoMappingStrategy.php', + 'Symfony\\Component\\Validator\\Mapping\\CascadingStrategy' => __DIR__ . '/..' . '/symfony/validator/Mapping/CascadingStrategy.php', + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadata' => __DIR__ . '/..' . '/symfony/validator/Mapping/ClassMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\ClassMetadataInterface' => __DIR__ . '/..' . '/symfony/validator/Mapping/ClassMetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\BlackHoleMetadataFactory' => __DIR__ . '/..' . '/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\LazyLoadingMetadataFactory' => __DIR__ . '/..' . '/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php', + 'Symfony\\Component\\Validator\\Mapping\\Factory\\MetadataFactoryInterface' => __DIR__ . '/..' . '/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\GenericMetadata' => __DIR__ . '/..' . '/symfony/validator/Mapping/GenericMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\GetterMetadata' => __DIR__ . '/..' . '/symfony/validator/Mapping/GetterMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AbstractLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/AbstractLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/AnnotationLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\AutoMappingTrait' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/AutoMappingTrait.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\FileLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/FileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\FilesLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/FilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\LoaderChain' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/LoaderChain.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/LoaderInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\PropertyInfoLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/PropertyInfoLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\StaticMethodLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/StaticMethodLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/XmlFileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\XmlFilesLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/XmlFilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/YamlFileLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\Loader\\YamlFilesLoader' => __DIR__ . '/..' . '/symfony/validator/Mapping/Loader/YamlFilesLoader.php', + 'Symfony\\Component\\Validator\\Mapping\\MemberMetadata' => __DIR__ . '/..' . '/symfony/validator/Mapping/MemberMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\MetadataInterface' => __DIR__ . '/..' . '/symfony/validator/Mapping/MetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\PropertyMetadata' => __DIR__ . '/..' . '/symfony/validator/Mapping/PropertyMetadata.php', + 'Symfony\\Component\\Validator\\Mapping\\PropertyMetadataInterface' => __DIR__ . '/..' . '/symfony/validator/Mapping/PropertyMetadataInterface.php', + 'Symfony\\Component\\Validator\\Mapping\\TraversalStrategy' => __DIR__ . '/..' . '/symfony/validator/Mapping/TraversalStrategy.php', + 'Symfony\\Component\\Validator\\ObjectInitializerInterface' => __DIR__ . '/..' . '/symfony/validator/ObjectInitializerInterface.php', + 'Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase' => __DIR__ . '/..' . '/symfony/validator/Test/ConstraintValidatorTestCase.php', + 'Symfony\\Component\\Validator\\Util\\PropertyPath' => __DIR__ . '/..' . '/symfony/validator/Util/PropertyPath.php', + 'Symfony\\Component\\Validator\\Validation' => __DIR__ . '/..' . '/symfony/validator/Validation.php', + 'Symfony\\Component\\Validator\\ValidatorBuilder' => __DIR__ . '/..' . '/symfony/validator/ValidatorBuilder.php', + 'Symfony\\Component\\Validator\\Validator\\ContextualValidatorInterface' => __DIR__ . '/..' . '/symfony/validator/Validator/ContextualValidatorInterface.php', + 'Symfony\\Component\\Validator\\Validator\\LazyProperty' => __DIR__ . '/..' . '/symfony/validator/Validator/LazyProperty.php', + 'Symfony\\Component\\Validator\\Validator\\RecursiveContextualValidator' => __DIR__ . '/..' . '/symfony/validator/Validator/RecursiveContextualValidator.php', + 'Symfony\\Component\\Validator\\Validator\\RecursiveValidator' => __DIR__ . '/..' . '/symfony/validator/Validator/RecursiveValidator.php', + 'Symfony\\Component\\Validator\\Validator\\TraceableValidator' => __DIR__ . '/..' . '/symfony/validator/Validator/TraceableValidator.php', + 'Symfony\\Component\\Validator\\Validator\\ValidatorInterface' => __DIR__ . '/..' . '/symfony/validator/Validator/ValidatorInterface.php', + 'Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilder' => __DIR__ . '/..' . '/symfony/validator/Violation/ConstraintViolationBuilder.php', + 'Symfony\\Component\\Validator\\Violation\\ConstraintViolationBuilderInterface' => __DIR__ . '/..' . '/symfony/validator/Violation/ConstraintViolationBuilderInterface.php', 'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/AmqpCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ArgsStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ArgsStub.php', 'Symfony\\Component\\VarDumper\\Caster\\Caster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/Caster.php', @@ -1232,6 +2353,20 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Contracts\\Cache\\TagAwareCacheInterface' => __DIR__ . '/..' . '/symfony/cache-contracts/TagAwareCacheInterface.php', 'Symfony\\Contracts\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts/Event.php', 'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts/EventDispatcherInterface.php', + 'Symfony\\Contracts\\HttpClient\\ChunkInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/ChunkInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ClientExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/ClientExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\DecodingExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/ExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/HttpExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\RedirectionExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\ServerExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/ServerExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\TimeoutExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\Exception\\TransportExceptionInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/Exception/TransportExceptionInterface.php', + 'Symfony\\Contracts\\HttpClient\\HttpClientInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/HttpClientInterface.php', + 'Symfony\\Contracts\\HttpClient\\ResponseInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/ResponseInterface.php', + 'Symfony\\Contracts\\HttpClient\\ResponseStreamInterface' => __DIR__ . '/..' . '/symfony/http-client-contracts/ResponseStreamInterface.php', + 'Symfony\\Contracts\\HttpClient\\Test\\HttpClientTestCase' => __DIR__ . '/..' . '/symfony/http-client-contracts/Test/HttpClientTestCase.php', + 'Symfony\\Contracts\\HttpClient\\Test\\TestHttpServer' => __DIR__ . '/..' . '/symfony/http-client-contracts/Test/TestHttpServer.php', 'Symfony\\Contracts\\Service\\Attribute\\Required' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/Required.php', 'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/SubscribedService.php', 'Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ResetInterface.php', @@ -1240,6 +2375,11 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php', 'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => __DIR__ . '/..' . '/symfony/service-contracts/Test/ServiceLocatorTest.php', + 'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/LocaleAwareInterface.php', + 'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => __DIR__ . '/..' . '/symfony/translation-contracts/Test/TranslatorTest.php', + 'Symfony\\Contracts\\Translation\\TranslatableInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatableInterface.php', + 'Symfony\\Contracts\\Translation\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatorInterface.php', + 'Symfony\\Contracts\\Translation\\TranslatorTrait' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatorTrait.php', 'Symfony\\Flex\\Cache' => __DIR__ . '/..' . '/symfony/flex/src/Cache.php', 'Symfony\\Flex\\Command\\DumpEnvCommand' => __DIR__ . '/..' . '/symfony/flex/src/Command/DumpEnvCommand.php', 'Symfony\\Flex\\Command\\GenerateIdCommand' => __DIR__ . '/..' . '/symfony/flex/src/Command/GenerateIdCommand.php', @@ -1289,6 +2429,35 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Flex\\Update\\RecipePatcher' => __DIR__ . '/..' . '/symfony/flex/src/Update/RecipePatcher.php', 'Symfony\\Flex\\Update\\RecipeUpdate' => __DIR__ . '/..' . '/symfony/flex/src/Update/RecipeUpdate.php', 'Symfony\\Polyfill\\Intl\\Grapheme\\Grapheme' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/Grapheme.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Collator' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Collator.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Currencies' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Currencies.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\AmPmTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/AmPmTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayOfWeekTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/DayOfWeekTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayOfYearTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/DayOfYearTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\DayTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/DayTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\FullTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/FullTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour1200Transformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/Hour1200Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour1201Transformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/Hour1201Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour2400Transformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/Hour2400Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Hour2401Transformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/Hour2401Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\HourTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/HourTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\MinuteTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/MinuteTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\MonthTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/MonthTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\QuarterTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/QuarterTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\SecondTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/SecondTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\TimezoneTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/TimezoneTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\Transformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/Transformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\DateFormat\\YearTransformer' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/DateFormat/YearTransformer.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/ExceptionInterface.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodArgumentNotImplementedException' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/MethodArgumentNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodArgumentValueNotImplementedException' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/MethodArgumentValueNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodNotImplementedException' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/MethodNotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\NotImplementedException' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/NotImplementedException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Exception/RuntimeException.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Icu' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Icu.php', + 'Symfony\\Polyfill\\Intl\\Icu\\IntlDateFormatter' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/IntlDateFormatter.php', + 'Symfony\\Polyfill\\Intl\\Icu\\Locale' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/Locale.php', + 'Symfony\\Polyfill\\Intl\\Icu\\NumberFormatter' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/NumberFormatter.php', 'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Normalizer.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php', 'Symfony\\Polyfill\\Php73\\Php73' => __DIR__ . '/..' . '/symfony/polyfill-php73/Php73.php', @@ -1302,6 +2471,180 @@ class ComposerStaticInitb2423aa65ed6776e221b68b36212a5a3 'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\RequestRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpFoundation/RequestRuntime.php', 'Symfony\\Runtime\\Symfony\\Component\\HttpFoundation\\ResponseRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpFoundation/ResponseRuntime.php', 'Symfony\\Runtime\\Symfony\\Component\\HttpKernel\\HttpKernelInterfaceRuntime' => __DIR__ . '/..' . '/symfony/runtime/Internal/HttpKernel/HttpKernelInterfaceRuntime.php', + 'Twig\\Cache\\CacheInterface' => __DIR__ . '/..' . '/twig/twig/src/Cache/CacheInterface.php', + 'Twig\\Cache\\FilesystemCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/FilesystemCache.php', + 'Twig\\Cache\\NullCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/NullCache.php', + 'Twig\\Compiler' => __DIR__ . '/..' . '/twig/twig/src/Compiler.php', + 'Twig\\Environment' => __DIR__ . '/..' . '/twig/twig/src/Environment.php', + 'Twig\\Error\\Error' => __DIR__ . '/..' . '/twig/twig/src/Error/Error.php', + 'Twig\\Error\\LoaderError' => __DIR__ . '/..' . '/twig/twig/src/Error/LoaderError.php', + 'Twig\\Error\\RuntimeError' => __DIR__ . '/..' . '/twig/twig/src/Error/RuntimeError.php', + 'Twig\\Error\\SyntaxError' => __DIR__ . '/..' . '/twig/twig/src/Error/SyntaxError.php', + 'Twig\\ExpressionParser' => __DIR__ . '/..' . '/twig/twig/src/ExpressionParser.php', + 'Twig\\ExtensionSet' => __DIR__ . '/..' . '/twig/twig/src/ExtensionSet.php', + 'Twig\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/AbstractExtension.php', + 'Twig\\Extension\\CoreExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/CoreExtension.php', + 'Twig\\Extension\\DebugExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/DebugExtension.php', + 'Twig\\Extension\\EscaperExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/EscaperExtension.php', + 'Twig\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/ExtensionInterface.php', + 'Twig\\Extension\\GlobalsInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/GlobalsInterface.php', + 'Twig\\Extension\\OptimizerExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/OptimizerExtension.php', + 'Twig\\Extension\\ProfilerExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/ProfilerExtension.php', + 'Twig\\Extension\\RuntimeExtensionInterface' => __DIR__ . '/..' . '/twig/twig/src/Extension/RuntimeExtensionInterface.php', + 'Twig\\Extension\\SandboxExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/SandboxExtension.php', + 'Twig\\Extension\\StagingExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/StagingExtension.php', + 'Twig\\Extension\\StringLoaderExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/StringLoaderExtension.php', + 'Twig\\FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/twig/twig/src/FileExtensionEscapingStrategy.php', + 'Twig\\Lexer' => __DIR__ . '/..' . '/twig/twig/src/Lexer.php', + 'Twig\\Loader\\ArrayLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/ArrayLoader.php', + 'Twig\\Loader\\ChainLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/ChainLoader.php', + 'Twig\\Loader\\FilesystemLoader' => __DIR__ . '/..' . '/twig/twig/src/Loader/FilesystemLoader.php', + 'Twig\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/Loader/LoaderInterface.php', + 'Twig\\Markup' => __DIR__ . '/..' . '/twig/twig/src/Markup.php', + 'Twig\\NodeTraverser' => __DIR__ . '/..' . '/twig/twig/src/NodeTraverser.php', + 'Twig\\NodeVisitor\\AbstractNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php', + 'Twig\\NodeVisitor\\EscaperNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php', + 'Twig\\NodeVisitor\\MacroAutoImportNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php', + 'Twig\\NodeVisitor\\NodeVisitorInterface' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php', + 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php', + 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php', + 'Twig\\NodeVisitor\\SandboxNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php', + 'Twig\\Node\\AutoEscapeNode' => __DIR__ . '/..' . '/twig/twig/src/Node/AutoEscapeNode.php', + 'Twig\\Node\\BlockNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BlockNode.php', + 'Twig\\Node\\BlockReferenceNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BlockReferenceNode.php', + 'Twig\\Node\\BodyNode' => __DIR__ . '/..' . '/twig/twig/src/Node/BodyNode.php', + 'Twig\\Node\\CheckSecurityCallNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckSecurityCallNode.php', + 'Twig\\Node\\CheckSecurityNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckSecurityNode.php', + 'Twig\\Node\\CheckToStringNode' => __DIR__ . '/..' . '/twig/twig/src/Node/CheckToStringNode.php', + 'Twig\\Node\\DeprecatedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DeprecatedNode.php', + 'Twig\\Node\\DoNode' => __DIR__ . '/..' . '/twig/twig/src/Node/DoNode.php', + 'Twig\\Node\\EmbedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/EmbedNode.php', + 'Twig\\Node\\Expression\\AbstractExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AbstractExpression.php', + 'Twig\\Node\\Expression\\ArrayExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrayExpression.php', + 'Twig\\Node\\Expression\\ArrowFunctionExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php', + 'Twig\\Node\\Expression\\AssignNameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AssignNameExpression.php', + 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php', + 'Twig\\Node\\Expression\\Binary\\AddBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AddBinary.php', + 'Twig\\Node\\Expression\\Binary\\AndBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AndBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseAndBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseOrBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php', + 'Twig\\Node\\Expression\\Binary\\BitwiseXorBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php', + 'Twig\\Node\\Expression\\Binary\\ConcatBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/ConcatBinary.php', + 'Twig\\Node\\Expression\\Binary\\DivBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/DivBinary.php', + 'Twig\\Node\\Expression\\Binary\\EndsWithBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php', + 'Twig\\Node\\Expression\\Binary\\EqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/EqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\FloorDivBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php', + 'Twig\\Node\\Expression\\Binary\\GreaterBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/GreaterBinary.php', + 'Twig\\Node\\Expression\\Binary\\GreaterEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\InBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/InBinary.php', + 'Twig\\Node\\Expression\\Binary\\LessBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/LessBinary.php', + 'Twig\\Node\\Expression\\Binary\\LessEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\MatchesBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/MatchesBinary.php', + 'Twig\\Node\\Expression\\Binary\\ModBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/ModBinary.php', + 'Twig\\Node\\Expression\\Binary\\MulBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/MulBinary.php', + 'Twig\\Node\\Expression\\Binary\\NotEqualBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php', + 'Twig\\Node\\Expression\\Binary\\NotInBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/NotInBinary.php', + 'Twig\\Node\\Expression\\Binary\\OrBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/OrBinary.php', + 'Twig\\Node\\Expression\\Binary\\PowerBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php', + 'Twig\\Node\\Expression\\Binary\\RangeBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php', + 'Twig\\Node\\Expression\\Binary\\SpaceshipBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php', + 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php', + 'Twig\\Node\\Expression\\Binary\\SubBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/SubBinary.php', + 'Twig\\Node\\Expression\\BlockReferenceExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php', + 'Twig\\Node\\Expression\\CallExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/CallExpression.php', + 'Twig\\Node\\Expression\\ConditionalExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ConditionalExpression.php', + 'Twig\\Node\\Expression\\ConstantExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ConstantExpression.php', + 'Twig\\Node\\Expression\\FilterExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/FilterExpression.php', + 'Twig\\Node\\Expression\\Filter\\DefaultFilter' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Filter/DefaultFilter.php', + 'Twig\\Node\\Expression\\FunctionExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/FunctionExpression.php', + 'Twig\\Node\\Expression\\GetAttrExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/GetAttrExpression.php', + 'Twig\\Node\\Expression\\InlinePrint' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/InlinePrint.php', + 'Twig\\Node\\Expression\\MethodCallExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/MethodCallExpression.php', + 'Twig\\Node\\Expression\\NameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/NameExpression.php', + 'Twig\\Node\\Expression\\NullCoalesceExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/NullCoalesceExpression.php', + 'Twig\\Node\\Expression\\ParentExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ParentExpression.php', + 'Twig\\Node\\Expression\\TempNameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/TempNameExpression.php', + 'Twig\\Node\\Expression\\TestExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/TestExpression.php', + 'Twig\\Node\\Expression\\Test\\ConstantTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/ConstantTest.php', + 'Twig\\Node\\Expression\\Test\\DefinedTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/DefinedTest.php', + 'Twig\\Node\\Expression\\Test\\DivisiblebyTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php', + 'Twig\\Node\\Expression\\Test\\EvenTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/EvenTest.php', + 'Twig\\Node\\Expression\\Test\\NullTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/NullTest.php', + 'Twig\\Node\\Expression\\Test\\OddTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/OddTest.php', + 'Twig\\Node\\Expression\\Test\\SameasTest' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Test/SameasTest.php', + 'Twig\\Node\\Expression\\Unary\\AbstractUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/AbstractUnary.php', + 'Twig\\Node\\Expression\\Unary\\NegUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NegUnary.php', + 'Twig\\Node\\Expression\\Unary\\NotUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NotUnary.php', + 'Twig\\Node\\Expression\\Unary\\PosUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/PosUnary.php', + 'Twig\\Node\\Expression\\VariadicExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/VariadicExpression.php', + 'Twig\\Node\\FlushNode' => __DIR__ . '/..' . '/twig/twig/src/Node/FlushNode.php', + 'Twig\\Node\\ForLoopNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForLoopNode.php', + 'Twig\\Node\\ForNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForNode.php', + 'Twig\\Node\\IfNode' => __DIR__ . '/..' . '/twig/twig/src/Node/IfNode.php', + 'Twig\\Node\\ImportNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ImportNode.php', + 'Twig\\Node\\IncludeNode' => __DIR__ . '/..' . '/twig/twig/src/Node/IncludeNode.php', + 'Twig\\Node\\MacroNode' => __DIR__ . '/..' . '/twig/twig/src/Node/MacroNode.php', + 'Twig\\Node\\ModuleNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ModuleNode.php', + 'Twig\\Node\\Node' => __DIR__ . '/..' . '/twig/twig/src/Node/Node.php', + 'Twig\\Node\\NodeCaptureInterface' => __DIR__ . '/..' . '/twig/twig/src/Node/NodeCaptureInterface.php', + 'Twig\\Node\\NodeOutputInterface' => __DIR__ . '/..' . '/twig/twig/src/Node/NodeOutputInterface.php', + 'Twig\\Node\\PrintNode' => __DIR__ . '/..' . '/twig/twig/src/Node/PrintNode.php', + 'Twig\\Node\\SandboxNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SandboxNode.php', + 'Twig\\Node\\SetNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SetNode.php', + 'Twig\\Node\\TextNode' => __DIR__ . '/..' . '/twig/twig/src/Node/TextNode.php', + 'Twig\\Node\\WithNode' => __DIR__ . '/..' . '/twig/twig/src/Node/WithNode.php', + 'Twig\\Parser' => __DIR__ . '/..' . '/twig/twig/src/Parser.php', + 'Twig\\Profiler\\Dumper\\BaseDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/BaseDumper.php', + 'Twig\\Profiler\\Dumper\\BlackfireDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/BlackfireDumper.php', + 'Twig\\Profiler\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/HtmlDumper.php', + 'Twig\\Profiler\\Dumper\\TextDumper' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Dumper/TextDumper.php', + 'Twig\\Profiler\\NodeVisitor\\ProfilerNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php', + 'Twig\\Profiler\\Node\\EnterProfileNode' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Node/EnterProfileNode.php', + 'Twig\\Profiler\\Node\\LeaveProfileNode' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Node/LeaveProfileNode.php', + 'Twig\\Profiler\\Profile' => __DIR__ . '/..' . '/twig/twig/src/Profiler/Profile.php', + 'Twig\\RuntimeLoader\\ContainerRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php', + 'Twig\\RuntimeLoader\\FactoryRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php', + 'Twig\\RuntimeLoader\\RuntimeLoaderInterface' => __DIR__ . '/..' . '/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php', + 'Twig\\Sandbox\\SecurityError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityError.php', + 'Twig\\Sandbox\\SecurityNotAllowedFilterError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php', + 'Twig\\Sandbox\\SecurityNotAllowedFunctionError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php', + 'Twig\\Sandbox\\SecurityNotAllowedMethodError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php', + 'Twig\\Sandbox\\SecurityNotAllowedPropertyError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php', + 'Twig\\Sandbox\\SecurityNotAllowedTagError' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php', + 'Twig\\Sandbox\\SecurityPolicy' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityPolicy.php', + 'Twig\\Sandbox\\SecurityPolicyInterface' => __DIR__ . '/..' . '/twig/twig/src/Sandbox/SecurityPolicyInterface.php', + 'Twig\\Source' => __DIR__ . '/..' . '/twig/twig/src/Source.php', + 'Twig\\Template' => __DIR__ . '/..' . '/twig/twig/src/Template.php', + 'Twig\\TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/src/TemplateWrapper.php', + 'Twig\\Test\\IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/IntegrationTestCase.php', + 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php', + 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php', + 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php', + 'Twig\\TokenParser\\AutoEscapeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', + 'Twig\\TokenParser\\BlockTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/BlockTokenParser.php', + 'Twig\\TokenParser\\DeprecatedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', + 'Twig\\TokenParser\\DoTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DoTokenParser.php', + 'Twig\\TokenParser\\EmbedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/EmbedTokenParser.php', + 'Twig\\TokenParser\\ExtendsTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ExtendsTokenParser.php', + 'Twig\\TokenParser\\FlushTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/FlushTokenParser.php', + 'Twig\\TokenParser\\ForTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ForTokenParser.php', + 'Twig\\TokenParser\\FromTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/FromTokenParser.php', + 'Twig\\TokenParser\\IfTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/IfTokenParser.php', + 'Twig\\TokenParser\\ImportTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ImportTokenParser.php', + 'Twig\\TokenParser\\IncludeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/IncludeTokenParser.php', + 'Twig\\TokenParser\\MacroTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/MacroTokenParser.php', + 'Twig\\TokenParser\\SandboxTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/SandboxTokenParser.php', + 'Twig\\TokenParser\\SetTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/SetTokenParser.php', + 'Twig\\TokenParser\\TokenParserInterface' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/TokenParserInterface.php', + 'Twig\\TokenParser\\UseTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/UseTokenParser.php', + 'Twig\\TokenParser\\WithTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/WithTokenParser.php', + 'Twig\\TokenStream' => __DIR__ . '/..' . '/twig/twig/src/TokenStream.php', + 'Twig\\TwigFilter' => __DIR__ . '/..' . '/twig/twig/src/TwigFilter.php', + 'Twig\\TwigFunction' => __DIR__ . '/..' . '/twig/twig/src/TwigFunction.php', + 'Twig\\TwigTest' => __DIR__ . '/..' . '/twig/twig/src/TwigTest.php', + 'Twig\\Util\\DeprecationCollector' => __DIR__ . '/..' . '/twig/twig/src/Util/DeprecationCollector.php', + 'Twig\\Util\\TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/src/Util/TemplateDirIterator.php', 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d40b6c5..1a83b3d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,5 +1,159 @@ { "packages": [ + { + "name": "doctrine/annotations", + "version": "1.13.2", + "version_normalized": "1.13.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" + }, + "time": "2021-08-05T19:00:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.13.2" + }, + "install-path": "../doctrine/annotations" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "version_normalized": "1.2.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "time": "2022-02-28T11:07:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "install-path": "../doctrine/lexer" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1285,6 +1439,112 @@ ], "install-path": "../symfony/flex" }, + { + "name": "symfony/form", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/form.git", + "reference": "7d1bd919be530e8071314a54bd5ae786452a81bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/form/zipball/7d1bd919be530e8071314a54bd5ae786452a81bf", + "reference": "7d1bd919be530e8071314a54bd5ae786452a81bf", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/options-resolver": "^5.1|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.23", + "symfony/property-access": "^5.0.8|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<4.4", + "symfony/doctrine-bridge": "<4.4", + "symfony/error-handler": "<4.4.5", + "symfony/framework-bundle": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<4.4", + "symfony/translation-contracts": "<1.1.7", + "symfony/twig-bridge": "<4.4" + }, + "require-dev": { + "doctrine/collections": "~1.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", + "symfony/validator": "^4.4.17|^5.1.9|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/security-csrf": "For protecting forms against CSRF attacks.", + "symfony/twig-bridge": "For templating with Twig.", + "symfony/validator": "For form validation." + }, + "time": "2022-04-23T15:25:10+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Form\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows to easily create, process and reuse HTML forms", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/form/tree/v5.4.8" + }, + "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/form" + }, { "name": "symfony/framework-bundle", "version": "v5.4.7", @@ -1439,6 +1699,177 @@ ], "install-path": "../symfony/framework-bundle" }, + { + "name": "symfony/http-client", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/0dabec4e3898d3e00451dd47b5ef839168f9bbf5", + "reference": "0dabec4e3898d3e00451dd47b5ef839168f9bbf5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-client-contracts": "^2.4", + "symfony/polyfill-php73": "^1.11", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.0|^2|^3" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "2.4" + }, + "require-dev": { + "amphp/amp": "^2.5", + "amphp/http-client": "^4.2.1", + "amphp/http-tunnel": "^1.0", + "amphp/socket": "^1.1", + "guzzlehttp/promises": "^1.4", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4.13|^5.1.5|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "time": "2022-04-12T16:02:29+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-client/tree/v5.4.8" + }, + "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/http-client" + }, + { + "name": "symfony/http-client-contracts", + "version": "v2.5.1", + "version_normalized": "2.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/1a4f708e4e87f335d1b1be6148060739152f0bd5", + "reference": "1a4f708e4e87f335d1b1be6148060739152f0bd5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "time": "2022-03-13T20:07:29+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.1" + }, + "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/http-client-contracts" + }, { "name": "symfony/http-foundation", "version": "v5.4.6", @@ -1630,6 +2061,154 @@ ], "install-path": "../symfony/http-kernel" }, + { + "name": "symfony/options-resolver", + "version": "v5.4.3", + "version_normalized": "5.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" + }, + "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/options-resolver" + }, + { + "name": "symfony/password-hasher", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/password-hasher.git", + "reference": "bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f", + "reference": "bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" + }, + "conflict": { + "symfony/security-core": "<5.3" + }, + "require-dev": { + "symfony/console": "^5.3|^6.0", + "symfony/security-core": "^5.3|^6.0" + }, + "time": "2022-04-15T13:57:25+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\PasswordHasher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides password hashing utilities", + "homepage": "https://symfony.com", + "keywords": [ + "hashing", + "password" + ], + "support": { + "source": "https://github.com/symfony/password-hasher/tree/v5.4.8" + }, + "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/password-hasher" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.25.0", @@ -1714,6 +2293,96 @@ ], "install-path": "../symfony/polyfill-intl-grapheme" }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.25.0", + "version_normalized": "1.25.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "c023a439b8551e320cc3c8433b198e408a623af1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/c023a439b8551e320cc3c8433b198e408a623af1", + "reference": "c023a439b8551e320cc3c8433b198e408a623af1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance and support of other locales than \"en\"" + }, + "time": "2021-10-26T17:16:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Icu\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.25.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-intl-icu" + }, { "name": "symfony/polyfill-intl-normalizer", "version": "v1.25.0", @@ -2137,6 +2806,184 @@ ], "install-path": "../symfony/polyfill-php81" }, + { + "name": "symfony/property-access", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/fe501d498d6ec7e9efe928c90fabedf629116495", + "reference": "fe501d498d6ec7e9efe928c90fabedf629116495", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/property-info": "^5.2|^6.0" + }, + "require-dev": { + "symfony/cache": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." + }, + "time": "2022-04-12T15:48:08+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property path", + "reflection" + ], + "support": { + "source": "https://github.com/symfony/property-access/tree/v5.4.8" + }, + "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/property-access" + }, + { + "name": "symfony/property-info", + "version": "v5.4.7", + "version_normalized": "5.4.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-info.git", + "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-info/zipball/0fc07795712972b9792f203d0fe0e77c26c3281d", + "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/dependency-injection": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0" + }, + "suggest": { + "phpdocumentor/reflection-docblock": "To use the PHPDoc", + "psr/cache-implementation": "To cache results", + "symfony/doctrine-bridge": "To use Doctrine metadata", + "symfony/serializer": "To use Serializer metadata" + }, + "time": "2022-03-30T13:40:48+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyInfo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Extracts information about PHP class' properties using metadata of popular sources", + "homepage": "https://symfony.com", + "keywords": [ + "doctrine", + "phpdoc", + "property", + "symfony", + "type", + "validator" + ], + "support": { + "source": "https://github.com/symfony/property-info/tree/v5.4.7" + }, + "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/property-info" + }, { "name": "symfony/routing", "version": "v5.4.3", @@ -2310,6 +3157,440 @@ ], "install-path": "../symfony/runtime" }, + { + "name": "symfony/security-bundle", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-bundle.git", + "reference": "9806c9d491584e14a4444ea861a15428ab4b00be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/9806c9d491584e14a4444ea861a15428ab4b00be", + "reference": "9806c9d491584e14a4444ea861a15428ab4b00be", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^5.1|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/password-hasher": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^5.4|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-guard": "^5.3", + "symfony/security-http": "^5.4|^6.0" + }, + "conflict": { + "symfony/browser-kit": "<4.4", + "symfony/console": "<4.4", + "symfony/framework-bundle": "<4.4", + "symfony/ldap": "<5.1", + "symfony/twig-bundle": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/dom-crawler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/ldap": "^5.3|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/twig-bridge": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "symfony/validator": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "time": "2022-04-15T11:48:31+00:00", + "type": "symfony-bundle", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\SecurityBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-bundle/tree/v5.4.8" + }, + "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/security-bundle" + }, + { + "name": "symfony/security-core", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-core.git", + "reference": "4540ecb8ae82cc46d9580672888597f481ff0440" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-core/zipball/4540ecb8ae82cc46d9580672888597f481ff0440", + "reference": "4540ecb8ae82cc46d9580672888597f481ff0440", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^1.1|^2|^3", + "symfony/password-hasher": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1.6|^2|^3" + }, + "conflict": { + "symfony/event-dispatcher": "<4.4", + "symfony/http-foundation": "<5.3", + "symfony/ldap": "<4.4", + "symfony/security-guard": "<4.4", + "symfony/validator": "<5.2" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "psr/container": "^1.0|^2.0", + "psr/log": "^1|^2|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/ldap": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/validator": "^5.2|^6.0" + }, + "suggest": { + "psr/container-implementation": "To instantiate the Security class", + "symfony/event-dispatcher": "", + "symfony/expression-language": "For using the expression voter", + "symfony/http-foundation": "", + "symfony/ldap": "For using LDAP integration", + "symfony/validator": "For using the user password constraint" + }, + "time": "2022-04-15T08:07:45+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Core\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Core Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-core/tree/v5.4.8" + }, + "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/security-core" + }, + { + "name": "symfony/security-csrf", + "version": "v5.4.3", + "version_normalized": "5.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-csrf.git", + "reference": "57c1c252ca756289c2b61327e08fb10be3936956" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/57c1c252ca756289c2b61327e08fb10be3936956", + "reference": "57c1c252ca756289c2b61327e08fb10be3936956", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^4.4|^5.0|^6.0" + }, + "conflict": { + "symfony/http-foundation": "<5.3" + }, + "require-dev": { + "symfony/http-foundation": "^5.3|^6.0" + }, + "suggest": { + "symfony/http-foundation": "For using the class SessionTokenStorage." + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Csrf\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - CSRF Library", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-csrf/tree/v5.4.3" + }, + "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/security-csrf" + }, + { + "name": "symfony/security-guard", + "version": "v5.4.3", + "version_normalized": "5.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-guard.git", + "reference": "3d68d9f8e162f6655eb0a0237b9f333a82a19da9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-guard/zipball/3d68d9f8e162f6655eb0a0237b9f333a82a19da9", + "reference": "3d68d9f8e162f6655eb0a0237b9f333a82a19da9", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15", + "symfony/security-core": "^5.0", + "symfony/security-http": "^5.3" + }, + "require-dev": { + "psr/log": "^1|^2|^3" + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Guard\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - Guard", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-guard/tree/v5.4.3" + }, + "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/security-guard" + }, + { + "name": "symfony/security-http", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/security-http.git", + "reference": "3d4b612da3a278285e6fd16fc2e5233820eeba0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/security-http/zipball/3d4b612da3a278285e6fd16fc2e5233820eeba0d", + "reference": "3d4b612da3a278285e6fd16fc2e5233820eeba0d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/security-core": "^5.4|^6.0" + }, + "conflict": { + "symfony/event-dispatcher": "<4.3", + "symfony/security-bundle": "<5.3", + "symfony/security-csrf": "<4.4" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", + "symfony/security-csrf": "For using tokens to protect authentication/logout attempts" + }, + "time": "2022-04-16T13:32:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Security\\Http\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Security Component - HTTP Integration", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/security-http/tree/v5.4.8" + }, + "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/security-http" + }, { "name": "symfony/service-contracts", "version": "v2.5.1", @@ -2485,6 +3766,419 @@ ], "install-path": "../symfony/string" }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.1", + "version_normalized": "2.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "time": "2022-01-02T09:53:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.1" + }, + "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/translation-contracts" + }, + { + "name": "symfony/twig-bridge", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "f68dbdb80c9ce425f503512dfa8c8c01cf789e43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/f68dbdb80c9ce425f503512dfa8c8c01cf789e43", + "reference": "f68dbdb80c9ce425f503512dfa8c8c01cf789e43", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1|^2|^3", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/console": "<5.3", + "symfony/form": "<5.3", + "symfony/http-foundation": "<5.3", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<5.2", + "symfony/workflow": "<5.2" + }, + "require-dev": { + "doctrine/annotations": "^1.12", + "egulias/email-validator": "^2.1.10|^3", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/console": "^5.3|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^5.3|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^5.2|^6.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/security-acl": "^2.8|^3.0", + "symfony/security-core": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-http": "^4.4|^5.0|^6.0", + "symfony/serializer": "^5.2|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.2|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "symfony/workflow": "^5.2|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "twig/cssinliner-extra": "^2.12|^3", + "twig/inky-extra": "^2.12|^3", + "twig/markdown-extra": "^2.12|^3" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security-core": "For using the SecurityExtension", + "symfony/security-csrf": "For using the CsrfExtension", + "symfony/security-http": "For using the LogoutUrlExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "time": "2022-04-12T15:48:08+00:00", + "type": "symfony-bridge", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides integration for Twig with various Symfony components", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bridge/tree/v5.4.8" + }, + "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/twig-bridge" + }, + { + "name": "symfony/twig-bundle", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bundle.git", + "reference": "c992b4474c3a31f3c40a1ca593d213833f91b818" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/c992b4474c3a31f3c40a1ca593d213833f91b818", + "reference": "c992b4474c3a31f3c40a1ca593d213833f91b818", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/twig-bridge": "^5.3|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/dependency-injection": "<5.3", + "symfony/framework-bundle": "<5.0", + "symfony/service-contracts": ">=3.0", + "symfony/translation": "<5.0" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "doctrine/cache": "^1.0|^2.0", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.0|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.0|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "time": "2022-04-03T13:03:10+00:00", + "type": "symfony-bundle", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\TwigBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a tight integration of Twig into the Symfony full-stack framework", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bundle/tree/v5.4.8" + }, + "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/twig-bundle" + }, + { + "name": "symfony/validator", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad", + "reference": "bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22", + "symfony/translation-contracts": "^1.1|^2|^3" + }, + "conflict": { + "doctrine/annotations": "<1.13", + "doctrine/cache": "<1.11", + "doctrine/lexer": "<1.1", + "phpunit/phpunit": "<5.4.3", + "symfony/dependency-injection": "<4.4", + "symfony/expression-language": "<5.1", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/property-info": "<5.3", + "symfony/translation": "<4.4", + "symfony/yaml": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "^1.13", + "doctrine/cache": "^1.11|^2.0", + "egulias/email-validator": "^2.1.10|^3", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^5.1|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/property-info": "^5.3|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the mapping cache.", + "symfony/config": "", + "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/translation": "For translating validation errors.", + "symfony/yaml": "" + }, + "time": "2022-04-15T08:07:45+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Validator\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to validate values", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/validator/tree/v5.4.8" + }, + "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/validator" + }, { "name": "symfony/var-dumper", "version": "v5.4.6", @@ -2653,6 +4347,89 @@ ], "install-path": "../symfony/var-exporter" }, + { + "name": "symfony/web-profiler-bundle", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-profiler-bundle.git", + "reference": "909c6eea7815066a80d0a362ed41abd7924e376a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/909c6eea7815066a80d0a362ed41abd7924e376a", + "reference": "909c6eea7815066a80d0a362ed41abd7924e376a", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/dependency-injection": "<5.2", + "symfony/form": "<4.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<4.4" + }, + "require-dev": { + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "time": "2022-04-22T08:14:12+00:00", + "type": "symfony-bundle", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\WebProfilerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a development tool that gives detailed information about the execution of any request", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.4.8" + }, + "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/web-profiler-bundle" + }, { "name": "symfony/yaml", "version": "v5.4.3", @@ -2730,6 +4507,85 @@ } ], "install-path": "../symfony/yaml" + }, + { + "name": "twig/twig", + "version": "v3.3.10", + "version_normalized": "3.3.10.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "8442df056c51b706793adf80a9fd363406dd3674" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8442df056c51b706793adf80a9fd363406dd3674", + "reference": "8442df056c51b706793adf80a9fd363406dd3674", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" + }, + "time": "2022-04-06T06:47:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.10" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "install-path": "../twig/twig" } ], "dev": true, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index ad16b65..24ad46a 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,24 +1,54 @@ array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '8ac12f715c8b3d186084d274b182c22d754ce09b', + 'reference' => 'e7253acfd862de465b6091306075e4b15ce83acd', 'name' => '__root__', 'dev' => true, ), 'versions' => array( '__root__' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '8ac12f715c8b3d186084d274b182c22d754ce09b', + 'reference' => 'e7253acfd862de465b6091306075e4b15ce83acd', 'dev_requirement' => false, ), + 'doctrine/annotations' => array( + 'pretty_version' => '1.13.2', + 'version' => '1.13.2.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../doctrine/annotations', + 'aliases' => array(), + 'reference' => '5b668aef16090008790395c02c893b1ba13f7e08', + 'dev_requirement' => false, + ), + 'doctrine/lexer' => array( + 'pretty_version' => '1.2.3', + 'version' => '1.2.3.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../doctrine/lexer', + 'aliases' => array(), + 'reference' => 'c268e882d4dbdd85e36e4ad69e02dc284f89d229', + 'dev_requirement' => false, + ), + 'php-http/async-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '*', + ), + ), + 'php-http/client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '*', + ), + ), 'psr/cache' => array( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', @@ -64,6 +94,12 @@ 0 => '1.0', ), ), + 'psr/http-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), 'psr/log' => array( 'pretty_version' => '1.1.4', 'version' => '1.1.4.0', @@ -223,6 +259,15 @@ 'reference' => '10e438f53a972439675dc720706f0cd5c0ed94f1', 'dev_requirement' => false, ), + 'symfony/form' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/form', + 'aliases' => array(), + 'reference' => '7d1bd919be530e8071314a54bd5ae786452a81bf', + 'dev_requirement' => false, + ), 'symfony/framework-bundle' => array( 'pretty_version' => 'v5.4.7', 'version' => '5.4.7.0', @@ -232,6 +277,30 @@ 'reference' => '7520f553c7a7721652c1b7ac95c09dae62a1676e', 'dev_requirement' => false, ), + 'symfony/http-client' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/http-client', + 'aliases' => array(), + 'reference' => '0dabec4e3898d3e00451dd47b5ef839168f9bbf5', + 'dev_requirement' => false, + ), + 'symfony/http-client-contracts' => array( + 'pretty_version' => 'v2.5.1', + 'version' => '2.5.1.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/http-client-contracts', + 'aliases' => array(), + 'reference' => '1a4f708e4e87f335d1b1be6148060739152f0bd5', + 'dev_requirement' => false, + ), + 'symfony/http-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '2.4', + ), + ), 'symfony/http-foundation' => array( 'pretty_version' => 'v5.4.6', 'version' => '5.4.6.0', @@ -250,6 +319,24 @@ 'reference' => '509243b9b3656db966284c45dffce9316c1ecc5c', 'dev_requirement' => false, ), + 'symfony/options-resolver' => array( + 'pretty_version' => 'v5.4.3', + 'version' => '5.4.3.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/options-resolver', + 'aliases' => array(), + 'reference' => 'cc1147cb11af1b43f503ac18f31aa3bec213aba8', + 'dev_requirement' => false, + ), + 'symfony/password-hasher' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/password-hasher', + 'aliases' => array(), + 'reference' => 'bc9c982b25c0292aa4e009b3e9cc9835e4d1e94f', + 'dev_requirement' => false, + ), 'symfony/polyfill-ctype' => array( 'dev_requirement' => false, 'replaced' => array( @@ -271,6 +358,15 @@ 'reference' => '81b86b50cf841a64252b439e738e97f4a34e2783', 'dev_requirement' => false, ), + 'symfony/polyfill-intl-icu' => array( + 'pretty_version' => 'v1.25.0', + 'version' => '1.25.0.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-intl-icu', + 'aliases' => array(), + 'reference' => 'c023a439b8551e320cc3c8433b198e408a623af1', + 'dev_requirement' => false, + ), 'symfony/polyfill-intl-normalizer' => array( 'pretty_version' => 'v1.25.0', 'version' => '1.25.0.0', @@ -322,6 +418,24 @@ 'reference' => '5de4ba2d41b15f9bd0e19b2ab9674135813ec98f', 'dev_requirement' => false, ), + 'symfony/property-access' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/property-access', + 'aliases' => array(), + 'reference' => 'fe501d498d6ec7e9efe928c90fabedf629116495', + 'dev_requirement' => false, + ), + 'symfony/property-info' => array( + 'pretty_version' => 'v5.4.7', + 'version' => '5.4.7.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/property-info', + 'aliases' => array(), + 'reference' => '0fc07795712972b9792f203d0fe0e77c26c3281d', + 'dev_requirement' => false, + ), 'symfony/routing' => array( 'pretty_version' => 'v5.4.3', 'version' => '5.4.3.0', @@ -340,6 +454,51 @@ 'reference' => 'dc22a2876de3a3dc26b686570d9e638d443b575e', 'dev_requirement' => false, ), + 'symfony/security-bundle' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'symfony-bundle', + 'install_path' => __DIR__ . '/../symfony/security-bundle', + 'aliases' => array(), + 'reference' => '9806c9d491584e14a4444ea861a15428ab4b00be', + 'dev_requirement' => false, + ), + 'symfony/security-core' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/security-core', + 'aliases' => array(), + 'reference' => '4540ecb8ae82cc46d9580672888597f481ff0440', + 'dev_requirement' => false, + ), + 'symfony/security-csrf' => array( + 'pretty_version' => 'v5.4.3', + 'version' => '5.4.3.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/security-csrf', + 'aliases' => array(), + 'reference' => '57c1c252ca756289c2b61327e08fb10be3936956', + 'dev_requirement' => false, + ), + 'symfony/security-guard' => array( + 'pretty_version' => 'v5.4.3', + 'version' => '5.4.3.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/security-guard', + 'aliases' => array(), + 'reference' => '3d68d9f8e162f6655eb0a0237b9f333a82a19da9', + 'dev_requirement' => false, + ), + 'symfony/security-http' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/security-http', + 'aliases' => array(), + 'reference' => '3d4b612da3a278285e6fd16fc2e5233820eeba0d', + 'dev_requirement' => false, + ), 'symfony/service-contracts' => array( 'pretty_version' => 'v2.5.1', 'version' => '2.5.1.0', @@ -364,6 +523,42 @@ 'reference' => '92043b7d8383e48104e411bc9434b260dbeb5a10', 'dev_requirement' => false, ), + 'symfony/translation-contracts' => array( + 'pretty_version' => 'v2.5.1', + 'version' => '2.5.1.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/translation-contracts', + 'aliases' => array(), + 'reference' => '1211df0afa701e45a04253110e959d4af4ef0f07', + 'dev_requirement' => false, + ), + 'symfony/twig-bridge' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'symfony-bridge', + 'install_path' => __DIR__ . '/../symfony/twig-bridge', + 'aliases' => array(), + 'reference' => 'f68dbdb80c9ce425f503512dfa8c8c01cf789e43', + 'dev_requirement' => false, + ), + 'symfony/twig-bundle' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'symfony-bundle', + 'install_path' => __DIR__ . '/../symfony/twig-bundle', + 'aliases' => array(), + 'reference' => 'c992b4474c3a31f3c40a1ca593d213833f91b818', + 'dev_requirement' => false, + ), + 'symfony/validator' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/validator', + 'aliases' => array(), + 'reference' => 'bdc6d04ba95c73ccbf906b4ad9b8775c738d83ad', + 'dev_requirement' => false, + ), 'symfony/var-dumper' => array( 'pretty_version' => 'v5.4.6', 'version' => '5.4.6.0', @@ -382,6 +577,15 @@ 'reference' => '7eacaa588c9b27f2738575adb4a8457a80d9c807', 'dev_requirement' => false, ), + 'symfony/web-profiler-bundle' => array( + 'pretty_version' => 'v5.4.8', + 'version' => '5.4.8.0', + 'type' => 'symfony-bundle', + 'install_path' => __DIR__ . '/../symfony/web-profiler-bundle', + 'aliases' => array(), + 'reference' => '909c6eea7815066a80d0a362ed41abd7924e376a', + 'dev_requirement' => false, + ), 'symfony/yaml' => array( 'pretty_version' => 'v5.4.3', 'version' => '5.4.3.0', @@ -391,5 +595,14 @@ 'reference' => 'e80f87d2c9495966768310fc531b487ce64237a2', 'dev_requirement' => false, ), + 'twig/twig' => array( + 'pretty_version' => 'v3.3.10', + 'version' => '3.3.10.0', + 'type' => 'library', + 'install_path' => __DIR__ . '/../twig/twig', + 'aliases' => array(), + 'reference' => '8442df056c51b706793adf80a9fd363406dd3674', + 'dev_requirement' => false, + ), ), ); diff --git a/vendor/doctrine/annotations/LICENSE b/vendor/doctrine/annotations/LICENSE new file mode 100644 index 0000000..5e781fc --- /dev/null +++ b/vendor/doctrine/annotations/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2013 Doctrine Project + +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/doctrine/annotations/README.md b/vendor/doctrine/annotations/README.md new file mode 100644 index 0000000..c2c7eb7 --- /dev/null +++ b/vendor/doctrine/annotations/README.md @@ -0,0 +1,18 @@ +# Doctrine Annotations + +[![Build Status](https://github.com/doctrine/annotations/workflows/Continuous%20Integration/badge.svg?label=build)](https://github.com/doctrine/persistence/actions) +[![Dependency Status](https://www.versioneye.com/package/php--doctrine--annotations/badge.png)](https://www.versioneye.com/package/php--doctrine--annotations) +[![Reference Status](https://www.versioneye.com/php/doctrine:annotations/reference_badge.svg)](https://www.versioneye.com/php/doctrine:annotations/references) +[![Total Downloads](https://poser.pugx.org/doctrine/annotations/downloads.png)](https://packagist.org/packages/doctrine/annotations) +[![Latest Stable Version](https://img.shields.io/packagist/v/doctrine/annotations.svg?label=stable)](https://packagist.org/packages/doctrine/annotations) + +Docblock Annotations Parser library (extracted from [Doctrine Common](https://github.com/doctrine/common)). + +## Documentation + +See the [doctrine-project website](https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/index.html). + +## Contributing + +When making a pull request, make sure your changes follow the +[Coding Standard Guidelines](https://www.doctrine-project.org/projects/doctrine-coding-standard/en/current/reference/index.html#introduction). diff --git a/vendor/doctrine/annotations/composer.json b/vendor/doctrine/annotations/composer.json new file mode 100644 index 0000000..00d0231 --- /dev/null +++ b/vendor/doctrine/annotations/composer.json @@ -0,0 +1,44 @@ +{ + "name": "doctrine/annotations", + "type": "library", + "description": "Docblock Annotations Parser", + "keywords": ["annotations", "docblock", "parser"], + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.1 || ^8.0", + "ext-tokenizer": "*", + "doctrine/lexer": "1.*", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" + }, + "config": { + "sort-packages": true + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } + }, + "autoload-dev": { + "psr-4": { + "Doctrine\\Performance\\Common\\Annotations\\": "tests/Doctrine/Performance/Common/Annotations", + "Doctrine\\Tests\\Common\\Annotations\\": "tests/Doctrine/Tests/Common/Annotations" + }, + "files": [ + "tests/Doctrine/Tests/Common/Annotations/Fixtures/functions.php", + "tests/Doctrine/Tests/Common/Annotations/Fixtures/SingleClassLOC1000.php" + ] + } +} diff --git a/vendor/doctrine/annotations/docs/en/annotations.rst b/vendor/doctrine/annotations/docs/en/annotations.rst new file mode 100644 index 0000000..2c3c428 --- /dev/null +++ b/vendor/doctrine/annotations/docs/en/annotations.rst @@ -0,0 +1,252 @@ +Handling Annotations +==================== + +There are several different approaches to handling annotations in PHP. +Doctrine Annotations maps docblock annotations to PHP classes. Because +not all docblock annotations are used for metadata purposes a filter is +applied to ignore or skip classes that are not Doctrine annotations. + +Take a look at the following code snippet: + +.. code-block:: php + + namespace MyProject\Entities; + + use Doctrine\ORM\Mapping AS ORM; + use Symfony\Component\Validator\Constraints AS Assert; + + /** + * @author Benjamin Eberlei + * @ORM\Entity + * @MyProject\Annotations\Foobarable + */ + class User + { + /** + * @ORM\Id @ORM\Column @ORM\GeneratedValue + * @dummy + * @var int + */ + private $id; + + /** + * @ORM\Column(type="string") + * @Assert\NotEmpty + * @Assert\Email + * @var string + */ + private $email; + } + +In this snippet you can see a variety of different docblock annotations: + +- Documentation annotations such as ``@var`` and ``@author``. These + annotations are ignored and never considered for throwing an + exception due to wrongly used annotations. +- Annotations imported through use statements. The statement ``use + Doctrine\ORM\Mapping AS ORM`` makes all classes under that namespace + available as ``@ORM\ClassName``. Same goes for the import of + ``@Assert``. +- The ``@dummy`` annotation. It is not a documentation annotation and + not ignored. For Doctrine Annotations it is not entirely clear how + to handle this annotation. Depending on the configuration an exception + (unknown annotation) will be thrown when parsing this annotation. +- The fully qualified annotation ``@MyProject\Annotations\Foobarable``. + This is transformed directly into the given class name. + +How are these annotations loaded? From looking at the code you could +guess that the ORM Mapping, Assert Validation and the fully qualified +annotation can just be loaded using +the defined PHP autoloaders. This is not the case however: For error +handling reasons every check for class existence inside the +``AnnotationReader`` sets the second parameter $autoload +of ``class_exists($name, $autoload)`` to false. To work flawlessly the +``AnnotationReader`` requires silent autoloaders which many autoloaders are +not. Silent autoloading is NOT part of the `PSR-0 specification +`_ +for autoloading. + +This is why Doctrine Annotations uses its own autoloading mechanism +through a global registry. If you are wondering about the annotation +registry being global, there is no other way to solve the architectural +problems of autoloading annotation classes in a straightforward fashion. +Additionally if you think about PHP autoloading then you recognize it is +a global as well. + +To anticipate the configuration section, making the above PHP class work +with Doctrine Annotations requires this setup: + +.. code-block:: php + + use Doctrine\Common\Annotations\AnnotationReader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + AnnotationRegistry::registerFile("/path/to/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); + AnnotationRegistry::registerAutoloadNamespace("Symfony\Component\Validator\Constraint", "/path/to/symfony/src"); + AnnotationRegistry::registerAutoloadNamespace("MyProject\Annotations", "/path/to/myproject/src"); + + $reader = new AnnotationReader(); + AnnotationReader::addGlobalIgnoredName('dummy'); + +The second block with the annotation registry calls registers all the +three different annotation namespaces that are used. +Doctrine Annotations saves all its annotations in a single file, that is +why ``AnnotationRegistry#registerFile`` is used in contrast to +``AnnotationRegistry#registerAutoloadNamespace`` which creates a PSR-0 +compatible loading mechanism for class to file names. + +In the third block, we create the actual ``AnnotationReader`` instance. +Note that we also add ``dummy`` to the global list of ignored +annotations for which we do not throw exceptions. Setting this is +necessary in our example case, otherwise ``@dummy`` would trigger an +exception to be thrown during the parsing of the docblock of +``MyProject\Entities\User#id``. + +Setup and Configuration +----------------------- + +To use the annotations library is simple, you just need to create a new +``AnnotationReader`` instance: + +.. code-block:: php + + $reader = new \Doctrine\Common\Annotations\AnnotationReader(); + +This creates a simple annotation reader with no caching other than in +memory (in php arrays). Since parsing docblocks can be expensive you +should cache this process by using a caching reader. + +To cache annotations, you can create a ``Doctrine\Common\Annotations\PsrCachedReader``. +This reader decorates the original reader and stores all annotations in a PSR-6 +cache: + +.. code-block:: php + + use Doctrine\Common\Annotations\AnnotationReader; + use Doctrine\Common\Annotations\PsrCachedReader; + + $cache = ... // instantiate a PSR-6 Cache pool + + $reader = new PsrCachedReader( + new AnnotationReader(), + $cache, + $debug = true + ); + +The ``debug`` flag is used here as well to invalidate the cache files +when the PHP class with annotations changed and should be used during +development. + +.. warning :: + + The ``AnnotationReader`` works and caches under the + assumption that all annotations of a doc-block are processed at + once. That means that annotation classes that do not exist and + aren't loaded and cannot be autoloaded (using the + AnnotationRegistry) would never be visible and not accessible if a + cache is used unless the cache is cleared and the annotations + requested again, this time with all annotations defined. + +By default the annotation reader returns a list of annotations with +numeric indexes. If you want your annotations to be indexed by their +class name you can wrap the reader in an ``IndexedReader``: + +.. code-block:: php + + use Doctrine\Common\Annotations\AnnotationReader; + use Doctrine\Common\Annotations\IndexedReader; + + $reader = new IndexedReader(new AnnotationReader()); + +.. warning:: + + You should never wrap the indexed reader inside a cached reader, + only the other way around. This way you can re-use the cache with + indexed or numeric keys, otherwise your code may experience failures + due to caching in a numerical or indexed format. + +Registering Annotations +~~~~~~~~~~~~~~~~~~~~~~~ + +As explained in the introduction, Doctrine Annotations uses its own +autoloading mechanism to determine if a given annotation has a +corresponding PHP class that can be autoloaded. For annotation +autoloading you have to configure the +``Doctrine\Common\Annotations\AnnotationRegistry``. There are three +different mechanisms to configure annotation autoloading: + +- Calling ``AnnotationRegistry#registerFile($file)`` to register a file + that contains one or more annotation classes. +- Calling ``AnnotationRegistry#registerNamespace($namespace, $dirs = + null)`` to register that the given namespace contains annotations and + that their base directory is located at the given $dirs or in the + include path if ``NULL`` is passed. The given directories should *NOT* + be the directory where classes of the namespace are in, but the base + directory of the root namespace. The AnnotationRegistry uses a + namespace to directory separator approach to resolve the correct path. +- Calling ``AnnotationRegistry#registerLoader($callable)`` to register + an autoloader callback. The callback accepts the class as first and + only parameter and has to return ``true`` if the corresponding file + was found and included. + +.. note:: + + Loaders have to fail silently, if a class is not found even if it + matches for example the namespace prefix of that loader. Never is a + loader to throw a warning or exception if the loading failed + otherwise parsing doc block annotations will become a huge pain. + +A sample loader callback could look like: + +.. code-block:: php + + use Doctrine\Common\Annotations\AnnotationRegistry; + use Symfony\Component\ClassLoader\UniversalClassLoader; + + AnnotationRegistry::registerLoader(function($class) { + $file = str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php"; + + if (file_exists("/my/base/path/" . $file)) { + // file_exists() makes sure that the loader fails silently + require "/my/base/path/" . $file; + } + }); + + $loader = new UniversalClassLoader(); + AnnotationRegistry::registerLoader(array($loader, "loadClass")); + + +Ignoring missing exceptions +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default an exception is thrown from the ``AnnotationReader`` if an +annotation was found that: + +- is not part of the list of ignored "documentation annotations"; +- was not imported through a use statement; +- is not a fully qualified class that exists. + +You can disable this behavior for specific names if your docblocks do +not follow strict requirements: + +.. code-block:: php + + $reader = new \Doctrine\Common\Annotations\AnnotationReader(); + AnnotationReader::addGlobalIgnoredName('foo'); + +PHP Imports +~~~~~~~~~~~ + +By default the annotation reader parses the use-statement of a php file +to gain access to the import rules and register them for the annotation +processing. Only if you are using PHP Imports can you validate the +correct usage of annotations and throw exceptions if you misspelled an +annotation. This mechanism is enabled by default. + +To ease the upgrade path, we still allow you to disable this mechanism. +Note however that we will remove this in future versions: + +.. code-block:: php + + $reader = new \Doctrine\Common\Annotations\AnnotationReader(); + $reader->setEnabledPhpImports(false); diff --git a/vendor/doctrine/annotations/docs/en/custom.rst b/vendor/doctrine/annotations/docs/en/custom.rst new file mode 100644 index 0000000..11fbe1a --- /dev/null +++ b/vendor/doctrine/annotations/docs/en/custom.rst @@ -0,0 +1,443 @@ +Custom Annotation Classes +========================= + +If you want to define your own annotations, you just have to group them +in a namespace and register this namespace in the ``AnnotationRegistry``. +Annotation classes have to contain a class-level docblock with the text +``@Annotation``: + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** @Annotation */ + class Bar + { + // some code + } + +Inject annotation values +------------------------ + +The annotation parser checks if the annotation constructor has arguments, +if so then it will pass the value array, otherwise it will try to inject +values into public properties directly: + + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** + * @Annotation + * + * Some Annotation using a constructor + */ + class Bar + { + private $foo; + + public function __construct(array $values) + { + $this->foo = $values['foo']; + } + } + + /** + * @Annotation + * + * Some Annotation without a constructor + */ + class Foo + { + public $bar; + } + +Optional: Constructors with Named Parameters +-------------------------------------------- + +Starting with Annotations v1.11 a new annotation instantiation strategy +is available that aims at compatibility of Annotation classes with the PHP 8 +attribute feature. You need to declare a constructor with regular parameter +names that match the named arguments in the annotation syntax. + +To enable this feature, you can tag your annotation class with +``@NamedArgumentConstructor`` (available from v1.12) or implement the +``Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation`` interface +(available from v1.11 and deprecated as of v1.12). +When using the ``@NamedArgumentConstructor`` tag, the first argument of the +constructor is considered as the default one. + + +Usage with the ``@NamedArgumentContrustor`` tag + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** + * @Annotation + * @NamedArgumentConstructor + */ + class Bar implements NamedArgumentConstructorAnnotation + { + private $foo; + + public function __construct(string $foo) + { + $this->foo = $foo; + } + } + + /** Usable with @Bar(foo="baz") */ + /** Usable with @Bar("baz") */ + +In combination with PHP 8's constructor property promotion feature +you can simplify this to: + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** + * @Annotation + * @NamedArgumentConstructor + */ + class Bar implements NamedArgumentConstructorAnnotation + { + public function __construct(private string $foo) {} + } + + +Usage with the +``Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation`` +interface (v1.11, deprecated as of v1.12): +.. code-block:: php + + namespace MyCompany\Annotations; + + use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation; + + /** @Annotation */ + class Bar implements NamedArgumentConstructorAnnotation + { + private $foo; + + public function __construct(private string $foo) {} + } + + /** Usable with @Bar(foo="baz") */ + +Annotation Target +----------------- + +``@Target`` indicates the kinds of class elements to which an annotation +type is applicable. Then you could define one or more targets: + +- ``CLASS`` Allowed in class docblocks +- ``PROPERTY`` Allowed in property docblocks +- ``METHOD`` Allowed in the method docblocks +- ``FUNCTION`` Allowed in function dockblocks +- ``ALL`` Allowed in class, property, method and function docblocks +- ``ANNOTATION`` Allowed inside other annotations + +If the annotations is not allowed in the current context, an +``AnnotationException`` is thrown. + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** + * @Annotation + * @Target({"METHOD","PROPERTY"}) + */ + class Bar + { + // some code + } + + /** + * @Annotation + * @Target("CLASS") + */ + class Foo + { + // some code + } + +Attribute types +--------------- + +The annotation parser checks the given parameters using the phpdoc +annotation ``@var``, The data type could be validated using the ``@var`` +annotation on the annotation properties or using the ``@Attributes`` and +``@Attribute`` annotations. + +If the data type does not match you get an ``AnnotationException`` + +.. code-block:: php + + namespace MyCompany\Annotations; + + /** + * @Annotation + * @Target({"METHOD","PROPERTY"}) + */ + class Bar + { + /** @var mixed */ + public $mixed; + + /** @var boolean */ + public $boolean; + + /** @var bool */ + public $bool; + + /** @var float */ + public $float; + + /** @var string */ + public $string; + + /** @var integer */ + public $integer; + + /** @var array */ + public $array; + + /** @var SomeAnnotationClass */ + public $annotation; + + /** @var array */ + public $arrayOfIntegers; + + /** @var array */ + public $arrayOfAnnotations; + } + + /** + * @Annotation + * @Target({"METHOD","PROPERTY"}) + * @Attributes({ + * @Attribute("stringProperty", type = "string"), + * @Attribute("annotProperty", type = "SomeAnnotationClass"), + * }) + */ + class Foo + { + public function __construct(array $values) + { + $this->stringProperty = $values['stringProperty']; + $this->annotProperty = $values['annotProperty']; + } + + // some code + } + +Annotation Required +------------------- + +``@Required`` indicates that the field must be specified when the +annotation is used. If it is not used you get an ``AnnotationException`` +stating that this value can not be null. + +Declaring a required field: + +.. code-block:: php + + /** + * @Annotation + * @Target("ALL") + */ + class Foo + { + /** @Required */ + public $requiredField; + } + +Usage: + +.. code-block:: php + + /** @Foo(requiredField="value") */ + public $direction; // Valid + + /** @Foo */ + public $direction; // Required field missing, throws an AnnotationException + + +Enumerated values +----------------- + +- An annotation property marked with ``@Enum`` is a field that accepts a + fixed set of scalar values. +- You should use ``@Enum`` fields any time you need to represent fixed + values. +- The annotation parser checks the given value and throws an + ``AnnotationException`` if the value does not match. + + +Declaring an enumerated property: + +.. code-block:: php + + /** + * @Annotation + * @Target("ALL") + */ + class Direction + { + /** + * @Enum({"NORTH", "SOUTH", "EAST", "WEST"}) + */ + public $value; + } + +Annotation usage: + +.. code-block:: php + + /** @Direction("NORTH") */ + public $direction; // Valid value + + /** @Direction("NORTHEAST") */ + public $direction; // Invalid value, throws an AnnotationException + + +Constants +--------- + +The use of constants and class constants is available on the annotations +parser. + +The following usages are allowed: + +.. code-block:: php + + namespace MyCompany\Entity; + + use MyCompany\Annotations\Foo; + use MyCompany\Annotations\Bar; + use MyCompany\Entity\SomeClass; + + /** + * @Foo(PHP_EOL) + * @Bar(Bar::FOO) + * @Foo({SomeClass::FOO, SomeClass::BAR}) + * @Bar({SomeClass::FOO_KEY = SomeClass::BAR_VALUE}) + */ + class User + { + } + + +Be careful with constants and the cache ! + +.. note:: + + The cached reader will not re-evaluate each time an annotation is + loaded from cache. When a constant is changed the cache must be + cleaned. + + +Usage +----- + +Using the library API is simple. Using the annotations described in the +previous section, you can now annotate other classes with your +annotations: + +.. code-block:: php + + namespace MyCompany\Entity; + + use MyCompany\Annotations\Foo; + use MyCompany\Annotations\Bar; + + /** + * @Foo(bar="foo") + * @Bar(foo="bar") + */ + class User + { + } + +Now we can write a script to get the annotations above: + +.. code-block:: php + + $reflClass = new ReflectionClass('MyCompany\Entity\User'); + $classAnnotations = $reader->getClassAnnotations($reflClass); + + foreach ($classAnnotations AS $annot) { + if ($annot instanceof \MyCompany\Annotations\Foo) { + echo $annot->bar; // prints "foo"; + } else if ($annot instanceof \MyCompany\Annotations\Bar) { + echo $annot->foo; // prints "bar"; + } + } + +You have a complete API for retrieving annotation class instances from a +class, property or method docblock: + + +Reader API +~~~~~~~~~~ + +Access all annotations of a class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getClassAnnotations(\ReflectionClass $class); + +Access one annotation of a class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getClassAnnotation(\ReflectionClass $class, $annotationName); + +Access all annotations of a method +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getMethodAnnotations(\ReflectionMethod $method); + +Access one annotation of a method +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getMethodAnnotation(\ReflectionMethod $method, $annotationName); + +Access all annotations of a property +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getPropertyAnnotations(\ReflectionProperty $property); + +Access one annotation of a property +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName); + +Access all annotations of a function +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getFunctionAnnotations(\ReflectionFunction $property); + +Access one annotation of a function +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: php + + public function getFunctionAnnotation(\ReflectionFunction $property, $annotationName); diff --git a/vendor/doctrine/annotations/docs/en/index.rst b/vendor/doctrine/annotations/docs/en/index.rst new file mode 100644 index 0000000..95476c3 --- /dev/null +++ b/vendor/doctrine/annotations/docs/en/index.rst @@ -0,0 +1,101 @@ +Introduction +============ + +Doctrine Annotations allows to implement custom annotation +functionality for PHP classes and functions. + +.. code-block:: php + + class Foo + { + /** + * @MyAnnotation(myProperty="value") + */ + private $bar; + } + +Annotations aren't implemented in PHP itself which is why this component +offers a way to use the PHP doc-blocks as a place for the well known +annotation syntax using the ``@`` char. + +Annotations in Doctrine are used for the ORM configuration to build the +class mapping, but it can be used in other projects for other purposes +too. + +Installation +============ + +You can install the Annotation component with composer: + +.. code-block:: + +   $ composer require doctrine/annotations + +Create an annotation class +========================== + +An annotation class is a representation of the later used annotation +configuration in classes. The annotation class of the previous example +looks like this: + +.. code-block:: php + + /** + * @Annotation + */ + final class MyAnnotation + { + public $myProperty; + } + +The annotation class is declared as an annotation by ``@Annotation``. + +:ref:`Read more about custom annotations. ` + +Reading annotations +=================== + +The access to the annotations happens by reflection of the class or function +containing them. There are multiple reader-classes implementing the +``Doctrine\Common\Annotations\Reader`` interface, that can access the +annotations of a class. A common one is +``Doctrine\Common\Annotations\AnnotationReader``: + +.. code-block:: php + + use Doctrine\Common\Annotations\AnnotationReader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + // Deprecated and will be removed in 2.0 but currently needed + AnnotationRegistry::registerLoader('class_exists'); + + $reflectionClass = new ReflectionClass(Foo::class); + $property = $reflectionClass->getProperty('bar'); + + $reader = new AnnotationReader(); + $myAnnotation = $reader->getPropertyAnnotation( + $property, + MyAnnotation::class + ); + + echo $myAnnotation->myProperty; // result: "value" + +Note that ``AnnotationRegistry::registerLoader('class_exists')`` only works +if you already have an autoloader configured (i.e. composer autoloader). +Otherwise, :ref:`please take a look to the other annotation autoload mechanisms `. + +A reader has multiple methods to access the annotations of a class or +function. + +:ref:`Read more about handling annotations. ` + +IDE Support +----------- + +Some IDEs already provide support for annotations: + +- Eclipse via the `Symfony2 Plugin `_ +- PhpStorm via the `PHP Annotations Plugin `_ or the `Symfony Plugin `_ + +.. _Read more about handling annotations.: annotations +.. _Read more about custom annotations.: custom diff --git a/vendor/doctrine/annotations/docs/en/sidebar.rst b/vendor/doctrine/annotations/docs/en/sidebar.rst new file mode 100644 index 0000000..6f5d13c --- /dev/null +++ b/vendor/doctrine/annotations/docs/en/sidebar.rst @@ -0,0 +1,6 @@ +.. toctree:: + :depth: 3 + + index + annotations + custom diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php new file mode 100644 index 0000000..750270e --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php @@ -0,0 +1,59 @@ + $data Key-value for properties to be defined in this class. + */ + final public function __construct(array $data) + { + foreach ($data as $key => $value) { + $this->$key = $value; + } + } + + /** + * Error handler for unknown property accessor in Annotation class. + * + * @param string $name Unknown property name. + * + * @throws BadMethodCallException + */ + public function __get($name) + { + throw new BadMethodCallException( + sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class) + ); + } + + /** + * Error handler for unknown property mutator in Annotation class. + * + * @param string $name Unknown property name. + * @param mixed $value Property value. + * + * @throws BadMethodCallException + */ + public function __set($name, $value) + { + throw new BadMethodCallException( + sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class) + ); + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php new file mode 100644 index 0000000..b1f8514 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php @@ -0,0 +1,21 @@ + */ + public $value; +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php new file mode 100644 index 0000000..35d6410 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php @@ -0,0 +1,69 @@ + */ + public $value; + + /** + * Literal target declaration. + * + * @var mixed[] + */ + public $literal; + + /** + * @throws InvalidArgumentException + * + * @phpstan-param array{literal?: mixed[], value: list} $values + */ + public function __construct(array $values) + { + if (! isset($values['literal'])) { + $values['literal'] = []; + } + + foreach ($values['value'] as $var) { + if (! is_scalar($var)) { + throw new InvalidArgumentException(sprintf( + '@Enum supports only scalar values "%s" given.', + is_object($var) ? get_class($var) : gettype($var) + )); + } + } + + foreach ($values['literal'] as $key => $var) { + if (! in_array($key, $values['value'])) { + throw new InvalidArgumentException(sprintf( + 'Undefined enumerator value "%s" for literal "%s".', + $key, + $var + )); + } + } + + $this->value = $values['value']; + $this->literal = $values['literal']; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php new file mode 100644 index 0000000..ae60f7d --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php @@ -0,0 +1,43 @@ + */ + public $names; + + /** + * @throws RuntimeException + * + * @phpstan-param array{value: string|list} $values + */ + public function __construct(array $values) + { + if (is_string($values['value'])) { + $values['value'] = [$values['value']]; + } + + if (! is_array($values['value'])) { + throw new RuntimeException(sprintf( + '@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', + json_encode($values['value']) + )); + } + + $this->names = $values['value']; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php new file mode 100644 index 0000000..1690601 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php @@ -0,0 +1,13 @@ + */ + private static $map = [ + 'ALL' => self::TARGET_ALL, + 'CLASS' => self::TARGET_CLASS, + 'METHOD' => self::TARGET_METHOD, + 'PROPERTY' => self::TARGET_PROPERTY, + 'FUNCTION' => self::TARGET_FUNCTION, + 'ANNOTATION' => self::TARGET_ANNOTATION, + ]; + + /** @phpstan-var list */ + public $value; + + /** + * Targets as bitmask. + * + * @var int + */ + public $targets; + + /** + * Literal target declaration. + * + * @var string + */ + public $literal; + + /** + * @throws InvalidArgumentException + * + * @phpstan-param array{value?: string|list} $values + */ + public function __construct(array $values) + { + if (! isset($values['value'])) { + $values['value'] = null; + } + + if (is_string($values['value'])) { + $values['value'] = [$values['value']]; + } + + if (! is_array($values['value'])) { + throw new InvalidArgumentException( + sprintf( + '@Target expects either a string value, or an array of strings, "%s" given.', + is_object($values['value']) ? get_class($values['value']) : gettype($values['value']) + ) + ); + } + + $bitmask = 0; + foreach ($values['value'] as $literal) { + if (! isset(self::$map[$literal])) { + throw new InvalidArgumentException( + sprintf( + 'Invalid Target "%s". Available targets: [%s]', + $literal, + implode(', ', array_keys(self::$map)) + ) + ); + } + + $bitmask |= self::$map[$literal]; + } + + $this->targets = $bitmask; + $this->value = $values['value']; + $this->literal = implode(', ', $this->value); + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php new file mode 100644 index 0000000..b1ea64e --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php @@ -0,0 +1,171 @@ + $available + */ + public static function enumeratorError($attributeName, $annotationName, $context, $available, $given) + { + return new self(sprintf( + '[Enum Error] Attribute "%s" of @%s declared on %s accepts only [%s], but got %s.', + $attributeName, + $annotationName, + $context, + implode(', ', $available), + is_object($given) ? get_class($given) : $given + )); + } + + /** + * @return AnnotationException + */ + public static function optimizerPlusSaveComments() + { + return new self( + 'You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1.' + ); + } + + /** + * @return AnnotationException + */ + public static function optimizerPlusLoadComments() + { + return new self( + 'You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.' + ); + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php new file mode 100644 index 0000000..1f538ee --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -0,0 +1,389 @@ + + */ + private static $globalImports = [ + 'ignoreannotation' => Annotation\IgnoreAnnotation::class, + ]; + + /** + * A list with annotations that are not causing exceptions when not resolved to an annotation class. + * + * The names are case sensitive. + * + * @var array + */ + private static $globalIgnoredNames = ImplicitlyIgnoredAnnotationNames::LIST; + + /** + * A list with annotations that are not causing exceptions when not resolved to an annotation class. + * + * The names are case sensitive. + * + * @var array + */ + private static $globalIgnoredNamespaces = []; + + /** + * Add a new annotation to the globally ignored annotation names with regard to exception handling. + * + * @param string $name + */ + public static function addGlobalIgnoredName($name) + { + self::$globalIgnoredNames[$name] = true; + } + + /** + * Add a new annotation to the globally ignored annotation namespaces with regard to exception handling. + * + * @param string $namespace + */ + public static function addGlobalIgnoredNamespace($namespace) + { + self::$globalIgnoredNamespaces[$namespace] = true; + } + + /** + * Annotations parser. + * + * @var DocParser + */ + private $parser; + + /** + * Annotations parser used to collect parsing metadata. + * + * @var DocParser + */ + private $preParser; + + /** + * PHP parser used to collect imports. + * + * @var PhpParser + */ + private $phpParser; + + /** + * In-memory cache mechanism to store imported annotations per class. + * + * @psalm-var array<'class'|'function', array>> + */ + private $imports = []; + + /** + * In-memory cache mechanism to store ignored annotations per class. + * + * @psalm-var array<'class'|'function', array>> + */ + private $ignoredAnnotationNames = []; + + /** + * Initializes a new AnnotationReader. + * + * @throws AnnotationException + */ + public function __construct(?DocParser $parser = null) + { + if ( + extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.save_comments') === '0' || + ini_get('opcache.save_comments') === '0') + ) { + throw AnnotationException::optimizerPlusSaveComments(); + } + + if (extension_loaded('Zend OPcache') && ini_get('opcache.save_comments') === 0) { + throw AnnotationException::optimizerPlusSaveComments(); + } + + // Make sure that the IgnoreAnnotation annotation is loaded + class_exists(IgnoreAnnotation::class); + + $this->parser = $parser ?: new DocParser(); + + $this->preParser = new DocParser(); + + $this->preParser->setImports(self::$globalImports); + $this->preParser->setIgnoreNotImportedAnnotations(true); + $this->preParser->setIgnoredAnnotationNames(self::$globalIgnoredNames); + + $this->phpParser = new PhpParser(); + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + $this->parser->setTarget(Target::TARGET_CLASS); + $this->parser->setImports($this->getImports($class)); + $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); + + return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + $annotations = $this->getClassAnnotations($class); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + $class = $property->getDeclaringClass(); + $context = 'property ' . $class->getName() . '::$' . $property->getName(); + + $this->parser->setTarget(Target::TARGET_PROPERTY); + $this->parser->setImports($this->getPropertyImports($property)); + $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); + + return $this->parser->parse($property->getDocComment(), $context); + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) + { + $annotations = $this->getPropertyAnnotations($property); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + $class = $method->getDeclaringClass(); + $context = 'method ' . $class->getName() . '::' . $method->getName() . '()'; + + $this->parser->setTarget(Target::TARGET_METHOD); + $this->parser->setImports($this->getMethodImports($method)); + $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); + + return $this->parser->parse($method->getDocComment(), $context); + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) + { + $annotations = $this->getMethodAnnotations($method); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * Gets the annotations applied to a function. + * + * @phpstan-return list An array of Annotations. + */ + public function getFunctionAnnotations(ReflectionFunction $function): array + { + $context = 'function ' . $function->getName(); + + $this->parser->setTarget(Target::TARGET_FUNCTION); + $this->parser->setImports($this->getImports($function)); + $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($function)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); + + return $this->parser->parse($function->getDocComment(), $context); + } + + /** + * Gets a function annotation. + * + * @return object|null The Annotation or NULL, if the requested annotation does not exist. + */ + public function getFunctionAnnotation(ReflectionFunction $function, string $annotationName) + { + $annotations = $this->getFunctionAnnotations($function); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * Returns the ignored annotations for the given class or function. + * + * @param ReflectionClass|ReflectionFunction $reflection + * + * @return array + */ + private function getIgnoredAnnotationNames($reflection): array + { + $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; + $name = $reflection->getName(); + + if (isset($this->ignoredAnnotationNames[$type][$name])) { + return $this->ignoredAnnotationNames[$type][$name]; + } + + $this->collectParsingMetadata($reflection); + + return $this->ignoredAnnotationNames[$type][$name]; + } + + /** + * Retrieves imports for a class or a function. + * + * @param ReflectionClass|ReflectionFunction $reflection + * + * @return array + */ + private function getImports($reflection): array + { + $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; + $name = $reflection->getName(); + + if (isset($this->imports[$type][$name])) { + return $this->imports[$type][$name]; + } + + $this->collectParsingMetadata($reflection); + + return $this->imports[$type][$name]; + } + + /** + * Retrieves imports for methods. + * + * @return array + */ + private function getMethodImports(ReflectionMethod $method) + { + $class = $method->getDeclaringClass(); + $classImports = $this->getImports($class); + + $traitImports = []; + + foreach ($class->getTraits() as $trait) { + if ( + ! $trait->hasMethod($method->getName()) + || $trait->getFileName() !== $method->getFileName() + ) { + continue; + } + + $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait)); + } + + return array_merge($classImports, $traitImports); + } + + /** + * Retrieves imports for properties. + * + * @return array + */ + private function getPropertyImports(ReflectionProperty $property) + { + $class = $property->getDeclaringClass(); + $classImports = $this->getImports($class); + + $traitImports = []; + + foreach ($class->getTraits() as $trait) { + if (! $trait->hasProperty($property->getName())) { + continue; + } + + $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait)); + } + + return array_merge($classImports, $traitImports); + } + + /** + * Collects parsing metadata for a given class or function. + * + * @param ReflectionClass|ReflectionFunction $reflection + */ + private function collectParsingMetadata($reflection): void + { + $type = $reflection instanceof ReflectionClass ? 'class' : 'function'; + $name = $reflection->getName(); + + $ignoredAnnotationNames = self::$globalIgnoredNames; + $annotations = $this->preParser->parse($reflection->getDocComment(), $type . ' ' . $name); + + foreach ($annotations as $annotation) { + if (! ($annotation instanceof IgnoreAnnotation)) { + continue; + } + + foreach ($annotation->names as $annot) { + $ignoredAnnotationNames[$annot] = true; + } + } + + $this->imports[$type][$name] = array_merge( + self::$globalImports, + $this->phpParser->parseUseStatements($reflection), + [ + '__NAMESPACE__' => $reflection->getNamespaceName(), + 'self' => $name, + ] + ); + + $this->ignoredAnnotationNames[$type][$name] = $ignoredAnnotationNames; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php new file mode 100644 index 0000000..259d497 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php @@ -0,0 +1,190 @@ +|null $dirs + */ + public static function registerAutoloadNamespace(string $namespace, $dirs = null): void + { + self::$autoloadNamespaces[$namespace] = $dirs; + } + + /** + * Registers multiple namespaces. + * + * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm. + * + * @deprecated This method is deprecated and will be removed in + * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. + * + * @param string[][]|string[]|null[] $namespaces indexed by namespace name + */ + public static function registerAutoloadNamespaces(array $namespaces): void + { + self::$autoloadNamespaces = array_merge(self::$autoloadNamespaces, $namespaces); + } + + /** + * Registers an autoloading callable for annotations, much like spl_autoload_register(). + * + * NOTE: These class loaders HAVE to be silent when a class was not found! + * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class. + * + * @deprecated This method is deprecated and will be removed in + * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. + */ + public static function registerLoader(callable $callable): void + { + // Reset our static cache now that we have a new loader to work with + self::$failedToAutoload = []; + self::$loaders[] = $callable; + } + + /** + * Registers an autoloading callable for annotations, if it is not already registered + * + * @deprecated This method is deprecated and will be removed in + * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. + */ + public static function registerUniqueLoader(callable $callable): void + { + if (in_array($callable, self::$loaders, true)) { + return; + } + + self::registerLoader($callable); + } + + /** + * Autoloads an annotation class silently. + */ + public static function loadAnnotationClass(string $class): bool + { + if (class_exists($class, false)) { + return true; + } + + if (array_key_exists($class, self::$failedToAutoload)) { + return false; + } + + foreach (self::$autoloadNamespaces as $namespace => $dirs) { + if (strpos($class, $namespace) !== 0) { + continue; + } + + $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; + + if ($dirs === null) { + $path = stream_resolve_include_path($file); + if ($path) { + require $path; + + return true; + } + } else { + foreach ((array) $dirs as $dir) { + if (is_file($dir . DIRECTORY_SEPARATOR . $file)) { + require $dir . DIRECTORY_SEPARATOR . $file; + + return true; + } + } + } + } + + foreach (self::$loaders as $loader) { + if ($loader($class) === true) { + return true; + } + } + + if ( + self::$loaders === [] && + self::$autoloadNamespaces === [] && + self::$registerFileUsed === false && + class_exists($class) + ) { + return true; + } + + self::$failedToAutoload[$class] = null; + + return false; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php new file mode 100644 index 0000000..c036b2d --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php @@ -0,0 +1,268 @@ +> */ + private $loadedAnnotations = []; + + /** @var int[] */ + private $loadedFilemtimes = []; + + /** + * @param bool $debug + */ + public function __construct(Reader $reader, Cache $cache, $debug = false) + { + $this->delegate = $reader; + $this->cache = $cache; + $this->debug = (bool) $debug; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + $cacheKey = $class->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class); + if ($annots === false) { + $annots = $this->delegate->getClassAnnotations($class); + $this->saveToCache($cacheKey, $annots); + } + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + foreach ($this->getClassAnnotations($class) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + $class = $property->getDeclaringClass(); + $cacheKey = $class->getName() . '$' . $property->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class); + if ($annots === false) { + $annots = $this->delegate->getPropertyAnnotations($property); + $this->saveToCache($cacheKey, $annots); + } + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) + { + foreach ($this->getPropertyAnnotations($property) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + $class = $method->getDeclaringClass(); + $cacheKey = $class->getName() . '#' . $method->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class); + if ($annots === false) { + $annots = $this->delegate->getMethodAnnotations($method); + $this->saveToCache($cacheKey, $annots); + } + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) + { + foreach ($this->getMethodAnnotations($method) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * Clears loaded annotations. + * + * @return void + */ + public function clearLoadedAnnotations() + { + $this->loadedAnnotations = []; + $this->loadedFilemtimes = []; + } + + /** + * Fetches a value from the cache. + * + * @param string $cacheKey The cache key. + * + * @return mixed The cached value or false when the value is not in cache. + */ + private function fetchFromCache($cacheKey, ReflectionClass $class) + { + $data = $this->cache->fetch($cacheKey); + if ($data !== false) { + if (! $this->debug || $this->isCacheFresh($cacheKey, $class)) { + return $data; + } + } + + return false; + } + + /** + * Saves a value to the cache. + * + * @param string $cacheKey The cache key. + * @param mixed $value The value. + * + * @return void + */ + private function saveToCache($cacheKey, $value) + { + $this->cache->save($cacheKey, $value); + if (! $this->debug) { + return; + } + + $this->cache->save('[C]' . $cacheKey, time()); + } + + /** + * Checks if the cache is fresh. + * + * @param string $cacheKey + * + * @return bool + */ + private function isCacheFresh($cacheKey, ReflectionClass $class) + { + $lastModification = $this->getLastModification($class); + if ($lastModification === 0) { + return true; + } + + return $this->cache->fetch('[C]' . $cacheKey) >= $lastModification; + } + + /** + * Returns the time the class was last modified, testing traits and parents + */ + private function getLastModification(ReflectionClass $class): int + { + $filename = $class->getFileName(); + + if (isset($this->loadedFilemtimes[$filename])) { + return $this->loadedFilemtimes[$filename]; + } + + $parent = $class->getParentClass(); + + $lastModification = max(array_merge( + [$filename ? filemtime($filename) : 0], + array_map(function (ReflectionClass $reflectionTrait): int { + return $this->getTraitLastModificationTime($reflectionTrait); + }, $class->getTraits()), + array_map(function (ReflectionClass $class): int { + return $this->getLastModification($class); + }, $class->getInterfaces()), + $parent ? [$this->getLastModification($parent)] : [] + )); + + assert($lastModification !== false); + + return $this->loadedFilemtimes[$filename] = $lastModification; + } + + private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int + { + $fileName = $reflectionTrait->getFileName(); + + if (isset($this->loadedFilemtimes[$fileName])) { + return $this->loadedFilemtimes[$fileName]; + } + + $lastModificationTime = max(array_merge( + [$fileName ? filemtime($fileName) : 0], + array_map(function (ReflectionClass $reflectionTrait): int { + return $this->getTraitLastModificationTime($reflectionTrait); + }, $reflectionTrait->getTraits()) + )); + + assert($lastModificationTime !== false); + + return $this->loadedFilemtimes[$fileName] = $lastModificationTime; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php new file mode 100644 index 0000000..f6567c5 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php @@ -0,0 +1,129 @@ += 100 + public const T_IDENTIFIER = 100; + public const T_AT = 101; + public const T_CLOSE_CURLY_BRACES = 102; + public const T_CLOSE_PARENTHESIS = 103; + public const T_COMMA = 104; + public const T_EQUALS = 105; + public const T_FALSE = 106; + public const T_NAMESPACE_SEPARATOR = 107; + public const T_OPEN_CURLY_BRACES = 108; + public const T_OPEN_PARENTHESIS = 109; + public const T_TRUE = 110; + public const T_NULL = 111; + public const T_COLON = 112; + public const T_MINUS = 113; + + /** @var array */ + protected $noCase = [ + '@' => self::T_AT, + ',' => self::T_COMMA, + '(' => self::T_OPEN_PARENTHESIS, + ')' => self::T_CLOSE_PARENTHESIS, + '{' => self::T_OPEN_CURLY_BRACES, + '}' => self::T_CLOSE_CURLY_BRACES, + '=' => self::T_EQUALS, + ':' => self::T_COLON, + '-' => self::T_MINUS, + '\\' => self::T_NAMESPACE_SEPARATOR, + ]; + + /** @var array */ + protected $withCase = [ + 'true' => self::T_TRUE, + 'false' => self::T_FALSE, + 'null' => self::T_NULL, + ]; + + /** + * Whether the next token starts immediately, or if there were + * non-captured symbols before that + */ + public function nextTokenIsAdjacent(): bool + { + return $this->token === null + || ($this->lookahead !== null + && ($this->lookahead['position'] - $this->token['position']) === strlen($this->token['value'])); + } + + /** + * {@inheritdoc} + */ + protected function getCatchablePatterns() + { + return [ + '[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*', + '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', + '"(?:""|[^"])*+"', + ]; + } + + /** + * {@inheritdoc} + */ + protected function getNonCatchablePatterns() + { + return ['\s+', '\*+', '(.)']; + } + + /** + * {@inheritdoc} + */ + protected function getType(&$value) + { + $type = self::T_NONE; + + if ($value[0] === '"') { + $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2)); + + return self::T_STRING; + } + + if (isset($this->noCase[$value])) { + return $this->noCase[$value]; + } + + if ($value[0] === '_' || $value[0] === '\\' || ctype_alpha($value[0])) { + return self::T_IDENTIFIER; + } + + $lowerValue = strtolower($value); + + if (isset($this->withCase[$lowerValue])) { + return $this->withCase[$lowerValue]; + } + + // Checking numeric value + if (is_numeric($value)) { + return strpos($value, '.') !== false || stripos($value, 'e') !== false + ? self::T_FLOAT : self::T_INTEGER; + } + + return $type; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php new file mode 100644 index 0000000..ae530c5 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php @@ -0,0 +1,1459 @@ + + */ + private static $classIdentifiers = [ + DocLexer::T_IDENTIFIER, + DocLexer::T_TRUE, + DocLexer::T_FALSE, + DocLexer::T_NULL, + ]; + + /** + * The lexer. + * + * @var DocLexer + */ + private $lexer; + + /** + * Current target context. + * + * @var int + */ + private $target; + + /** + * Doc parser used to collect annotation target. + * + * @var DocParser + */ + private static $metadataParser; + + /** + * Flag to control if the current annotation is nested or not. + * + * @var bool + */ + private $isNestedAnnotation = false; + + /** + * Hashmap containing all use-statements that are to be used when parsing + * the given doc block. + * + * @var array + */ + private $imports = []; + + /** + * This hashmap is used internally to cache results of class_exists() + * look-ups. + * + * @var array + */ + private $classExists = []; + + /** + * Whether annotations that have not been imported should be ignored. + * + * @var bool + */ + private $ignoreNotImportedAnnotations = false; + + /** + * An array of default namespaces if operating in simple mode. + * + * @var string[] + */ + private $namespaces = []; + + /** + * A list with annotations that are not causing exceptions when not resolved to an annotation class. + * + * The names must be the raw names as used in the class, not the fully qualified + * + * @var bool[] indexed by annotation name + */ + private $ignoredAnnotationNames = []; + + /** + * A list with annotations in namespaced format + * that are not causing exceptions when not resolved to an annotation class. + * + * @var bool[] indexed by namespace name + */ + private $ignoredAnnotationNamespaces = []; + + /** @var string */ + private $context = ''; + + /** + * Hash-map for caching annotation metadata. + * + * @var array + */ + private static $annotationMetadata = [ + Annotation\Target::class => [ + 'is_annotation' => true, + 'has_constructor' => true, + 'has_named_argument_constructor' => false, + 'properties' => [], + 'targets_literal' => 'ANNOTATION_CLASS', + 'targets' => Target::TARGET_CLASS, + 'default_property' => 'value', + 'attribute_types' => [ + 'value' => [ + 'required' => false, + 'type' => 'array', + 'array_type' => 'string', + 'value' => 'array', + ], + ], + ], + Annotation\Attribute::class => [ + 'is_annotation' => true, + 'has_constructor' => false, + 'has_named_argument_constructor' => false, + 'targets_literal' => 'ANNOTATION_ANNOTATION', + 'targets' => Target::TARGET_ANNOTATION, + 'default_property' => 'name', + 'properties' => [ + 'name' => 'name', + 'type' => 'type', + 'required' => 'required', + ], + 'attribute_types' => [ + 'value' => [ + 'required' => true, + 'type' => 'string', + 'value' => 'string', + ], + 'type' => [ + 'required' => true, + 'type' => 'string', + 'value' => 'string', + ], + 'required' => [ + 'required' => false, + 'type' => 'boolean', + 'value' => 'boolean', + ], + ], + ], + Annotation\Attributes::class => [ + 'is_annotation' => true, + 'has_constructor' => false, + 'has_named_argument_constructor' => false, + 'targets_literal' => 'ANNOTATION_CLASS', + 'targets' => Target::TARGET_CLASS, + 'default_property' => 'value', + 'properties' => ['value' => 'value'], + 'attribute_types' => [ + 'value' => [ + 'type' => 'array', + 'required' => true, + 'array_type' => Annotation\Attribute::class, + 'value' => 'array<' . Annotation\Attribute::class . '>', + ], + ], + ], + Annotation\Enum::class => [ + 'is_annotation' => true, + 'has_constructor' => true, + 'has_named_argument_constructor' => false, + 'targets_literal' => 'ANNOTATION_PROPERTY', + 'targets' => Target::TARGET_PROPERTY, + 'default_property' => 'value', + 'properties' => ['value' => 'value'], + 'attribute_types' => [ + 'value' => [ + 'type' => 'array', + 'required' => true, + ], + 'literal' => [ + 'type' => 'array', + 'required' => false, + ], + ], + ], + Annotation\NamedArgumentConstructor::class => [ + 'is_annotation' => true, + 'has_constructor' => false, + 'has_named_argument_constructor' => false, + 'targets_literal' => 'ANNOTATION_CLASS', + 'targets' => Target::TARGET_CLASS, + 'default_property' => null, + 'properties' => [], + 'attribute_types' => [], + ], + ]; + + /** + * Hash-map for handle types declaration. + * + * @var array + */ + private static $typeMap = [ + 'float' => 'double', + 'bool' => 'boolean', + // allow uppercase Boolean in honor of George Boole + 'Boolean' => 'boolean', + 'int' => 'integer', + ]; + + /** + * Constructs a new DocParser. + */ + public function __construct() + { + $this->lexer = new DocLexer(); + } + + /** + * Sets the annotation names that are ignored during the parsing process. + * + * The names are supposed to be the raw names as used in the class, not the + * fully qualified class names. + * + * @param bool[] $names indexed by annotation name + * + * @return void + */ + public function setIgnoredAnnotationNames(array $names) + { + $this->ignoredAnnotationNames = $names; + } + + /** + * Sets the annotation namespaces that are ignored during the parsing process. + * + * @param bool[] $ignoredAnnotationNamespaces indexed by annotation namespace name + * + * @return void + */ + public function setIgnoredAnnotationNamespaces($ignoredAnnotationNamespaces) + { + $this->ignoredAnnotationNamespaces = $ignoredAnnotationNamespaces; + } + + /** + * Sets ignore on not-imported annotations. + * + * @param bool $bool + * + * @return void + */ + public function setIgnoreNotImportedAnnotations($bool) + { + $this->ignoreNotImportedAnnotations = (bool) $bool; + } + + /** + * Sets the default namespaces. + * + * @param string $namespace + * + * @return void + * + * @throws RuntimeException + */ + public function addNamespace($namespace) + { + if ($this->imports) { + throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.'); + } + + $this->namespaces[] = $namespace; + } + + /** + * Sets the imports. + * + * @param array $imports + * + * @return void + * + * @throws RuntimeException + */ + public function setImports(array $imports) + { + if ($this->namespaces) { + throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.'); + } + + $this->imports = $imports; + } + + /** + * Sets current target context as bitmask. + * + * @param int $target + * + * @return void + */ + public function setTarget($target) + { + $this->target = $target; + } + + /** + * Parses the given docblock string for annotations. + * + * @param string $input The docblock string to parse. + * @param string $context The parsing context. + * + * @throws AnnotationException + * @throws ReflectionException + * + * @phpstan-return list Array of annotations. If no annotations are found, an empty array is returned. + */ + public function parse($input, $context = '') + { + $pos = $this->findInitialTokenPosition($input); + if ($pos === null) { + return []; + } + + $this->context = $context; + + $this->lexer->setInput(trim(substr($input, $pos), '* /')); + $this->lexer->moveNext(); + + return $this->Annotations(); + } + + /** + * Finds the first valid annotation + * + * @param string $input The docblock string to parse + */ + private function findInitialTokenPosition($input): ?int + { + $pos = 0; + + // search for first valid annotation + while (($pos = strpos($input, '@', $pos)) !== false) { + $preceding = substr($input, $pos - 1, 1); + + // if the @ is preceded by a space, a tab or * it is valid + if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") { + return $pos; + } + + $pos++; + } + + return null; + } + + /** + * Attempts to match the given token with the current lookahead token. + * If they match, updates the lookahead token; otherwise raises a syntax error. + * + * @param int $token Type of token. + * + * @return bool True if tokens match; false otherwise. + * + * @throws AnnotationException + */ + private function match(int $token): bool + { + if (! $this->lexer->isNextToken($token)) { + throw $this->syntaxError($this->lexer->getLiteral($token)); + } + + return $this->lexer->moveNext(); + } + + /** + * Attempts to match the current lookahead token with any of the given tokens. + * + * If any of them matches, this method updates the lookahead token; otherwise + * a syntax error is raised. + * + * @throws AnnotationException + * + * @phpstan-param list $tokens + */ + private function matchAny(array $tokens): bool + { + if (! $this->lexer->isNextTokenAny($tokens)) { + throw $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens))); + } + + return $this->lexer->moveNext(); + } + + /** + * Generates a new syntax error. + * + * @param string $expected Expected string. + * @param mixed[]|null $token Optional token. + */ + private function syntaxError(string $expected, ?array $token = null): AnnotationException + { + if ($token === null) { + $token = $this->lexer->lookahead; + } + + $message = sprintf('Expected %s, got ', $expected); + $message .= $this->lexer->lookahead === null + ? 'end of string' + : sprintf("'%s' at position %s", $token['value'], $token['position']); + + if (strlen($this->context)) { + $message .= ' in ' . $this->context; + } + + $message .= '.'; + + return AnnotationException::syntaxError($message); + } + + /** + * Attempts to check if a class exists or not. This never goes through the PHP autoloading mechanism + * but uses the {@link AnnotationRegistry} to load classes. + * + * @param class-string $fqcn + */ + private function classExists(string $fqcn): bool + { + if (isset($this->classExists[$fqcn])) { + return $this->classExists[$fqcn]; + } + + // first check if the class already exists, maybe loaded through another AnnotationReader + if (class_exists($fqcn, false)) { + return $this->classExists[$fqcn] = true; + } + + // final check, does this class exist? + return $this->classExists[$fqcn] = AnnotationRegistry::loadAnnotationClass($fqcn); + } + + /** + * Collects parsing metadata for a given annotation class + * + * @param class-string $name The annotation name + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function collectAnnotationMetadata(string $name): void + { + if (self::$metadataParser === null) { + self::$metadataParser = new self(); + + self::$metadataParser->setIgnoreNotImportedAnnotations(true); + self::$metadataParser->setIgnoredAnnotationNames($this->ignoredAnnotationNames); + self::$metadataParser->setImports([ + 'enum' => Enum::class, + 'target' => Target::class, + 'attribute' => Attribute::class, + 'attributes' => Attributes::class, + 'namedargumentconstructor' => NamedArgumentConstructor::class, + ]); + + // Make sure that annotations from metadata are loaded + class_exists(Enum::class); + class_exists(Target::class); + class_exists(Attribute::class); + class_exists(Attributes::class); + class_exists(NamedArgumentConstructor::class); + } + + $class = new ReflectionClass($name); + $docComment = $class->getDocComment(); + + // Sets default values for annotation metadata + $constructor = $class->getConstructor(); + $metadata = [ + 'default_property' => null, + 'has_constructor' => $constructor !== null && $constructor->getNumberOfParameters() > 0, + 'constructor_args' => [], + 'properties' => [], + 'property_types' => [], + 'attribute_types' => [], + 'targets_literal' => null, + 'targets' => Target::TARGET_ALL, + 'is_annotation' => strpos($docComment, '@Annotation') !== false, + ]; + + $metadata['has_named_argument_constructor'] = $metadata['has_constructor'] + && $class->implementsInterface(NamedArgumentConstructorAnnotation::class); + + // verify that the class is really meant to be an annotation + if ($metadata['is_annotation']) { + self::$metadataParser->setTarget(Target::TARGET_CLASS); + + foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { + if ($annotation instanceof Target) { + $metadata['targets'] = $annotation->targets; + $metadata['targets_literal'] = $annotation->literal; + + continue; + } + + if ($annotation instanceof NamedArgumentConstructor) { + $metadata['has_named_argument_constructor'] = $metadata['has_constructor']; + if ($metadata['has_named_argument_constructor']) { + // choose the first argument as the default property + $metadata['default_property'] = $constructor->getParameters()[0]->getName(); + } + } + + if (! ($annotation instanceof Attributes)) { + continue; + } + + foreach ($annotation->value as $attribute) { + $this->collectAttributeTypeMetadata($metadata, $attribute); + } + } + + // if not has a constructor will inject values into public properties + if ($metadata['has_constructor'] === false) { + // collect all public properties + foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + $metadata['properties'][$property->name] = $property->name; + + $propertyComment = $property->getDocComment(); + if ($propertyComment === false) { + continue; + } + + $attribute = new Attribute(); + + $attribute->required = (strpos($propertyComment, '@Required') !== false); + $attribute->name = $property->name; + $attribute->type = (strpos($propertyComment, '@var') !== false && + preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches)) + ? $matches[1] + : 'mixed'; + + $this->collectAttributeTypeMetadata($metadata, $attribute); + + // checks if the property has @Enum + if (strpos($propertyComment, '@Enum') === false) { + continue; + } + + $context = 'property ' . $class->name . '::$' . $property->name; + + self::$metadataParser->setTarget(Target::TARGET_PROPERTY); + + foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { + if (! $annotation instanceof Enum) { + continue; + } + + $metadata['enum'][$property->name]['value'] = $annotation->value; + $metadata['enum'][$property->name]['literal'] = (! empty($annotation->literal)) + ? $annotation->literal + : $annotation->value; + } + } + + // choose the first property as default property + $metadata['default_property'] = reset($metadata['properties']); + } elseif ($metadata['has_named_argument_constructor']) { + foreach ($constructor->getParameters() as $parameter) { + $metadata['constructor_args'][$parameter->getName()] = [ + 'position' => $parameter->getPosition(), + 'default' => $parameter->isOptional() ? $parameter->getDefaultValue() : null, + ]; + } + } + } + + self::$annotationMetadata[$name] = $metadata; + } + + /** + * Collects parsing metadata for a given attribute. + * + * @param mixed[] $metadata + */ + private function collectAttributeTypeMetadata(array &$metadata, Attribute $attribute): void + { + // handle internal type declaration + $type = self::$typeMap[$attribute->type] ?? $attribute->type; + + // handle the case if the property type is mixed + if ($type === 'mixed') { + return; + } + + // Evaluate type + $pos = strpos($type, '<'); + if ($pos !== false) { + // Checks if the property has array + $arrayType = substr($type, $pos + 1, -1); + $type = 'array'; + + if (isset(self::$typeMap[$arrayType])) { + $arrayType = self::$typeMap[$arrayType]; + } + + $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType; + } else { + // Checks if the property has type[] + $pos = strrpos($type, '['); + if ($pos !== false) { + $arrayType = substr($type, 0, $pos); + $type = 'array'; + + if (isset(self::$typeMap[$arrayType])) { + $arrayType = self::$typeMap[$arrayType]; + } + + $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType; + } + } + + $metadata['attribute_types'][$attribute->name]['type'] = $type; + $metadata['attribute_types'][$attribute->name]['value'] = $attribute->type; + $metadata['attribute_types'][$attribute->name]['required'] = $attribute->required; + } + + /** + * Annotations ::= Annotation {[ "*" ]* [Annotation]}* + * + * @throws AnnotationException + * @throws ReflectionException + * + * @phpstan-return list + */ + private function Annotations(): array + { + $annotations = []; + + while ($this->lexer->lookahead !== null) { + if ($this->lexer->lookahead['type'] !== DocLexer::T_AT) { + $this->lexer->moveNext(); + continue; + } + + // make sure the @ is preceded by non-catchable pattern + if ( + $this->lexer->token !== null && + $this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen( + $this->lexer->token['value'] + ) + ) { + $this->lexer->moveNext(); + continue; + } + + // make sure the @ is followed by either a namespace separator, or + // an identifier token + $peek = $this->lexer->glimpse(); + if ( + ($peek === null) + || ($peek['type'] !== DocLexer::T_NAMESPACE_SEPARATOR && ! in_array( + $peek['type'], + self::$classIdentifiers, + true + )) + || $peek['position'] !== $this->lexer->lookahead['position'] + 1 + ) { + $this->lexer->moveNext(); + continue; + } + + $this->isNestedAnnotation = false; + $annot = $this->Annotation(); + if ($annot === false) { + continue; + } + + $annotations[] = $annot; + } + + return $annotations; + } + + /** + * Annotation ::= "@" AnnotationName MethodCall + * AnnotationName ::= QualifiedName | SimpleName + * QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName + * NameSpacePart ::= identifier | null | false | true + * SimpleName ::= identifier | null | false | true + * + * @return object|false False if it is not a valid annotation. + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function Annotation() + { + $this->match(DocLexer::T_AT); + + // check if we have an annotation + $name = $this->Identifier(); + + if ( + $this->lexer->isNextToken(DocLexer::T_MINUS) + && $this->lexer->nextTokenIsAdjacent() + ) { + // Annotations with dashes, such as "@foo-" or "@foo-bar", are to be discarded + return false; + } + + // only process names which are not fully qualified, yet + // fully qualified names must start with a \ + $originalName = $name; + + if ($name[0] !== '\\') { + $pos = strpos($name, '\\'); + $alias = ($pos === false) ? $name : substr($name, 0, $pos); + $found = false; + $loweredAlias = strtolower($alias); + + if ($this->namespaces) { + foreach ($this->namespaces as $namespace) { + if ($this->classExists($namespace . '\\' . $name)) { + $name = $namespace . '\\' . $name; + $found = true; + break; + } + } + } elseif (isset($this->imports[$loweredAlias])) { + $namespace = ltrim($this->imports[$loweredAlias], '\\'); + $name = ($pos !== false) + ? $namespace . substr($name, $pos) + : $namespace; + $found = $this->classExists($name); + } elseif ( + ! isset($this->ignoredAnnotationNames[$name]) + && isset($this->imports['__NAMESPACE__']) + && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name) + ) { + $name = $this->imports['__NAMESPACE__'] . '\\' . $name; + $found = true; + } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) { + $found = true; + } + + if (! $found) { + if ($this->isIgnoredAnnotation($name)) { + return false; + } + + throw AnnotationException::semanticalError(sprintf( + <<<'EXCEPTION' +The annotation "@%s" in %s was never imported. Did you maybe forget to add a "use" statement for this annotation? +EXCEPTION + , + $name, + $this->context + )); + } + } + + $name = ltrim($name, '\\'); + + if (! $this->classExists($name)) { + throw AnnotationException::semanticalError(sprintf( + 'The annotation "@%s" in %s does not exist, or could not be auto-loaded.', + $name, + $this->context + )); + } + + // at this point, $name contains the fully qualified class name of the + // annotation, and it is also guaranteed that this class exists, and + // that it is loaded + + // collects the metadata annotation only if there is not yet + if (! isset(self::$annotationMetadata[$name])) { + $this->collectAnnotationMetadata($name); + } + + // verify that the class is really meant to be an annotation and not just any ordinary class + if (self::$annotationMetadata[$name]['is_annotation'] === false) { + if ($this->isIgnoredAnnotation($originalName) || $this->isIgnoredAnnotation($name)) { + return false; + } + + throw AnnotationException::semanticalError(sprintf( + <<<'EXCEPTION' +The class "%s" is not annotated with @Annotation. +Are you sure this class can be used as annotation? +If so, then you need to add @Annotation to the _class_ doc comment of "%s". +If it is indeed no annotation, then you need to add @IgnoreAnnotation("%s") to the _class_ doc comment of %s. +EXCEPTION + , + $name, + $name, + $originalName, + $this->context + )); + } + + //if target is nested annotation + $target = $this->isNestedAnnotation ? Target::TARGET_ANNOTATION : $this->target; + + // Next will be nested + $this->isNestedAnnotation = true; + + //if annotation does not support current target + if ((self::$annotationMetadata[$name]['targets'] & $target) === 0 && $target) { + throw AnnotationException::semanticalError( + sprintf( + <<<'EXCEPTION' +Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s. +EXCEPTION + , + $originalName, + $this->context, + self::$annotationMetadata[$name]['targets_literal'] + ) + ); + } + + $arguments = $this->MethodCall(); + $values = $this->resolvePositionalValues($arguments, $name); + + if (isset(self::$annotationMetadata[$name]['enum'])) { + // checks all declared attributes + foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { + // checks if the attribute is a valid enumerator + if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { + throw AnnotationException::enumeratorError( + $property, + $name, + $this->context, + $enum['literal'], + $values[$property] + ); + } + } + } + + // checks all declared attributes + foreach (self::$annotationMetadata[$name]['attribute_types'] as $property => $type) { + if ( + $property === self::$annotationMetadata[$name]['default_property'] + && ! isset($values[$property]) && isset($values['value']) + ) { + $property = 'value'; + } + + // handle a not given attribute or null value + if (! isset($values[$property])) { + if ($type['required']) { + throw AnnotationException::requiredError( + $property, + $originalName, + $this->context, + 'a(n) ' . $type['value'] + ); + } + + continue; + } + + if ($type['type'] === 'array') { + // handle the case of a single value + if (! is_array($values[$property])) { + $values[$property] = [$values[$property]]; + } + + // checks if the attribute has array type declaration, such as "array" + if (isset($type['array_type'])) { + foreach ($values[$property] as $item) { + if (gettype($item) !== $type['array_type'] && ! $item instanceof $type['array_type']) { + throw AnnotationException::attributeTypeError( + $property, + $originalName, + $this->context, + 'either a(n) ' . $type['array_type'] . ', or an array of ' . $type['array_type'] . 's', + $item + ); + } + } + } + } elseif (gettype($values[$property]) !== $type['type'] && ! $values[$property] instanceof $type['type']) { + throw AnnotationException::attributeTypeError( + $property, + $originalName, + $this->context, + 'a(n) ' . $type['value'], + $values[$property] + ); + } + } + + if (self::$annotationMetadata[$name]['has_named_argument_constructor']) { + if (PHP_VERSION_ID >= 80000) { + return new $name(...$values); + } + + $positionalValues = []; + foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) { + $positionalValues[$parameter['position']] = $parameter['default']; + } + + foreach ($values as $property => $value) { + if (! isset(self::$annotationMetadata[$name]['constructor_args'][$property])) { + throw AnnotationException::creationError(sprintf( + <<<'EXCEPTION' +The annotation @%s declared on %s does not have a property named "%s" +that can be set through its named arguments constructor. +Available named arguments: %s +EXCEPTION + , + $originalName, + $this->context, + $property, + implode(', ', array_keys(self::$annotationMetadata[$name]['constructor_args'])) + )); + } + + $positionalValues[self::$annotationMetadata[$name]['constructor_args'][$property]['position']] = $value; + } + + return new $name(...$positionalValues); + } + + // check if the annotation expects values via the constructor, + // or directly injected into public properties + if (self::$annotationMetadata[$name]['has_constructor'] === true) { + return new $name($values); + } + + $instance = new $name(); + + foreach ($values as $property => $value) { + if (! isset(self::$annotationMetadata[$name]['properties'][$property])) { + if ($property !== 'value') { + throw AnnotationException::creationError(sprintf( + <<<'EXCEPTION' +The annotation @%s declared on %s does not have a property named "%s". +Available properties: %s +EXCEPTION + , + $originalName, + $this->context, + $property, + implode(', ', self::$annotationMetadata[$name]['properties']) + )); + } + + // handle the case if the property has no annotations + $property = self::$annotationMetadata[$name]['default_property']; + if (! $property) { + throw AnnotationException::creationError(sprintf( + 'The annotation @%s declared on %s does not accept any values, but got %s.', + $originalName, + $this->context, + json_encode($values) + )); + } + } + + $instance->{$property} = $value; + } + + return $instance; + } + + /** + * MethodCall ::= ["(" [Values] ")"] + * + * @return mixed[] + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function MethodCall(): array + { + $values = []; + + if (! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) { + return $values; + } + + $this->match(DocLexer::T_OPEN_PARENTHESIS); + + if (! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { + $values = $this->Values(); + } + + $this->match(DocLexer::T_CLOSE_PARENTHESIS); + + return $values; + } + + /** + * Values ::= Array | Value {"," Value}* [","] + * + * @return mixed[] + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function Values(): array + { + $values = [$this->Value()]; + + while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { + $this->match(DocLexer::T_COMMA); + + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) { + break; + } + + $token = $this->lexer->lookahead; + $value = $this->Value(); + + $values[] = $value; + } + + $namedArguments = []; + $positionalArguments = []; + foreach ($values as $k => $value) { + if (is_object($value) && $value instanceof stdClass) { + $namedArguments[$value->name] = $value->value; + } else { + $positionalArguments[$k] = $value; + } + } + + return ['named_arguments' => $namedArguments, 'positional_arguments' => $positionalArguments]; + } + + /** + * Constant ::= integer | string | float | boolean + * + * @return mixed + * + * @throws AnnotationException + */ + private function Constant() + { + $identifier = $this->Identifier(); + + if (! defined($identifier) && strpos($identifier, '::') !== false && $identifier[0] !== '\\') { + [$className, $const] = explode('::', $identifier); + + $pos = strpos($className, '\\'); + $alias = ($pos === false) ? $className : substr($className, 0, $pos); + $found = false; + $loweredAlias = strtolower($alias); + + switch (true) { + case ! empty($this->namespaces): + foreach ($this->namespaces as $ns) { + if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) { + $className = $ns . '\\' . $className; + $found = true; + break; + } + } + + break; + + case isset($this->imports[$loweredAlias]): + $found = true; + $className = ($pos !== false) + ? $this->imports[$loweredAlias] . substr($className, $pos) + : $this->imports[$loweredAlias]; + break; + + default: + if (isset($this->imports['__NAMESPACE__'])) { + $ns = $this->imports['__NAMESPACE__']; + + if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) { + $className = $ns . '\\' . $className; + $found = true; + } + } + + break; + } + + if ($found) { + $identifier = $className . '::' . $const; + } + } + + /** + * Checks if identifier ends with ::class and remove the leading backslash if it exists. + */ + if ( + $this->identifierEndsWithClassConstant($identifier) && + ! $this->identifierStartsWithBackslash($identifier) + ) { + return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier)); + } + + if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) { + return substr($identifier, 1, $this->getClassConstantPositionInIdentifier($identifier) - 1); + } + + if (! defined($identifier)) { + throw AnnotationException::semanticalErrorConstants($identifier, $this->context); + } + + return constant($identifier); + } + + private function identifierStartsWithBackslash(string $identifier): bool + { + return $identifier[0] === '\\'; + } + + private function identifierEndsWithClassConstant(string $identifier): bool + { + return $this->getClassConstantPositionInIdentifier($identifier) === strlen($identifier) - strlen('::class'); + } + + /** + * @return int|false + */ + private function getClassConstantPositionInIdentifier(string $identifier) + { + return stripos($identifier, '::class'); + } + + /** + * Identifier ::= string + * + * @throws AnnotationException + */ + private function Identifier(): string + { + // check if we have an annotation + if (! $this->lexer->isNextTokenAny(self::$classIdentifiers)) { + throw $this->syntaxError('namespace separator or identifier'); + } + + $this->lexer->moveNext(); + + $className = $this->lexer->token['value']; + + while ( + $this->lexer->lookahead !== null && + $this->lexer->lookahead['position'] === ($this->lexer->token['position'] + + strlen($this->lexer->token['value'])) && + $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR) + ) { + $this->match(DocLexer::T_NAMESPACE_SEPARATOR); + $this->matchAny(self::$classIdentifiers); + + $className .= '\\' . $this->lexer->token['value']; + } + + return $className; + } + + /** + * Value ::= PlainValue | FieldAssignment + * + * @return mixed + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function Value() + { + $peek = $this->lexer->glimpse(); + + if ($peek['type'] === DocLexer::T_EQUALS) { + return $this->FieldAssignment(); + } + + return $this->PlainValue(); + } + + /** + * PlainValue ::= integer | string | float | boolean | Array | Annotation + * + * @return mixed + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function PlainValue() + { + if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) { + return $this->Arrayx(); + } + + if ($this->lexer->isNextToken(DocLexer::T_AT)) { + return $this->Annotation(); + } + + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + return $this->Constant(); + } + + switch ($this->lexer->lookahead['type']) { + case DocLexer::T_STRING: + $this->match(DocLexer::T_STRING); + + return $this->lexer->token['value']; + + case DocLexer::T_INTEGER: + $this->match(DocLexer::T_INTEGER); + + return (int) $this->lexer->token['value']; + + case DocLexer::T_FLOAT: + $this->match(DocLexer::T_FLOAT); + + return (float) $this->lexer->token['value']; + + case DocLexer::T_TRUE: + $this->match(DocLexer::T_TRUE); + + return true; + + case DocLexer::T_FALSE: + $this->match(DocLexer::T_FALSE); + + return false; + + case DocLexer::T_NULL: + $this->match(DocLexer::T_NULL); + + return null; + + default: + throw $this->syntaxError('PlainValue'); + } + } + + /** + * FieldAssignment ::= FieldName "=" PlainValue + * FieldName ::= identifier + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function FieldAssignment(): stdClass + { + $this->match(DocLexer::T_IDENTIFIER); + $fieldName = $this->lexer->token['value']; + + $this->match(DocLexer::T_EQUALS); + + $item = new stdClass(); + $item->name = $fieldName; + $item->value = $this->PlainValue(); + + return $item; + } + + /** + * Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}" + * + * @return mixed[] + * + * @throws AnnotationException + * @throws ReflectionException + */ + private function Arrayx(): array + { + $array = $values = []; + + $this->match(DocLexer::T_OPEN_CURLY_BRACES); + + // If the array is empty, stop parsing and return. + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) { + $this->match(DocLexer::T_CLOSE_CURLY_BRACES); + + return $array; + } + + $values[] = $this->ArrayEntry(); + + while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { + $this->match(DocLexer::T_COMMA); + + // optional trailing comma + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) { + break; + } + + $values[] = $this->ArrayEntry(); + } + + $this->match(DocLexer::T_CLOSE_CURLY_BRACES); + + foreach ($values as $value) { + [$key, $val] = $value; + + if ($key !== null) { + $array[$key] = $val; + } else { + $array[] = $val; + } + } + + return $array; + } + + /** + * ArrayEntry ::= Value | KeyValuePair + * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant + * Key ::= string | integer | Constant + * + * @throws AnnotationException + * @throws ReflectionException + * + * @phpstan-return array{mixed, mixed} + */ + private function ArrayEntry(): array + { + $peek = $this->lexer->glimpse(); + + if ( + $peek['type'] === DocLexer::T_EQUALS + || $peek['type'] === DocLexer::T_COLON + ) { + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + $key = $this->Constant(); + } else { + $this->matchAny([DocLexer::T_INTEGER, DocLexer::T_STRING]); + $key = $this->lexer->token['value']; + } + + $this->matchAny([DocLexer::T_EQUALS, DocLexer::T_COLON]); + + return [$key, $this->PlainValue()]; + } + + return [null, $this->Value()]; + } + + /** + * Checks whether the given $name matches any ignored annotation name or namespace + */ + private function isIgnoredAnnotation(string $name): bool + { + if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) { + return true; + } + + foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) { + $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\'; + + if (stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace) === 0) { + return true; + } + } + + return false; + } + + /** + * Resolve positional arguments (without name) to named ones + * + * @param array $arguments + * + * @return array + */ + private function resolvePositionalValues(array $arguments, string $name): array + { + $positionalArguments = $arguments['positional_arguments'] ?? []; + $values = $arguments['named_arguments'] ?? []; + + if ( + self::$annotationMetadata[$name]['has_named_argument_constructor'] + && self::$annotationMetadata[$name]['default_property'] !== null + ) { + // We must ensure that we don't have positional arguments after named ones + $positions = array_keys($positionalArguments); + $lastPosition = null; + foreach ($positions as $position) { + if ( + ($lastPosition === null && $position !== 0) || + ($lastPosition !== null && $position !== $lastPosition + 1) + ) { + throw $this->syntaxError('Positional arguments after named arguments is not allowed'); + } + + $lastPosition = $position; + } + + foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) { + $position = $parameter['position']; + if (isset($values[$property]) || ! isset($positionalArguments[$position])) { + continue; + } + + $values[$property] = $positionalArguments[$position]; + } + } else { + if (count($positionalArguments) > 0 && ! isset($values['value'])) { + if (count($positionalArguments) === 1) { + $value = array_pop($positionalArguments); + } else { + $value = array_values($positionalArguments); + } + + $values['value'] = $value; + } + } + + return $values; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php new file mode 100644 index 0000000..6c6c22c --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -0,0 +1,315 @@ +> */ + private $loadedAnnotations = []; + + /** @var array */ + private $classNameHashes = []; + + /** @var int */ + private $umask; + + /** + * @param string $cacheDir + * @param bool $debug + * @param int $umask + * + * @throws InvalidArgumentException + */ + public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002) + { + if (! is_int($umask)) { + throw new InvalidArgumentException(sprintf( + 'The parameter umask must be an integer, was: %s', + gettype($umask) + )); + } + + $this->reader = $reader; + $this->umask = $umask; + + if (! is_dir($cacheDir) && ! @mkdir($cacheDir, 0777 & (~$this->umask), true)) { + throw new InvalidArgumentException(sprintf( + 'The directory "%s" does not exist and could not be created.', + $cacheDir + )); + } + + $this->dir = rtrim($cacheDir, '\\/'); + $this->debug = $debug; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + if (! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + + $key = $this->classNameHashes[$class->name]; + + if (isset($this->loadedAnnotations[$key])) { + return $this->loadedAnnotations[$key]; + } + + $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; + if (! is_file($path)) { + $annot = $this->reader->getClassAnnotations($class); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + $filename = $class->getFilename(); + if ( + $this->debug + && $filename !== false + && filemtime($path) < filemtime($filename) + ) { + @unlink($path); + + $annot = $this->reader->getClassAnnotations($class); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + return $this->loadedAnnotations[$key] = include $path; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + $class = $property->getDeclaringClass(); + if (! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + + $key = $this->classNameHashes[$class->name] . '$' . $property->getName(); + + if (isset($this->loadedAnnotations[$key])) { + return $this->loadedAnnotations[$key]; + } + + $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; + if (! is_file($path)) { + $annot = $this->reader->getPropertyAnnotations($property); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + $filename = $class->getFilename(); + if ( + $this->debug + && $filename !== false + && filemtime($path) < filemtime($filename) + ) { + @unlink($path); + + $annot = $this->reader->getPropertyAnnotations($property); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + return $this->loadedAnnotations[$key] = include $path; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + $class = $method->getDeclaringClass(); + if (! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + + $key = $this->classNameHashes[$class->name] . '#' . $method->getName(); + + if (isset($this->loadedAnnotations[$key])) { + return $this->loadedAnnotations[$key]; + } + + $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php'; + if (! is_file($path)) { + $annot = $this->reader->getMethodAnnotations($method); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + $filename = $class->getFilename(); + if ( + $this->debug + && $filename !== false + && filemtime($path) < filemtime($filename) + ) { + @unlink($path); + + $annot = $this->reader->getMethodAnnotations($method); + $this->saveCacheFile($path, $annot); + + return $this->loadedAnnotations[$key] = $annot; + } + + return $this->loadedAnnotations[$key] = include $path; + } + + /** + * Saves the cache file. + * + * @param string $path + * @param mixed $data + * + * @return void + */ + private function saveCacheFile($path, $data) + { + if (! is_writable($this->dir)) { + throw new InvalidArgumentException(sprintf( + <<<'EXCEPTION' +The directory "%s" is not writable. Both the webserver and the console user need access. +You can manage access rights for multiple users with "chmod +a". +If your system does not support this, check out the acl package., +EXCEPTION + , + $this->dir + )); + } + + $tempfile = tempnam($this->dir, uniqid('', true)); + + if ($tempfile === false) { + throw new RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir)); + } + + @chmod($tempfile, 0666 & (~$this->umask)); + + $written = file_put_contents( + $tempfile, + 'umask)); + + if (rename($tempfile, $path) === false) { + @unlink($tempfile); + + throw new RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path)); + } + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + $annotations = $this->getClassAnnotations($class); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) + { + $annotations = $this->getMethodAnnotations($method); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) + { + $annotations = $this->getPropertyAnnotations($property); + + foreach ($annotations as $annotation) { + if ($annotation instanceof $annotationName) { + return $annotation; + } + } + + return null; + } + + /** + * Clears loaded annotations. + * + * @return void + */ + public function clearLoadedAnnotations() + { + $this->loadedAnnotations = []; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php new file mode 100644 index 0000000..2efeb1d --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php @@ -0,0 +1,177 @@ + true, + 'Attribute' => true, + 'Attributes' => true, + /* Can we enable this? 'Enum' => true, */ + 'Required' => true, + 'Target' => true, + 'NamedArgumentConstructor' => true, + ]; + + private const WidelyUsedNonStandard = [ + 'fix' => true, + 'fixme' => true, + 'override' => true, + ]; + + private const PhpDocumentor1 = [ + 'abstract' => true, + 'access' => true, + 'code' => true, + 'deprec' => true, + 'endcode' => true, + 'exception' => true, + 'final' => true, + 'ingroup' => true, + 'inheritdoc' => true, + 'inheritDoc' => true, + 'magic' => true, + 'name' => true, + 'private' => true, + 'static' => true, + 'staticvar' => true, + 'staticVar' => true, + 'toc' => true, + 'tutorial' => true, + 'throw' => true, + ]; + + private const PhpDocumentor2 = [ + 'api' => true, + 'author' => true, + 'category' => true, + 'copyright' => true, + 'deprecated' => true, + 'example' => true, + 'filesource' => true, + 'global' => true, + 'ignore' => true, + /* Can we enable this? 'index' => true, */ + 'internal' => true, + 'license' => true, + 'link' => true, + 'method' => true, + 'package' => true, + 'param' => true, + 'property' => true, + 'property-read' => true, + 'property-write' => true, + 'return' => true, + 'see' => true, + 'since' => true, + 'source' => true, + 'subpackage' => true, + 'throws' => true, + 'todo' => true, + 'TODO' => true, + 'usedby' => true, + 'uses' => true, + 'var' => true, + 'version' => true, + ]; + + private const PHPUnit = [ + 'author' => true, + 'after' => true, + 'afterClass' => true, + 'backupGlobals' => true, + 'backupStaticAttributes' => true, + 'before' => true, + 'beforeClass' => true, + 'codeCoverageIgnore' => true, + 'codeCoverageIgnoreStart' => true, + 'codeCoverageIgnoreEnd' => true, + 'covers' => true, + 'coversDefaultClass' => true, + 'coversNothing' => true, + 'dataProvider' => true, + 'depends' => true, + 'doesNotPerformAssertions' => true, + 'expectedException' => true, + 'expectedExceptionCode' => true, + 'expectedExceptionMessage' => true, + 'expectedExceptionMessageRegExp' => true, + 'group' => true, + 'large' => true, + 'medium' => true, + 'preserveGlobalState' => true, + 'requires' => true, + 'runTestsInSeparateProcesses' => true, + 'runInSeparateProcess' => true, + 'small' => true, + 'test' => true, + 'testdox' => true, + 'testWith' => true, + 'ticket' => true, + 'uses' => true, + ]; + + private const PhpCheckStyle = ['SuppressWarnings' => true]; + + private const PhpStorm = ['noinspection' => true]; + + private const PEAR = ['package_version' => true]; + + private const PlainUML = [ + 'startuml' => true, + 'enduml' => true, + ]; + + private const Symfony = ['experimental' => true]; + + private const PhpCodeSniffer = [ + 'codingStandardsIgnoreStart' => true, + 'codingStandardsIgnoreEnd' => true, + ]; + + private const SlevomatCodingStandard = ['phpcsSuppress' => true]; + + private const Phan = ['suppress' => true]; + + private const Rector = ['noRector' => true]; + + private const StaticAnalysis = [ + // PHPStan, Psalm + 'extends' => true, + 'implements' => true, + 'template' => true, + 'use' => true, + + // Psalm + 'pure' => true, + 'immutable' => true, + ]; + + public const LIST = self::Reserved + + self::WidelyUsedNonStandard + + self::PhpDocumentor1 + + self::PhpDocumentor2 + + self::PHPUnit + + self::PhpCheckStyle + + self::PhpStorm + + self::PEAR + + self::PlainUML + + self::Symfony + + self::SlevomatCodingStandard + + self::PhpCodeSniffer + + self::Phan + + self::Rector + + self::StaticAnalysis; + + private function __construct() + { + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php new file mode 100644 index 0000000..42e7076 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php @@ -0,0 +1,100 @@ +delegate = $reader; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + $annotations = []; + foreach ($this->delegate->getClassAnnotations($class) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotation) + { + return $this->delegate->getClassAnnotation($class, $annotation); + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + $annotations = []; + foreach ($this->delegate->getMethodAnnotations($method) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotation) + { + return $this->delegate->getMethodAnnotation($method, $annotation); + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + $annotations = []; + foreach ($this->delegate->getPropertyAnnotations($property) as $annot) { + $annotations[get_class($annot)] = $annot; + } + + return $annotations; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotation) + { + return $this->delegate->getPropertyAnnotation($property, $annotation); + } + + /** + * Proxies all methods to the delegate. + * + * @param string $method + * @param mixed[] $args + * + * @return mixed + */ + public function __call($method, $args) + { + return call_user_func_array([$this->delegate, $method], $args); + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php new file mode 100644 index 0000000..8af224c --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php @@ -0,0 +1,14 @@ +ReflectionClass object. + * + * @return array A list with use statements in the form (Alias => FQN). + */ + public function parseClass(ReflectionClass $class) + { + return $this->parseUseStatements($class); + } + + /** + * Parse a class or function for use statements. + * + * @param ReflectionClass|ReflectionFunction $reflection + * + * @psalm-return array a list with use statements in the form (Alias => FQN). + */ + public function parseUseStatements($reflection): array + { + if (method_exists($reflection, 'getUseStatements')) { + return $reflection->getUseStatements(); + } + + $filename = $reflection->getFileName(); + + if ($filename === false) { + return []; + } + + $content = $this->getFileContent($filename, $reflection->getStartLine()); + + if ($content === null) { + return []; + } + + $namespace = preg_quote($reflection->getNamespaceName()); + $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); + $tokenizer = new TokenParser('parseUseStatements($reflection->getNamespaceName()); + } + + /** + * Gets the content of the file right up to the given line number. + * + * @param string $filename The name of the file to load. + * @param int $lineNumber The number of lines to read from file. + * + * @return string|null The content of the file or null if the file does not exist. + */ + private function getFileContent($filename, $lineNumber) + { + if (! is_file($filename)) { + return null; + } + + $content = ''; + $lineCnt = 0; + $file = new SplFileObject($filename); + while (! $file->eof()) { + if ($lineCnt++ === $lineNumber) { + break; + } + + $content .= $file->fgets(); + } + + return $content; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php new file mode 100644 index 0000000..a7099d5 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php @@ -0,0 +1,232 @@ +> */ + private $loadedAnnotations = []; + + /** @var int[] */ + private $loadedFilemtimes = []; + + public function __construct(Reader $reader, CacheItemPoolInterface $cache, bool $debug = false) + { + $this->delegate = $reader; + $this->cache = $cache; + $this->debug = (bool) $debug; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + $cacheKey = $class->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class, 'getClassAnnotations', $class); + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + foreach ($this->getClassAnnotations($class) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + $class = $property->getDeclaringClass(); + $cacheKey = $class->getName() . '$' . $property->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class, 'getPropertyAnnotations', $property); + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) + { + foreach ($this->getPropertyAnnotations($property) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + $class = $method->getDeclaringClass(); + $cacheKey = $class->getName() . '#' . $method->getName(); + + if (isset($this->loadedAnnotations[$cacheKey])) { + return $this->loadedAnnotations[$cacheKey]; + } + + $annots = $this->fetchFromCache($cacheKey, $class, 'getMethodAnnotations', $method); + + return $this->loadedAnnotations[$cacheKey] = $annots; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) + { + foreach ($this->getMethodAnnotations($method) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + public function clearLoadedAnnotations(): void + { + $this->loadedAnnotations = []; + $this->loadedFilemtimes = []; + } + + /** @return mixed[] */ + private function fetchFromCache( + string $cacheKey, + ReflectionClass $class, + string $method, + Reflector $reflector + ): array { + $cacheKey = rawurlencode($cacheKey); + + $item = $this->cache->getItem($cacheKey); + if (($this->debug && ! $this->refresh($cacheKey, $class)) || ! $item->isHit()) { + $this->cache->save($item->set($this->delegate->{$method}($reflector))); + } + + return $item->get(); + } + + /** + * Used in debug mode to check if the cache is fresh. + * + * @return bool Returns true if the cache was fresh, or false if the class + * being read was modified since writing to the cache. + */ + private function refresh(string $cacheKey, ReflectionClass $class): bool + { + $lastModification = $this->getLastModification($class); + if ($lastModification === 0) { + return true; + } + + $item = $this->cache->getItem('[C]' . $cacheKey); + if ($item->isHit() && $item->get() >= $lastModification) { + return true; + } + + $this->cache->save($item->set(time())); + + return false; + } + + /** + * Returns the time the class was last modified, testing traits and parents + */ + private function getLastModification(ReflectionClass $class): int + { + $filename = $class->getFileName(); + + if (isset($this->loadedFilemtimes[$filename])) { + return $this->loadedFilemtimes[$filename]; + } + + $parent = $class->getParentClass(); + + $lastModification = max(array_merge( + [$filename ? filemtime($filename) : 0], + array_map(function (ReflectionClass $reflectionTrait): int { + return $this->getTraitLastModificationTime($reflectionTrait); + }, $class->getTraits()), + array_map(function (ReflectionClass $class): int { + return $this->getLastModification($class); + }, $class->getInterfaces()), + $parent ? [$this->getLastModification($parent)] : [] + )); + + assert($lastModification !== false); + + return $this->loadedFilemtimes[$filename] = $lastModification; + } + + private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int + { + $fileName = $reflectionTrait->getFileName(); + + if (isset($this->loadedFilemtimes[$fileName])) { + return $this->loadedFilemtimes[$fileName]; + } + + $lastModificationTime = max(array_merge( + [$fileName ? filemtime($fileName) : 0], + array_map(function (ReflectionClass $reflectionTrait): int { + return $this->getTraitLastModificationTime($reflectionTrait); + }, $reflectionTrait->getTraits()) + )); + + assert($lastModificationTime !== false); + + return $this->loadedFilemtimes[$fileName] = $lastModificationTime; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php new file mode 100644 index 0000000..0663ffd --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php @@ -0,0 +1,80 @@ + An array of Annotations. + */ + public function getClassAnnotations(ReflectionClass $class); + + /** + * Gets a class annotation. + * + * @param ReflectionClass $class The ReflectionClass of the class from which + * the class annotations should be read. + * @param class-string $annotationName The name of the annotation. + * + * @return T|null The Annotation or NULL, if the requested annotation does not exist. + * + * @template T + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName); + + /** + * Gets the annotations applied to a method. + * + * @param ReflectionMethod $method The ReflectionMethod of the method from which + * the annotations should be read. + * + * @return array An array of Annotations. + */ + public function getMethodAnnotations(ReflectionMethod $method); + + /** + * Gets a method annotation. + * + * @param ReflectionMethod $method The ReflectionMethod to read the annotations from. + * @param class-string $annotationName The name of the annotation. + * + * @return T|null The Annotation or NULL, if the requested annotation does not exist. + * + * @template T + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName); + + /** + * Gets the annotations applied to a property. + * + * @param ReflectionProperty $property The ReflectionProperty of the property + * from which the annotations should be read. + * + * @return array An array of Annotations. + */ + public function getPropertyAnnotations(ReflectionProperty $property); + + /** + * Gets a property annotation. + * + * @param ReflectionProperty $property The ReflectionProperty to read the annotations from. + * @param class-string $annotationName The name of the annotation. + * + * @return T|null The Annotation or NULL, if the requested annotation does not exist. + * + * @template T + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName); +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php new file mode 100644 index 0000000..8a78c11 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php @@ -0,0 +1,114 @@ +parser = new DocParser(); + $this->parser->setIgnoreNotImportedAnnotations(true); + } + + /** + * Adds a namespace in which we will look for annotations. + * + * @param string $namespace + * + * @return void + */ + public function addNamespace($namespace) + { + $this->parser->addNamespace($namespace); + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotations(ReflectionClass $class) + { + return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotations(ReflectionMethod $method) + { + return $this->parser->parse( + $method->getDocComment(), + 'method ' . $method->getDeclaringClass()->name . '::' . $method->getName() . '()' + ); + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotations(ReflectionProperty $property) + { + return $this->parser->parse( + $property->getDocComment(), + 'property ' . $property->getDeclaringClass()->name . '::$' . $property->getName() + ); + } + + /** + * {@inheritDoc} + */ + public function getClassAnnotation(ReflectionClass $class, $annotationName) + { + foreach ($this->getClassAnnotations($class) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) + { + foreach ($this->getMethodAnnotations($method) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) + { + foreach ($this->getPropertyAnnotations($property) as $annot) { + if ($annot instanceof $annotationName) { + return $annot; + } + } + + return null; + } +} diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php new file mode 100644 index 0000000..9605fb8 --- /dev/null +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php @@ -0,0 +1,208 @@ + + */ + private $tokens; + + /** + * The number of tokens. + * + * @var int + */ + private $numTokens; + + /** + * The current array pointer. + * + * @var int + */ + private $pointer = 0; + + /** + * @param string $contents + */ + public function __construct($contents) + { + $this->tokens = token_get_all($contents); + + // The PHP parser sets internal compiler globals for certain things. Annoyingly, the last docblock comment it + // saw gets stored in doc_comment. When it comes to compile the next thing to be include()d this stored + // doc_comment becomes owned by the first thing the compiler sees in the file that it considers might have a + // docblock. If the first thing in the file is a class without a doc block this would cause calls to + // getDocBlock() on said class to return our long lost doc_comment. Argh. + // To workaround, cause the parser to parse an empty docblock. Sure getDocBlock() will return this, but at least + // it's harmless to us. + token_get_all("numTokens = count($this->tokens); + } + + /** + * Gets the next non whitespace and non comment token. + * + * @param bool $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped. + * If FALSE then only whitespace and normal comments are skipped. + * + * @return mixed[]|string|null The token if exists, null otherwise. + */ + public function next($docCommentIsComment = true) + { + for ($i = $this->pointer; $i < $this->numTokens; $i++) { + $this->pointer++; + if ( + $this->tokens[$i][0] === T_WHITESPACE || + $this->tokens[$i][0] === T_COMMENT || + ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT) + ) { + continue; + } + + return $this->tokens[$i]; + } + + return null; + } + + /** + * Parses a single use statement. + * + * @return array A list with all found class names for a use statement. + */ + public function parseUseStatement() + { + $groupRoot = ''; + $class = ''; + $alias = ''; + $statements = []; + $explicitAlias = false; + while (($token = $this->next())) { + if (! $explicitAlias && $token[0] === T_STRING) { + $class .= $token[1]; + $alias = $token[1]; + } elseif ($explicitAlias && $token[0] === T_STRING) { + $alias = $token[1]; + } elseif ( + PHP_VERSION_ID >= 80000 && + ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED) + ) { + $class .= $token[1]; + + $classSplit = explode('\\', $token[1]); + $alias = $classSplit[count($classSplit) - 1]; + } elseif ($token[0] === T_NS_SEPARATOR) { + $class .= '\\'; + $alias = ''; + } elseif ($token[0] === T_AS) { + $explicitAlias = true; + $alias = ''; + } elseif ($token === ',') { + $statements[strtolower($alias)] = $groupRoot . $class; + $class = ''; + $alias = ''; + $explicitAlias = false; + } elseif ($token === ';') { + $statements[strtolower($alias)] = $groupRoot . $class; + break; + } elseif ($token === '{') { + $groupRoot = $class; + $class = ''; + } elseif ($token === '}') { + continue; + } else { + break; + } + } + + return $statements; + } + + /** + * Gets all use statements. + * + * @param string $namespaceName The namespace name of the reflected class. + * + * @return array A list with all found use statements. + */ + public function parseUseStatements($namespaceName) + { + $statements = []; + while (($token = $this->next())) { + if ($token[0] === T_USE) { + $statements = array_merge($statements, $this->parseUseStatement()); + continue; + } + + if ($token[0] !== T_NAMESPACE || $this->parseNamespace() !== $namespaceName) { + continue; + } + + // Get fresh array for new namespace. This is to prevent the parser to collect the use statements + // for a previous namespace with the same name. This is the case if a namespace is defined twice + // or if a namespace with the same name is commented out. + $statements = []; + } + + return $statements; + } + + /** + * Gets the namespace. + * + * @return string The found namespace. + */ + public function parseNamespace() + { + $name = ''; + while ( + ($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR || ( + PHP_VERSION_ID >= 80000 && + ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED) + )) + ) { + $name .= $token[1]; + } + + return $name; + } + + /** + * Gets the class name. + * + * @return string The found class name. + */ + public function parseClass() + { + // Namespaces and class names are tokenized the same: T_STRINGs + // separated by T_NS_SEPARATOR so we can use one function to provide + // both. + return $this->parseNamespace(); + } +} diff --git a/vendor/doctrine/lexer/LICENSE b/vendor/doctrine/lexer/LICENSE new file mode 100644 index 0000000..e8fdec4 --- /dev/null +++ b/vendor/doctrine/lexer/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2006-2018 Doctrine Project + +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/doctrine/lexer/README.md b/vendor/doctrine/lexer/README.md new file mode 100644 index 0000000..784f2a2 --- /dev/null +++ b/vendor/doctrine/lexer/README.md @@ -0,0 +1,9 @@ +# Doctrine Lexer + +[![Build Status](https://github.com/doctrine/lexer/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/lexer/actions) + +Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. + +This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). + +https://www.doctrine-project.org/projects/lexer.html diff --git a/vendor/doctrine/lexer/composer.json b/vendor/doctrine/lexer/composer.json new file mode 100644 index 0000000..c435647 --- /dev/null +++ b/vendor/doctrine/lexer/composer.json @@ -0,0 +1,41 @@ +{ + "name": "doctrine/lexer", + "type": "library", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "keywords": [ + "php", + "parser", + "lexer", + "annotations", + "docblock" + ], + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" } + }, + "config": { + "allow-plugins": { + "composer/package-versions-deprecated": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "sort-packages": true + } +} diff --git a/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php new file mode 100644 index 0000000..7e8a11d --- /dev/null +++ b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php @@ -0,0 +1,337 @@ + + */ + private $tokens = []; + + /** + * Current lexer position in input string. + * + * @var int + */ + private $position = 0; + + /** + * Current peek of current lexer position. + * + * @var int + */ + private $peek = 0; + + /** + * The next token in the input. + * + * @var mixed[]|null + * @psalm-var Token|null + */ + public $lookahead; + + /** + * The last matched/seen token. + * + * @var mixed[]|null + * @psalm-var Token|null + */ + public $token; + + /** + * Composed regex for input parsing. + * + * @var string|null + */ + private $regex; + + /** + * Sets the input data to be tokenized. + * + * The Lexer is immediately reset and the new input tokenized. + * Any unprocessed tokens from any previous input are lost. + * + * @param string $input The input to be tokenized. + * + * @return void + */ + public function setInput($input) + { + $this->input = $input; + $this->tokens = []; + + $this->reset(); + $this->scan($input); + } + + /** + * Resets the lexer. + * + * @return void + */ + public function reset() + { + $this->lookahead = null; + $this->token = null; + $this->peek = 0; + $this->position = 0; + } + + /** + * Resets the peek pointer to 0. + * + * @return void + */ + public function resetPeek() + { + $this->peek = 0; + } + + /** + * Resets the lexer position on the input to the given position. + * + * @param int $position Position to place the lexical scanner. + * + * @return void + */ + public function resetPosition($position = 0) + { + $this->position = $position; + } + + /** + * Retrieve the original lexer's input until a given position. + * + * @param int $position + * + * @return string + */ + public function getInputUntilPosition($position) + { + return substr($this->input, 0, $position); + } + + /** + * Checks whether a given token matches the current lookahead. + * + * @param int|string $type + * + * @return bool + */ + public function isNextToken($type) + { + return $this->lookahead !== null && $this->lookahead['type'] === $type; + } + + /** + * Checks whether any of the given tokens matches the current lookahead. + * + * @param list $types + * + * @return bool + */ + public function isNextTokenAny(array $types) + { + return $this->lookahead !== null && in_array($this->lookahead['type'], $types, true); + } + + /** + * Moves to the next token in the input string. + * + * @return bool + */ + public function moveNext() + { + $this->peek = 0; + $this->token = $this->lookahead; + $this->lookahead = isset($this->tokens[$this->position]) + ? $this->tokens[$this->position++] : null; + + return $this->lookahead !== null; + } + + /** + * Tells the lexer to skip input tokens until it sees a token with the given value. + * + * @param string $type The token type to skip until. + * + * @return void + */ + public function skipUntil($type) + { + while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { + $this->moveNext(); + } + } + + /** + * Checks if given value is identical to the given token. + * + * @param mixed $value + * @param int|string $token + * + * @return bool + */ + public function isA($value, $token) + { + return $this->getType($value) === $token; + } + + /** + * Moves the lookahead token forward. + * + * @return mixed[]|null The next token or NULL if there are no more tokens ahead. + * @psalm-return Token|null + */ + public function peek() + { + if (isset($this->tokens[$this->position + $this->peek])) { + return $this->tokens[$this->position + $this->peek++]; + } + + return null; + } + + /** + * Peeks at the next token, returns it and immediately resets the peek. + * + * @return mixed[]|null The next token or NULL if there are no more tokens ahead. + * @psalm-return Token|null + */ + public function glimpse() + { + $peek = $this->peek(); + $this->peek = 0; + + return $peek; + } + + /** + * Scans the input string for tokens. + * + * @param string $input A query string. + * + * @return void + */ + protected function scan($input) + { + if (! isset($this->regex)) { + $this->regex = sprintf( + '/(%s)|%s/%s', + implode(')|(', $this->getCatchablePatterns()), + implode('|', $this->getNonCatchablePatterns()), + $this->getModifiers() + ); + } + + $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; + $matches = preg_split($this->regex, $input, -1, $flags); + + if ($matches === false) { + // Work around https://bugs.php.net/78122 + $matches = [[$input, 0]]; + } + + foreach ($matches as $match) { + // Must remain before 'value' assignment since it can change content + $type = $this->getType($match[0]); + + $this->tokens[] = [ + 'value' => $match[0], + 'type' => $type, + 'position' => $match[1], + ]; + } + } + + /** + * Gets the literal for a given token. + * + * @param int|string $token + * + * @return int|string + */ + public function getLiteral($token) + { + $className = static::class; + $reflClass = new ReflectionClass($className); + $constants = $reflClass->getConstants(); + + foreach ($constants as $name => $value) { + if ($value === $token) { + return $className . '::' . $name; + } + } + + return $token; + } + + /** + * Regex modifiers + * + * @return string + */ + protected function getModifiers() + { + return 'iu'; + } + + /** + * Lexical catchable patterns. + * + * @return string[] + */ + abstract protected function getCatchablePatterns(); + + /** + * Lexical non-catchable patterns. + * + * @return string[] + */ + abstract protected function getNonCatchablePatterns(); + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * + * @return int|string|null + */ + abstract protected function getType(&$value); +} diff --git a/vendor/doctrine/lexer/psalm.xml b/vendor/doctrine/lexer/psalm.xml new file mode 100644 index 0000000..f331e50 --- /dev/null +++ b/vendor/doctrine/lexer/psalm.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/vendor/symfony/form/AbstractExtension.php b/vendor/symfony/form/AbstractExtension.php new file mode 100644 index 0000000..ca27900 --- /dev/null +++ b/vendor/symfony/form/AbstractExtension.php @@ -0,0 +1,198 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +abstract class AbstractExtension implements FormExtensionInterface +{ + /** + * The types provided by this extension. + * + * @var FormTypeInterface[] + */ + private $types; + + /** + * The type extensions provided by this extension. + * + * @var FormTypeExtensionInterface[][] + */ + private $typeExtensions; + + /** + * The type guesser provided by this extension. + * + * @var FormTypeGuesserInterface|null + */ + private $typeGuesser; + + /** + * Whether the type guesser has been loaded. + * + * @var bool + */ + private $typeGuesserLoaded = false; + + /** + * {@inheritdoc} + */ + public function getType(string $name) + { + if (null === $this->types) { + $this->initTypes(); + } + + if (!isset($this->types[$name])) { + throw new InvalidArgumentException(sprintf('The type "%s" cannot be loaded by this extension.', $name)); + } + + return $this->types[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasType(string $name) + { + if (null === $this->types) { + $this->initTypes(); + } + + return isset($this->types[$name]); + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions(string $name) + { + if (null === $this->typeExtensions) { + $this->initTypeExtensions(); + } + + return $this->typeExtensions[$name] + ?? []; + } + + /** + * {@inheritdoc} + */ + public function hasTypeExtensions(string $name) + { + if (null === $this->typeExtensions) { + $this->initTypeExtensions(); + } + + return isset($this->typeExtensions[$name]) && \count($this->typeExtensions[$name]) > 0; + } + + /** + * {@inheritdoc} + */ + public function getTypeGuesser() + { + if (!$this->typeGuesserLoaded) { + $this->initTypeGuesser(); + } + + return $this->typeGuesser; + } + + /** + * Registers the types. + * + * @return FormTypeInterface[] + */ + protected function loadTypes() + { + return []; + } + + /** + * Registers the type extensions. + * + * @return FormTypeExtensionInterface[] + */ + protected function loadTypeExtensions() + { + return []; + } + + /** + * Registers the type guesser. + * + * @return FormTypeGuesserInterface|null + */ + protected function loadTypeGuesser() + { + return null; + } + + /** + * Initializes the types. + * + * @throws UnexpectedTypeException if any registered type is not an instance of FormTypeInterface + */ + private function initTypes() + { + $this->types = []; + + foreach ($this->loadTypes() as $type) { + if (!$type instanceof FormTypeInterface) { + throw new UnexpectedTypeException($type, FormTypeInterface::class); + } + + $this->types[\get_class($type)] = $type; + } + } + + /** + * Initializes the type extensions. + * + * @throws UnexpectedTypeException if any registered type extension is not + * an instance of FormTypeExtensionInterface + */ + private function initTypeExtensions() + { + $this->typeExtensions = []; + + foreach ($this->loadTypeExtensions() as $extension) { + if (!$extension instanceof FormTypeExtensionInterface) { + throw new UnexpectedTypeException($extension, FormTypeExtensionInterface::class); + } + + foreach ($extension::getExtendedTypes() as $extendedType) { + $this->typeExtensions[$extendedType][] = $extension; + } + } + } + + /** + * Initializes the type guesser. + * + * @throws UnexpectedTypeException if the type guesser is not an instance of FormTypeGuesserInterface + */ + private function initTypeGuesser() + { + $this->typeGuesserLoaded = true; + + $this->typeGuesser = $this->loadTypeGuesser(); + if (null !== $this->typeGuesser && !$this->typeGuesser instanceof FormTypeGuesserInterface) { + throw new UnexpectedTypeException($this->typeGuesser, FormTypeGuesserInterface::class); + } + } +} diff --git a/vendor/symfony/form/AbstractRendererEngine.php b/vendor/symfony/form/AbstractRendererEngine.php new file mode 100644 index 0000000..07bf28c --- /dev/null +++ b/vendor/symfony/form/AbstractRendererEngine.php @@ -0,0 +1,206 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Contracts\Service\ResetInterface; + +/** + * Default implementation of {@link FormRendererEngineInterface}. + * + * @author Bernhard Schussek + */ +abstract class AbstractRendererEngine implements FormRendererEngineInterface, ResetInterface +{ + /** + * The variable in {@link FormView} used as cache key. + */ + public const CACHE_KEY_VAR = 'cache_key'; + + /** + * @var array + */ + protected $defaultThemes; + + /** + * @var array[] + */ + protected $themes = []; + + /** + * @var bool[] + */ + protected $useDefaultThemes = []; + + /** + * @var array[] + */ + protected $resources = []; + + /** + * @var array> + */ + private $resourceHierarchyLevels = []; + + /** + * Creates a new renderer engine. + * + * @param array $defaultThemes The default themes. The type of these + * themes is open to the implementation. + */ + public function __construct(array $defaultThemes = []) + { + $this->defaultThemes = $defaultThemes; + } + + /** + * {@inheritdoc} + */ + public function setTheme(FormView $view, $themes, bool $useDefaultThemes = true) + { + $cacheKey = $view->vars[self::CACHE_KEY_VAR]; + + // Do not cast, as casting turns objects into arrays of properties + $this->themes[$cacheKey] = \is_array($themes) ? $themes : [$themes]; + $this->useDefaultThemes[$cacheKey] = $useDefaultThemes; + + // Unset instead of resetting to an empty array, in order to allow + // implementations (like TwigRendererEngine) to check whether $cacheKey + // is set at all. + unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]); + } + + /** + * {@inheritdoc} + */ + public function getResourceForBlockName(FormView $view, string $blockName) + { + $cacheKey = $view->vars[self::CACHE_KEY_VAR]; + + if (!isset($this->resources[$cacheKey][$blockName])) { + $this->loadResourceForBlockName($cacheKey, $view, $blockName); + } + + return $this->resources[$cacheKey][$blockName]; + } + + /** + * {@inheritdoc} + */ + public function getResourceForBlockNameHierarchy(FormView $view, array $blockNameHierarchy, int $hierarchyLevel) + { + $cacheKey = $view->vars[self::CACHE_KEY_VAR]; + $blockName = $blockNameHierarchy[$hierarchyLevel]; + + if (!isset($this->resources[$cacheKey][$blockName])) { + $this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $hierarchyLevel); + } + + return $this->resources[$cacheKey][$blockName]; + } + + /** + * {@inheritdoc} + */ + public function getResourceHierarchyLevel(FormView $view, array $blockNameHierarchy, int $hierarchyLevel) + { + $cacheKey = $view->vars[self::CACHE_KEY_VAR]; + $blockName = $blockNameHierarchy[$hierarchyLevel]; + + if (!isset($this->resources[$cacheKey][$blockName])) { + $this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $hierarchyLevel); + } + + // If $block was previously rendered loaded with loadTemplateForBlock(), the template + // is cached but the hierarchy level is not. In this case, we know that the block + // exists at this very hierarchy level, so we can just set it. + if (!isset($this->resourceHierarchyLevels[$cacheKey][$blockName])) { + $this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel; + } + + return $this->resourceHierarchyLevels[$cacheKey][$blockName]; + } + + /** + * Loads the cache with the resource for a given block name. + * + * @see getResourceForBlock() + * + * @return bool + */ + abstract protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName); + + /** + * Loads the cache with the resource for a specific level of a block hierarchy. + * + * @see getResourceForBlockHierarchy() + */ + private function loadResourceForBlockNameHierarchy(string $cacheKey, FormView $view, array $blockNameHierarchy, int $hierarchyLevel): bool + { + $blockName = $blockNameHierarchy[$hierarchyLevel]; + + // Try to find a template for that block + if ($this->loadResourceForBlockName($cacheKey, $view, $blockName)) { + // If loadTemplateForBlock() returns true, it was able to populate the + // cache. The only missing thing is to set the hierarchy level at which + // the template was found. + $this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel; + + return true; + } + + if ($hierarchyLevel > 0) { + $parentLevel = $hierarchyLevel - 1; + $parentBlockName = $blockNameHierarchy[$parentLevel]; + + // The next two if statements contain slightly duplicated code. This is by intention + // and tries to avoid execution of unnecessary checks in order to increase performance. + + if (isset($this->resources[$cacheKey][$parentBlockName])) { + // It may happen that the parent block is already loaded, but its level is not. + // In this case, the parent block must have been loaded by loadResourceForBlock(), + // which does not check the hierarchy of the block. Subsequently the block must have + // been found directly on the parent level. + if (!isset($this->resourceHierarchyLevels[$cacheKey][$parentBlockName])) { + $this->resourceHierarchyLevels[$cacheKey][$parentBlockName] = $parentLevel; + } + + // Cache the shortcuts for further accesses + $this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName]; + $this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName]; + + return true; + } + + if ($this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $parentLevel)) { + // Cache the shortcuts for further accesses + $this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName]; + $this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName]; + + return true; + } + } + + // Cache the result for further accesses + $this->resources[$cacheKey][$blockName] = false; + $this->resourceHierarchyLevels[$cacheKey][$blockName] = false; + + return false; + } + + public function reset(): void + { + $this->themes = []; + $this->useDefaultThemes = []; + $this->resources = []; + $this->resourceHierarchyLevels = []; + } +} diff --git a/vendor/symfony/form/AbstractType.php b/vendor/symfony/form/AbstractType.php new file mode 100644 index 0000000..3325b8b --- /dev/null +++ b/vendor/symfony/form/AbstractType.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Util\StringUtil; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Bernhard Schussek + */ +abstract class AbstractType implements FormTypeInterface +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return StringUtil::fqcnToBlockPrefix(static::class) ?: ''; + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return FormType::class; + } +} diff --git a/vendor/symfony/form/AbstractTypeExtension.php b/vendor/symfony/form/AbstractTypeExtension.php new file mode 100644 index 0000000..9d369bf --- /dev/null +++ b/vendor/symfony/form/AbstractTypeExtension.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Bernhard Schussek + */ +abstract class AbstractTypeExtension implements FormTypeExtensionInterface +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + } +} diff --git a/vendor/symfony/form/Button.php b/vendor/symfony/form/Button.php new file mode 100644 index 0000000..1ffdd46 --- /dev/null +++ b/vendor/symfony/form/Button.php @@ -0,0 +1,455 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\AlreadySubmittedException; +use Symfony\Component\Form\Exception\BadMethodCallException; + +/** + * A form button. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class Button implements \IteratorAggregate, FormInterface +{ + /** + * @var FormInterface|null + */ + private $parent; + + /** + * @var FormConfigInterface + */ + private $config; + + /** + * @var bool + */ + private $submitted = false; + + /** + * Creates a new button from a form configuration. + */ + public function __construct(FormConfigInterface $config) + { + $this->config = $config; + } + + /** + * Unsupported method. + * + * @param string $offset + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return false; + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @param string $offset + * + * @return FormInterface + * + * @throws BadMethodCallException + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @param string $offset + * @param FormInterface $value + * + * @return void + * + * @throws BadMethodCallException + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @param string $offset + * + * @return void + * + * @throws BadMethodCallException + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * {@inheritdoc} + */ + public function setParent(FormInterface $parent = null) + { + if ($this->submitted) { + throw new AlreadySubmittedException('You cannot set the parent of a submitted button.'); + } + + $this->parent = $parent; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return $this->parent; + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @throws BadMethodCallException + */ + public function add($child, string $type = null, array $options = []) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @throws BadMethodCallException + */ + public function get(string $name) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * @return bool + */ + public function has(string $name) + { + return false; + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @throws BadMethodCallException + */ + public function remove(string $name) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * {@inheritdoc} + */ + public function all() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getErrors(bool $deep = false, bool $flatten = true) + { + return new FormErrorIterator($this, []); + } + + /** + * Unsupported method. + * + * This method should not be invoked. + * + * @param mixed $modelData + * + * @return $this + */ + public function setData($modelData) + { + // no-op, called during initialization of the form tree + return $this; + } + + /** + * Unsupported method. + */ + public function getData() + { + return null; + } + + /** + * Unsupported method. + */ + public function getNormData() + { + return null; + } + + /** + * Unsupported method. + */ + public function getViewData() + { + return null; + } + + /** + * Unsupported method. + * + * @return array + */ + public function getExtraData() + { + return []; + } + + /** + * Returns the button's configuration. + * + * @return FormConfigInterface + */ + public function getConfig() + { + return $this->config; + } + + /** + * Returns whether the button is submitted. + * + * @return bool + */ + public function isSubmitted() + { + return $this->submitted; + } + + /** + * Returns the name by which the button is identified in forms. + * + * @return string + */ + public function getName() + { + return $this->config->getName(); + } + + /** + * Unsupported method. + */ + public function getPropertyPath() + { + return null; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function addError(FormError $error) + { + throw new BadMethodCallException('Buttons cannot have errors.'); + } + + /** + * Unsupported method. + * + * @return bool + */ + public function isValid() + { + return true; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function isRequired() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isDisabled() + { + if ($this->parent && $this->parent->isDisabled()) { + return true; + } + + return $this->config->getDisabled(); + } + + /** + * Unsupported method. + * + * @return bool + */ + public function isEmpty() + { + return true; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function isSynchronized() + { + return true; + } + + /** + * Unsupported method. + */ + public function getTransformationFailure() + { + return null; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function initialize() + { + throw new BadMethodCallException('Buttons cannot be initialized. Call initialize() on the root form instead.'); + } + + /** + * Unsupported method. + * + * @param mixed $request + * + * @throws BadMethodCallException + */ + public function handleRequest($request = null) + { + throw new BadMethodCallException('Buttons cannot handle requests. Call handleRequest() on the root form instead.'); + } + + /** + * Submits data to the button. + * + * @param array|string|null $submittedData Not used + * @param bool $clearMissing Not used + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the button has already been submitted + */ + public function submit($submittedData, bool $clearMissing = true) + { + if ($this->submitted) { + throw new AlreadySubmittedException('A form can only be submitted once.'); + } + + $this->submitted = true; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->parent ? $this->parent->getRoot() : $this; + } + + /** + * {@inheritdoc} + */ + public function isRoot() + { + return null === $this->parent; + } + + /** + * {@inheritdoc} + */ + public function createView(FormView $parent = null) + { + if (null === $parent && $this->parent) { + $parent = $this->parent->createView(); + } + + $type = $this->config->getType(); + $options = $this->config->getOptions(); + + $view = $type->createView($this, $parent); + + $type->buildView($view, $this, $options); + $type->finishView($view, $this, $options); + + return $view; + } + + /** + * Unsupported method. + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return 0; + } + + /** + * Unsupported method. + * + * @return \EmptyIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \EmptyIterator(); + } +} diff --git a/vendor/symfony/form/ButtonBuilder.php b/vendor/symfony/form/ButtonBuilder.php new file mode 100644 index 0000000..c85bcc0 --- /dev/null +++ b/vendor/symfony/form/ButtonBuilder.php @@ -0,0 +1,744 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\InvalidArgumentException; + +/** + * A builder for {@link Button} instances. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface +{ + protected $locked = false; + + /** + * @var bool + */ + private $disabled = false; + + /** + * @var ResolvedFormTypeInterface + */ + private $type; + + /** + * @var string + */ + private $name; + + /** + * @var array + */ + private $attributes = []; + + /** + * @var array + */ + private $options; + + /** + * @throws InvalidArgumentException if the name is empty + */ + public function __construct(?string $name, array $options = []) + { + if ('' === $name || null === $name) { + throw new InvalidArgumentException('Buttons cannot have empty names.'); + } + + $this->name = $name; + $this->options = $options; + + FormConfigBuilder::validateName($name); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function add($child, string $type = null, array $options = []) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function create(string $name, string $type = null, array $options = []) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function get(string $name) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function remove(string $name) + { + throw new BadMethodCallException('Buttons cannot have children.'); + } + + /** + * Unsupported method. + * + * @return bool + */ + public function has(string $name) + { + return false; + } + + /** + * Returns the children. + * + * @return array + */ + public function all() + { + return []; + } + + /** + * Creates the button. + * + * @return Button + */ + public function getForm() + { + return new Button($this->getFormConfig()); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function addEventListener(string $eventName, callable $listener, int $priority = 0) + { + throw new BadMethodCallException('Buttons do not support event listeners.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function addEventSubscriber(EventSubscriberInterface $subscriber) + { + throw new BadMethodCallException('Buttons do not support event subscribers.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false) + { + throw new BadMethodCallException('Buttons do not support data transformers.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function resetViewTransformers() + { + throw new BadMethodCallException('Buttons do not support data transformers.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false) + { + throw new BadMethodCallException('Buttons do not support data transformers.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function resetModelTransformers() + { + throw new BadMethodCallException('Buttons do not support data transformers.'); + } + + /** + * {@inheritdoc} + */ + public function setAttribute(string $name, $value) + { + $this->attributes[$name] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setAttributes(array $attributes) + { + $this->attributes = $attributes; + + return $this; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setDataMapper(DataMapperInterface $dataMapper = null) + { + throw new BadMethodCallException('Buttons do not support data mappers.'); + } + + /** + * Set whether the button is disabled. + * + * @return $this + */ + public function setDisabled(bool $disabled) + { + $this->disabled = $disabled; + + return $this; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setEmptyData($emptyData) + { + throw new BadMethodCallException('Buttons do not support empty data.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setErrorBubbling(bool $errorBubbling) + { + throw new BadMethodCallException('Buttons do not support error bubbling.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setRequired(bool $required) + { + throw new BadMethodCallException('Buttons cannot be required.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setPropertyPath($propertyPath) + { + throw new BadMethodCallException('Buttons do not support property paths.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setMapped(bool $mapped) + { + throw new BadMethodCallException('Buttons do not support data mapping.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setByReference(bool $byReference) + { + throw new BadMethodCallException('Buttons do not support data mapping.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setCompound(bool $compound) + { + throw new BadMethodCallException('Buttons cannot be compound.'); + } + + /** + * Sets the type of the button. + * + * @return $this + */ + public function setType(ResolvedFormTypeInterface $type) + { + $this->type = $type; + + return $this; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setData($data) + { + throw new BadMethodCallException('Buttons do not support data.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setDataLocked(bool $locked) + { + throw new BadMethodCallException('Buttons do not support data locking.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setFormFactory(FormFactoryInterface $formFactory) + { + throw new BadMethodCallException('Buttons do not support form factories.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setAction(string $action) + { + throw new BadMethodCallException('Buttons do not support actions.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setMethod(string $method) + { + throw new BadMethodCallException('Buttons do not support methods.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setRequestHandler(RequestHandlerInterface $requestHandler) + { + throw new BadMethodCallException('Buttons do not support request handlers.'); + } + + /** + * Unsupported method. + * + * @return $this + * + * @throws BadMethodCallException + */ + public function setAutoInitialize(bool $initialize) + { + if (true === $initialize) { + throw new BadMethodCallException('Buttons do not support automatic initialization.'); + } + + return $this; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setInheritData(bool $inheritData) + { + throw new BadMethodCallException('Buttons do not support data inheritance.'); + } + + /** + * Builds and returns the button configuration. + * + * @return FormConfigInterface + */ + public function getFormConfig() + { + // This method should be idempotent, so clone the builder + $config = clone $this; + $config->locked = true; + + return $config; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function setIsEmptyCallback(?callable $isEmptyCallback) + { + throw new BadMethodCallException('Buttons do not support "is empty" callback.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function getEventDispatcher() + { + throw new BadMethodCallException('Buttons do not support event dispatching.'); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->name; + } + + /** + * Unsupported method. + */ + public function getPropertyPath() + { + return null; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getMapped() + { + return false; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getByReference() + { + return false; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getCompound() + { + return false; + } + + /** + * Returns the form type used to construct the button. + * + * @return ResolvedFormTypeInterface + */ + public function getType() + { + return $this->type; + } + + /** + * Unsupported method. + * + * @return array + */ + public function getViewTransformers() + { + return []; + } + + /** + * Unsupported method. + * + * @return array + */ + public function getModelTransformers() + { + return []; + } + + /** + * Unsupported method. + */ + public function getDataMapper() + { + return null; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getRequired() + { + return false; + } + + /** + * Returns whether the button is disabled. + * + * @return bool + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getErrorBubbling() + { + return false; + } + + /** + * Unsupported method. + */ + public function getEmptyData() + { + return null; + } + + /** + * Returns additional attributes of the button. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Returns whether the attribute with the given name exists. + * + * @return bool + */ + public function hasAttribute(string $name) + { + return \array_key_exists($name, $this->attributes); + } + + /** + * Returns the value of the given attribute. + * + * @param mixed $default The value returned if the attribute does not exist + * + * @return mixed + */ + public function getAttribute(string $name, $default = null) + { + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; + } + + /** + * Unsupported method. + */ + public function getData() + { + return null; + } + + /** + * Unsupported method. + */ + public function getDataClass() + { + return null; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getDataLocked() + { + return false; + } + + /** + * Unsupported method. + */ + public function getFormFactory() + { + throw new BadMethodCallException('Buttons do not support adding children.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function getAction() + { + throw new BadMethodCallException('Buttons do not support actions.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function getMethod() + { + throw new BadMethodCallException('Buttons do not support methods.'); + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function getRequestHandler() + { + throw new BadMethodCallException('Buttons do not support request handlers.'); + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getAutoInitialize() + { + return false; + } + + /** + * Unsupported method. + * + * @return bool + */ + public function getInheritData() + { + return false; + } + + /** + * Returns all options passed during the construction of the button. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Returns whether a specific option exists. + * + * @return bool + */ + public function hasOption(string $name) + { + return \array_key_exists($name, $this->options); + } + + /** + * Returns the value of a specific option. + * + * @param mixed $default The value returned if the option does not exist + * + * @return mixed + */ + public function getOption(string $name, $default = null) + { + return \array_key_exists($name, $this->options) ? $this->options[$name] : $default; + } + + /** + * Unsupported method. + * + * @throws BadMethodCallException + */ + public function getIsEmptyCallback(): ?callable + { + throw new BadMethodCallException('Buttons do not support "is empty" callback.'); + } + + /** + * Unsupported method. + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return 0; + } + + /** + * Unsupported method. + * + * @return \EmptyIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \EmptyIterator(); + } +} diff --git a/vendor/symfony/form/ButtonTypeInterface.php b/vendor/symfony/form/ButtonTypeInterface.php new file mode 100644 index 0000000..dd5117c --- /dev/null +++ b/vendor/symfony/form/ButtonTypeInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A type that should be converted into a {@link Button} instance. + * + * @author Bernhard Schussek + */ +interface ButtonTypeInterface extends FormTypeInterface +{ +} diff --git a/vendor/symfony/form/CHANGELOG.md b/vendor/symfony/form/CHANGELOG.md new file mode 100644 index 0000000..9d7e764 --- /dev/null +++ b/vendor/symfony/form/CHANGELOG.md @@ -0,0 +1,567 @@ +CHANGELOG +========= + +5.4 +--- + + * Deprecate calling `FormErrorIterator::children()` if the current element is not iterable. + * Allow to pass `TranslatableMessage` objects to the `help` option + * Add the `EnumType` + +5.3 +--- + + * Changed `$forms` parameter type of the `DataMapperInterface::mapDataToForms()` method from `iterable` to `\Traversable`. + * Changed `$forms` parameter type of the `DataMapperInterface::mapFormsToData()` method from `iterable` to `\Traversable`. + * Deprecated passing an array as the second argument of the `DataMapper::mapDataToForms()` method, pass `\Traversable` instead. + * Deprecated passing an array as the first argument of the `DataMapper::mapFormsToData()` method, pass `\Traversable` instead. + * Deprecated passing an array as the second argument of the `CheckboxListMapper::mapDataToForms()` method, pass `\Traversable` instead. + * Deprecated passing an array as the first argument of the `CheckboxListMapper::mapFormsToData()` method, pass `\Traversable` instead. + * Deprecated passing an array as the second argument of the `RadioListMapper::mapDataToForms()` method, pass `\Traversable` instead. + * Deprecated passing an array as the first argument of the `RadioListMapper::mapFormsToData()` method, pass `\Traversable` instead. + * Added a `choice_translation_parameters` option to `ChoiceType` + * Add `UuidType` and `UlidType` + * Dependency on `symfony/intl` was removed. Install `symfony/intl` if you are using `LocaleType`, `CountryType`, `CurrencyType`, `LanguageType` or `TimezoneType`. + * Add `priority` option to `BaseType` and sorting view fields + +5.2.0 +----- + + * Added support for using the `{{ label }}` placeholder in constraint messages, which is replaced in the `ViolationMapper` by the corresponding field form label. + * Added `DataMapper`, `ChainAccessor`, `PropertyPathAccessor` and `CallbackAccessor` with new callable `getter` and `setter` options for each form type + * Deprecated `PropertyPathMapper` in favor of `DataMapper` and `PropertyPathAccessor` + * Added an `html5` option to `MoneyType` and `PercentType`, to use `` + +5.1.0 +----- + + * Deprecated not configuring the `rounding_mode` option of the `PercentType`. It will default to `\NumberFormatter::ROUND_HALFUP` in Symfony 6. + * Deprecated not passing a rounding mode to the constructor of `PercentToLocalizedStringTransformer`. It will default to `\NumberFormatter::ROUND_HALFUP` in Symfony 6. + * Added `collection_entry` block prefix to `CollectionType` entries + * Added a `choice_filter` option to `ChoiceType` + * Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()` - not defining them is deprecated. + * Added a `ChoiceList` facade to leverage explicit choice list caching based on options + * Added an `AbstractChoiceLoader` to simplify implementations and handle global optimizations + * The `view_timezone` option defaults to the `model_timezone` if no `reference_date` is configured. + * Implementing the `FormConfigInterface` without implementing the `getIsEmptyCallback()` method + is deprecated. The method will be added to the interface in 6.0. + * Implementing the `FormConfigBuilderInterface` without implementing the `setIsEmptyCallback()` method + is deprecated. The method will be added to the interface in 6.0. + * Added a `rounding_mode` option for the PercentType and correctly round the value when submitted + * Deprecated `Symfony\Component\Form\Extension\Validator\Util\ServerParams` in favor of its parent class `Symfony\Component\Form\Util\ServerParams` + * Added the `html5` option to the `ColorType` to validate the input + * Deprecated `NumberToLocalizedStringTransformer::ROUND_*` constants, use `\NumberFormatter::ROUND_*` instead + +5.0.0 +----- + + * Removed support for using different values for the "model_timezone" and "view_timezone" options of the `TimeType` + without configuring a reference date. + * Removed the `scale` option of the `IntegerType`. + * Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is + set to `single_text` is not supported anymore. + * The `format` option of `DateType` and `DateTimeType` cannot be used when the `html5` option is enabled. + * Using names for buttons that do not start with a letter, a digit, or an underscore throw an exception + * Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons throw an exception. + * removed the `ChoiceLoaderInterface` implementation in `CountryType`, `LanguageType`, `LocaleType` and `CurrencyType` + * removed `getExtendedType()` method of the `FormTypeExtensionInterface` + * added static `getExtendedTypes()` method to the `FormTypeExtensionInterface` + * calling to `FormRenderer::searchAndRenderBlock()` method for fields which were already rendered throw a `BadMethodCallException` + * removed the `regions` option of the `TimezoneType` + * removed the `$scale` argument of the `IntegerToLocalizedStringTransformer` + * removed `TemplatingExtension` and `TemplatingRendererEngine` classes, use Twig instead + * passing a null message when instantiating a `Symfony\Component\Form\FormError` is not allowed + * removed support for using `int` or `float` as data for the `NumberType` when the `input` option is set to `string` + +4.4.0 +----- + + * add new `WeekType` + * using different values for the "model_timezone" and "view_timezone" options of the `TimeType` without configuring a + reference date is deprecated + * preferred choices are repeated in the list of all choices + * deprecated using `int` or `float` as data for the `NumberType` when the `input` option is set to `string` + * The type guesser guesses the HTML accept attribute when a mime type is configured in the File or Image constraint. + * Overriding the methods `FormIntegrationTestCase::setUp()`, `TypeTestCase::setUp()` and `TypeTestCase::tearDown()` without the `void` return-type is deprecated. + * marked all dispatched event classes as `@final` + * Added the `validate` option to `SubmitType` to toggle the browser built-in form validation. + * Added the `alpha3` option to `LanguageType` and `CountryType` to use alpha3 instead of alpha2 codes + +4.3.0 +----- + + * added a `symbol` option to the `PercentType` that allows to disable or customize the output of the percent character + * Using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled is deprecated. + * Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an + exception in 5.0. + * Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and + will lead to an exception in 5.0. + * added `html5` option to `NumberType` that allows to render `type="number"` input fields + * deprecated using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` + option is set to `single_text` + * added `block_prefix` option to `BaseType`. + * added `help_html` option to display the `help` text as HTML. + * `FormError` doesn't implement `Serializable` anymore + * `FormDataCollector` has been marked as `final` + * added `label_translation_parameters`, `attr_translation_parameters`, `help_translation_parameters` options + to `FormType` to pass translation parameters to form labels, attributes (`placeholder` and `title`) and help text respectively. + The passed parameters will replace placeholders in translation messages. + + ```php + class OrderType extends AbstractType + { + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->add('comment', TextType::class, [ + 'label' => 'Comment to the order to %company%', + 'label_translation_parameters' => [ + '%company%' => 'Acme', + ], + 'help' => 'The address of the %company% is %address%', + 'help_translation_parameters' => [ + '%company%' => 'Acme Ltd.', + '%address%' => '4 Form street, Symfonyville', + ], + ]) + } + } + ``` + * added the `input_format` option to `DateType`, `DateTimeType`, and `TimeType` to specify the input format when setting + the `input` option to `string` + * dispatch `PreSubmitEvent` on `form.pre_submit` + * dispatch `SubmitEvent` on `form.submit` + * dispatch `PostSubmitEvent` on `form.post_submit` + * dispatch `PreSetDataEvent` on `form.pre_set_data` + * dispatch `PostSetDataEvent` on `form.post_set_data` + * added an `input` option to `NumberType` + * removed default option grouping in `TimezoneType`, use `group_by` instead + +4.2.0 +----- + + * The `getExtendedType()` method of the `FormTypeExtensionInterface` is deprecated and will be removed in 5.0. Type + extensions must implement the static `getExtendedTypes()` method instead and return an iterable of extended types. + + Before: + + ```php + class FooTypeExtension extends AbstractTypeExtension + { + public function getExtendedType() + { + return FormType::class; + } + + // ... + } + ``` + + After: + + ```php + class FooTypeExtension extends AbstractTypeExtension + { + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } + + // ... + } + ``` + * deprecated the `$scale` argument of the `IntegerToLocalizedStringTransformer` + * added `Symfony\Component\Form\ClearableErrorsInterface` + * deprecated calling `FormRenderer::searchAndRenderBlock` for fields which were already rendered + * added a cause when a CSRF error has occurred + * deprecated the `scale` option of the `IntegerType` + * removed restriction on allowed HTTP methods + * deprecated the `regions` option of the `TimezoneType` + +4.1.0 +----- + + * added `input=datetime_immutable` to `DateType`, `TimeType`, `DateTimeType` + * added `rounding_mode` option to `MoneyType` + * added `choice_translation_locale` option to `CountryType`, `LanguageType`, `LocaleType` and `CurrencyType` + * deprecated the `ChoiceLoaderInterface` implementation in `CountryType`, `LanguageType`, `LocaleType` and `CurrencyType` + * added `input=datetime_immutable` to DateType, TimeType, DateTimeType + * added `rounding_mode` option to MoneyType + +4.0.0 +----- + + * using the `choices` option in `CountryType`, `CurrencyType`, `LanguageType`, + `LocaleType`, and `TimezoneType` when the `choice_loader` option is not `null` + is not supported anymore and the configured choices will be ignored + * callable strings that are passed to the options of the `ChoiceType` are + treated as property paths + * the `choices_as_values` option of the `ChoiceType` has been removed + * removed the support for caching loaded choice lists in `LazyChoiceList`, + cache the choice list in the used `ChoiceLoaderInterface` implementation + instead + * removed the support for objects implementing both `\Traversable` and `\ArrayAccess` in `ResizeFormListener::preSubmit()` + * removed the ability to use `FormDataCollector` without the `symfony/var-dumper` component + * removed passing a `ValueExporter` instance to the `FormDataExtractor::__construct()` method + * removed passing guesser services ids as the fourth argument of `DependencyInjectionExtension::__construct()` + * removed the ability to validate an unsubmitted form. + * removed `ChoiceLoaderInterface` implementation in `TimezoneType` + * added the `false_values` option to the `CheckboxType` which allows to configure custom values which will be treated as `false` during submission + +3.4.0 +----- + + * added `DebugCommand` + * deprecated `ChoiceLoaderInterface` implementation in `TimezoneType` + * added options "input" and "regions" to `TimezoneType` + * added an option to ``Symfony\Component\Form\FormRendererEngineInterface::setTheme()`` and + ``Symfony\Component\Form\FormRendererInterface::setTheme()`` to disable usage of default themes when rendering a form + +3.3.0 +----- + + * deprecated using "choices" option in ``CountryType``, ``CurrencyType``, ``LanguageType``, ``LocaleType``, and + ``TimezoneType`` when "choice_loader" is not ``null`` + * added `Symfony\Component\Form\FormErrorIterator::findByCodes()` + * added `getTypedExtensions`, `getTypes`, and `getTypeGuessers` to `Symfony\Component\Form\Test\FormIntegrationTestCase` + * added `FormPass` + +3.2.0 +----- + + * added `CallbackChoiceLoader` + * implemented `ChoiceLoaderInterface` in children of `ChoiceType` + +3.1.0 +----- + + * deprecated the "choices_as_values" option of ChoiceType + * deprecated support for data objects that implements both `Traversable` and + `ArrayAccess` in `ResizeFormListener::preSubmit` method + * Using callable strings as choice options in `ChoiceType` has been deprecated + and will be used as `PropertyPath` instead of callable in Symfony 4.0. + * implemented `DataTransformerInterface` in `TextType` + * deprecated caching loaded choice list in `LazyChoiceList::$loadedList` + +3.0.0 +----- + + * removed `FormTypeInterface::setDefaultOptions()` method + * removed `AbstractType::setDefaultOptions()` method + * removed `FormTypeExtensionInterface::setDefaultOptions()` method + * removed `AbstractTypeExtension::setDefaultOptions()` method + * added `FormTypeInterface::configureOptions()` method + * added `FormTypeExtensionInterface::configureOptions()` method + +2.8.0 +----- + + * added option "choice_translation_domain" to DateType, TimeType and DateTimeType. + * deprecated option "read_only" in favor of "attr['readonly']" + * added the html5 "range" FormType + * deprecated the "cascade_validation" option in favor of setting "constraints" + with the Valid constraint + * moved data trimming logic of TrimListener into StringUtil + * [BC BREAK] When registering a type extension through the DI extension, the tag alias has to match the actual extended type. + +2.7.38 +------ + + * [BC BREAK] the `isFileUpload()` method was added to the `RequestHandlerInterface` + +2.7.0 +----- + + * added option "choice_translation_domain" to ChoiceType. + * deprecated option "precision" in favor of "scale" + * deprecated the overwriting of AbstractType::setDefaultOptions() in favor of overwriting AbstractType::configureOptions(). + * deprecated the overwriting of AbstractTypeExtension::setDefaultOptions() in favor of overwriting AbstractTypeExtension::configureOptions(). + * added new ChoiceList interface and implementations in the Symfony\Component\Form\ChoiceList namespace + * added new ChoiceView in the Symfony\Component\Form\ChoiceList\View namespace + * choice groups are now represented by ChoiceGroupView objects in the view + * deprecated the old ChoiceList interface and implementations + * deprecated the old ChoiceView class + * added CheckboxListMapper and RadioListMapper + * deprecated ChoiceToBooleanArrayTransformer and ChoicesToBooleanArrayTransformer + * deprecated FixCheckboxInputListener and FixRadioInputListener + * deprecated the "choice_list" option of ChoiceType + * added new options to ChoiceType: + * "choices_as_values" + * "choice_loader" + * "choice_label" + * "choice_name" + * "choice_value" + * "choice_attr" + * "group_by" + +2.6.2 +----- + + * Added back the `model_timezone` and `view_timezone` options for `TimeType`, `DateType` + and `BirthdayType` + +2.6.0 +----- + + * added "html5" option to Date, Time and DateTimeFormType to be able to + enable/disable HTML5 input date when widget option is "single_text" + * added "label_format" option with possible placeholders "%name%" and "%id%" + * [BC BREAK] drop support for model_timezone and view_timezone options in TimeType, DateType and BirthdayType, + update to 2.6.2 to get back support for these options + +2.5.0 +------ + + * deprecated options "max_length" and "pattern" in favor of putting these values in "attr" option + * added an option for multiple files upload + * form errors now reference their cause (constraint violation, exception, ...) + * form errors now remember which form they were originally added to + * [BC BREAK] added two optional parameters to FormInterface::getErrors() and + changed the method to return a Symfony\Component\Form\FormErrorIterator + instance instead of an array + * errors mapped to unsubmitted forms are discarded now + * ObjectChoiceList now compares choices by their value, if a value path is + given + * you can now pass interface names in the "data_class" option + * [BC BREAK] added `FormInterface::getTransformationFailure()` + +2.4.0 +----- + + * moved CSRF implementation to the new Security CSRF sub-component + * deprecated CsrfProviderInterface and its implementations + * deprecated options "csrf_provider" and "intention" in favor of the new options "csrf_token_manager" and "csrf_token_id" + +2.3.0 +----- + + * deprecated FormPerformanceTestCase and FormIntegrationTestCase in the Symfony\Component\Form\Tests namespace and moved them to the Symfony\Component\Form\Test namespace + * deprecated TypeTestCase in the Symfony\Component\Form\Tests\Extension\Core\Type namespace and moved it to the Symfony\Component\Form\Test namespace + * changed FormRenderer::humanize() to humanize also camel cased field name + * added RequestHandlerInterface and FormInterface::handleRequest() + * deprecated passing a Request instance to FormInterface::bind() + * added options "method" and "action" to FormType + * deprecated option "virtual" in favor "inherit_data" + * deprecated VirtualFormAwareIterator in favor of InheritDataAwareIterator + * [BC BREAK] removed the "array" type hint from DataMapperInterface + * improved forms inheriting their parent data to actually return that data from getData(), getNormData() and getViewData() + * added component-level exceptions for various SPL exceptions + changed all uses of the deprecated Exception class to use more specialized exceptions instead + removed NotInitializedException, NotValidException, TypeDefinitionException, TypeLoaderException, CreationException + * added events PRE_SUBMIT, SUBMIT and POST_SUBMIT + * deprecated events PRE_BIND, BIND and POST_BIND + * [BC BREAK] renamed bind() and isBound() in FormInterface to submit() and isSubmitted() + * added methods submit() and isSubmitted() to Form + * deprecated bind() and isBound() in Form + * deprecated AlreadyBoundException in favor of AlreadySubmittedException + * added support for PATCH requests + * [BC BREAK] added initialize() to FormInterface + * [BC BREAK] added getAutoInitialize() to FormConfigInterface + * [BC BREAK] added setAutoInitialize() to FormConfigBuilderInterface + * [BC BREAK] initialization for Form instances added to a form tree must be manually disabled + * PRE_SET_DATA is now guaranteed to be called after children were added by the form builder, + unless FormInterface::setData() is called manually + * fixed CSRF error message to be translated + * custom CSRF error messages can now be set through the "csrf_message" option + * fixed: expanded single-choice fields now show a radio button for the empty value + +2.2.0 +----- + + * TrimListener now removes unicode whitespaces + * deprecated getParent(), setParent() and hasParent() in FormBuilderInterface + * FormInterface::add() now accepts a FormInterface instance OR a field's name, type and options + * removed special characters between the choice or text fields of DateType unless + the option "format" is set to a custom value + * deprecated FormException and introduced ExceptionInterface instead + * [BC BREAK] FormException is now an interface + * protected FormBuilder methods from being called when it is turned into a FormConfigInterface with getFormConfig() + * [BC BREAK] inserted argument `$message` in the constructor of `FormError` + * the PropertyPath class and related classes were moved to a dedicated + PropertyAccess component. During the move, InvalidPropertyException was + renamed to NoSuchPropertyException. FormUtil was split: FormUtil::singularify() + can now be found in Symfony\Component\PropertyAccess\StringUtil. The methods + getValue() and setValue() from PropertyPath were extracted into a new class + PropertyAccessor. + * added an optional PropertyAccessorInterface parameter to FormType, + ObjectChoiceList and PropertyPathMapper + * [BC BREAK] PropertyPathMapper and FormType now have a constructor + * [BC BREAK] setting the option "validation_groups" to ``false`` now disables validation + instead of assuming group "Default" + +2.1.0 +----- + + * [BC BREAK] ``read_only`` field attribute now renders as ``readonly="readonly"``, use ``disabled`` instead + * [BC BREAK] child forms now aren't validated anymore by default + * made validation of form children configurable (new option: cascade_validation) + * added support for validation groups as callbacks + * made the translation catalogue configurable via the "translation_domain" option + * added Form::getErrorsAsString() to help debugging forms + * allowed setting different options for RepeatedType fields (like the label) + * added support for empty form name at root level, this enables rendering forms + without form name prefix in field names + * [BC BREAK] form and field names must start with a letter, digit or underscore + and only contain letters, digits, underscores, hyphens and colons + * [BC BREAK] changed default name of the prototype in the "collection" type + from "$$name$$" to "\__name\__". No dollars are appended/prepended to custom + names anymore. + * [BC BREAK] improved ChoiceListInterface + * [BC BREAK] added SimpleChoiceList and LazyChoiceList as replacement of + ArrayChoiceList + * added ChoiceList and ObjectChoiceList to use objects as choices + * [BC BREAK] removed EntitiesToArrayTransformer and EntityToIdTransformer. + The former has been replaced by CollectionToArrayTransformer in combination + with EntityChoiceList, the latter is not required in the core anymore. + * [BC BREAK] renamed + * ArrayToBooleanChoicesTransformer to ChoicesToBooleanArrayTransformer + * ScalarToBooleanChoicesTransformer to ChoiceToBooleanArrayTransformer + * ArrayToChoicesTransformer to ChoicesToValuesTransformer + * ScalarToChoiceTransformer to ChoiceToValueTransformer + to be consistent with the naming in ChoiceListInterface. + They were merged into ChoiceList and have no public equivalent anymore. + * choice fields now throw a FormException if neither the "choices" nor the + "choice_list" option is set + * the radio type is now a child of the checkbox type + * the collection, choice (with multiple selection) and entity (with multiple + selection) types now make use of addXxx() and removeXxx() methods in your + model if you set "by_reference" to false. For a custom, non-recognized + singular form, set the "property_path" option like this: "plural|singular" + * forms now don't create an empty object anymore if they are completely + empty and not required. The empty value for such forms is null. + * added constant Guess::VERY_HIGH_CONFIDENCE + * [BC BREAK] The methods `add`, `remove`, `setParent`, `bind` and `setData` + in class Form now throw an exception if the form is already bound + * fields of constrained classes without a NotBlank or NotNull constraint are + set to not required now, as stated in the docs + * fixed TimeType and DateTimeType to not display seconds when "widget" is + "single_text" unless "with_seconds" is set to true + * checkboxes of in an expanded multiple-choice field don't include the choice + in their name anymore. Their names terminate with "[]" now. + * deprecated FormValidatorInterface and substituted its implementations + by event subscribers + * simplified CSRF protection and removed the csrf type + * deprecated FieldType and merged it into FormType + * added new option "compound" that lets you switch between field and form behavior + * [BC BREAK] renamed theme blocks + * "field_*" to "form_*" + * "field_widget" to "form_widget_simple" + * "widget_choice_options" to "choice_widget_options" + * "generic_label" to "form_label" + * added theme blocks "form_widget_compound", "choice_widget_expanded" and + "choice_widget_collapsed" to make theming more modular + * ValidatorTypeGuesser now guesses "collection" for array type constraint + * added method `guessPattern` to FormTypeGuesserInterface to guess which pattern to use in the HTML5 attribute "pattern" + * deprecated method `guessMinLength` in favor of `guessPattern` + * labels don't display field attributes anymore. Label attributes can be + passed in the "label_attr" option/variable + * added option "mapped" which should be used instead of setting "property_path" to false + * [BC BREAK] "data_class" now *must* be set if a form maps to an object and should be left empty otherwise + * improved error mapping on forms + * dot (".") rules are now allowed to map errors assigned to a form to + one of its children + * errors are not mapped to unsynchronized forms anymore + * [BC BREAK] changed Form constructor to accept a single `FormConfigInterface` object + * [BC BREAK] changed argument order in the FormBuilder constructor + * added Form method `getViewData` + * deprecated Form methods + * `getTypes` + * `getErrorBubbling` + * `getNormTransformers` + * `getClientTransformers` + * `getAttribute` + * `hasAttribute` + * `getClientData` + * added FormBuilder methods + * `getTypes` + * `addViewTransformer` + * `getViewTransformers` + * `resetViewTransformers` + * `addModelTransformer` + * `getModelTransformers` + * `resetModelTransformers` + * deprecated FormBuilder methods + * `prependClientTransformer` + * `appendClientTransformer` + * `getClientTransformers` + * `resetClientTransformers` + * `prependNormTransformer` + * `appendNormTransformer` + * `getNormTransformers` + * `resetNormTransformers` + * deprecated the option "validation_constraint" in favor of the new + option "constraints" + * removed superfluous methods from DataMapperInterface + * `mapFormToData` + * `mapDataToForm` + * added `setDefaultOptions` to FormTypeInterface and FormTypeExtensionInterface + which accepts an OptionsResolverInterface instance + * deprecated the methods `getDefaultOptions` and `getAllowedOptionValues` + in FormTypeInterface and FormTypeExtensionInterface + * options passed during construction can now be accessed from FormConfigInterface + * added FormBuilderInterface and FormConfigEditorInterface + * [BC BREAK] the method `buildForm` in FormTypeInterface and FormTypeExtensionInterface + now receives a FormBuilderInterface instead of a FormBuilder instance + * [BC BREAK] the method `buildViewBottomUp` was renamed to `finishView` in + FormTypeInterface and FormTypeExtensionInterface + * [BC BREAK] the options array is now passed as last argument of the + methods + * `buildView` + * `finishView` + in FormTypeInterface and FormTypeExtensionInterface + * [BC BREAK] no options are passed to `getParent` of FormTypeInterface anymore + * deprecated DataEvent and FilterDataEvent in favor of the new FormEvent which is + now passed to all events thrown by the component + * FormEvents::BIND now replaces FormEvents::BIND_NORM_DATA + * FormEvents::PRE_SET_DATA now replaces FormEvents::SET_DATA + * FormEvents::PRE_BIND now replaces FormEvents::BIND_CLIENT_DATA + * deprecated FormEvents::SET_DATA, FormEvents::BIND_CLIENT_DATA and + FormEvents::BIND_NORM_DATA + * [BC BREAK] reversed the order of the first two arguments to `createNamed` + and `createNamedBuilder` in `FormFactoryInterface` + * deprecated `getChildren` in Form and FormBuilder in favor of `all` + * deprecated `hasChildren` in Form and FormBuilder in favor of `count` + * FormBuilder now implements \IteratorAggregate + * [BC BREAK] compound forms now always need a data mapper + * FormBuilder now maintains the order when explicitly adding form builders as children + * ChoiceType now doesn't add the empty value anymore if the choices already contain an empty element + * DateType, TimeType and DateTimeType now show empty values again if not required + * [BC BREAK] fixed rendering of errors for DateType, BirthdayType and similar ones + * [BC BREAK] fixed: form constraints are only validated if they belong to the validated group + * deprecated `bindRequest` in `Form` and replaced it by a listener to FormEvents::PRE_BIND + * fixed: the "data" option supersedes default values from the model + * changed DateType to refer to the "format" option for calculating the year and day choices instead + of padding them automatically + * [BC BREAK] DateType defaults to the format "yyyy-MM-dd" now if the widget is + "single_text", in order to support the HTML 5 date field out of the box + * added the option "format" to DateTimeType + * [BC BREAK] DateTimeType now outputs RFC 3339 dates by default, as generated and + consumed by HTML5 browsers, if the widget is "single_text" + * deprecated the options "data_timezone" and "user_timezone" in DateType, DateTimeType and TimeType + and renamed them to "model_timezone" and "view_timezone" + * fixed: TransformationFailedExceptions thrown in the model transformer are now caught by the form + * added FormRegistryInterface, ResolvedFormTypeInterface and ResolvedFormTypeFactoryInterface + * deprecated FormFactory methods + * `addType` + * `hasType` + * `getType` + * [BC BREAK] FormFactory now expects a FormRegistryInterface and a ResolvedFormTypeFactoryInterface as constructor argument + * [BC BREAK] The method `createBuilder` in FormTypeInterface is not supported anymore for performance reasons + * [BC BREAK] Removed `setTypes` from FormBuilder + * deprecated AbstractType methods + * `getExtensions` + * `setExtensions` + * ChoiceType now caches its created choice lists to improve performance + * [BC BREAK] Rows of a collection field cannot be themed individually anymore. All rows in the collection + field now have the same block names, which contains "entry" where it previously contained the row index. + * [BC BREAK] When registering a type through the DI extension, the tag alias has to match the actual type name. + * added FormRendererInterface, FormRendererEngineInterface and implementations of these interfaces + * [BC BREAK] removed the following methods from FormUtil: + * `toArrayKey` + * `toArrayKeys` + * `isChoiceGroup` + * `isChoiceSelected` + * [BC BREAK] renamed method `renderBlock` in FormHelper to `block` and changed its signature + * made FormView properties public and deprecated their accessor methods + * made the normalized data of a form accessible in the template through the variable "form.vars.data" + * made the original data of a choice accessible in the template through the property "choice.data" + * added convenience class Forms and FormFactoryBuilderInterface diff --git a/vendor/symfony/form/CallbackTransformer.php b/vendor/symfony/form/CallbackTransformer.php new file mode 100644 index 0000000..5125214 --- /dev/null +++ b/vendor/symfony/form/CallbackTransformer.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +class CallbackTransformer implements DataTransformerInterface +{ + private $transform; + private $reverseTransform; + + /** + * @param callable $transform The forward transform callback + * @param callable $reverseTransform The reverse transform callback + */ + public function __construct(callable $transform, callable $reverseTransform) + { + $this->transform = $transform; + $this->reverseTransform = $reverseTransform; + } + + /** + * {@inheritdoc} + */ + public function transform($data) + { + return ($this->transform)($data); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($data) + { + return ($this->reverseTransform)($data); + } +} diff --git a/vendor/symfony/form/ChoiceList/ArrayChoiceList.php b/vendor/symfony/form/ChoiceList/ArrayChoiceList.php new file mode 100644 index 0000000..49b991a --- /dev/null +++ b/vendor/symfony/form/ChoiceList/ArrayChoiceList.php @@ -0,0 +1,238 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList; + +/** + * A list of choices with arbitrary data types. + * + * The user of this class is responsible for assigning string values to the + * choices annd for their uniqueness. + * Both the choices and their values are passed to the constructor. + * Each choice must have a corresponding value (with the same key) in + * the values array. + * + * @author Bernhard Schussek + */ +class ArrayChoiceList implements ChoiceListInterface +{ + /** + * The choices in the list. + * + * @var array + */ + protected $choices; + + /** + * The values indexed by the original keys. + * + * @var array + */ + protected $structuredValues; + + /** + * The original keys of the choices array. + * + * @var int[]|string[] + */ + protected $originalKeys; + protected $valueCallback; + + /** + * Creates a list with the given choices and values. + * + * The given choice array must have the same array keys as the value array. + * + * @param iterable $choices The selectable choices + * @param callable|null $value The callable for creating the value + * for a choice. If `null` is passed, + * incrementing integers are used as + * values + */ + public function __construct(iterable $choices, callable $value = null) + { + if ($choices instanceof \Traversable) { + $choices = iterator_to_array($choices); + } + + if (null === $value && $this->castableToString($choices)) { + $value = function ($choice) { + return false === $choice ? '0' : (string) $choice; + }; + } + + if (null !== $value) { + // If a deterministic value generator was passed, use it later + $this->valueCallback = $value; + } else { + // Otherwise generate incrementing integers as values + $i = 0; + $value = function () use (&$i) { + return $i++; + }; + } + + // If the choices are given as recursive array (i.e. with explicit + // choice groups), flatten the array. The grouping information is needed + // in the view only. + $this->flatten($choices, $value, $choicesByValues, $keysByValues, $structuredValues); + + $this->choices = $choicesByValues; + $this->originalKeys = $keysByValues; + $this->structuredValues = $structuredValues; + } + + /** + * {@inheritdoc} + */ + public function getChoices() + { + return $this->choices; + } + + /** + * {@inheritdoc} + */ + public function getValues() + { + return array_map('strval', array_keys($this->choices)); + } + + /** + * {@inheritdoc} + */ + public function getStructuredValues() + { + return $this->structuredValues; + } + + /** + * {@inheritdoc} + */ + public function getOriginalKeys() + { + return $this->originalKeys; + } + + /** + * {@inheritdoc} + */ + public function getChoicesForValues(array $values) + { + $choices = []; + + foreach ($values as $i => $givenValue) { + if (\array_key_exists($givenValue, $this->choices)) { + $choices[$i] = $this->choices[$givenValue]; + } + } + + return $choices; + } + + /** + * {@inheritdoc} + */ + public function getValuesForChoices(array $choices) + { + $values = []; + + // Use the value callback to compare choices by their values, if present + if ($this->valueCallback) { + $givenValues = []; + + foreach ($choices as $i => $givenChoice) { + $givenValues[$i] = (string) ($this->valueCallback)($givenChoice); + } + + return array_intersect($givenValues, array_keys($this->choices)); + } + + // Otherwise compare choices by identity + foreach ($choices as $i => $givenChoice) { + foreach ($this->choices as $value => $choice) { + if ($choice === $givenChoice) { + $values[$i] = (string) $value; + break; + } + } + } + + return $values; + } + + /** + * Flattens an array into the given output variables. + * + * @param array $choices The array to flatten + * @param callable $value The callable for generating choice values + * @param array|null $choicesByValues The flattened choices indexed by the + * corresponding values + * @param array|null $keysByValues The original keys indexed by the + * corresponding values + * @param array|null $structuredValues The values indexed by the original keys + * + * @internal + */ + protected function flatten(array $choices, callable $value, ?array &$choicesByValues, ?array &$keysByValues, ?array &$structuredValues) + { + if (null === $choicesByValues) { + $choicesByValues = []; + $keysByValues = []; + $structuredValues = []; + } + + foreach ($choices as $key => $choice) { + if (\is_array($choice)) { + $this->flatten($choice, $value, $choicesByValues, $keysByValues, $structuredValues[$key]); + + continue; + } + + $choiceValue = (string) $value($choice); + $choicesByValues[$choiceValue] = $choice; + $keysByValues[$choiceValue] = $key; + $structuredValues[$key] = $choiceValue; + } + } + + /** + * Checks whether the given choices can be cast to strings without + * generating duplicates. + * This method is responsible for preventing conflict between scalar values + * and the empty value. + */ + private function castableToString(array $choices, array &$cache = []): bool + { + foreach ($choices as $choice) { + if (\is_array($choice)) { + if (!$this->castableToString($choice, $cache)) { + return false; + } + + continue; + } elseif (!is_scalar($choice)) { + return false; + } + + // prevent having false casted to the empty string by isset() + $choice = false === $choice ? '0' : (string) $choice; + + if (isset($cache[$choice])) { + return false; + } + + $cache[$choice] = true; + } + + return true; + } +} diff --git a/vendor/symfony/form/ChoiceList/ChoiceList.php b/vendor/symfony/form/ChoiceList/ChoiceList.php new file mode 100644 index 0000000..df63c83 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/ChoiceList.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList; + +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceAttr; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFieldName; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFilter; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceLabel; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceLoader; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceTranslationParameters; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceValue; +use Symfony\Component\Form\ChoiceList\Factory\Cache\GroupBy; +use Symfony\Component\Form\ChoiceList\Factory\Cache\PreferredChoice; +use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A set of convenient static methods to create cacheable choice list options. + * + * @author Jules Pietri + */ +final class ChoiceList +{ + /** + * Creates a cacheable loader from any callable providing iterable choices. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable $choices A callable that must return iterable choices or grouped choices + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the loader + */ + public static function lazy($formType, callable $choices, $vary = null): ChoiceLoader + { + return self::loader($formType, new CallbackChoiceLoader($choices), $vary); + } + + /** + * Decorates a loader to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param ChoiceLoaderInterface $loader A loader responsible for creating loading choices or grouped choices + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the loader + */ + public static function loader($formType, ChoiceLoaderInterface $loader, $vary = null): ChoiceLoader + { + return new ChoiceLoader($formType, $loader, $vary); + } + + /** + * Decorates a "choice_value" callback to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable $value Any pseudo callable to create a unique string value from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the callback + */ + public static function value($formType, $value, $vary = null): ChoiceValue + { + return new ChoiceValue($formType, $value, $vary); + } + + /** + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable $filter Any pseudo callable to filter a choice list + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the callback + */ + public static function filter($formType, $filter, $vary = null): ChoiceFilter + { + return new ChoiceFilter($formType, $filter, $vary); + } + + /** + * Decorates a "choice_label" option to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable|false $label Any pseudo callable to create a label from a choice or false to discard it + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the option + */ + public static function label($formType, $label, $vary = null): ChoiceLabel + { + return new ChoiceLabel($formType, $label, $vary); + } + + /** + * Decorates a "choice_name" callback to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable $fieldName Any pseudo callable to create a field name from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the callback + */ + public static function fieldName($formType, $fieldName, $vary = null): ChoiceFieldName + { + return new ChoiceFieldName($formType, $fieldName, $vary); + } + + /** + * Decorates a "choice_attr" option to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable|array $attr Any pseudo callable or array to create html attributes from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the option + */ + public static function attr($formType, $attr, $vary = null): ChoiceAttr + { + return new ChoiceAttr($formType, $attr, $vary); + } + + /** + * Decorates a "choice_translation_parameters" option to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable|array $translationParameters Any pseudo callable or array to create translation parameters from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the option + */ + public static function translationParameters($formType, $translationParameters, $vary = null): ChoiceTranslationParameters + { + return new ChoiceTranslationParameters($formType, $translationParameters, $vary); + } + + /** + * Decorates a "group_by" callback to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable $groupBy Any pseudo callable to return a group name from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the callback + */ + public static function groupBy($formType, $groupBy, $vary = null): GroupBy + { + return new GroupBy($formType, $groupBy, $vary); + } + + /** + * Decorates a "preferred_choices" option to make it cacheable. + * + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param callable|array $preferred Any pseudo callable or array to return a group name from a choice + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the option + */ + public static function preferred($formType, $preferred, $vary = null): PreferredChoice + { + return new PreferredChoice($formType, $preferred, $vary); + } + + /** + * Should not be instantiated. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/form/ChoiceList/ChoiceListInterface.php b/vendor/symfony/form/ChoiceList/ChoiceListInterface.php new file mode 100644 index 0000000..8bf6f95 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/ChoiceListInterface.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList; + +/** + * A list of choices that can be selected in a choice field. + * + * A choice list assigns unique string values to each of a list of choices. + * These string values are displayed in the "value" attributes in HTML and + * submitted back to the server. + * + * The acceptable data types for the choices depend on the implementation. + * Values must always be strings and (within the list) free of duplicates. + * + * @author Bernhard Schussek + */ +interface ChoiceListInterface +{ + /** + * Returns all selectable choices. + * + * @return array The selectable choices indexed by the corresponding values + */ + public function getChoices(); + + /** + * Returns the values for the choices. + * + * The values are strings that do not contain duplicates: + * + * $form->add('field', 'choice', [ + * 'choices' => [ + * 'Decided' => ['Yes' => true, 'No' => false], + * 'Undecided' => ['Maybe' => null], + * ], + * ]); + * + * In this example, the result of this method is: + * + * [ + * 'Yes' => '0', + * 'No' => '1', + * 'Maybe' => '2', + * ] + * + * Null and false MUST NOT conflict when being casted to string. + * For this some default incremented values SHOULD be computed. + * + * @return string[] + */ + public function getValues(); + + /** + * Returns the values in the structure originally passed to the list. + * + * Contrary to {@link getValues()}, the result is indexed by the original + * keys of the choices. If the original array contained nested arrays, these + * nested arrays are represented here as well: + * + * $form->add('field', 'choice', [ + * 'choices' => [ + * 'Decided' => ['Yes' => true, 'No' => false], + * 'Undecided' => ['Maybe' => null], + * ], + * ]); + * + * In this example, the result of this method is: + * + * [ + * 'Decided' => ['Yes' => '0', 'No' => '1'], + * 'Undecided' => ['Maybe' => '2'], + * ] + * + * Nested arrays do not make sense in a view format unless + * they are used as a convenient way of grouping. + * If the implementation does not intend to support grouped choices, + * this method SHOULD be equivalent to {@link getValues()}. + * The $groupBy callback parameter SHOULD be used instead. + * + * @return string[] + */ + public function getStructuredValues(); + + /** + * Returns the original keys of the choices. + * + * The original keys are the keys of the choice array that was passed in the + * "choice" option of the choice type. Note that this array may contain + * duplicates if the "choice" option contained choice groups: + * + * $form->add('field', 'choice', [ + * 'choices' => [ + * 'Decided' => [true, false], + * 'Undecided' => [null], + * ], + * ]); + * + * In this example, the original key 0 appears twice, once for `true` and + * once for `null`. + * + * @return int[]|string[] The original choice keys indexed by the + * corresponding choice values + */ + public function getOriginalKeys(); + + /** + * Returns the choices corresponding to the given values. + * + * The choices are returned with the same keys and in the same order as the + * corresponding values in the given array. + * + * @param string[] $values An array of choice values. Non-existing values in + * this array are ignored + * + * @return array + */ + public function getChoicesForValues(array $values); + + /** + * Returns the values corresponding to the given choices. + * + * The values are returned with the same keys and in the same order as the + * corresponding choices in the given array. + * + * @param array $choices An array of choices. Non-existing choices in this + * array are ignored + * + * @return string[] + */ + public function getValuesForChoices(array $choices); +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/AbstractStaticOption.php b/vendor/symfony/form/ChoiceList/Factory/Cache/AbstractStaticOption.php new file mode 100644 index 0000000..42b31e0 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/AbstractStaticOption.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A template decorator for static {@see ChoiceType} options. + * + * Used as fly weight for {@see CachingFactoryDecorator}. + * + * @internal + * + * @author Jules Pietri + */ +abstract class AbstractStaticOption +{ + private static $options = []; + + /** @var bool|callable|string|array|\Closure|ChoiceLoaderInterface */ + private $option; + + /** + * @param FormTypeInterface|FormTypeExtensionInterface $formType A form type or type extension configuring a cacheable choice list + * @param mixed $option Any pseudo callable, array, string or bool to define a choice list option + * @param mixed|null $vary Dynamic data used to compute a unique hash when caching the option + */ + final public function __construct($formType, $option, $vary = null) + { + if (!$formType instanceof FormTypeInterface && !$formType instanceof FormTypeExtensionInterface) { + throw new \TypeError(sprintf('Expected an instance of "%s" or "%s", but got "%s".', FormTypeInterface::class, FormTypeExtensionInterface::class, get_debug_type($formType))); + } + + $hash = CachingFactoryDecorator::generateHash([static::class, $formType, $vary]); + + $this->option = self::$options[$hash] ?? self::$options[$hash] = $option; + } + + /** + * @return mixed + */ + final public function getOption() + { + return $this->option; + } + + final public static function reset(): void + { + self::$options = []; + } +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceAttr.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceAttr.php new file mode 100644 index 0000000..8de6956 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceAttr.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_attr" option. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceAttr extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFieldName.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFieldName.php new file mode 100644 index 0000000..0c71e20 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFieldName.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_name" callback. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceFieldName extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFilter.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFilter.php new file mode 100644 index 0000000..13b8cd8 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceFilter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_filter" option. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceFilter extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLabel.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLabel.php new file mode 100644 index 0000000..664a090 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLabel.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_label" option. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceLabel extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php new file mode 100644 index 0000000..83b2ca0 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceLoader.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_loader" option. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceLoader extends AbstractStaticOption implements ChoiceLoaderInterface +{ + /** + * {@inheritdoc} + */ + public function loadChoiceList(callable $value = null): ChoiceListInterface + { + return $this->getOption()->loadChoiceList($value); + } + + /** + * {@inheritdoc} + */ + public function loadChoicesForValues(array $values, callable $value = null): array + { + return $this->getOption()->loadChoicesForValues($values, $value); + } + + /** + * {@inheritdoc} + */ + public function loadValuesForChoices(array $choices, callable $value = null): array + { + return $this->getOption()->loadValuesForChoices($choices, $value); + } +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceTranslationParameters.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceTranslationParameters.php new file mode 100644 index 0000000..e9ab5c7 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceTranslationParameters.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_translation_parameters" option. + * + * @internal + * + * @author Vincent Langlet + */ +final class ChoiceTranslationParameters extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceValue.php b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceValue.php new file mode 100644 index 0000000..d96f1e9 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/ChoiceValue.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "choice_value" callback. + * + * @internal + * + * @author Jules Pietri + */ +final class ChoiceValue extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/GroupBy.php b/vendor/symfony/form/ChoiceList/Factory/Cache/GroupBy.php new file mode 100644 index 0000000..2ad492c --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/GroupBy.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "group_by" callback. + * + * @internal + * + * @author Jules Pietri + */ +final class GroupBy extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/Cache/PreferredChoice.php b/vendor/symfony/form/ChoiceList/Factory/Cache/PreferredChoice.php new file mode 100644 index 0000000..4aefd69 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/Cache/PreferredChoice.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory\Cache; + +use Symfony\Component\Form\FormTypeExtensionInterface; +use Symfony\Component\Form\FormTypeInterface; + +/** + * A cacheable wrapper for any {@see FormTypeInterface} or {@see FormTypeExtensionInterface} + * which configures a "preferred_choices" option. + * + * @internal + * + * @author Jules Pietri + */ +final class PreferredChoice extends AbstractStaticOption +{ +} diff --git a/vendor/symfony/form/ChoiceList/Factory/CachingFactoryDecorator.php b/vendor/symfony/form/ChoiceList/Factory/CachingFactoryDecorator.php new file mode 100644 index 0000000..2abdd1f --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/CachingFactoryDecorator.php @@ -0,0 +1,254 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Caches the choice lists created by the decorated factory. + * + * To cache a list based on its options, arguments must be decorated + * by a {@see Cache\AbstractStaticOption} implementation. + * + * @author Bernhard Schussek + * @author Jules Pietri + */ +class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterface +{ + private $decoratedFactory; + + /** + * @var ChoiceListInterface[] + */ + private $lists = []; + + /** + * @var ChoiceListView[] + */ + private $views = []; + + /** + * Generates a SHA-256 hash for the given value. + * + * Optionally, a namespace string can be passed. Calling this method will + * the same values, but different namespaces, will return different hashes. + * + * @param mixed $value The value to hash + * + * @return string The SHA-256 hash + * + * @internal + */ + public static function generateHash($value, string $namespace = ''): string + { + if (\is_object($value)) { + $value = spl_object_hash($value); + } elseif (\is_array($value)) { + array_walk_recursive($value, function (&$v) { + if (\is_object($v)) { + $v = spl_object_hash($v); + } + }); + } + + return hash('sha256', $namespace.':'.serialize($value)); + } + + public function __construct(ChoiceListFactoryInterface $decoratedFactory) + { + $this->decoratedFactory = $decoratedFactory; + } + + /** + * Returns the decorated factory. + * + * @return ChoiceListFactoryInterface + */ + public function getDecoratedFactory() + { + return $this->decoratedFactory; + } + + /** + * {@inheritdoc} + * + * @param mixed $value + * @param mixed $filter + */ + public function createListFromChoices(iterable $choices, $value = null/*, $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + if ($choices instanceof \Traversable) { + $choices = iterator_to_array($choices); + } + + $cache = true; + // Only cache per value and filter when needed. The value is not validated on purpose. + // The decorated factory may decide which values to accept and which not. + if ($value instanceof Cache\ChoiceValue) { + $value = $value->getOption(); + } elseif ($value) { + $cache = false; + } + if ($filter instanceof Cache\ChoiceFilter) { + $filter = $filter->getOption(); + } elseif ($filter) { + $cache = false; + } + + if (!$cache) { + return $this->decoratedFactory->createListFromChoices($choices, $value, $filter); + } + + $hash = self::generateHash([$choices, $value, $filter], 'fromChoices'); + + if (!isset($this->lists[$hash])) { + $this->lists[$hash] = $this->decoratedFactory->createListFromChoices($choices, $value, $filter); + } + + return $this->lists[$hash]; + } + + /** + * {@inheritdoc} + * + * @param mixed $value + * @param mixed $filter + */ + public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null/*, $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + $cache = true; + + if ($loader instanceof Cache\ChoiceLoader) { + $loader = $loader->getOption(); + } else { + $cache = false; + } + + if ($value instanceof Cache\ChoiceValue) { + $value = $value->getOption(); + } elseif ($value) { + $cache = false; + } + + if ($filter instanceof Cache\ChoiceFilter) { + $filter = $filter->getOption(); + } elseif ($filter) { + $cache = false; + } + + if (!$cache) { + return $this->decoratedFactory->createListFromLoader($loader, $value, $filter); + } + + $hash = self::generateHash([$loader, $value, $filter], 'fromLoader'); + + if (!isset($this->lists[$hash])) { + $this->lists[$hash] = $this->decoratedFactory->createListFromLoader($loader, $value, $filter); + } + + return $this->lists[$hash]; + } + + /** + * {@inheritdoc} + * + * @param mixed $preferredChoices + * @param mixed $label + * @param mixed $index + * @param mixed $groupBy + * @param mixed $attr + * @param mixed $labelTranslationParameters + */ + public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null/*, $labelTranslationParameters = []*/) + { + $labelTranslationParameters = \func_num_args() > 6 ? func_get_arg(6) : []; + $cache = true; + + if ($preferredChoices instanceof Cache\PreferredChoice) { + $preferredChoices = $preferredChoices->getOption(); + } elseif ($preferredChoices) { + $cache = false; + } + + if ($label instanceof Cache\ChoiceLabel) { + $label = $label->getOption(); + } elseif (null !== $label) { + $cache = false; + } + + if ($index instanceof Cache\ChoiceFieldName) { + $index = $index->getOption(); + } elseif ($index) { + $cache = false; + } + + if ($groupBy instanceof Cache\GroupBy) { + $groupBy = $groupBy->getOption(); + } elseif ($groupBy) { + $cache = false; + } + + if ($attr instanceof Cache\ChoiceAttr) { + $attr = $attr->getOption(); + } elseif ($attr) { + $cache = false; + } + + if ($labelTranslationParameters instanceof Cache\ChoiceTranslationParameters) { + $labelTranslationParameters = $labelTranslationParameters->getOption(); + } elseif ([] !== $labelTranslationParameters) { + $cache = false; + } + + if (!$cache) { + return $this->decoratedFactory->createView( + $list, + $preferredChoices, + $label, + $index, + $groupBy, + $attr, + $labelTranslationParameters + ); + } + + $hash = self::generateHash([$list, $preferredChoices, $label, $index, $groupBy, $attr, $labelTranslationParameters]); + + if (!isset($this->views[$hash])) { + $this->views[$hash] = $this->decoratedFactory->createView( + $list, + $preferredChoices, + $label, + $index, + $groupBy, + $attr, + $labelTranslationParameters + ); + } + + return $this->views[$hash]; + } + + public function reset() + { + $this->lists = []; + $this->views = []; + Cache\AbstractStaticOption::reset(); + } +} diff --git a/vendor/symfony/form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/vendor/symfony/form/ChoiceList/Factory/ChoiceListFactoryInterface.php new file mode 100644 index 0000000..6d4b555 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/ChoiceListFactoryInterface.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; + +/** + * Creates {@link ChoiceListInterface} instances. + * + * @author Bernhard Schussek + */ +interface ChoiceListFactoryInterface +{ + /** + * Creates a choice list for the given choices. + * + * The choices should be passed in the values of the choices array. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as only argument. + * Null may be passed when the choice list contains the empty value. + * + * @param callable|null $filter The callable filtering the choices + * + * @return ChoiceListInterface + */ + public function createListFromChoices(iterable $choices, callable $value = null/*, callable $filter = null*/); + + /** + * Creates a choice list that is loaded with the given loader. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as only argument. + * Null may be passed when the choice list contains the empty value. + * + * @param callable|null $filter The callable filtering the choices + * + * @return ChoiceListInterface + */ + public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null/*, callable $filter = null*/); + + /** + * Creates a view for the given choice list. + * + * Callables may be passed for all optional arguments. The callables receive + * the choice as first and the array key as the second argument. + * + * * The callable for the label and the name should return the generated + * label/choice name. + * * The callable for the preferred choices should return true or false, + * depending on whether the choice should be preferred or not. + * * The callable for the grouping should return the group name or null if + * a choice should not be grouped. + * * The callable for the attributes should return an array of HTML + * attributes that will be inserted in the tag of the choice. + * + * If no callable is passed, the labels will be generated from the choice + * keys. The view indices will be generated using an incrementing integer + * by default. + * + * The preferred choices can also be passed as array. Each choice that is + * contained in that array will be marked as preferred. + * + * The attributes can be passed as multi-dimensional array. The keys should + * match the keys of the choices. The values should be arrays of HTML + * attributes that should be added to the respective choice. + * + * @param array|callable|null $preferredChoices The preferred choices + * @param callable|false|null $label The callable generating the choice labels; + * pass false to discard the label + * @param array|callable|null $attr The callable generating the HTML attributes + * @param array|callable $labelTranslationParameters The parameters used to translate the choice labels + * + * @return ChoiceListView + */ + public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null/*, $labelTranslationParameters = []*/); +} diff --git a/vendor/symfony/form/ChoiceList/Factory/DefaultChoiceListFactory.php b/vendor/symfony/form/ChoiceList/Factory/DefaultChoiceListFactory.php new file mode 100644 index 0000000..c4aa752 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/DefaultChoiceListFactory.php @@ -0,0 +1,322 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory; + +use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\LazyChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\Loader\FilterChoiceLoaderDecorator; +use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; +use Symfony\Component\Form\ChoiceList\View\ChoiceView; +use Symfony\Component\Translation\TranslatableMessage; + +/** + * Default implementation of {@link ChoiceListFactoryInterface}. + * + * @author Bernhard Schussek + * @author Jules Pietri + */ +class DefaultChoiceListFactory implements ChoiceListFactoryInterface +{ + /** + * {@inheritdoc} + * + * @param callable|null $filter + */ + public function createListFromChoices(iterable $choices, callable $value = null/*, callable $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + if ($filter) { + // filter the choice list lazily + return $this->createListFromLoader(new FilterChoiceLoaderDecorator( + new CallbackChoiceLoader(static function () use ($choices) { + return $choices; + } + ), $filter), $value); + } + + return new ArrayChoiceList($choices, $value); + } + + /** + * {@inheritdoc} + * + * @param callable|null $filter + */ + public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null/*, callable $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + if ($filter) { + $loader = new FilterChoiceLoaderDecorator($loader, $filter); + } + + return new LazyChoiceList($loader, $value); + } + + /** + * {@inheritdoc} + * + * @param array|callable $labelTranslationParameters The parameters used to translate the choice labels + */ + public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null/*, $labelTranslationParameters = []*/) + { + $labelTranslationParameters = \func_num_args() > 6 ? func_get_arg(6) : []; + $preferredViews = []; + $preferredViewsOrder = []; + $otherViews = []; + $choices = $list->getChoices(); + $keys = $list->getOriginalKeys(); + + if (!\is_callable($preferredChoices)) { + if (empty($preferredChoices)) { + $preferredChoices = null; + } else { + // make sure we have keys that reflect order + $preferredChoices = array_values($preferredChoices); + $preferredChoices = static function ($choice) use ($preferredChoices) { + return array_search($choice, $preferredChoices, true); + }; + } + } + + // The names are generated from an incrementing integer by default + if (null === $index) { + $index = 0; + } + + // If $groupBy is a callable returning a string + // choices are added to the group with the name returned by the callable. + // If $groupBy is a callable returning an array + // choices are added to the groups with names returned by the callable + // If the callable returns null, the choice is not added to any group + if (\is_callable($groupBy)) { + foreach ($choices as $value => $choice) { + self::addChoiceViewsGroupedByCallable( + $groupBy, + $choice, + $value, + $label, + $keys, + $index, + $attr, + $labelTranslationParameters, + $preferredChoices, + $preferredViews, + $preferredViewsOrder, + $otherViews + ); + } + + // Remove empty group views that may have been created by + // addChoiceViewsGroupedByCallable() + foreach ($preferredViews as $key => $view) { + if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) { + unset($preferredViews[$key]); + } + } + + foreach ($otherViews as $key => $view) { + if ($view instanceof ChoiceGroupView && 0 === \count($view->choices)) { + unset($otherViews[$key]); + } + } + + foreach ($preferredViewsOrder as $key => $groupViewsOrder) { + if ($groupViewsOrder) { + $preferredViewsOrder[$key] = min($groupViewsOrder); + } else { + unset($preferredViewsOrder[$key]); + } + } + } else { + // Otherwise use the original structure of the choices + self::addChoiceViewsFromStructuredValues( + $list->getStructuredValues(), + $label, + $choices, + $keys, + $index, + $attr, + $labelTranslationParameters, + $preferredChoices, + $preferredViews, + $preferredViewsOrder, + $otherViews + ); + } + + uksort($preferredViews, static function ($a, $b) use ($preferredViewsOrder): int { + return isset($preferredViewsOrder[$a], $preferredViewsOrder[$b]) + ? $preferredViewsOrder[$a] <=> $preferredViewsOrder[$b] + : 0; + }); + + return new ChoiceListView($otherViews, $preferredViews); + } + + private static function addChoiceView($choice, string $value, $label, array $keys, &$index, $attr, $labelTranslationParameters, ?callable $isPreferred, array &$preferredViews, array &$preferredViewsOrder, array &$otherViews) + { + // $value may be an integer or a string, since it's stored in the array + // keys. We want to guarantee it's a string though. + $key = $keys[$value]; + $nextIndex = \is_int($index) ? $index++ : $index($choice, $key, $value); + + // BC normalize label to accept a false value + if (null === $label) { + // If the labels are null, use the original choice key by default + $label = (string) $key; + } elseif (false !== $label) { + // If "choice_label" is set to false and "expanded" is true, the value false + // should be passed on to the "label" option of the checkboxes/radio buttons + $dynamicLabel = $label($choice, $key, $value); + + if (false === $dynamicLabel) { + $label = false; + } elseif ($dynamicLabel instanceof TranslatableMessage) { + $label = $dynamicLabel; + } else { + $label = (string) $dynamicLabel; + } + } + + $view = new ChoiceView( + $choice, + $value, + $label, + // The attributes may be a callable or a mapping from choice indices + // to nested arrays + \is_callable($attr) ? $attr($choice, $key, $value) : ($attr[$key] ?? []), + // The label translation parameters may be a callable or a mapping from choice indices + // to nested arrays + \is_callable($labelTranslationParameters) ? $labelTranslationParameters($choice, $key, $value) : ($labelTranslationParameters[$key] ?? []) + ); + + // $isPreferred may be null if no choices are preferred + if (null !== $isPreferred && false !== $preferredKey = $isPreferred($choice, $key, $value)) { + $preferredViews[$nextIndex] = $view; + $preferredViewsOrder[$nextIndex] = $preferredKey; + } + + $otherViews[$nextIndex] = $view; + } + + private static function addChoiceViewsFromStructuredValues(array $values, $label, array $choices, array $keys, &$index, $attr, $labelTranslationParameters, ?callable $isPreferred, array &$preferredViews, array &$preferredViewsOrder, array &$otherViews) + { + foreach ($values as $key => $value) { + if (null === $value) { + continue; + } + + // Add the contents of groups to new ChoiceGroupView instances + if (\is_array($value)) { + $preferredViewsForGroup = []; + $otherViewsForGroup = []; + + self::addChoiceViewsFromStructuredValues( + $value, + $label, + $choices, + $keys, + $index, + $attr, + $labelTranslationParameters, + $isPreferred, + $preferredViewsForGroup, + $preferredViewsOrder, + $otherViewsForGroup + ); + + if (\count($preferredViewsForGroup) > 0) { + $preferredViews[$key] = new ChoiceGroupView($key, $preferredViewsForGroup); + } + + if (\count($otherViewsForGroup) > 0) { + $otherViews[$key] = new ChoiceGroupView($key, $otherViewsForGroup); + } + + continue; + } + + // Add ungrouped items directly + self::addChoiceView( + $choices[$value], + $value, + $label, + $keys, + $index, + $attr, + $labelTranslationParameters, + $isPreferred, + $preferredViews, + $preferredViewsOrder, + $otherViews + ); + } + } + + private static function addChoiceViewsGroupedByCallable(callable $groupBy, $choice, string $value, $label, array $keys, &$index, $attr, $labelTranslationParameters, ?callable $isPreferred, array &$preferredViews, array &$preferredViewsOrder, array &$otherViews) + { + $groupLabels = $groupBy($choice, $keys[$value], $value); + + if (null === $groupLabels) { + // If the callable returns null, don't group the choice + self::addChoiceView( + $choice, + $value, + $label, + $keys, + $index, + $attr, + $labelTranslationParameters, + $isPreferred, + $preferredViews, + $preferredViewsOrder, + $otherViews + ); + + return; + } + + $groupLabels = \is_array($groupLabels) ? array_map('strval', $groupLabels) : [(string) $groupLabels]; + + foreach ($groupLabels as $groupLabel) { + // Initialize the group views if necessary. Unnecessarily built group + // views will be cleaned up at the end of createView() + if (!isset($preferredViews[$groupLabel])) { + $preferredViews[$groupLabel] = new ChoiceGroupView($groupLabel); + $otherViews[$groupLabel] = new ChoiceGroupView($groupLabel); + } + if (!isset($preferredViewsOrder[$groupLabel])) { + $preferredViewsOrder[$groupLabel] = []; + } + + self::addChoiceView( + $choice, + $value, + $label, + $keys, + $index, + $attr, + $labelTranslationParameters, + $isPreferred, + $preferredViews[$groupLabel]->choices, + $preferredViewsOrder[$groupLabel], + $otherViews[$groupLabel]->choices + ); + } + } +} diff --git a/vendor/symfony/form/ChoiceList/Factory/PropertyAccessDecorator.php b/vendor/symfony/form/ChoiceList/Factory/PropertyAccessDecorator.php new file mode 100644 index 0000000..d3acea5 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Factory/PropertyAccessDecorator.php @@ -0,0 +1,239 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Factory; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; +use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * Adds property path support to a choice list factory. + * + * Pass the decorated factory to the constructor: + * + * $decorator = new PropertyAccessDecorator($factory); + * + * You can now pass property paths for generating choice values, labels, view + * indices, HTML attributes and for determining the preferred choices and the + * choice groups: + * + * // extract values from the $value property + * $list = $createListFromChoices($objects, 'value'); + * + * @author Bernhard Schussek + */ +class PropertyAccessDecorator implements ChoiceListFactoryInterface +{ + private $decoratedFactory; + private $propertyAccessor; + + public function __construct(ChoiceListFactoryInterface $decoratedFactory, PropertyAccessorInterface $propertyAccessor = null) + { + $this->decoratedFactory = $decoratedFactory; + $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + } + + /** + * Returns the decorated factory. + * + * @return ChoiceListFactoryInterface + */ + public function getDecoratedFactory() + { + return $this->decoratedFactory; + } + + /** + * {@inheritdoc} + * + * @param mixed $value + * @param mixed $filter + * + * @return ChoiceListInterface + */ + public function createListFromChoices(iterable $choices, $value = null/*, $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + if (\is_string($value)) { + $value = new PropertyPath($value); + } + + if ($value instanceof PropertyPathInterface) { + $accessor = $this->propertyAccessor; + $value = function ($choice) use ($accessor, $value) { + // The callable may be invoked with a non-object/array value + // when such values are passed to + // ChoiceListInterface::getValuesForChoices(). Handle this case + // so that the call to getValue() doesn't break. + return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null; + }; + } + + if (\is_string($filter)) { + $filter = new PropertyPath($filter); + } + + if ($filter instanceof PropertyPath) { + $accessor = $this->propertyAccessor; + $filter = static function ($choice) use ($accessor, $filter) { + return (\is_object($choice) || \is_array($choice)) && $accessor->getValue($choice, $filter); + }; + } + + return $this->decoratedFactory->createListFromChoices($choices, $value, $filter); + } + + /** + * {@inheritdoc} + * + * @param mixed $value + * @param mixed $filter + * + * @return ChoiceListInterface + */ + public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null/*, $filter = null*/) + { + $filter = \func_num_args() > 2 ? func_get_arg(2) : null; + + if (\is_string($value)) { + $value = new PropertyPath($value); + } + + if ($value instanceof PropertyPathInterface) { + $accessor = $this->propertyAccessor; + $value = function ($choice) use ($accessor, $value) { + // The callable may be invoked with a non-object/array value + // when such values are passed to + // ChoiceListInterface::getValuesForChoices(). Handle this case + // so that the call to getValue() doesn't break. + return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null; + }; + } + + if (\is_string($filter)) { + $filter = new PropertyPath($filter); + } + + if ($filter instanceof PropertyPath) { + $accessor = $this->propertyAccessor; + $filter = static function ($choice) use ($accessor, $filter) { + return (\is_object($choice) || \is_array($choice)) && $accessor->getValue($choice, $filter); + }; + } + + return $this->decoratedFactory->createListFromLoader($loader, $value, $filter); + } + + /** + * {@inheritdoc} + * + * @param mixed $preferredChoices + * @param mixed $label + * @param mixed $index + * @param mixed $groupBy + * @param mixed $attr + * @param mixed $labelTranslationParameters + * + * @return ChoiceListView + */ + public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null/*, $labelTranslationParameters = []*/) + { + $labelTranslationParameters = \func_num_args() > 6 ? func_get_arg(6) : []; + $accessor = $this->propertyAccessor; + + if (\is_string($label)) { + $label = new PropertyPath($label); + } + + if ($label instanceof PropertyPathInterface) { + $label = function ($choice) use ($accessor, $label) { + return $accessor->getValue($choice, $label); + }; + } + + if (\is_string($preferredChoices)) { + $preferredChoices = new PropertyPath($preferredChoices); + } + + if ($preferredChoices instanceof PropertyPathInterface) { + $preferredChoices = function ($choice) use ($accessor, $preferredChoices) { + try { + return $accessor->getValue($choice, $preferredChoices); + } catch (UnexpectedTypeException $e) { + // Assume not preferred if not readable + return false; + } + }; + } + + if (\is_string($index)) { + $index = new PropertyPath($index); + } + + if ($index instanceof PropertyPathInterface) { + $index = function ($choice) use ($accessor, $index) { + return $accessor->getValue($choice, $index); + }; + } + + if (\is_string($groupBy)) { + $groupBy = new PropertyPath($groupBy); + } + + if ($groupBy instanceof PropertyPathInterface) { + $groupBy = function ($choice) use ($accessor, $groupBy) { + try { + return $accessor->getValue($choice, $groupBy); + } catch (UnexpectedTypeException $e) { + // Don't group if path is not readable + return null; + } + }; + } + + if (\is_string($attr)) { + $attr = new PropertyPath($attr); + } + + if ($attr instanceof PropertyPathInterface) { + $attr = function ($choice) use ($accessor, $attr) { + return $accessor->getValue($choice, $attr); + }; + } + + if (\is_string($labelTranslationParameters)) { + $labelTranslationParameters = new PropertyPath($labelTranslationParameters); + } + + if ($labelTranslationParameters instanceof PropertyPath) { + $labelTranslationParameters = static function ($choice) use ($accessor, $labelTranslationParameters) { + return $accessor->getValue($choice, $labelTranslationParameters); + }; + } + + return $this->decoratedFactory->createView( + $list, + $preferredChoices, + $label, + $index, + $groupBy, + $attr, + $labelTranslationParameters + ); + } +} diff --git a/vendor/symfony/form/ChoiceList/LazyChoiceList.php b/vendor/symfony/form/ChoiceList/LazyChoiceList.php new file mode 100644 index 0000000..ab4c103 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/LazyChoiceList.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\Component\Form\ChoiceList; + +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; + +/** + * A choice list that loads its choices lazily. + * + * The choices are fetched using a {@link ChoiceLoaderInterface} instance. + * If only {@link getChoicesForValues()} or {@link getValuesForChoices()} is + * called, the choice list is only loaded partially for improved performance. + * + * Once {@link getChoices()} or {@link getValues()} is called, the list is + * loaded fully. + * + * @author Bernhard Schussek + */ +class LazyChoiceList implements ChoiceListInterface +{ + private $loader; + + /** + * The callable creating string values for each choice. + * + * If null, choices are cast to strings. + * + * @var callable|null + */ + private $value; + + /** + * Creates a lazily-loaded list using the given loader. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as first and the array key as the second + * argument. + * + * @param callable|null $value The callable generating the choice values + */ + public function __construct(ChoiceLoaderInterface $loader, callable $value = null) + { + $this->loader = $loader; + $this->value = $value; + } + + /** + * {@inheritdoc} + */ + public function getChoices() + { + return $this->loader->loadChoiceList($this->value)->getChoices(); + } + + /** + * {@inheritdoc} + */ + public function getValues() + { + return $this->loader->loadChoiceList($this->value)->getValues(); + } + + /** + * {@inheritdoc} + */ + public function getStructuredValues() + { + return $this->loader->loadChoiceList($this->value)->getStructuredValues(); + } + + /** + * {@inheritdoc} + */ + public function getOriginalKeys() + { + return $this->loader->loadChoiceList($this->value)->getOriginalKeys(); + } + + /** + * {@inheritdoc} + */ + public function getChoicesForValues(array $values) + { + return $this->loader->loadChoicesForValues($values, $this->value); + } + + /** + * {@inheritdoc} + */ + public function getValuesForChoices(array $choices) + { + return $this->loader->loadValuesForChoices($choices, $this->value); + } +} diff --git a/vendor/symfony/form/ChoiceList/Loader/AbstractChoiceLoader.php b/vendor/symfony/form/ChoiceList/Loader/AbstractChoiceLoader.php new file mode 100644 index 0000000..a30af63 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Loader/AbstractChoiceLoader.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Loader; + +use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; + +/** + * @author Jules Pietri + */ +abstract class AbstractChoiceLoader implements ChoiceLoaderInterface +{ + /** + * The loaded choice list. + * + * @var ArrayChoiceList + */ + private $choiceList; + + /** + * @final + * + * {@inheritdoc} + */ + public function loadChoiceList(callable $value = null): ChoiceListInterface + { + return $this->choiceList ?? ($this->choiceList = new ArrayChoiceList($this->loadChoices(), $value)); + } + + /** + * {@inheritdoc} + */ + public function loadChoicesForValues(array $values, callable $value = null) + { + if (!$values) { + return []; + } + + if ($this->choiceList) { + return $this->choiceList->getChoicesForValues($values); + } + + return $this->doLoadChoicesForValues($values, $value); + } + + /** + * {@inheritdoc} + */ + public function loadValuesForChoices(array $choices, callable $value = null) + { + if (!$choices) { + return []; + } + + if ($value) { + // if a value callback exists, use it + return array_map($value, $choices); + } + + if ($this->choiceList) { + return $this->choiceList->getValuesForChoices($choices); + } + + return $this->doLoadValuesForChoices($choices); + } + + abstract protected function loadChoices(): iterable; + + protected function doLoadChoicesForValues(array $values, ?callable $value): array + { + return $this->loadChoiceList($value)->getChoicesForValues($values); + } + + protected function doLoadValuesForChoices(array $choices): array + { + return $this->loadChoiceList()->getValuesForChoices($choices); + } +} diff --git a/vendor/symfony/form/ChoiceList/Loader/CallbackChoiceLoader.php b/vendor/symfony/form/ChoiceList/Loader/CallbackChoiceLoader.php new file mode 100644 index 0000000..1811d43 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Loader/CallbackChoiceLoader.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Loader; + +/** + * Loads an {@link ArrayChoiceList} instance from a callable returning iterable choices. + * + * @author Jules Pietri + */ +class CallbackChoiceLoader extends AbstractChoiceLoader +{ + private $callback; + + /** + * @param callable $callback The callable returning iterable choices + */ + public function __construct(callable $callback) + { + $this->callback = $callback; + } + + protected function loadChoices(): iterable + { + return ($this->callback)(); + } +} diff --git a/vendor/symfony/form/ChoiceList/Loader/ChoiceLoaderInterface.php b/vendor/symfony/form/ChoiceList/Loader/ChoiceLoaderInterface.php new file mode 100644 index 0000000..98e03bb --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Loader/ChoiceLoaderInterface.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Loader; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; + +/** + * Loads a choice list. + * + * The methods {@link loadChoicesForValues()} and {@link loadValuesForChoices()} + * can be used to load the list only partially in cases where a fully-loaded + * list is not necessary. + * + * @author Bernhard Schussek + */ +interface ChoiceLoaderInterface +{ + /** + * Loads a list of choices. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as only argument. + * Null may be passed when the choice list contains the empty value. + * + * @param callable|null $value The callable which generates the values + * from choices + * + * @return ChoiceListInterface + */ + public function loadChoiceList(callable $value = null); + + /** + * Loads the choices corresponding to the given values. + * + * The choices are returned with the same keys and in the same order as the + * corresponding values in the given array. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as only argument. + * Null may be passed when the choice list contains the empty value. + * + * @param string[] $values An array of choice values. Non-existing + * values in this array are ignored + * @param callable|null $value The callable generating the choice values + * + * @return array + */ + public function loadChoicesForValues(array $values, callable $value = null); + + /** + * Loads the values corresponding to the given choices. + * + * The values are returned with the same keys and in the same order as the + * corresponding choices in the given array. + * + * Optionally, a callable can be passed for generating the choice values. + * The callable receives the choice as only argument. + * Null may be passed when the choice list contains the empty value. + * + * @param array $choices An array of choices. Non-existing choices in + * this array are ignored + * @param callable|null $value The callable generating the choice values + * + * @return string[] + */ + public function loadValuesForChoices(array $choices, callable $value = null); +} diff --git a/vendor/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php b/vendor/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php new file mode 100644 index 0000000..a52f3b8 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Loader; + +/** + * A decorator to filter choices only when they are loaded or partially loaded. + * + * @author Jules Pietri + */ +class FilterChoiceLoaderDecorator extends AbstractChoiceLoader +{ + private $decoratedLoader; + private $filter; + + public function __construct(ChoiceLoaderInterface $loader, callable $filter) + { + $this->decoratedLoader = $loader; + $this->filter = $filter; + } + + protected function loadChoices(): iterable + { + $list = $this->decoratedLoader->loadChoiceList(); + + if (array_values($list->getValues()) === array_values($structuredValues = $list->getStructuredValues())) { + return array_filter(array_combine($list->getOriginalKeys(), $list->getChoices()), $this->filter); + } + + foreach ($structuredValues as $group => $values) { + if ($values && $filtered = array_filter($list->getChoicesForValues($values), $this->filter)) { + $choices[$group] = $filtered; + } + // filter empty groups + } + + return $choices ?? []; + } + + /** + * {@inheritdoc} + */ + public function loadChoicesForValues(array $values, callable $value = null): array + { + return array_filter($this->decoratedLoader->loadChoicesForValues($values, $value), $this->filter); + } + + /** + * {@inheritdoc} + */ + public function loadValuesForChoices(array $choices, callable $value = null): array + { + return $this->decoratedLoader->loadValuesForChoices(array_filter($choices, $this->filter), $value); + } +} diff --git a/vendor/symfony/form/ChoiceList/Loader/IntlCallbackChoiceLoader.php b/vendor/symfony/form/ChoiceList/Loader/IntlCallbackChoiceLoader.php new file mode 100644 index 0000000..546937b --- /dev/null +++ b/vendor/symfony/form/ChoiceList/Loader/IntlCallbackChoiceLoader.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\Loader; + +/** + * Callback choice loader optimized for Intl choice types. + * + * @author Jules Pietri + * @author Yonel Ceruto + */ +class IntlCallbackChoiceLoader extends CallbackChoiceLoader +{ + /** + * {@inheritdoc} + */ + public function loadChoicesForValues(array $values, callable $value = null) + { + return parent::loadChoicesForValues(array_filter($values), $value); + } + + /** + * {@inheritdoc} + */ + public function loadValuesForChoices(array $choices, callable $value = null) + { + $choices = array_filter($choices); + + // If no callable is set, choices are the same as values + if (null === $value) { + return $choices; + } + + return parent::loadValuesForChoices($choices, $value); + } +} diff --git a/vendor/symfony/form/ChoiceList/View/ChoiceGroupView.php b/vendor/symfony/form/ChoiceList/View/ChoiceGroupView.php new file mode 100644 index 0000000..46b7d19 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/View/ChoiceGroupView.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\View; + +/** + * Represents a group of choices in templates. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class ChoiceGroupView implements \IteratorAggregate +{ + public $label; + public $choices; + + /** + * Creates a new choice group view. + * + * @param array $choices the choice views in the group + */ + public function __construct(string $label, array $choices = []) + { + $this->label = $label; + $this->choices = $choices; + } + + /** + * {@inheritdoc} + * + * @return \Traversable + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \ArrayIterator($this->choices); + } +} diff --git a/vendor/symfony/form/ChoiceList/View/ChoiceListView.php b/vendor/symfony/form/ChoiceList/View/ChoiceListView.php new file mode 100644 index 0000000..586269b --- /dev/null +++ b/vendor/symfony/form/ChoiceList/View/ChoiceListView.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\View; + +/** + * Represents a choice list in templates. + * + * A choice list contains choices and optionally preferred choices which are + * displayed in the very beginning of the list. Both choices and preferred + * choices may be grouped in {@link ChoiceGroupView} instances. + * + * @author Bernhard Schussek + */ +class ChoiceListView +{ + public $choices; + public $preferredChoices; + + /** + * Creates a new choice list view. + * + * @param ChoiceGroupView[]|ChoiceView[] $choices The choice views + * @param ChoiceGroupView[]|ChoiceView[] $preferredChoices the preferred choice views + */ + public function __construct(array $choices = [], array $preferredChoices = []) + { + $this->choices = $choices; + $this->preferredChoices = $preferredChoices; + } + + /** + * Returns whether a placeholder is in the choices. + * + * A placeholder must be the first child element, not be in a group and have an empty value. + * + * @return bool + */ + public function hasPlaceholder() + { + if ($this->preferredChoices) { + $firstChoice = reset($this->preferredChoices); + + return $firstChoice instanceof ChoiceView && '' === $firstChoice->value; + } + + $firstChoice = reset($this->choices); + + return $firstChoice instanceof ChoiceView && '' === $firstChoice->value; + } +} diff --git a/vendor/symfony/form/ChoiceList/View/ChoiceView.php b/vendor/symfony/form/ChoiceList/View/ChoiceView.php new file mode 100644 index 0000000..e1d8ac9 --- /dev/null +++ b/vendor/symfony/form/ChoiceList/View/ChoiceView.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\ChoiceList\View; + +use Symfony\Component\Translation\TranslatableMessage; + +/** + * Represents a choice in templates. + * + * @author Bernhard Schussek + */ +class ChoiceView +{ + public $label; + public $value; + public $data; + + /** + * Additional attributes for the HTML tag. + */ + public $attr; + + /** + * Additional parameters used to translate the label. + */ + public $labelTranslationParameters; + + /** + * Creates a new choice view. + * + * @param mixed $data The original choice + * @param string $value The view representation of the choice + * @param string|TranslatableMessage|false $label The label displayed to humans; pass false to discard the label + * @param array $attr Additional attributes for the HTML tag + * @param array $labelTranslationParameters Additional parameters used to translate the label + */ + public function __construct($data, string $value, $label, array $attr = [], array $labelTranslationParameters = []) + { + $this->data = $data; + $this->value = $value; + $this->label = $label; + $this->attr = $attr; + $this->labelTranslationParameters = $labelTranslationParameters; + } +} diff --git a/vendor/symfony/form/ClearableErrorsInterface.php b/vendor/symfony/form/ClearableErrorsInterface.php new file mode 100644 index 0000000..e609bed --- /dev/null +++ b/vendor/symfony/form/ClearableErrorsInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A form element whose errors can be cleared. + * + * @author Colin O'Dell + */ +interface ClearableErrorsInterface +{ + /** + * Removes all the errors of this form. + * + * @param bool $deep Whether to remove errors from child forms as well + * + * @return $this + */ + public function clearErrors(bool $deep = false); +} diff --git a/vendor/symfony/form/ClickableInterface.php b/vendor/symfony/form/ClickableInterface.php new file mode 100644 index 0000000..8b02d36 --- /dev/null +++ b/vendor/symfony/form/ClickableInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A clickable form element. + * + * @author Bernhard Schussek + */ +interface ClickableInterface +{ + /** + * Returns whether this element was clicked. + * + * @return bool + */ + public function isClicked(); +} diff --git a/vendor/symfony/form/Command/DebugCommand.php b/vendor/symfony/form/Command/DebugCommand.php new file mode 100644 index 0000000..6979831 --- /dev/null +++ b/vendor/symfony/form/Command/DebugCommand.php @@ -0,0 +1,292 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Form\Console\Helper\DescriptorHelper; +use Symfony\Component\Form\Extension\Core\CoreExtension; +use Symfony\Component\Form\FormRegistryInterface; +use Symfony\Component\Form\FormTypeInterface; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; + +/** + * A console command for retrieving information about form types. + * + * @author Yonel Ceruto + */ +class DebugCommand extends Command +{ + protected static $defaultName = 'debug:form'; + protected static $defaultDescription = 'Display form type information'; + + private $formRegistry; + private $namespaces; + private $types; + private $extensions; + private $guessers; + private $fileLinkFormatter; + + public function __construct(FormRegistryInterface $formRegistry, array $namespaces = ['Symfony\Component\Form\Extension\Core\Type'], array $types = [], array $extensions = [], array $guessers = [], FileLinkFormatter $fileLinkFormatter = null) + { + parent::__construct(); + + $this->formRegistry = $formRegistry; + $this->namespaces = $namespaces; + $this->types = $types; + $this->extensions = $extensions; + $this->guessers = $guessers; + $this->fileLinkFormatter = $fileLinkFormatter; + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setDefinition([ + new InputArgument('class', InputArgument::OPTIONAL, 'The form type class'), + new InputArgument('option', InputArgument::OPTIONAL, 'The form type option'), + new InputOption('show-deprecated', null, InputOption::VALUE_NONE, 'Display deprecated options in form types'), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'), + ]) + ->setDescription(self::$defaultDescription) + ->setHelp(<<<'EOF' +The %command.name% command displays information about form types. + + php %command.full_name% + +The command lists all built-in types, services types, type extensions and +guessers currently available. + + php %command.full_name% Symfony\Component\Form\Extension\Core\Type\ChoiceType + php %command.full_name% ChoiceType + +The command lists all defined options that contains the given form type, +as well as their parents and type extensions. + + php %command.full_name% ChoiceType choice_value + +Use the --show-deprecated option to display form types with +deprecated options or the deprecated options of the given form type: + + php %command.full_name% --show-deprecated + php %command.full_name% ChoiceType --show-deprecated + +The command displays the definition of the given option name. + + php %command.full_name% --format=json + +The command lists everything in a machine readable json format. +EOF + ) + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + if (null === $class = $input->getArgument('class')) { + $object = null; + $options['core_types'] = $this->getCoreTypes(); + $options['service_types'] = array_values(array_diff($this->types, $options['core_types'])); + if ($input->getOption('show-deprecated')) { + $options['core_types'] = $this->filterTypesByDeprecated($options['core_types']); + $options['service_types'] = $this->filterTypesByDeprecated($options['service_types']); + } + $options['extensions'] = $this->extensions; + $options['guessers'] = $this->guessers; + foreach ($options as $k => $list) { + sort($options[$k]); + } + } else { + if (!class_exists($class) || !is_subclass_of($class, FormTypeInterface::class)) { + $class = $this->getFqcnTypeClass($input, $io, $class); + } + $resolvedType = $this->formRegistry->getType($class); + + if ($option = $input->getArgument('option')) { + $object = $resolvedType->getOptionsResolver(); + + if (!$object->isDefined($option)) { + $message = sprintf('Option "%s" is not defined in "%s".', $option, \get_class($resolvedType->getInnerType())); + + if ($alternatives = $this->findAlternatives($option, $object->getDefinedOptions())) { + if (1 === \count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + $message .= implode("\n ", $alternatives); + } + + throw new InvalidArgumentException($message); + } + + $options['type'] = $resolvedType->getInnerType(); + $options['option'] = $option; + } else { + $object = $resolvedType; + } + } + + $helper = new DescriptorHelper($this->fileLinkFormatter); + $options['format'] = $input->getOption('format'); + $options['show_deprecated'] = $input->getOption('show-deprecated'); + $helper->describe($io, $object, $options); + + return 0; + } + + private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, string $shortClassName): string + { + $classes = $this->getFqcnTypeClasses($shortClassName); + + if (0 === $count = \count($classes)) { + $message = sprintf("Could not find type \"%s\" into the following namespaces:\n %s", $shortClassName, implode("\n ", $this->namespaces)); + + $allTypes = array_merge($this->getCoreTypes(), $this->types); + if ($alternatives = $this->findAlternatives($shortClassName, $allTypes)) { + if (1 === \count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + $message .= implode("\n ", $alternatives); + } + + throw new InvalidArgumentException($message); + } + if (1 === $count) { + return $classes[0]; + } + if (!$input->isInteractive()) { + throw new InvalidArgumentException(sprintf("The type \"%s\" is ambiguous.\n\nDid you mean one of these?\n %s.", $shortClassName, implode("\n ", $classes))); + } + + return $io->choice(sprintf("The type \"%s\" is ambiguous.\n\nSelect one of the following form types to display its information:", $shortClassName), $classes, $classes[0]); + } + + private function getFqcnTypeClasses(string $shortClassName): array + { + $classes = []; + sort($this->namespaces); + foreach ($this->namespaces as $namespace) { + if (class_exists($fqcn = $namespace.'\\'.$shortClassName)) { + $classes[] = $fqcn; + } elseif (class_exists($fqcn = $namespace.'\\'.ucfirst($shortClassName))) { + $classes[] = $fqcn; + } elseif (class_exists($fqcn = $namespace.'\\'.ucfirst($shortClassName).'Type')) { + $classes[] = $fqcn; + } elseif (str_ends_with($shortClassName, 'type') && class_exists($fqcn = $namespace.'\\'.ucfirst(substr($shortClassName, 0, -4).'Type'))) { + $classes[] = $fqcn; + } + } + + return $classes; + } + + private function getCoreTypes(): array + { + $coreExtension = new CoreExtension(); + $loadTypesRefMethod = (new \ReflectionObject($coreExtension))->getMethod('loadTypes'); + $loadTypesRefMethod->setAccessible(true); + $coreTypes = $loadTypesRefMethod->invoke($coreExtension); + $coreTypes = array_map(function (FormTypeInterface $type) { return \get_class($type); }, $coreTypes); + sort($coreTypes); + + return $coreTypes; + } + + private function filterTypesByDeprecated(array $types): array + { + $typesWithDeprecatedOptions = []; + foreach ($types as $class) { + $optionsResolver = $this->formRegistry->getType($class)->getOptionsResolver(); + foreach ($optionsResolver->getDefinedOptions() as $option) { + if ($optionsResolver->isDeprecated($option)) { + $typesWithDeprecatedOptions[] = $class; + break; + } + } + } + + return $typesWithDeprecatedOptions; + } + + private function findAlternatives(string $name, array $collection): array + { + $alternatives = []; + foreach ($collection as $item) { + $lev = levenshtein($name, $item); + if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) { + $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; + } + } + + $threshold = 1e3; + $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); + ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); + + return array_keys($alternatives); + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestArgumentValuesFor('class')) { + $suggestions->suggestValues(array_merge($this->getCoreTypes(), $this->types)); + + return; + } + + if ($input->mustSuggestArgumentValuesFor('option') && null !== $class = $input->getArgument('class')) { + $this->completeOptions($class, $suggestions); + + return; + } + + if ($input->mustSuggestOptionValuesFor('format')) { + $helper = new DescriptorHelper(); + $suggestions->suggestValues($helper->getFormats()); + } + } + + private function completeOptions(string $class, CompletionSuggestions $suggestions): void + { + if (!class_exists($class) || !is_subclass_of($class, FormTypeInterface::class)) { + $classes = $this->getFqcnTypeClasses($class); + + if (1 === \count($classes)) { + $class = $classes[0]; + } + } + + if (!$this->formRegistry->hasType($class)) { + return; + } + + $resolvedType = $this->formRegistry->getType($class); + $suggestions->suggestValues($resolvedType->getOptionsResolver()->getDefinedOptions()); + } +} diff --git a/vendor/symfony/form/Console/Descriptor/Descriptor.php b/vendor/symfony/form/Console/Descriptor/Descriptor.php new file mode 100644 index 0000000..4aceafb --- /dev/null +++ b/vendor/symfony/form/Console/Descriptor/Descriptor.php @@ -0,0 +1,207 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Console\Descriptor; + +use Symfony\Component\Console\Descriptor\DescriptorInterface; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\OutputStyle; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Form\ResolvedFormTypeInterface; +use Symfony\Component\Form\Util\OptionsResolverWrapper; +use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector; +use Symfony\Component\OptionsResolver\Exception\NoConfigurationException; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Yonel Ceruto + * + * @internal + */ +abstract class Descriptor implements DescriptorInterface +{ + /** @var OutputStyle */ + protected $output; + protected $type; + protected $ownOptions = []; + protected $overriddenOptions = []; + protected $parentOptions = []; + protected $extensionOptions = []; + protected $requiredOptions = []; + protected $parents = []; + protected $extensions = []; + + /** + * {@inheritdoc} + */ + public function describe(OutputInterface $output, $object, array $options = []) + { + $this->output = $output instanceof OutputStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output); + + switch (true) { + case null === $object: + $this->describeDefaults($options); + break; + case $object instanceof ResolvedFormTypeInterface: + $this->describeResolvedFormType($object, $options); + break; + case $object instanceof OptionsResolver: + $this->describeOption($object, $options); + break; + default: + throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object))); + } + } + + abstract protected function describeDefaults(array $options); + + abstract protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = []); + + abstract protected function describeOption(OptionsResolver $optionsResolver, array $options); + + protected function collectOptions(ResolvedFormTypeInterface $type) + { + $this->parents = []; + $this->extensions = []; + + if (null !== $type->getParent()) { + $optionsResolver = clone $this->getParentOptionsResolver($type->getParent()); + } else { + $optionsResolver = new OptionsResolver(); + } + + $type->getInnerType()->configureOptions($ownOptionsResolver = new OptionsResolverWrapper()); + $this->ownOptions = array_diff($ownOptionsResolver->getDefinedOptions(), $optionsResolver->getDefinedOptions()); + $overriddenOptions = array_intersect(array_merge($ownOptionsResolver->getDefinedOptions(), $ownOptionsResolver->getUndefinedOptions()), $optionsResolver->getDefinedOptions()); + + $this->parentOptions = []; + foreach ($this->parents as $class => $parentOptions) { + $this->overriddenOptions[$class] = array_intersect($overriddenOptions, $parentOptions); + $this->parentOptions[$class] = array_diff($parentOptions, $overriddenOptions); + } + + $type->getInnerType()->configureOptions($optionsResolver); + $this->collectTypeExtensionsOptions($type, $optionsResolver); + $this->extensionOptions = []; + foreach ($this->extensions as $class => $extensionOptions) { + $this->overriddenOptions[$class] = array_intersect($overriddenOptions, $extensionOptions); + $this->extensionOptions[$class] = array_diff($extensionOptions, $overriddenOptions); + } + + $this->overriddenOptions = array_filter($this->overriddenOptions); + $this->parentOptions = array_filter($this->parentOptions); + $this->extensionOptions = array_filter($this->extensionOptions); + $this->requiredOptions = $optionsResolver->getRequiredOptions(); + + $this->parents = array_keys($this->parents); + $this->extensions = array_keys($this->extensions); + } + + protected function getOptionDefinition(OptionsResolver $optionsResolver, string $option) + { + $definition = []; + + if ($info = $optionsResolver->getInfo($option)) { + $definition = [ + 'info' => $info, + ]; + } + + $definition += [ + 'required' => $optionsResolver->isRequired($option), + 'deprecated' => $optionsResolver->isDeprecated($option), + ]; + + $introspector = new OptionsResolverIntrospector($optionsResolver); + + $map = [ + 'default' => 'getDefault', + 'lazy' => 'getLazyClosures', + 'allowedTypes' => 'getAllowedTypes', + 'allowedValues' => 'getAllowedValues', + 'normalizers' => 'getNormalizers', + 'deprecation' => 'getDeprecation', + ]; + + foreach ($map as $key => $method) { + try { + $definition[$key] = $introspector->{$method}($option); + } catch (NoConfigurationException $e) { + // noop + } + } + + if (isset($definition['deprecation']) && isset($definition['deprecation']['message']) && \is_string($definition['deprecation']['message'])) { + $definition['deprecationMessage'] = strtr($definition['deprecation']['message'], ['%name%' => $option]); + $definition['deprecationPackage'] = $definition['deprecation']['package']; + $definition['deprecationVersion'] = $definition['deprecation']['version']; + } + + return $definition; + } + + protected function filterOptionsByDeprecated(ResolvedFormTypeInterface $type) + { + $deprecatedOptions = []; + $resolver = $type->getOptionsResolver(); + foreach ($resolver->getDefinedOptions() as $option) { + if ($resolver->isDeprecated($option)) { + $deprecatedOptions[] = $option; + } + } + + $filterByDeprecated = function (array $options) use ($deprecatedOptions) { + foreach ($options as $class => $opts) { + if ($deprecated = array_intersect($deprecatedOptions, $opts)) { + $options[$class] = $deprecated; + } else { + unset($options[$class]); + } + } + + return $options; + }; + + $this->ownOptions = array_intersect($deprecatedOptions, $this->ownOptions); + $this->overriddenOptions = $filterByDeprecated($this->overriddenOptions); + $this->parentOptions = $filterByDeprecated($this->parentOptions); + $this->extensionOptions = $filterByDeprecated($this->extensionOptions); + } + + private function getParentOptionsResolver(ResolvedFormTypeInterface $type): OptionsResolver + { + $this->parents[$class = \get_class($type->getInnerType())] = []; + + if (null !== $type->getParent()) { + $optionsResolver = clone $this->getParentOptionsResolver($type->getParent()); + } else { + $optionsResolver = new OptionsResolver(); + } + + $inheritedOptions = $optionsResolver->getDefinedOptions(); + $type->getInnerType()->configureOptions($optionsResolver); + $this->parents[$class] = array_diff($optionsResolver->getDefinedOptions(), $inheritedOptions); + + $this->collectTypeExtensionsOptions($type, $optionsResolver); + + return $optionsResolver; + } + + private function collectTypeExtensionsOptions(ResolvedFormTypeInterface $type, OptionsResolver $optionsResolver) + { + foreach ($type->getTypeExtensions() as $extension) { + $inheritedOptions = $optionsResolver->getDefinedOptions(); + $extension->configureOptions($optionsResolver); + $this->extensions[\get_class($extension)] = array_diff($optionsResolver->getDefinedOptions(), $inheritedOptions); + } + } +} diff --git a/vendor/symfony/form/Console/Descriptor/JsonDescriptor.php b/vendor/symfony/form/Console/Descriptor/JsonDescriptor.php new file mode 100644 index 0000000..d40561e --- /dev/null +++ b/vendor/symfony/form/Console/Descriptor/JsonDescriptor.php @@ -0,0 +1,118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Console\Descriptor; + +use Symfony\Component\Form\ResolvedFormTypeInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Yonel Ceruto + * + * @internal + */ +class JsonDescriptor extends Descriptor +{ + protected function describeDefaults(array $options) + { + $data['builtin_form_types'] = $options['core_types']; + $data['service_form_types'] = $options['service_types']; + if (!$options['show_deprecated']) { + $data['type_extensions'] = $options['extensions']; + $data['type_guessers'] = $options['guessers']; + } + + $this->writeData($data, $options); + } + + protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = []) + { + $this->collectOptions($resolvedFormType); + + if ($options['show_deprecated']) { + $this->filterOptionsByDeprecated($resolvedFormType); + } + + $formOptions = [ + 'own' => $this->ownOptions, + 'overridden' => $this->overriddenOptions, + 'parent' => $this->parentOptions, + 'extension' => $this->extensionOptions, + 'required' => $this->requiredOptions, + ]; + $this->sortOptions($formOptions); + + $data = [ + 'class' => \get_class($resolvedFormType->getInnerType()), + 'block_prefix' => $resolvedFormType->getInnerType()->getBlockPrefix(), + 'options' => $formOptions, + 'parent_types' => $this->parents, + 'type_extensions' => $this->extensions, + ]; + + $this->writeData($data, $options); + } + + protected function describeOption(OptionsResolver $optionsResolver, array $options) + { + $definition = $this->getOptionDefinition($optionsResolver, $options['option']); + + $map = []; + if ($definition['deprecated']) { + $map['deprecated'] = 'deprecated'; + if (\is_string($definition['deprecationMessage'])) { + $map['deprecation_message'] = 'deprecationMessage'; + } + } + $map += [ + 'info' => 'info', + 'required' => 'required', + 'default' => 'default', + 'allowed_types' => 'allowedTypes', + 'allowed_values' => 'allowedValues', + ]; + foreach ($map as $label => $name) { + if (\array_key_exists($name, $definition)) { + $data[$label] = $definition[$name]; + + if ('default' === $name) { + $data['is_lazy'] = isset($definition['lazy']); + } + } + } + $data['has_normalizer'] = isset($definition['normalizers']); + + $this->writeData($data, $options); + } + + private function writeData(array $data, array $options) + { + $flags = $options['json_encoding'] ?? 0; + + $this->output->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n"); + } + + private function sortOptions(array &$options) + { + foreach ($options as &$opts) { + $sorted = false; + foreach ($opts as &$opt) { + if (\is_array($opt)) { + sort($opt); + $sorted = true; + } + } + if (!$sorted) { + sort($opts); + } + } + } +} diff --git a/vendor/symfony/form/Console/Descriptor/TextDescriptor.php b/vendor/symfony/form/Console/Descriptor/TextDescriptor.php new file mode 100644 index 0000000..4862a67 --- /dev/null +++ b/vendor/symfony/form/Console/Descriptor/TextDescriptor.php @@ -0,0 +1,222 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Console\Descriptor; + +use Symfony\Component\Console\Helper\Dumper; +use Symfony\Component\Console\Helper\TableSeparator; +use Symfony\Component\Form\ResolvedFormTypeInterface; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Yonel Ceruto + * + * @internal + */ +class TextDescriptor extends Descriptor +{ + private $fileLinkFormatter; + + public function __construct(FileLinkFormatter $fileLinkFormatter = null) + { + $this->fileLinkFormatter = $fileLinkFormatter; + } + + protected function describeDefaults(array $options) + { + if ($options['core_types']) { + $this->output->section('Built-in form types (Symfony\Component\Form\Extension\Core\Type)'); + $shortClassNames = array_map(function ($fqcn) { + return $this->formatClassLink($fqcn, \array_slice(explode('\\', $fqcn), -1)[0]); + }, $options['core_types']); + for ($i = 0, $loopsMax = \count($shortClassNames); $i * 5 < $loopsMax; ++$i) { + $this->output->writeln(' '.implode(', ', \array_slice($shortClassNames, $i * 5, 5))); + } + } + + if ($options['service_types']) { + $this->output->section('Service form types'); + $this->output->listing(array_map([$this, 'formatClassLink'], $options['service_types'])); + } + + if (!$options['show_deprecated']) { + if ($options['extensions']) { + $this->output->section('Type extensions'); + $this->output->listing(array_map([$this, 'formatClassLink'], $options['extensions'])); + } + + if ($options['guessers']) { + $this->output->section('Type guessers'); + $this->output->listing(array_map([$this, 'formatClassLink'], $options['guessers'])); + } + } + } + + protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedFormType, array $options = []) + { + $this->collectOptions($resolvedFormType); + + if ($options['show_deprecated']) { + $this->filterOptionsByDeprecated($resolvedFormType); + } + + $formOptions = $this->normalizeAndSortOptionsColumns(array_filter([ + 'own' => $this->ownOptions, + 'overridden' => $this->overriddenOptions, + 'parent' => $this->parentOptions, + 'extension' => $this->extensionOptions, + ])); + + // setting headers and column order + $tableHeaders = array_intersect_key([ + 'own' => 'Options', + 'overridden' => 'Overridden options', + 'parent' => 'Parent options', + 'extension' => 'Extension options', + ], $formOptions); + + $this->output->title(sprintf('%s (Block prefix: "%s")', \get_class($resolvedFormType->getInnerType()), $resolvedFormType->getInnerType()->getBlockPrefix())); + + if ($formOptions) { + $this->output->table($tableHeaders, $this->buildTableRows($tableHeaders, $formOptions)); + } + + if ($this->parents) { + $this->output->section('Parent types'); + $this->output->listing(array_map([$this, 'formatClassLink'], $this->parents)); + } + + if ($this->extensions) { + $this->output->section('Type extensions'); + $this->output->listing(array_map([$this, 'formatClassLink'], $this->extensions)); + } + } + + protected function describeOption(OptionsResolver $optionsResolver, array $options) + { + $definition = $this->getOptionDefinition($optionsResolver, $options['option']); + + $dump = new Dumper($this->output); + $map = []; + if ($definition['deprecated']) { + $map = [ + 'Deprecated' => 'deprecated', + 'Deprecation package' => 'deprecationPackage', + 'Deprecation version' => 'deprecationVersion', + 'Deprecation message' => 'deprecationMessage', + ]; + } + $map += [ + 'Info' => 'info', + 'Required' => 'required', + 'Default' => 'default', + 'Allowed types' => 'allowedTypes', + 'Allowed values' => 'allowedValues', + 'Normalizers' => 'normalizers', + ]; + $rows = []; + foreach ($map as $label => $name) { + $value = \array_key_exists($name, $definition) ? $dump($definition[$name]) : '-'; + if ('default' === $name && isset($definition['lazy'])) { + $value = "Value: $value\n\nClosure(s): ".$dump($definition['lazy']); + } + + $rows[] = ["$label", $value]; + $rows[] = new TableSeparator(); + } + array_pop($rows); + + $this->output->title(sprintf('%s (%s)', \get_class($options['type']), $options['option'])); + $this->output->table([], $rows); + } + + private function buildTableRows(array $headers, array $options): array + { + $tableRows = []; + $count = \count(max($options)); + for ($i = 0; $i < $count; ++$i) { + $cells = []; + foreach (array_keys($headers) as $group) { + $option = $options[$group][$i] ?? null; + if (\is_string($option) && \in_array($option, $this->requiredOptions, true)) { + $option .= ' (required)'; + } + $cells[] = $option; + } + $tableRows[] = $cells; + } + + return $tableRows; + } + + private function normalizeAndSortOptionsColumns(array $options): array + { + foreach ($options as $group => $opts) { + $sorted = false; + foreach ($opts as $class => $opt) { + if (\is_string($class)) { + unset($options[$group][$class]); + } + + if (!\is_array($opt) || 0 === \count($opt)) { + continue; + } + + if (!$sorted) { + $options[$group] = []; + } else { + $options[$group][] = null; + } + $options[$group][] = sprintf('%s', (new \ReflectionClass($class))->getShortName()); + $options[$group][] = new TableSeparator(); + + sort($opt); + $sorted = true; + $options[$group] = array_merge($options[$group], $opt); + } + + if (!$sorted) { + sort($options[$group]); + } + } + + return $options; + } + + private function formatClassLink(string $class, string $text = null): string + { + if (null === $text) { + $text = $class; + } + + if ('' === $fileLink = $this->getFileLink($class)) { + return $text; + } + + return sprintf('%s', $fileLink, $text); + } + + private function getFileLink(string $class): string + { + if (null === $this->fileLinkFormatter) { + return ''; + } + + try { + $r = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return ''; + } + + return (string) $this->fileLinkFormatter->format($r->getFileName(), $r->getStartLine()); + } +} diff --git a/vendor/symfony/form/Console/Helper/DescriptorHelper.php b/vendor/symfony/form/Console/Helper/DescriptorHelper.php new file mode 100644 index 0000000..355fb95 --- /dev/null +++ b/vendor/symfony/form/Console/Helper/DescriptorHelper.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Console\Helper; + +use Symfony\Component\Console\Helper\DescriptorHelper as BaseDescriptorHelper; +use Symfony\Component\Form\Console\Descriptor\JsonDescriptor; +use Symfony\Component\Form\Console\Descriptor\TextDescriptor; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; + +/** + * @author Yonel Ceruto + * + * @internal + */ +class DescriptorHelper extends BaseDescriptorHelper +{ + public function __construct(FileLinkFormatter $fileLinkFormatter = null) + { + $this + ->register('txt', new TextDescriptor($fileLinkFormatter)) + ->register('json', new JsonDescriptor()) + ; + } +} diff --git a/vendor/symfony/form/DataAccessorInterface.php b/vendor/symfony/form/DataAccessorInterface.php new file mode 100644 index 0000000..a5b4bc8 --- /dev/null +++ b/vendor/symfony/form/DataAccessorInterface.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Writes and reads values to/from an object or array bound to a form. + * + * @author Yonel Ceruto + */ +interface DataAccessorInterface +{ + /** + * Returns the value at the end of the property of the object graph. + * + * @param object|array $viewData The view data of the compound form + * @param FormInterface $form The {@link FormInterface()} instance to check + * + * @return mixed + * + * @throws Exception\AccessException If unable to read from the given form data + */ + public function getValue($viewData, FormInterface $form); + + /** + * Sets the value at the end of the property of the object graph. + * + * @param object|array $viewData The view data of the compound form + * @param mixed $value The value to set at the end of the object graph + * @param FormInterface $form The {@link FormInterface()} instance to check + * + * @throws Exception\AccessException If unable to write the given value + */ + public function setValue(&$viewData, $value, FormInterface $form): void; + + /** + * Returns whether a value can be read from an object graph. + * + * Whenever this method returns true, {@link getValue()} is guaranteed not + * to throw an exception when called with the same arguments. + * + * @param object|array $viewData The view data of the compound form + * @param FormInterface $form The {@link FormInterface()} instance to check + */ + public function isReadable($viewData, FormInterface $form): bool; + + /** + * Returns whether a value can be written at a given object graph. + * + * Whenever this method returns true, {@link setValue()} is guaranteed not + * to throw an exception when called with the same arguments. + * + * @param object|array $viewData The view data of the compound form + * @param FormInterface $form The {@link FormInterface()} instance to check + */ + public function isWritable($viewData, FormInterface $form): bool; +} diff --git a/vendor/symfony/form/DataMapperInterface.php b/vendor/symfony/form/DataMapperInterface.php new file mode 100644 index 0000000..c2cd360 --- /dev/null +++ b/vendor/symfony/form/DataMapperInterface.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @author Bernhard Schussek + */ +interface DataMapperInterface +{ + /** + * Maps the view data of a compound form to its children. + * + * The method is responsible for calling {@link FormInterface::setData()} + * on the children of compound forms, defining their underlying model data. + * + * @param mixed $viewData View data of the compound form being initialized + * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances + * + * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported + */ + public function mapDataToForms($viewData, \Traversable $forms); + + /** + * Maps the model data of a list of children forms into the view data of their parent. + * + * This is the internal cascade call of FormInterface::submit for compound forms, since they + * cannot be bound to any input nor the request as scalar, but their children may: + * + * $compoundForm->submit($arrayOfChildrenViewData) + * // inside: + * $childForm->submit($childViewData); + * // for each entry, do the same and/or reverse transform + * $this->dataMapper->mapFormsToData($compoundForm, $compoundInitialViewData) + * // then reverse transform + * + * When a simple form is submitted the following is happening: + * + * $simpleForm->submit($submittedViewData) + * // inside: + * $this->viewData = $submittedViewData + * // then reverse transform + * + * The model data can be an array or an object, so this second argument is always passed + * by reference. + * + * @param FormInterface[]|\Traversable $forms A list of {@link FormInterface} instances + * @param mixed $viewData The compound form's view data that get mapped + * its children model data + * + * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported + */ + public function mapFormsToData(\Traversable $forms, &$viewData); +} diff --git a/vendor/symfony/form/DataTransformerInterface.php b/vendor/symfony/form/DataTransformerInterface.php new file mode 100644 index 0000000..5f48428 --- /dev/null +++ b/vendor/symfony/form/DataTransformerInterface.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms a value between different representations. + * + * @author Bernhard Schussek + */ +interface DataTransformerInterface +{ + /** + * Transforms a value from the original representation to a transformed representation. + * + * This method is called when the form field is initialized with its default data, on + * two occasions for two types of transformers: + * + * 1. Model transformers which normalize the model data. + * This is mainly useful when the same form type (the same configuration) + * has to handle different kind of underlying data, e.g The DateType can + * deal with strings or \DateTime objects as input. + * + * 2. View transformers which adapt the normalized data to the view format. + * a/ When the form is simple, the value returned by convention is used + * directly in the view and thus can only be a string or an array. In + * this case the data class should be null. + * + * b/ When the form is compound the returned value should be an array or + * an object to be mapped to the children. Each property of the compound + * data will be used as model data by each child and will be transformed + * too. In this case data class should be the class of the object, or null + * when it is an array. + * + * All transformers are called in a configured order from model data to view value. + * At the end of this chain the view data will be validated against the data class + * setting. + * + * This method must be able to deal with empty values. Usually this will + * be NULL, but depending on your implementation other empty values are + * possible as well (such as empty strings). The reasoning behind this is + * that data transformers must be chainable. If the transform() method + * of the first data transformer outputs NULL, the second must be able to + * process that value. + * + * @param mixed $value The value in the original representation + * + * @return mixed + * + * @throws TransformationFailedException when the transformation fails + */ + public function transform($value); + + /** + * Transforms a value from the transformed representation to its original + * representation. + * + * This method is called when {@link Form::submit()} is called to transform the requests tainted data + * into an acceptable format. + * + * The same transformers are called in the reverse order so the responsibility is to + * return one of the types that would be expected as input of transform(). + * + * This method must be able to deal with empty values. Usually this will + * be an empty string, but depending on your implementation other empty + * values are possible as well (such as NULL). The reasoning behind + * this is that value transformers must be chainable. If the + * reverseTransform() method of the first value transformer outputs an + * empty string, the second value transformer must be able to process that + * value. + * + * By convention, reverseTransform() should return NULL if an empty string + * is passed. + * + * @param mixed $value The value in the transformed representation + * + * @return mixed + * + * @throws TransformationFailedException when the transformation fails + */ + public function reverseTransform($value); +} diff --git a/vendor/symfony/form/DependencyInjection/FormPass.php b/vendor/symfony/form/DependencyInjection/FormPass.php new file mode 100644 index 0000000..0ba4611 --- /dev/null +++ b/vendor/symfony/form/DependencyInjection/FormPass.php @@ -0,0 +1,146 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\DependencyInjection; + +use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Adds all services with the tags "form.type", "form.type_extension" and + * "form.type_guesser" as arguments of the "form.extension" service. + * + * @author Bernhard Schussek + */ +class FormPass implements CompilerPassInterface +{ + use PriorityTaggedServiceTrait; + + private $formExtensionService; + private $formTypeTag; + private $formTypeExtensionTag; + private $formTypeGuesserTag; + private $formDebugCommandService; + + public function __construct(string $formExtensionService = 'form.extension', string $formTypeTag = 'form.type', string $formTypeExtensionTag = 'form.type_extension', string $formTypeGuesserTag = 'form.type_guesser', string $formDebugCommandService = 'console.command.form_debug') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->formExtensionService = $formExtensionService; + $this->formTypeTag = $formTypeTag; + $this->formTypeExtensionTag = $formTypeExtensionTag; + $this->formTypeGuesserTag = $formTypeGuesserTag; + $this->formDebugCommandService = $formDebugCommandService; + } + + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition($this->formExtensionService)) { + return; + } + + $definition = $container->getDefinition($this->formExtensionService); + $definition->replaceArgument(0, $this->processFormTypes($container)); + $definition->replaceArgument(1, $this->processFormTypeExtensions($container)); + $definition->replaceArgument(2, $this->processFormTypeGuessers($container)); + } + + private function processFormTypes(ContainerBuilder $container): Reference + { + // Get service locator argument + $servicesMap = []; + $namespaces = ['Symfony\Component\Form\Extension\Core\Type' => true]; + + // Builds an array with fully-qualified type class names as keys and service IDs as values + foreach ($container->findTaggedServiceIds($this->formTypeTag, true) as $serviceId => $tag) { + // Add form type service to the service locator + $serviceDefinition = $container->getDefinition($serviceId); + $servicesMap[$formType = $serviceDefinition->getClass()] = new Reference($serviceId); + $namespaces[substr($formType, 0, strrpos($formType, '\\'))] = true; + } + + if ($container->hasDefinition($this->formDebugCommandService)) { + $commandDefinition = $container->getDefinition($this->formDebugCommandService); + $commandDefinition->setArgument(1, array_keys($namespaces)); + $commandDefinition->setArgument(2, array_keys($servicesMap)); + } + + return ServiceLocatorTagPass::register($container, $servicesMap); + } + + private function processFormTypeExtensions(ContainerBuilder $container): array + { + $typeExtensions = []; + $typeExtensionsClasses = []; + foreach ($this->findAndSortTaggedServices($this->formTypeExtensionTag, $container) as $reference) { + $serviceId = (string) $reference; + $serviceDefinition = $container->getDefinition($serviceId); + + $tag = $serviceDefinition->getTag($this->formTypeExtensionTag); + $typeExtensionClass = $container->getParameterBag()->resolveValue($serviceDefinition->getClass()); + + if (isset($tag[0]['extended_type'])) { + $typeExtensions[$tag[0]['extended_type']][] = new Reference($serviceId); + $typeExtensionsClasses[] = $typeExtensionClass; + } else { + $extendsTypes = false; + + $typeExtensionsClasses[] = $typeExtensionClass; + foreach ($typeExtensionClass::getExtendedTypes() as $extendedType) { + $typeExtensions[$extendedType][] = new Reference($serviceId); + $extendsTypes = true; + } + + if (!$extendsTypes) { + throw new InvalidArgumentException(sprintf('The getExtendedTypes() method for service "%s" does not return any extended types.', $serviceId)); + } + } + } + + foreach ($typeExtensions as $extendedType => $extensions) { + $typeExtensions[$extendedType] = new IteratorArgument($extensions); + } + + if ($container->hasDefinition($this->formDebugCommandService)) { + $commandDefinition = $container->getDefinition($this->formDebugCommandService); + $commandDefinition->setArgument(3, $typeExtensionsClasses); + } + + return $typeExtensions; + } + + private function processFormTypeGuessers(ContainerBuilder $container): ArgumentInterface + { + $guessers = []; + $guessersClasses = []; + foreach ($container->findTaggedServiceIds($this->formTypeGuesserTag, true) as $serviceId => $tags) { + $guessers[] = new Reference($serviceId); + + $serviceDefinition = $container->getDefinition($serviceId); + $guessersClasses[] = $serviceDefinition->getClass(); + } + + if ($container->hasDefinition($this->formDebugCommandService)) { + $commandDefinition = $container->getDefinition($this->formDebugCommandService); + $commandDefinition->setArgument(4, $guessersClasses); + } + + return new IteratorArgument($guessers); + } +} diff --git a/vendor/symfony/form/Event/PostSetDataEvent.php b/vendor/symfony/form/Event/PostSetDataEvent.php new file mode 100644 index 0000000..eef5374 --- /dev/null +++ b/vendor/symfony/form/Event/PostSetDataEvent.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Event; + +use Symfony\Component\Form\FormEvent; + +/** + * This event is dispatched at the end of the Form::setData() method. + * + * This event is mostly here for reading data after having pre-populated the form. + */ +final class PostSetDataEvent extends FormEvent +{ +} diff --git a/vendor/symfony/form/Event/PostSubmitEvent.php b/vendor/symfony/form/Event/PostSubmitEvent.php new file mode 100644 index 0000000..aa3775f --- /dev/null +++ b/vendor/symfony/form/Event/PostSubmitEvent.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Event; + +use Symfony\Component\Form\FormEvent; + +/** + * This event is dispatched after the Form::submit() + * once the model and view data have been denormalized. + * + * It can be used to fetch data after denormalization. + */ +final class PostSubmitEvent extends FormEvent +{ +} diff --git a/vendor/symfony/form/Event/PreSetDataEvent.php b/vendor/symfony/form/Event/PreSetDataEvent.php new file mode 100644 index 0000000..5450400 --- /dev/null +++ b/vendor/symfony/form/Event/PreSetDataEvent.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Event; + +use Symfony\Component\Form\FormEvent; + +/** + * This event is dispatched at the beginning of the Form::setData() method. + * + * It can be used to: + * - Modify the data given during pre-population; + * - Modify a form depending on the pre-populated data (adding or removing fields dynamically). + */ +final class PreSetDataEvent extends FormEvent +{ +} diff --git a/vendor/symfony/form/Event/PreSubmitEvent.php b/vendor/symfony/form/Event/PreSubmitEvent.php new file mode 100644 index 0000000..a72ac5d --- /dev/null +++ b/vendor/symfony/form/Event/PreSubmitEvent.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Event; + +use Symfony\Component\Form\FormEvent; + +/** + * This event is dispatched at the beginning of the Form::submit() method. + * + * It can be used to: + * - Change data from the request, before submitting the data to the form. + * - Add or remove form fields, before submitting the data to the form. + */ +final class PreSubmitEvent extends FormEvent +{ +} diff --git a/vendor/symfony/form/Event/SubmitEvent.php b/vendor/symfony/form/Event/SubmitEvent.php new file mode 100644 index 0000000..71d3b06 --- /dev/null +++ b/vendor/symfony/form/Event/SubmitEvent.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Event; + +use Symfony\Component\Form\FormEvent; + +/** + * This event is dispatched just before the Form::submit() method + * transforms back the normalized data to the model and view data. + * + * It can be used to change data from the normalized representation of the data. + */ +final class SubmitEvent extends FormEvent +{ +} diff --git a/vendor/symfony/form/Exception/AccessException.php b/vendor/symfony/form/Exception/AccessException.php new file mode 100644 index 0000000..ac712cc --- /dev/null +++ b/vendor/symfony/form/Exception/AccessException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +class AccessException extends RuntimeException +{ +} diff --git a/vendor/symfony/form/Exception/AlreadySubmittedException.php b/vendor/symfony/form/Exception/AlreadySubmittedException.php new file mode 100644 index 0000000..5e8c305 --- /dev/null +++ b/vendor/symfony/form/Exception/AlreadySubmittedException.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Thrown when an operation is called that is not acceptable after submitting + * a form. + * + * @author Bernhard Schussek + */ +class AlreadySubmittedException extends LogicException +{ +} diff --git a/vendor/symfony/form/Exception/BadMethodCallException.php b/vendor/symfony/form/Exception/BadMethodCallException.php new file mode 100644 index 0000000..27649dd --- /dev/null +++ b/vendor/symfony/form/Exception/BadMethodCallException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base BadMethodCallException for the Form component. + * + * @author Bernhard Schussek + */ +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/form/Exception/ErrorMappingException.php b/vendor/symfony/form/Exception/ErrorMappingException.php new file mode 100644 index 0000000..a696849 --- /dev/null +++ b/vendor/symfony/form/Exception/ErrorMappingException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +class ErrorMappingException extends RuntimeException +{ +} diff --git a/vendor/symfony/form/Exception/ExceptionInterface.php b/vendor/symfony/form/Exception/ExceptionInterface.php new file mode 100644 index 0000000..69145f0 --- /dev/null +++ b/vendor/symfony/form/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base ExceptionInterface for the Form component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/form/Exception/InvalidArgumentException.php b/vendor/symfony/form/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..a270e0c --- /dev/null +++ b/vendor/symfony/form/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base InvalidArgumentException for the Form component. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/form/Exception/InvalidConfigurationException.php b/vendor/symfony/form/Exception/InvalidConfigurationException.php new file mode 100644 index 0000000..daa0c42 --- /dev/null +++ b/vendor/symfony/form/Exception/InvalidConfigurationException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +class InvalidConfigurationException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/form/Exception/LogicException.php b/vendor/symfony/form/Exception/LogicException.php new file mode 100644 index 0000000..8487802 --- /dev/null +++ b/vendor/symfony/form/Exception/LogicException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base LogicException for Form component. + * + * @author Alexander Kotynia + */ +class LogicException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/form/Exception/OutOfBoundsException.php b/vendor/symfony/form/Exception/OutOfBoundsException.php new file mode 100644 index 0000000..44d3116 --- /dev/null +++ b/vendor/symfony/form/Exception/OutOfBoundsException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base OutOfBoundsException for Form component. + * + * @author Alexander Kotynia + */ +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/form/Exception/RuntimeException.php b/vendor/symfony/form/Exception/RuntimeException.php new file mode 100644 index 0000000..0af48a4 --- /dev/null +++ b/vendor/symfony/form/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Base RuntimeException for the Form component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/form/Exception/StringCastException.php b/vendor/symfony/form/Exception/StringCastException.php new file mode 100644 index 0000000..f9b51d6 --- /dev/null +++ b/vendor/symfony/form/Exception/StringCastException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +class StringCastException extends RuntimeException +{ +} diff --git a/vendor/symfony/form/Exception/TransformationFailedException.php b/vendor/symfony/form/Exception/TransformationFailedException.php new file mode 100644 index 0000000..89eba08 --- /dev/null +++ b/vendor/symfony/form/Exception/TransformationFailedException.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +/** + * Indicates a value transformation error. + * + * @author Bernhard Schussek + */ +class TransformationFailedException extends RuntimeException +{ + private $invalidMessage; + private $invalidMessageParameters; + + public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, string $invalidMessage = null, array $invalidMessageParameters = []) + { + parent::__construct($message, $code, $previous); + + $this->setInvalidMessage($invalidMessage, $invalidMessageParameters); + } + + /** + * Sets the message that will be shown to the user. + * + * @param string|null $invalidMessage The message or message key + * @param array $invalidMessageParameters Data to be passed into the translator + */ + public function setInvalidMessage(string $invalidMessage = null, array $invalidMessageParameters = []): void + { + $this->invalidMessage = $invalidMessage; + $this->invalidMessageParameters = $invalidMessageParameters; + } + + public function getInvalidMessage(): ?string + { + return $this->invalidMessage; + } + + public function getInvalidMessageParameters(): array + { + return $this->invalidMessageParameters; + } +} diff --git a/vendor/symfony/form/Exception/UnexpectedTypeException.php b/vendor/symfony/form/Exception/UnexpectedTypeException.php new file mode 100644 index 0000000..d25d470 --- /dev/null +++ b/vendor/symfony/form/Exception/UnexpectedTypeException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Exception; + +class UnexpectedTypeException extends InvalidArgumentException +{ + public function __construct($value, string $expectedType) + { + parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, get_debug_type($value))); + } +} diff --git a/vendor/symfony/form/Extension/Core/CoreExtension.php b/vendor/symfony/form/Extension/Core/CoreExtension.php new file mode 100644 index 0000000..c6768b8 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/CoreExtension.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core; + +use Symfony\Component\Form\AbstractExtension; +use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; +use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; +use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory; +use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator; +use Symfony\Component\Form\Extension\Core\Type\TransformationFailureExtension; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * Represents the main form extension, which loads the core functionality. + * + * @author Bernhard Schussek + */ +class CoreExtension extends AbstractExtension +{ + private $propertyAccessor; + private $choiceListFactory; + private $translator; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null, TranslatorInterface $translator = null) + { + $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + $this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor)); + $this->translator = $translator; + } + + protected function loadTypes() + { + return [ + new Type\FormType($this->propertyAccessor), + new Type\BirthdayType(), + new Type\CheckboxType(), + new Type\ChoiceType($this->choiceListFactory, $this->translator), + new Type\CollectionType(), + new Type\CountryType(), + new Type\DateIntervalType(), + new Type\DateType(), + new Type\DateTimeType(), + new Type\EmailType(), + new Type\HiddenType(), + new Type\IntegerType(), + new Type\LanguageType(), + new Type\LocaleType(), + new Type\MoneyType(), + new Type\NumberType(), + new Type\PasswordType(), + new Type\PercentType(), + new Type\RadioType(), + new Type\RangeType(), + new Type\RepeatedType(), + new Type\SearchType(), + new Type\TextareaType(), + new Type\TextType(), + new Type\TimeType(), + new Type\TimezoneType(), + new Type\UrlType(), + new Type\FileType($this->translator), + new Type\ButtonType(), + new Type\SubmitType(), + new Type\ResetType(), + new Type\CurrencyType(), + new Type\TelType(), + new Type\ColorType($this->translator), + new Type\WeekType(), + ]; + } + + protected function loadTypeExtensions() + { + return [ + new TransformationFailureExtension($this->translator), + ]; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataAccessor/CallbackAccessor.php b/vendor/symfony/form/Extension/Core/DataAccessor/CallbackAccessor.php new file mode 100644 index 0000000..fb12145 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataAccessor/CallbackAccessor.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataAccessor; + +use Symfony\Component\Form\DataAccessorInterface; +use Symfony\Component\Form\Exception\AccessException; +use Symfony\Component\Form\FormInterface; + +/** + * Writes and reads values to/from an object or array using callback functions. + * + * @author Yonel Ceruto + */ +class CallbackAccessor implements DataAccessorInterface +{ + /** + * {@inheritdoc} + */ + public function getValue($data, FormInterface $form) + { + if (null === $getter = $form->getConfig()->getOption('getter')) { + throw new AccessException('Unable to read from the given form data as no getter is defined.'); + } + + return ($getter)($data, $form); + } + + /** + * {@inheritdoc} + */ + public function setValue(&$data, $value, FormInterface $form): void + { + if (null === $setter = $form->getConfig()->getOption('setter')) { + throw new AccessException('Unable to write the given value as no setter is defined.'); + } + + ($setter)($data, $form->getData(), $form); + } + + /** + * {@inheritdoc} + */ + public function isReadable($data, FormInterface $form): bool + { + return null !== $form->getConfig()->getOption('getter'); + } + + /** + * {@inheritdoc} + */ + public function isWritable($data, FormInterface $form): bool + { + return null !== $form->getConfig()->getOption('setter'); + } +} diff --git a/vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php b/vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php new file mode 100644 index 0000000..39e444b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataAccessor; + +use Symfony\Component\Form\DataAccessorInterface; +use Symfony\Component\Form\Exception\AccessException; +use Symfony\Component\Form\FormInterface; + +/** + * @author Yonel Ceruto + */ +class ChainAccessor implements DataAccessorInterface +{ + private $accessors; + + /** + * @param DataAccessorInterface[]|iterable $accessors + */ + public function __construct(iterable $accessors) + { + $this->accessors = $accessors; + } + + /** + * {@inheritdoc} + */ + public function getValue($data, FormInterface $form) + { + foreach ($this->accessors as $accessor) { + if ($accessor->isReadable($data, $form)) { + return $accessor->getValue($data, $form); + } + } + + throw new AccessException('Unable to read from the given form data as no accessor in the chain is able to read the data.'); + } + + /** + * {@inheritdoc} + */ + public function setValue(&$data, $value, FormInterface $form): void + { + foreach ($this->accessors as $accessor) { + if ($accessor->isWritable($data, $form)) { + $accessor->setValue($data, $value, $form); + + return; + } + } + + throw new AccessException('Unable to write the given value as no accessor in the chain is able to set the data.'); + } + + /** + * {@inheritdoc} + */ + public function isReadable($data, FormInterface $form): bool + { + foreach ($this->accessors as $accessor) { + if ($accessor->isReadable($data, $form)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function isWritable($data, FormInterface $form): bool + { + foreach ($this->accessors as $accessor) { + if ($accessor->isWritable($data, $form)) { + return true; + } + } + + return false; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php b/vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php new file mode 100644 index 0000000..06b0d36 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.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\Component\Form\Extension\Core\DataAccessor; + +use Symfony\Component\Form\DataAccessorInterface; +use Symfony\Component\Form\Exception\AccessException; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\PropertyAccess\Exception\AccessException as PropertyAccessException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * Writes and reads values to/from an object or array using property path. + * + * @author Yonel Ceruto + * @author Bernhard Schussek + */ +class PropertyPathAccessor implements DataAccessorInterface +{ + private $propertyAccessor; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor(); + } + + /** + * {@inheritdoc} + */ + public function getValue($data, FormInterface $form) + { + if (null === $propertyPath = $form->getPropertyPath()) { + throw new AccessException('Unable to read from the given form data as no property path is defined.'); + } + + return $this->getPropertyValue($data, $propertyPath); + } + + /** + * {@inheritdoc} + */ + public function setValue(&$data, $propertyValue, FormInterface $form): void + { + if (null === $propertyPath = $form->getPropertyPath()) { + throw new AccessException('Unable to write the given value as no property path is defined.'); + } + + // If the field is of type DateTimeInterface and the data is the same skip the update to + // keep the original object hash + if ($propertyValue instanceof \DateTimeInterface && $propertyValue == $this->getPropertyValue($data, $propertyPath)) { + return; + } + + // If the data is identical to the value in $data, we are + // dealing with a reference + if (!\is_object($data) || !$form->getConfig()->getByReference() || $propertyValue !== $this->getPropertyValue($data, $propertyPath)) { + $this->propertyAccessor->setValue($data, $propertyPath, $propertyValue); + } + } + + /** + * {@inheritdoc} + */ + public function isReadable($data, FormInterface $form): bool + { + return null !== $form->getPropertyPath(); + } + + /** + * {@inheritdoc} + */ + public function isWritable($data, FormInterface $form): bool + { + return null !== $form->getPropertyPath(); + } + + private function getPropertyValue($data, PropertyPathInterface $propertyPath) + { + try { + return $this->propertyAccessor->getValue($data, $propertyPath); + } catch (PropertyAccessException $e) { + if (!$e instanceof UninitializedPropertyException + // For versions without UninitializedPropertyException check the exception message + && (class_exists(UninitializedPropertyException::class) || false === strpos($e->getMessage(), 'You should initialize it')) + ) { + throw $e; + } + + return null; + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataMapper/CheckboxListMapper.php b/vendor/symfony/form/Extension/Core/DataMapper/CheckboxListMapper.php new file mode 100644 index 0000000..ecfd83a --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataMapper/CheckboxListMapper.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataMapper; + +use Symfony\Component\Form\DataMapperInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Maps choices to/from checkbox forms. + * + * A {@link ChoiceListInterface} implementation is used to find the + * corresponding string values for the choices. Each checkbox form whose "value" + * option corresponds to any of the selected values is marked as selected. + * + * @author Bernhard Schussek + */ +class CheckboxListMapper implements DataMapperInterface +{ + /** + * {@inheritdoc} + */ + public function mapDataToForms($choices, iterable $checkboxes) + { + if (\is_array($checkboxes)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + if (null === $choices) { + $choices = []; + } + + if (!\is_array($choices)) { + throw new UnexpectedTypeException($choices, 'array'); + } + + foreach ($checkboxes as $checkbox) { + $value = $checkbox->getConfig()->getOption('value'); + $checkbox->setData(\in_array($value, $choices, true)); + } + } + + /** + * {@inheritdoc} + */ + public function mapFormsToData(iterable $checkboxes, &$choices) + { + if (\is_array($checkboxes)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + if (!\is_array($choices)) { + throw new UnexpectedTypeException($choices, 'array'); + } + + $values = []; + + foreach ($checkboxes as $checkbox) { + if ($checkbox->getData()) { + // construct an array of choice values + $values[] = $checkbox->getConfig()->getOption('value'); + } + } + + $choices = $values; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php b/vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php new file mode 100644 index 0000000..5f4c498 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataMapper; + +use Symfony\Component\Form\DataAccessorInterface; +use Symfony\Component\Form\DataMapperInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\DataAccessor\CallbackAccessor; +use Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor; +use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor; + +/** + * Maps arrays/objects to/from forms using data accessors. + * + * @author Bernhard Schussek + */ +class DataMapper implements DataMapperInterface +{ + private $dataAccessor; + + public function __construct(DataAccessorInterface $dataAccessor = null) + { + $this->dataAccessor = $dataAccessor ?? new ChainAccessor([ + new CallbackAccessor(), + new PropertyPathAccessor(), + ]); + } + + /** + * {@inheritdoc} + */ + public function mapDataToForms($data, iterable $forms): void + { + if (\is_array($forms)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + $empty = null === $data || [] === $data; + + if (!$empty && !\is_array($data) && !\is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } + + foreach ($forms as $form) { + $config = $form->getConfig(); + + if (!$empty && $config->getMapped() && $this->dataAccessor->isReadable($data, $form)) { + $form->setData($this->dataAccessor->getValue($data, $form)); + } else { + $form->setData($config->getData()); + } + } + } + + /** + * {@inheritdoc} + */ + public function mapFormsToData(iterable $forms, &$data): void + { + if (\is_array($forms)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + if (null === $data) { + return; + } + + if (!\is_array($data) && !\is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } + + foreach ($forms as $form) { + $config = $form->getConfig(); + + // Write-back is disabled if the form is not synchronized (transformation failed), + // if the form was not submitted and if the form is disabled (modification not allowed) + if ($config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled() && $this->dataAccessor->isWritable($data, $form)) { + $this->dataAccessor->setValue($data, $form->getData(), $form); + } + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataMapper/PropertyPathMapper.php b/vendor/symfony/form/Extension/Core/DataMapper/PropertyPathMapper.php new file mode 100644 index 0000000..504dbe4 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataMapper/PropertyPathMapper.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataMapper; + +use Symfony\Component\Form\DataMapperInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\PropertyAccess\Exception\AccessException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; + +trigger_deprecation('symfony/form', '5.2', 'The "%s" class is deprecated. Use "%s" instead.', PropertyPathMapper::class, DataMapper::class); + +/** + * Maps arrays/objects to/from forms using property paths. + * + * @author Bernhard Schussek + * + * @deprecated since symfony/form 5.2. Use {@see DataMapper} instead. + */ +class PropertyPathMapper implements DataMapperInterface +{ + private $propertyAccessor; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + } + + /** + * {@inheritdoc} + */ + public function mapDataToForms($data, iterable $forms) + { + $empty = null === $data || [] === $data; + + if (!$empty && !\is_array($data) && !\is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } + + foreach ($forms as $form) { + $propertyPath = $form->getPropertyPath(); + $config = $form->getConfig(); + + if (!$empty && null !== $propertyPath && $config->getMapped()) { + $form->setData($this->getPropertyValue($data, $propertyPath)); + } else { + $form->setData($config->getData()); + } + } + } + + /** + * {@inheritdoc} + */ + public function mapFormsToData(iterable $forms, &$data) + { + if (null === $data) { + return; + } + + if (!\is_array($data) && !\is_object($data)) { + throw new UnexpectedTypeException($data, 'object, array or empty'); + } + + foreach ($forms as $form) { + $propertyPath = $form->getPropertyPath(); + $config = $form->getConfig(); + + // Write-back is disabled if the form is not synchronized (transformation failed), + // if the form was not submitted and if the form is disabled (modification not allowed) + if (null !== $propertyPath && $config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled()) { + $propertyValue = $form->getData(); + // If the field is of type DateTimeInterface and the data is the same skip the update to + // keep the original object hash + if ($propertyValue instanceof \DateTimeInterface && $propertyValue == $this->getPropertyValue($data, $propertyPath)) { + continue; + } + + // If the data is identical to the value in $data, we are + // dealing with a reference + if (!\is_object($data) || !$config->getByReference() || $propertyValue !== $this->getPropertyValue($data, $propertyPath)) { + $this->propertyAccessor->setValue($data, $propertyPath, $propertyValue); + } + } + } + } + + private function getPropertyValue($data, $propertyPath) + { + try { + return $this->propertyAccessor->getValue($data, $propertyPath); + } catch (AccessException $e) { + if (!$e instanceof UninitializedPropertyException + // For versions without UninitializedPropertyException check the exception message + && (class_exists(UninitializedPropertyException::class) || !str_contains($e->getMessage(), 'You should initialize it')) + ) { + throw $e; + } + + return null; + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataMapper/RadioListMapper.php b/vendor/symfony/form/Extension/Core/DataMapper/RadioListMapper.php new file mode 100644 index 0000000..b54adfa --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataMapper/RadioListMapper.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataMapper; + +use Symfony\Component\Form\DataMapperInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Maps choices to/from radio forms. + * + * A {@link ChoiceListInterface} implementation is used to find the + * corresponding string values for the choices. The radio form whose "value" + * option corresponds to the selected value is marked as selected. + * + * @author Bernhard Schussek + */ +class RadioListMapper implements DataMapperInterface +{ + /** + * {@inheritdoc} + */ + public function mapDataToForms($choice, iterable $radios) + { + if (\is_array($radios)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + if (!\is_string($choice)) { + throw new UnexpectedTypeException($choice, 'string'); + } + + foreach ($radios as $radio) { + $value = $radio->getConfig()->getOption('value'); + $radio->setData($choice === $value); + } + } + + /** + * {@inheritdoc} + */ + public function mapFormsToData(iterable $radios, &$choice) + { + if (\is_array($radios)) { + trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__); + } + + if (null !== $choice && !\is_string($choice)) { + throw new UnexpectedTypeException($choice, 'null or string'); + } + + $choice = null; + + foreach ($radios as $radio) { + if ($radio->getData()) { + if ('placeholder' === $radio->getName()) { + return; + } + + $choice = $radio->getConfig()->getOption('value'); + + return; + } + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php new file mode 100644 index 0000000..f799209 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class ArrayToPartsTransformer implements DataTransformerInterface +{ + private $partMapping; + + public function __construct(array $partMapping) + { + $this->partMapping = $partMapping; + } + + public function transform($array) + { + if (null === $array) { + $array = []; + } + + if (!\is_array($array)) { + throw new TransformationFailedException('Expected an array.'); + } + + $result = []; + + foreach ($this->partMapping as $partKey => $originalKeys) { + if (empty($array)) { + $result[$partKey] = null; + } else { + $result[$partKey] = array_intersect_key($array, array_flip($originalKeys)); + } + } + + return $result; + } + + public function reverseTransform($array) + { + if (!\is_array($array)) { + throw new TransformationFailedException('Expected an array.'); + } + + $result = []; + $emptyKeys = []; + + foreach ($this->partMapping as $partKey => $originalKeys) { + if (!empty($array[$partKey])) { + foreach ($originalKeys as $originalKey) { + if (isset($array[$partKey][$originalKey])) { + $result[$originalKey] = $array[$partKey][$originalKey]; + } + } + } else { + $emptyKeys[] = $partKey; + } + } + + if (\count($emptyKeys) > 0) { + if (\count($emptyKeys) === \count($this->partMapping)) { + // All parts empty + return null; + } + + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys))); + } + + return $result; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php new file mode 100644 index 0000000..142f489 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\InvalidArgumentException; + +abstract class BaseDateTimeTransformer implements DataTransformerInterface +{ + protected static $formats = [ + \IntlDateFormatter::NONE, + \IntlDateFormatter::FULL, + \IntlDateFormatter::LONG, + \IntlDateFormatter::MEDIUM, + \IntlDateFormatter::SHORT, + ]; + + protected $inputTimezone; + + protected $outputTimezone; + + /** + * @param string|null $inputTimezone The name of the input timezone + * @param string|null $outputTimezone The name of the output timezone + * + * @throws InvalidArgumentException if a timezone is not valid + */ + public function __construct(string $inputTimezone = null, string $outputTimezone = null) + { + $this->inputTimezone = $inputTimezone ?: date_default_timezone_get(); + $this->outputTimezone = $outputTimezone ?: date_default_timezone_get(); + + // Check if input and output timezones are valid + try { + new \DateTimeZone($this->inputTimezone); + } catch (\Exception $e) { + throw new InvalidArgumentException(sprintf('Input timezone is invalid: "%s".', $this->inputTimezone), $e->getCode(), $e); + } + + try { + new \DateTimeZone($this->outputTimezone); + } catch (\Exception $e) { + throw new InvalidArgumentException(sprintf('Output timezone is invalid: "%s".', $this->outputTimezone), $e->getCode(), $e); + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/BooleanToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/BooleanToStringTransformer.php new file mode 100644 index 0000000..b2d5745 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/BooleanToStringTransformer.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a Boolean and a string. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class BooleanToStringTransformer implements DataTransformerInterface +{ + private $trueValue; + + private $falseValues; + + /** + * @param string $trueValue The value emitted upon transform if the input is true + */ + public function __construct(string $trueValue, array $falseValues = [null]) + { + $this->trueValue = $trueValue; + $this->falseValues = $falseValues; + if (\in_array($this->trueValue, $this->falseValues, true)) { + throw new InvalidArgumentException('The specified "true" value is contained in the false-values.'); + } + } + + /** + * Transforms a Boolean into a string. + * + * @param bool $value Boolean value + * + * @return string|null + * + * @throws TransformationFailedException if the given value is not a Boolean + */ + public function transform($value) + { + if (null === $value) { + return null; + } + + if (!\is_bool($value)) { + throw new TransformationFailedException('Expected a Boolean.'); + } + + return $value ? $this->trueValue : null; + } + + /** + * Transforms a string into a Boolean. + * + * @param string $value String value + * + * @return bool + * + * @throws TransformationFailedException if the given value is not a string + */ + public function reverseTransform($value) + { + if (\in_array($value, $this->falseValues, true)) { + return false; + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + return true; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php new file mode 100644 index 0000000..e1feafe --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class ChoiceToValueTransformer implements DataTransformerInterface +{ + private $choiceList; + + public function __construct(ChoiceListInterface $choiceList) + { + $this->choiceList = $choiceList; + } + + public function transform($choice) + { + return (string) current($this->choiceList->getValuesForChoices([$choice])); + } + + public function reverseTransform($value) + { + if (null !== $value && !\is_string($value)) { + throw new TransformationFailedException('Expected a string or null.'); + } + + $choices = $this->choiceList->getChoicesForValues([(string) $value]); + + if (1 !== \count($choices)) { + if (null === $value || '' === $value) { + return null; + } + + throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique.', $value)); + } + + return current($choices); + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php new file mode 100644 index 0000000..6c9e4fe --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class ChoicesToValuesTransformer implements DataTransformerInterface +{ + private $choiceList; + + public function __construct(ChoiceListInterface $choiceList) + { + $this->choiceList = $choiceList; + } + + /** + * @return array + * + * @throws TransformationFailedException if the given value is not an array + */ + public function transform($array) + { + if (null === $array) { + return []; + } + + if (!\is_array($array)) { + throw new TransformationFailedException('Expected an array.'); + } + + return $this->choiceList->getValuesForChoices($array); + } + + /** + * @return array + * + * @throws TransformationFailedException if the given value is not an array + * or if no matching choice could be + * found for some given value + */ + public function reverseTransform($array) + { + if (null === $array) { + return []; + } + + if (!\is_array($array)) { + throw new TransformationFailedException('Expected an array.'); + } + + $choices = $this->choiceList->getChoicesForValues($array); + + if (\count($choices) !== \count($array)) { + throw new TransformationFailedException('Could not find all matching choices for the given values.'); + } + + return $choices; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DataTransformerChain.php b/vendor/symfony/form/Extension/Core/DataTransformer/DataTransformerChain.php new file mode 100644 index 0000000..e3107a8 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DataTransformerChain.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Passes a value through multiple value transformers. + * + * @author Bernhard Schussek + */ +class DataTransformerChain implements DataTransformerInterface +{ + protected $transformers; + + /** + * Uses the given value transformers to transform values. + * + * @param DataTransformerInterface[] $transformers + */ + public function __construct(array $transformers) + { + $this->transformers = $transformers; + } + + /** + * Passes the value through the transform() method of all nested transformers. + * + * The transformers receive the value in the same order as they were passed + * to the constructor. Each transformer receives the result of the previous + * transformer as input. The output of the last transformer is returned + * by this method. + * + * @param mixed $value The original value + * + * @return mixed + * + * @throws TransformationFailedException + */ + public function transform($value) + { + foreach ($this->transformers as $transformer) { + $value = $transformer->transform($value); + } + + return $value; + } + + /** + * Passes the value through the reverseTransform() method of all nested + * transformers. + * + * The transformers receive the value in the reverse order as they were passed + * to the constructor. Each transformer receives the result of the previous + * transformer as input. The output of the last transformer is returned + * by this method. + * + * @param mixed $value The transformed value + * + * @return mixed + * + * @throws TransformationFailedException + */ + public function reverseTransform($value) + { + for ($i = \count($this->transformers) - 1; $i >= 0; --$i) { + $value = $this->transformers[$i]->reverseTransform($value); + } + + return $value; + } + + /** + * @return DataTransformerInterface[] + */ + public function getTransformers() + { + return $this->transformers; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php new file mode 100644 index 0000000..5a37d4c --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Transforms between a normalized date interval and an interval string/array. + * + * @author Steffen Roßkamp + */ +class DateIntervalToArrayTransformer implements DataTransformerInterface +{ + public const YEARS = 'years'; + public const MONTHS = 'months'; + public const DAYS = 'days'; + public const HOURS = 'hours'; + public const MINUTES = 'minutes'; + public const SECONDS = 'seconds'; + public const INVERT = 'invert'; + + private const AVAILABLE_FIELDS = [ + self::YEARS => 'y', + self::MONTHS => 'm', + self::DAYS => 'd', + self::HOURS => 'h', + self::MINUTES => 'i', + self::SECONDS => 's', + self::INVERT => 'r', + ]; + private $fields; + private $pad; + + /** + * @param string[]|null $fields The date fields + * @param bool $pad Whether to use padding + */ + public function __construct(array $fields = null, bool $pad = false) + { + $this->fields = $fields ?? ['years', 'months', 'days', 'hours', 'minutes', 'seconds', 'invert']; + $this->pad = $pad; + } + + /** + * Transforms a normalized date interval into an interval array. + * + * @param \DateInterval $dateInterval Normalized date interval + * + * @return array + * + * @throws UnexpectedTypeException if the given value is not a \DateInterval instance + */ + public function transform($dateInterval) + { + if (null === $dateInterval) { + return array_intersect_key( + [ + 'years' => '', + 'months' => '', + 'weeks' => '', + 'days' => '', + 'hours' => '', + 'minutes' => '', + 'seconds' => '', + 'invert' => false, + ], + array_flip($this->fields) + ); + } + if (!$dateInterval instanceof \DateInterval) { + throw new UnexpectedTypeException($dateInterval, \DateInterval::class); + } + $result = []; + foreach (self::AVAILABLE_FIELDS as $field => $char) { + $result[$field] = $dateInterval->format('%'.($this->pad ? strtoupper($char) : $char)); + } + if (\in_array('weeks', $this->fields, true)) { + $result['weeks'] = '0'; + if (isset($result['days']) && (int) $result['days'] >= 7) { + $result['weeks'] = (string) floor($result['days'] / 7); + $result['days'] = (string) ($result['days'] % 7); + } + } + $result['invert'] = '-' === $result['invert']; + $result = array_intersect_key($result, array_flip($this->fields)); + + return $result; + } + + /** + * Transforms an interval array into a normalized date interval. + * + * @param array $value Interval array + * + * @return \DateInterval|null + * + * @throws UnexpectedTypeException if the given value is not an array + * @throws TransformationFailedException if the value could not be transformed + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + if (!\is_array($value)) { + throw new UnexpectedTypeException($value, 'array'); + } + if ('' === implode('', $value)) { + return null; + } + $emptyFields = []; + foreach ($this->fields as $field) { + if (!isset($value[$field])) { + $emptyFields[] = $field; + } + } + if (\count($emptyFields) > 0) { + throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields))); + } + if (isset($value['invert']) && !\is_bool($value['invert'])) { + throw new TransformationFailedException('The value of "invert" must be boolean.'); + } + foreach (self::AVAILABLE_FIELDS as $field => $char) { + if ('invert' !== $field && isset($value[$field]) && !ctype_digit((string) $value[$field])) { + throw new TransformationFailedException(sprintf('This amount of "%s" is invalid.', $field)); + } + } + try { + if (!empty($value['weeks'])) { + $interval = sprintf( + 'P%sY%sM%sWT%sH%sM%sS', + empty($value['years']) ? '0' : $value['years'], + empty($value['months']) ? '0' : $value['months'], + empty($value['weeks']) ? '0' : $value['weeks'], + empty($value['hours']) ? '0' : $value['hours'], + empty($value['minutes']) ? '0' : $value['minutes'], + empty($value['seconds']) ? '0' : $value['seconds'] + ); + } else { + $interval = sprintf( + 'P%sY%sM%sDT%sH%sM%sS', + empty($value['years']) ? '0' : $value['years'], + empty($value['months']) ? '0' : $value['months'], + empty($value['days']) ? '0' : $value['days'], + empty($value['hours']) ? '0' : $value['hours'], + empty($value['minutes']) ? '0' : $value['minutes'], + empty($value['seconds']) ? '0' : $value['seconds'] + ); + } + $dateInterval = new \DateInterval($interval); + if (isset($value['invert'])) { + $dateInterval->invert = $value['invert'] ? 1 : 0; + } + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + return $dateInterval; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php new file mode 100644 index 0000000..723c344 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Transforms between a date string and a DateInterval object. + * + * @author Steffen Roßkamp + */ +class DateIntervalToStringTransformer implements DataTransformerInterface +{ + private $format; + + /** + * Transforms a \DateInterval instance to a string. + * + * @see \DateInterval::format() for supported formats + * + * @param string $format The date format + */ + public function __construct(string $format = 'P%yY%mM%dDT%hH%iM%sS') + { + $this->format = $format; + } + + /** + * Transforms a DateInterval object into a date string with the configured format. + * + * @param \DateInterval|null $value A DateInterval object + * + * @return string + * + * @throws UnexpectedTypeException if the given value is not a \DateInterval instance + */ + public function transform($value) + { + if (null === $value) { + return ''; + } + if (!$value instanceof \DateInterval) { + throw new UnexpectedTypeException($value, \DateInterval::class); + } + + return $value->format($this->format); + } + + /** + * Transforms a date string in the configured format into a DateInterval object. + * + * @param string $value An ISO 8601 or date string like date interval presentation + * + * @return \DateInterval|null + * + * @throws UnexpectedTypeException if the given value is not a string + * @throws TransformationFailedException if the date interval could not be parsed + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + if (!\is_string($value)) { + throw new UnexpectedTypeException($value, 'string'); + } + if ('' === $value) { + return null; + } + if (!$this->isISO8601($value)) { + throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet.'); + } + $valuePattern = '/^'.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $this->format).'$/'; + if (!preg_match($valuePattern, $value)) { + throw new TransformationFailedException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $value, $this->format)); + } + try { + $dateInterval = new \DateInterval($value); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + return $dateInterval; + } + + private function isISO8601(string $string): bool + { + return preg_match('/^P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string); + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php new file mode 100644 index 0000000..6eb40af --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a DateTimeImmutable object and a DateTime object. + * + * @author Valentin Udaltsov + */ +final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInterface +{ + /** + * Transforms a DateTimeImmutable into a DateTime object. + * + * @param \DateTimeImmutable|null $value A DateTimeImmutable object + * + * @throws TransformationFailedException If the given value is not a \DateTimeImmutable + */ + public function transform($value): ?\DateTime + { + if (null === $value) { + return null; + } + + if (!$value instanceof \DateTimeImmutable) { + throw new TransformationFailedException('Expected a \DateTimeImmutable.'); + } + + if (\PHP_VERSION_ID >= 70300) { + return \DateTime::createFromImmutable($value); + } + + return \DateTime::createFromFormat('U.u', $value->format('U.u'))->setTimezone($value->getTimezone()); + } + + /** + * Transforms a DateTime object into a DateTimeImmutable object. + * + * @param \DateTime|null $value A DateTime object + * + * @throws TransformationFailedException If the given value is not a \DateTime + */ + public function reverseTransform($value): ?\DateTimeImmutable + { + if (null === $value) { + return null; + } + + if (!$value instanceof \DateTime) { + throw new TransformationFailedException('Expected a \DateTime.'); + } + + return \DateTimeImmutable::createFromMutable($value); + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php new file mode 100644 index 0000000..ac225d6 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -0,0 +1,184 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a normalized time and a localized time string/array. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class DateTimeToArrayTransformer extends BaseDateTimeTransformer +{ + private $pad; + private $fields; + private $referenceDate; + + /** + * @param string|null $inputTimezone The input timezone + * @param string|null $outputTimezone The output timezone + * @param string[]|null $fields The date fields + * @param bool $pad Whether to use padding + */ + public function __construct(string $inputTimezone = null, string $outputTimezone = null, array $fields = null, bool $pad = false, \DateTimeInterface $referenceDate = null) + { + parent::__construct($inputTimezone, $outputTimezone); + + $this->fields = $fields ?? ['year', 'month', 'day', 'hour', 'minute', 'second']; + $this->pad = $pad; + $this->referenceDate = $referenceDate ?? new \DateTimeImmutable('1970-01-01 00:00:00'); + } + + /** + * Transforms a normalized date into a localized date. + * + * @param \DateTimeInterface $dateTime A DateTimeInterface object + * + * @return array + * + * @throws TransformationFailedException If the given value is not a \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return array_intersect_key([ + 'year' => '', + 'month' => '', + 'day' => '', + 'hour' => '', + 'minute' => '', + 'second' => '', + ], array_flip($this->fields)); + } + + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); + } + + if ($this->inputTimezone !== $this->outputTimezone) { + if (!$dateTime instanceof \DateTimeImmutable) { + $dateTime = clone $dateTime; + } + + $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } + + $result = array_intersect_key([ + 'year' => $dateTime->format('Y'), + 'month' => $dateTime->format('m'), + 'day' => $dateTime->format('d'), + 'hour' => $dateTime->format('H'), + 'minute' => $dateTime->format('i'), + 'second' => $dateTime->format('s'), + ], array_flip($this->fields)); + + if (!$this->pad) { + foreach ($result as &$entry) { + // remove leading zeros + $entry = (string) (int) $entry; + } + // unset reference to keep scope clear + unset($entry); + } + + return $result; + } + + /** + * Transforms a localized date into a normalized date. + * + * @param array $value Localized date + * + * @return \DateTime|null + * + * @throws TransformationFailedException If the given value is not an array, + * if the value could not be transformed + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + + if (!\is_array($value)) { + throw new TransformationFailedException('Expected an array.'); + } + + if ('' === implode('', $value)) { + return null; + } + + $emptyFields = []; + + foreach ($this->fields as $field) { + if (!isset($value[$field])) { + $emptyFields[] = $field; + } + } + + if (\count($emptyFields) > 0) { + throw new TransformationFailedException(sprintf('The fields "%s" should not be empty.', implode('", "', $emptyFields))); + } + + if (isset($value['month']) && !ctype_digit((string) $value['month'])) { + throw new TransformationFailedException('This month is invalid.'); + } + + if (isset($value['day']) && !ctype_digit((string) $value['day'])) { + throw new TransformationFailedException('This day is invalid.'); + } + + if (isset($value['year']) && !ctype_digit((string) $value['year'])) { + throw new TransformationFailedException('This year is invalid.'); + } + + if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) { + throw new TransformationFailedException('This is an invalid date.'); + } + + if (isset($value['hour']) && !ctype_digit((string) $value['hour'])) { + throw new TransformationFailedException('This hour is invalid.'); + } + + if (isset($value['minute']) && !ctype_digit((string) $value['minute'])) { + throw new TransformationFailedException('This minute is invalid.'); + } + + if (isset($value['second']) && !ctype_digit((string) $value['second'])) { + throw new TransformationFailedException('This second is invalid.'); + } + + try { + $dateTime = new \DateTime(sprintf( + '%s-%s-%s %s:%s:%s', + empty($value['year']) ? $this->referenceDate->format('Y') : $value['year'], + empty($value['month']) ? $this->referenceDate->format('m') : $value['month'], + empty($value['day']) ? $this->referenceDate->format('d') : $value['day'], + $value['hour'] ?? $this->referenceDate->format('H'), + $value['minute'] ?? $this->referenceDate->format('i'), + $value['second'] ?? $this->referenceDate->format('s') + ), + new \DateTimeZone($this->outputTimezone) + ); + + if ($this->inputTimezone !== $this->outputTimezone) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + return $dateTime; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php new file mode 100644 index 0000000..ebbc76b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Franz Wilding + * @author Bernhard Schussek + * @author Fred Cox + */ +class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer +{ + public const HTML5_FORMAT = 'Y-m-d\\TH:i:s'; + + /** + * Transforms a \DateTime into a local date and time string. + * + * According to the HTML standard, the input string of a datetime-local + * input is an RFC3339 date followed by 'T', followed by an RFC3339 time. + * https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-local-date-and-time-string + * + * @param \DateTime|\DateTimeInterface $dateTime A DateTime object + * + * @return string + * + * @throws TransformationFailedException If the given value is not an + * instance of \DateTime or \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTime && !$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + } + + if ($this->inputTimezone !== $this->outputTimezone) { + if (!$dateTime instanceof \DateTimeImmutable) { + $dateTime = clone $dateTime; + } + + $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } + + return $dateTime->format(self::HTML5_FORMAT); + } + + /** + * Transforms a local date and time string into a \DateTime. + * + * When transforming back to DateTime the regex is slightly laxer, taking into + * account rules for parsing a local date and time string + * https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-local-date-and-time-string + * + * @param string $dateTimeLocal Formatted string + * + * @return \DateTime|null + * + * @throws TransformationFailedException If the given value is not a string, + * if the value could not be transformed + */ + public function reverseTransform($dateTimeLocal) + { + if (!\is_string($dateTimeLocal)) { + throw new TransformationFailedException('Expected a string.'); + } + + if ('' === $dateTimeLocal) { + return null; + } + + // to maintain backwards compatibility we do not strictly validate the submitted date + // see https://github.com/symfony/symfony/issues/28699 + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?/', $dateTimeLocal, $matches)) { + throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $dateTimeLocal)); + } + + try { + $dateTime = new \DateTime($dateTimeLocal, new \DateTimeZone($this->outputTimezone)); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + if ($this->inputTimezone !== $dateTime->getTimezone()->getName()) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + + if (!checkdate($matches[2], $matches[3], $matches[1])) { + throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); + } + + return $dateTime; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php new file mode 100644 index 0000000..7c8a4bc --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -0,0 +1,208 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Transforms between a normalized time and a localized time string. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer +{ + private $dateFormat; + private $timeFormat; + private $pattern; + private $calendar; + + /** + * @see BaseDateTimeTransformer::formats for available format options + * + * @param string|null $inputTimezone The name of the input timezone + * @param string|null $outputTimezone The name of the output timezone + * @param int|null $dateFormat The date format + * @param int|null $timeFormat The time format + * @param int $calendar One of the \IntlDateFormatter calendar constants + * @param string|null $pattern A pattern to pass to \IntlDateFormatter + * + * @throws UnexpectedTypeException If a format is not supported or if a timezone is not a string + */ + public function __construct(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null) + { + parent::__construct($inputTimezone, $outputTimezone); + + if (null === $dateFormat) { + $dateFormat = \IntlDateFormatter::MEDIUM; + } + + if (null === $timeFormat) { + $timeFormat = \IntlDateFormatter::SHORT; + } + + if (!\in_array($dateFormat, self::$formats, true)) { + throw new UnexpectedTypeException($dateFormat, implode('", "', self::$formats)); + } + + if (!\in_array($timeFormat, self::$formats, true)) { + throw new UnexpectedTypeException($timeFormat, implode('", "', self::$formats)); + } + + $this->dateFormat = $dateFormat; + $this->timeFormat = $timeFormat; + $this->calendar = $calendar; + $this->pattern = $pattern; + } + + /** + * Transforms a normalized date into a localized date string/array. + * + * @param \DateTimeInterface $dateTime A DateTimeInterface object + * + * @return string + * + * @throws TransformationFailedException if the given value is not a \DateTimeInterface + * or if the date could not be transformed + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); + } + + $value = $this->getIntlDateFormatter()->format($dateTime->getTimestamp()); + + if (0 != intl_get_error_code()) { + throw new TransformationFailedException(intl_get_error_message()); + } + + return $value; + } + + /** + * Transforms a localized date string/array into a normalized date. + * + * @param string|array $value Localized date string/array + * + * @return \DateTime|null + * + * @throws TransformationFailedException if the given value is not a string, + * if the date could not be parsed + */ + public function reverseTransform($value) + { + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + if ('' === $value) { + return null; + } + + // date-only patterns require parsing to be done in UTC, as midnight might not exist in the local timezone due + // to DST changes + $dateOnly = $this->isPatternDateOnly(); + $dateFormatter = $this->getIntlDateFormatter($dateOnly); + + try { + $timestamp = @$dateFormatter->parse($value); + } catch (\IntlException $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + if (0 != intl_get_error_code()) { + throw new TransformationFailedException(intl_get_error_message(), intl_get_error_code()); + } elseif ($timestamp > 253402214400) { + // This timestamp represents UTC midnight of 9999-12-31 to prevent 5+ digit years + throw new TransformationFailedException('Years beyond 9999 are not supported.'); + } elseif (false === $timestamp) { + // the value couldn't be parsed but the Intl extension didn't report an error code, this + // could be the case when the Intl polyfill is used which always returns 0 as the error code + throw new TransformationFailedException(sprintf('"%s" could not be parsed as a date.', $value)); + } + + try { + if ($dateOnly) { + // we only care about year-month-date, which has been delivered as a timestamp pointing to UTC midnight + $dateTime = new \DateTime(gmdate('Y-m-d', $timestamp), new \DateTimeZone($this->outputTimezone)); + } else { + // read timestamp into DateTime object - the formatter delivers a timestamp + $dateTime = new \DateTime(sprintf('@%s', $timestamp)); + } + // set timezone separately, as it would be ignored if set via the constructor, + // see https://php.net/datetime.construct + $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + if ($this->outputTimezone !== $this->inputTimezone) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + + return $dateTime; + } + + /** + * Returns a preconfigured IntlDateFormatter instance. + * + * @param bool $ignoreTimezone Use UTC regardless of the configured timezone + * + * @return \IntlDateFormatter + * + * @throws TransformationFailedException in case the date formatter cannot be constructed + */ + protected function getIntlDateFormatter(bool $ignoreTimezone = false) + { + $dateFormat = $this->dateFormat; + $timeFormat = $this->timeFormat; + $timezone = new \DateTimeZone($ignoreTimezone ? 'UTC' : $this->outputTimezone); + + $calendar = $this->calendar; + $pattern = $this->pattern; + + $intlDateFormatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormat, $timeFormat, $timezone, $calendar, $pattern ?? ''); + + // new \intlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/66323 + if (!$intlDateFormatter) { + throw new TransformationFailedException(intl_get_error_message(), intl_get_error_code()); + } + + $intlDateFormatter->setLenient(false); + + return $intlDateFormatter; + } + + /** + * Checks if the pattern contains only a date. + * + * @return bool + */ + protected function isPatternDateOnly() + { + if (null === $this->pattern) { + return false; + } + + // strip escaped text + $pattern = preg_replace("#'(.*?)'#", '', $this->pattern); + + // check for the absence of time-related placeholders + return 0 === preg_match('#[ahHkKmsSAzZOvVxX]#', $pattern); + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php new file mode 100644 index 0000000..e0cdbcf --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer +{ + /** + * Transforms a normalized date into a localized date. + * + * @param \DateTimeInterface $dateTime A DateTimeInterface object + * + * @return string + * + * @throws TransformationFailedException If the given value is not a \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); + } + + if ($this->inputTimezone !== $this->outputTimezone) { + if (!$dateTime instanceof \DateTimeImmutable) { + $dateTime = clone $dateTime; + } + + $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } + + return preg_replace('/\+00:00$/', 'Z', $dateTime->format('c')); + } + + /** + * Transforms a formatted string following RFC 3339 into a normalized date. + * + * @param string $rfc3339 Formatted string + * + * @return \DateTime|null + * + * @throws TransformationFailedException If the given value is not a string, + * if the value could not be transformed + */ + public function reverseTransform($rfc3339) + { + if (!\is_string($rfc3339)) { + throw new TransformationFailedException('Expected a string.'); + } + + if ('' === $rfc3339) { + return null; + } + + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { + throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339)); + } + + try { + $dateTime = new \DateTime($rfc3339); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + if ($this->inputTimezone !== $dateTime->getTimezone()->getName()) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + + if (!checkdate($matches[2], $matches[3], $matches[1])) { + throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); + } + + return $dateTime; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php new file mode 100644 index 0000000..955b465 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a date string and a DateTime object. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class DateTimeToStringTransformer extends BaseDateTimeTransformer +{ + /** + * Format used for generating strings. + * + * @var string + */ + private $generateFormat; + + /** + * Format used for parsing strings. + * + * Different than the {@link $generateFormat} because formats for parsing + * support additional characters in PHP that are not supported for + * generating strings. + * + * @var string + */ + private $parseFormat; + + /** + * Transforms a \DateTime instance to a string. + * + * @see \DateTime::format() for supported formats + * + * @param string|null $inputTimezone The name of the input timezone + * @param string|null $outputTimezone The name of the output timezone + * @param string $format The date format + */ + public function __construct(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s') + { + parent::__construct($inputTimezone, $outputTimezone); + + $this->generateFormat = $this->parseFormat = $format; + + // See https://php.net/datetime.createfromformat + // The character "|" in the format makes sure that the parts of a date + // that are *not* specified in the format are reset to the corresponding + // values from 1970-01-01 00:00:00 instead of the current time. + // Without "|" and "Y-m-d", "2010-02-03" becomes "2010-02-03 12:32:47", + // where the time corresponds to the current server time. + // With "|" and "Y-m-d", "2010-02-03" becomes "2010-02-03 00:00:00", + // which is at least deterministic and thus used here. + if (!str_contains($this->parseFormat, '|')) { + $this->parseFormat .= '|'; + } + } + + /** + * Transforms a DateTime object into a date string with the configured format + * and timezone. + * + * @param \DateTimeInterface $dateTime A DateTimeInterface object + * + * @return string + * + * @throws TransformationFailedException If the given value is not a \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); + } + + if (!$dateTime instanceof \DateTimeImmutable) { + $dateTime = clone $dateTime; + } + + $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + + return $dateTime->format($this->generateFormat); + } + + /** + * Transforms a date string in the configured timezone into a DateTime object. + * + * @param string $value A value as produced by PHP's date() function + * + * @return \DateTime|null + * + * @throws TransformationFailedException If the given value is not a string, + * or could not be transformed + */ + public function reverseTransform($value) + { + if (empty($value)) { + return null; + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + $outputTz = new \DateTimeZone($this->outputTimezone); + $dateTime = \DateTime::createFromFormat($this->parseFormat, $value, $outputTz); + + $lastErrors = \DateTime::getLastErrors(); + + if (0 < $lastErrors['warning_count'] || 0 < $lastErrors['error_count']) { + throw new TransformationFailedException(implode(', ', array_merge(array_values($lastErrors['warnings']), array_values($lastErrors['errors'])))); + } + + try { + if ($this->inputTimezone !== $this->outputTimezone) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + return $dateTime; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php new file mode 100644 index 0000000..f6c38ba --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a timestamp and a DateTime object. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class DateTimeToTimestampTransformer extends BaseDateTimeTransformer +{ + /** + * Transforms a DateTime object into a timestamp in the configured timezone. + * + * @param \DateTimeInterface $dateTime A DateTimeInterface object + * + * @return int|null + * + * @throws TransformationFailedException If the given value is not a \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return null; + } + + if (!$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTimeInterface.'); + } + + return $dateTime->getTimestamp(); + } + + /** + * Transforms a timestamp in the configured timezone into a DateTime object. + * + * @param string $value A timestamp + * + * @return \DateTime|null + * + * @throws TransformationFailedException If the given value is not a timestamp + * or if the given timestamp is invalid + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + + if (!is_numeric($value)) { + throw new TransformationFailedException('Expected a numeric.'); + } + + try { + $dateTime = new \DateTime(); + $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + $dateTime->setTimestamp($value); + + if ($this->inputTimezone !== $this->outputTimezone) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + return $dateTime; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php new file mode 100644 index 0000000..6dfccdf --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a timezone identifier string and a DateTimeZone object. + * + * @author Roland Franssen + */ +class DateTimeZoneToStringTransformer implements DataTransformerInterface +{ + private $multiple; + + public function __construct(bool $multiple = false) + { + $this->multiple = $multiple; + } + + /** + * {@inheritdoc} + */ + public function transform($dateTimeZone) + { + if (null === $dateTimeZone) { + return null; + } + + if ($this->multiple) { + if (!\is_array($dateTimeZone)) { + throw new TransformationFailedException('Expected an array of \DateTimeZone objects.'); + } + + return array_map([new self(), 'transform'], $dateTimeZone); + } + + if (!$dateTimeZone instanceof \DateTimeZone) { + throw new TransformationFailedException('Expected a \DateTimeZone object.'); + } + + return $dateTimeZone->getName(); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + + if ($this->multiple) { + if (!\is_array($value)) { + throw new TransformationFailedException('Expected an array of timezone identifier strings.'); + } + + return array_map([new self(), 'reverseTransform'], $value); + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a timezone identifier string.'); + } + + try { + return new \DateTimeZone($value); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php new file mode 100644 index 0000000..1ba9140 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between an integer and a localized number with grouping + * (each thousand) and comma separators. + * + * @author Bernhard Schussek + */ +class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransformer +{ + /** + * Constructs a transformer. + * + * @param bool $grouping Whether thousands should be grouped + * @param int $roundingMode One of the ROUND_ constants in this class + * @param string|null $locale locale used for transforming + */ + public function __construct(?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_DOWN, string $locale = null) + { + parent::__construct(0, $grouping, $roundingMode, $locale); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($value) + { + $decimalSeparator = $this->getNumberFormatter()->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); + + if (\is_string($value) && str_contains($value, $decimalSeparator)) { + throw new TransformationFailedException(sprintf('The value "%s" is not a valid integer.', $value)); + } + + $result = parent::reverseTransform($value); + + return null !== $result ? (int) $result : null; + } + + /** + * @internal + */ + protected function castParsedValue($value) + { + return $value; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php new file mode 100644 index 0000000..aa4629f --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformer.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a timezone identifier string and a IntlTimeZone object. + * + * @author Roland Franssen + */ +class IntlTimeZoneToStringTransformer implements DataTransformerInterface +{ + private $multiple; + + public function __construct(bool $multiple = false) + { + $this->multiple = $multiple; + } + + /** + * {@inheritdoc} + */ + public function transform($intlTimeZone) + { + if (null === $intlTimeZone) { + return null; + } + + if ($this->multiple) { + if (!\is_array($intlTimeZone)) { + throw new TransformationFailedException('Expected an array of \IntlTimeZone objects.'); + } + + return array_map([new self(), 'transform'], $intlTimeZone); + } + + if (!$intlTimeZone instanceof \IntlTimeZone) { + throw new TransformationFailedException('Expected a \IntlTimeZone object.'); + } + + return $intlTimeZone->getID(); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($value) + { + if (null === $value) { + return; + } + + if ($this->multiple) { + if (!\is_array($value)) { + throw new TransformationFailedException('Expected an array of timezone identifier strings.'); + } + + return array_map([new self(), 'reverseTransform'], $value); + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a timezone identifier string.'); + } + + $intlTimeZone = \IntlTimeZone::createTimeZone($value); + + if ('Etc/Unknown' === $intlTimeZone->getID()) { + throw new TransformationFailedException(sprintf('Unknown timezone identifier "%s".', $value)); + } + + return $intlTimeZone; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php new file mode 100644 index 0000000..9784fe6 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a normalized format and a localized money string. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransformer +{ + private $divisor; + + public function __construct(?int $scale = 2, ?bool $grouping = true, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, ?int $divisor = 1, string $locale = null) + { + parent::__construct($scale ?? 2, $grouping ?? true, $roundingMode, $locale); + + $this->divisor = $divisor ?? 1; + } + + /** + * Transforms a normalized format into a localized money string. + * + * @param int|float|null $value Normalized number + * + * @return string + * + * @throws TransformationFailedException if the given value is not numeric or + * if the value cannot be transformed + */ + public function transform($value) + { + if (null !== $value && 1 !== $this->divisor) { + if (!is_numeric($value)) { + throw new TransformationFailedException('Expected a numeric.'); + } + $value /= $this->divisor; + } + + return parent::transform($value); + } + + /** + * Transforms a localized money string into a normalized format. + * + * @param string $value Localized money string + * + * @return int|float|null + * + * @throws TransformationFailedException if the given value is not a string + * or if the value cannot be transformed + */ + public function reverseTransform($value) + { + $value = parent::reverseTransform($value); + if (null !== $value && 1 !== $this->divisor) { + $value = (float) (string) ($value * $this->divisor); + } + + return $value; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php new file mode 100644 index 0000000..53e564b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -0,0 +1,265 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between a number type and a localized number with grouping + * (each thousand) and comma separators. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class NumberToLocalizedStringTransformer implements DataTransformerInterface +{ + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_CEILING instead. + */ + public const ROUND_CEILING = \NumberFormatter::ROUND_CEILING; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_FLOOR instead. + */ + public const ROUND_FLOOR = \NumberFormatter::ROUND_FLOOR; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_UP instead. + */ + public const ROUND_UP = \NumberFormatter::ROUND_UP; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_DOWN instead. + */ + public const ROUND_DOWN = \NumberFormatter::ROUND_DOWN; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFEVEN instead. + */ + public const ROUND_HALF_EVEN = \NumberFormatter::ROUND_HALFEVEN; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFUP instead. + */ + public const ROUND_HALF_UP = \NumberFormatter::ROUND_HALFUP; + + /** + * @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFDOWN instead. + */ + public const ROUND_HALF_DOWN = \NumberFormatter::ROUND_HALFDOWN; + + protected $grouping; + + protected $roundingMode; + + private $scale; + private $locale; + + public function __construct(int $scale = null, ?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, string $locale = null) + { + $this->scale = $scale; + $this->grouping = $grouping ?? false; + $this->roundingMode = $roundingMode ?? \NumberFormatter::ROUND_HALFUP; + $this->locale = $locale; + } + + /** + * Transforms a number type into localized number. + * + * @param int|float|null $value Number value + * + * @return string + * + * @throws TransformationFailedException if the given value is not numeric + * or if the value cannot be transformed + */ + public function transform($value) + { + if (null === $value) { + return ''; + } + + if (!is_numeric($value)) { + throw new TransformationFailedException('Expected a numeric.'); + } + + $formatter = $this->getNumberFormatter(); + $value = $formatter->format($value); + + if (intl_is_failure($formatter->getErrorCode())) { + throw new TransformationFailedException($formatter->getErrorMessage()); + } + + // Convert non-breaking and narrow non-breaking spaces to normal ones + $value = str_replace(["\xc2\xa0", "\xe2\x80\xaf"], ' ', $value); + + return $value; + } + + /** + * Transforms a localized number into an integer or float. + * + * @param string $value The localized value + * + * @return int|float|null + * + * @throws TransformationFailedException if the given value is not a string + * or if the value cannot be transformed + */ + public function reverseTransform($value) + { + if (null !== $value && !\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + if (null === $value || '' === $value) { + return null; + } + + if (\in_array($value, ['NaN', 'NAN', 'nan'], true)) { + throw new TransformationFailedException('"NaN" is not a valid number.'); + } + + $position = 0; + $formatter = $this->getNumberFormatter(); + $groupSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); + $decSep = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); + + if ('.' !== $decSep && (!$this->grouping || '.' !== $groupSep)) { + $value = str_replace('.', $decSep, $value); + } + + if (',' !== $decSep && (!$this->grouping || ',' !== $groupSep)) { + $value = str_replace(',', $decSep, $value); + } + + if (str_contains($value, $decSep)) { + $type = \NumberFormatter::TYPE_DOUBLE; + } else { + $type = \PHP_INT_SIZE === 8 + ? \NumberFormatter::TYPE_INT64 + : \NumberFormatter::TYPE_INT32; + } + + $result = $formatter->parse($value, $type, $position); + + if (intl_is_failure($formatter->getErrorCode())) { + throw new TransformationFailedException($formatter->getErrorMessage()); + } + + if ($result >= \PHP_INT_MAX || $result <= -\PHP_INT_MAX) { + throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.'); + } + + $result = $this->castParsedValue($result); + + if (false !== $encoding = mb_detect_encoding($value, null, true)) { + $length = mb_strlen($value, $encoding); + $remainder = mb_substr($value, $position, $length, $encoding); + } else { + $length = \strlen($value); + $remainder = substr($value, $position, $length); + } + + // After parsing, position holds the index of the character where the + // parsing stopped + if ($position < $length) { + // Check if there are unrecognized characters at the end of the + // number (excluding whitespace characters) + $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); + + if ('' !== $remainder) { + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder)); + } + } + + // NumberFormatter::parse() does not round + return $this->round($result); + } + + /** + * Returns a preconfigured \NumberFormatter instance. + * + * @return \NumberFormatter + */ + protected function getNumberFormatter() + { + $formatter = new \NumberFormatter($this->locale ?? \Locale::getDefault(), \NumberFormatter::DECIMAL); + + if (null !== $this->scale) { + $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->scale); + $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode); + } + + $formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping); + + return $formatter; + } + + /** + * @internal + */ + protected function castParsedValue($value) + { + if (\is_int($value) && $value === (int) $float = (float) $value) { + return $float; + } + + return $value; + } + + /** + * Rounds a number according to the configured scale and rounding mode. + * + * @param int|float $number A number + * + * @return int|float + */ + private function round($number) + { + if (null !== $this->scale && null !== $this->roundingMode) { + // shift number to maintain the correct scale during rounding + $roundingCoef = 10 ** $this->scale; + // string representation to avoid rounding errors, similar to bcmul() + $number = (string) ($number * $roundingCoef); + + switch ($this->roundingMode) { + case \NumberFormatter::ROUND_CEILING: + $number = ceil($number); + break; + case \NumberFormatter::ROUND_FLOOR: + $number = floor($number); + break; + case \NumberFormatter::ROUND_UP: + $number = $number > 0 ? ceil($number) : floor($number); + break; + case \NumberFormatter::ROUND_DOWN: + $number = $number > 0 ? floor($number) : ceil($number); + break; + case \NumberFormatter::ROUND_HALFEVEN: + $number = round($number, 0, \PHP_ROUND_HALF_EVEN); + break; + case \NumberFormatter::ROUND_HALFUP: + $number = round($number, 0, \PHP_ROUND_HALF_UP); + break; + case \NumberFormatter::ROUND_HALFDOWN: + $number = round($number, 0, \PHP_ROUND_HALF_DOWN); + break; + } + + $number = 1 === $roundingCoef ? (int) $number : $number / $roundingCoef; + } + + return $number; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php new file mode 100644 index 0000000..5b97f01 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -0,0 +1,249 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * Transforms between a normalized format (integer or float) and a percentage value. + * + * @author Bernhard Schussek + * @author Florian Eckerstorfer + */ +class PercentToLocalizedStringTransformer implements DataTransformerInterface +{ + public const FRACTIONAL = 'fractional'; + public const INTEGER = 'integer'; + + protected static $types = [ + self::FRACTIONAL, + self::INTEGER, + ]; + + private $roundingMode; + private $type; + private $scale; + private $html5Format; + + /** + * @see self::$types for a list of supported types + * + * @param int|null $roundingMode A value from \NumberFormatter, such as \NumberFormatter::ROUND_HALFUP + * @param bool $html5Format Use an HTML5 specific format, see https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats + * + * @throws UnexpectedTypeException if the given value of type is unknown + */ + public function __construct(int $scale = null, string $type = null, int $roundingMode = null, bool $html5Format = false) + { + if (null === $type) { + $type = self::FRACTIONAL; + } + + if (null === $roundingMode && (\func_num_args() < 4 || func_get_arg(3))) { + trigger_deprecation('symfony/form', '5.1', 'Not passing a rounding mode to "%s()" is deprecated. Starting with Symfony 6.0 it will default to "\NumberFormatter::ROUND_HALFUP".', __METHOD__); + } + + if (!\in_array($type, self::$types, true)) { + throw new UnexpectedTypeException($type, implode('", "', self::$types)); + } + + $this->type = $type; + $this->scale = $scale ?? 0; + $this->roundingMode = $roundingMode; + $this->html5Format = $html5Format; + } + + /** + * Transforms between a normalized format (integer or float) into a percentage value. + * + * @param int|float $value Normalized value + * + * @return string + * + * @throws TransformationFailedException if the given value is not numeric or + * if the value could not be transformed + */ + public function transform($value) + { + if (null === $value) { + return ''; + } + + if (!is_numeric($value)) { + throw new TransformationFailedException('Expected a numeric.'); + } + + if (self::FRACTIONAL == $this->type) { + $value *= 100; + } + + $formatter = $this->getNumberFormatter(); + $value = $formatter->format($value); + + if (intl_is_failure($formatter->getErrorCode())) { + throw new TransformationFailedException($formatter->getErrorMessage()); + } + + // replace the UTF-8 non break spaces + return $value; + } + + /** + * Transforms between a percentage value into a normalized format (integer or float). + * + * @param string $value Percentage value + * + * @return int|float|null + * + * @throws TransformationFailedException if the given value is not a string or + * if the value could not be transformed + */ + public function reverseTransform($value) + { + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + if ('' === $value) { + return null; + } + + $position = 0; + $formatter = $this->getNumberFormatter(); + $groupSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); + $decSep = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); + $grouping = $formatter->getAttribute(\NumberFormatter::GROUPING_USED); + + if ('.' !== $decSep && (!$grouping || '.' !== $groupSep)) { + $value = str_replace('.', $decSep, $value); + } + + if (',' !== $decSep && (!$grouping || ',' !== $groupSep)) { + $value = str_replace(',', $decSep, $value); + } + + if (str_contains($value, $decSep)) { + $type = \NumberFormatter::TYPE_DOUBLE; + } else { + $type = \PHP_INT_SIZE === 8 ? \NumberFormatter::TYPE_INT64 : \NumberFormatter::TYPE_INT32; + } + + // replace normal spaces so that the formatter can read them + $result = $formatter->parse(str_replace(' ', "\xc2\xa0", $value), $type, $position); + + if (intl_is_failure($formatter->getErrorCode())) { + throw new TransformationFailedException($formatter->getErrorMessage()); + } + + if (self::FRACTIONAL == $this->type) { + $result /= 100; + } + + if (\function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($value, null, true)) { + $length = mb_strlen($value, $encoding); + $remainder = mb_substr($value, $position, $length, $encoding); + } else { + $length = \strlen($value); + $remainder = substr($value, $position, $length); + } + + // After parsing, position holds the index of the character where the + // parsing stopped + if ($position < $length) { + // Check if there are unrecognized characters at the end of the + // number (excluding whitespace characters) + $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); + + if ('' !== $remainder) { + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s".', $remainder)); + } + } + + return $this->round($result); + } + + /** + * Returns a preconfigured \NumberFormatter instance. + * + * @return \NumberFormatter + */ + protected function getNumberFormatter() + { + // Values used in HTML5 number inputs should be formatted as in "1234.5", ie. 'en' format without grouping, + // according to https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats + $formatter = new \NumberFormatter($this->html5Format ? 'en' : \Locale::getDefault(), \NumberFormatter::DECIMAL); + + if ($this->html5Format) { + $formatter->setAttribute(\NumberFormatter::GROUPING_USED, 0); + } + + $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->scale); + + if (null !== $this->roundingMode) { + $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode); + } + + return $formatter; + } + + /** + * Rounds a number according to the configured scale and rounding mode. + * + * @param int|float $number A number + * + * @return int|float + */ + private function round($number) + { + if (null !== $this->scale && null !== $this->roundingMode) { + // shift number to maintain the correct scale during rounding + $roundingCoef = 10 ** $this->scale; + + if (self::FRACTIONAL == $this->type) { + $roundingCoef *= 100; + } + + // string representation to avoid rounding errors, similar to bcmul() + $number = (string) ($number * $roundingCoef); + + switch ($this->roundingMode) { + case \NumberFormatter::ROUND_CEILING: + $number = ceil($number); + break; + case \NumberFormatter::ROUND_FLOOR: + $number = floor($number); + break; + case \NumberFormatter::ROUND_UP: + $number = $number > 0 ? ceil($number) : floor($number); + break; + case \NumberFormatter::ROUND_DOWN: + $number = $number > 0 ? floor($number) : ceil($number); + break; + case \NumberFormatter::ROUND_HALFEVEN: + $number = round($number, 0, \PHP_ROUND_HALF_EVEN); + break; + case \NumberFormatter::ROUND_HALFUP: + $number = round($number, 0, \PHP_ROUND_HALF_UP); + break; + case \NumberFormatter::ROUND_HALFDOWN: + $number = round($number, 0, \PHP_ROUND_HALF_DOWN); + break; + } + + $number = 1 === $roundingCoef ? (int) $number : $number / $roundingCoef; + } + + return $number; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/StringToFloatTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/StringToFloatTransformer.php new file mode 100644 index 0000000..27e60b4 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/StringToFloatTransformer.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +class StringToFloatTransformer implements DataTransformerInterface +{ + private $scale; + + public function __construct(int $scale = null) + { + $this->scale = $scale; + } + + /** + * @param mixed $value + * + * @return float|null + */ + public function transform($value) + { + if (null === $value) { + return null; + } + + if (!\is_string($value) || !is_numeric($value)) { + throw new TransformationFailedException('Expected a numeric string.'); + } + + return (float) $value; + } + + /** + * @param mixed $value + * + * @return string|null + */ + public function reverseTransform($value) + { + if (null === $value) { + return null; + } + + if (!\is_int($value) && !\is_float($value)) { + throw new TransformationFailedException('Expected a numeric.'); + } + + if ($this->scale > 0) { + return number_format((float) $value, $this->scale, '.', ''); + } + + return (string) $value; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/UlidToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/UlidToStringTransformer.php new file mode 100644 index 0000000..33b57db --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/UlidToStringTransformer.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Uid\Ulid; + +/** + * Transforms between a ULID string and a Ulid object. + * + * @author Pavel Dyakonov + */ +class UlidToStringTransformer implements DataTransformerInterface +{ + /** + * Transforms a Ulid object into a string. + * + * @param Ulid $value A Ulid object + * + * @return string|null + * + * @throws TransformationFailedException If the given value is not a Ulid object + */ + public function transform($value) + { + if (null === $value) { + return null; + } + + if (!$value instanceof Ulid) { + throw new TransformationFailedException('Expected a Ulid.'); + } + + return (string) $value; + } + + /** + * Transforms a ULID string into a Ulid object. + * + * @param string $value A ULID string + * + * @return Ulid|null + * + * @throws TransformationFailedException If the given value is not a string, + * or could not be transformed + */ + public function reverseTransform($value) + { + if (null === $value || '' === $value) { + return null; + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + try { + $ulid = new Ulid($value); + } catch (\InvalidArgumentException $e) { + throw new TransformationFailedException(sprintf('The value "%s" is not a valid ULID.', $value), $e->getCode(), $e); + } + + return $ulid; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/UuidToStringTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/UuidToStringTransformer.php new file mode 100644 index 0000000..1ccf04b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/UuidToStringTransformer.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Uid\Uuid; + +/** + * Transforms between a UUID string and a Uuid object. + * + * @author Pavel Dyakonov + */ +class UuidToStringTransformer implements DataTransformerInterface +{ + /** + * Transforms a Uuid object into a string. + * + * @param Uuid $value A Uuid object + * + * @return string|null + * + * @throws TransformationFailedException If the given value is not a Uuid object + */ + public function transform($value) + { + if (null === $value) { + return null; + } + + if (!$value instanceof Uuid) { + throw new TransformationFailedException('Expected a Uuid.'); + } + + return (string) $value; + } + + /** + * Transforms a UUID string into a Uuid object. + * + * @param string $value A UUID string + * + * @return Uuid|null + * + * @throws TransformationFailedException If the given value is not a string, + * or could not be transformed + */ + public function reverseTransform($value) + { + if (null === $value || '' === $value) { + return null; + } + + if (!\is_string($value)) { + throw new TransformationFailedException('Expected a string.'); + } + + try { + $uuid = new Uuid($value); + } catch (\InvalidArgumentException $e) { + throw new TransformationFailedException(sprintf('The value "%s" is not a valid UUID.', $value), $e->getCode(), $e); + } + + return $uuid; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php new file mode 100644 index 0000000..5249e3b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class ValueToDuplicatesTransformer implements DataTransformerInterface +{ + private $keys; + + public function __construct(array $keys) + { + $this->keys = $keys; + } + + /** + * Duplicates the given value through the array. + * + * @param mixed $value The value + * + * @return array + */ + public function transform($value) + { + $result = []; + + foreach ($this->keys as $key) { + $result[$key] = $value; + } + + return $result; + } + + /** + * Extracts the duplicated value from an array. + * + * @return mixed + * + * @throws TransformationFailedException if the given value is not an array or + * if the given array cannot be transformed + */ + public function reverseTransform($array) + { + if (!\is_array($array)) { + throw new TransformationFailedException('Expected an array.'); + } + + $result = current($array); + $emptyKeys = []; + + foreach ($this->keys as $key) { + if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && [] !== $array[$key]) { + if ($array[$key] !== $result) { + throw new TransformationFailedException('All values in the array should be the same.'); + } + } else { + $emptyKeys[] = $key; + } + } + + if (\count($emptyKeys) > 0) { + if (\count($emptyKeys) == \count($this->keys)) { + // All keys empty + return null; + } + + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty.', implode('", "', $emptyKeys))); + } + + return $result; + } +} diff --git a/vendor/symfony/form/Extension/Core/DataTransformer/WeekToArrayTransformer.php b/vendor/symfony/form/Extension/Core/DataTransformer/WeekToArrayTransformer.php new file mode 100644 index 0000000..d7349bb --- /dev/null +++ b/vendor/symfony/form/Extension/Core/DataTransformer/WeekToArrayTransformer.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * Transforms between an ISO 8601 week date string and an array. + * + * @author Damien Fayet + */ +class WeekToArrayTransformer implements DataTransformerInterface +{ + /** + * Transforms a string containing an ISO 8601 week date into an array. + * + * @param string|null $value A week date string + * + * @return array{year: int|null, week: int|null} + * + * @throws TransformationFailedException If the given value is not a string, + * or if the given value does not follow the right format + */ + public function transform($value) + { + if (null === $value) { + return ['year' => null, 'week' => null]; + } + + if (!\is_string($value)) { + throw new TransformationFailedException(sprintf('Value is expected to be a string but was "%s".', get_debug_type($value))); + } + + if (0 === preg_match('/^(?P\d{4})-W(?P\d{2})$/', $value, $matches)) { + throw new TransformationFailedException('Given data does not follow the date format "Y-\WW".'); + } + + return [ + 'year' => (int) $matches['year'], + 'week' => (int) $matches['week'], + ]; + } + + /** + * Transforms an array into a week date string. + * + * @param array{year: int|null, week: int|null} $value + * + * @return string|null A week date string following the format Y-\WW + * + * @throws TransformationFailedException If the given value cannot be merged in a valid week date string, + * or if the obtained week date does not exists + */ + public function reverseTransform($value) + { + if (null === $value || [] === $value) { + return null; + } + + if (!\is_array($value)) { + throw new TransformationFailedException(sprintf('Value is expected to be an array, but was "%s".', get_debug_type($value))); + } + + if (!\array_key_exists('year', $value)) { + throw new TransformationFailedException('Key "year" is missing.'); + } + + if (!\array_key_exists('week', $value)) { + throw new TransformationFailedException('Key "week" is missing.'); + } + + if ($additionalKeys = array_diff(array_keys($value), ['year', 'week'])) { + throw new TransformationFailedException(sprintf('Expected only keys "year" and "week" to be present, but also got ["%s"].', implode('", "', $additionalKeys))); + } + + if (null === $value['year'] && null === $value['week']) { + return null; + } + + if (!\is_int($value['year'])) { + throw new TransformationFailedException(sprintf('Year is expected to be an integer, but was "%s".', get_debug_type($value['year']))); + } + + if (!\is_int($value['week'])) { + throw new TransformationFailedException(sprintf('Week is expected to be an integer, but was "%s".', get_debug_type($value['week']))); + } + + // The 28th December is always in the last week of the year + if (date('W', strtotime('28th December '.$value['year'])) < $value['week']) { + throw new TransformationFailedException(sprintf('Week "%d" does not exist for year "%d".', $value['week'], $value['year'])); + } + + return sprintf('%d-W%02d', $value['year'], $value['week']); + } +} diff --git a/vendor/symfony/form/Extension/Core/EventListener/FixUrlProtocolListener.php b/vendor/symfony/form/Extension/Core/EventListener/FixUrlProtocolListener.php new file mode 100644 index 0000000..c497212 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/EventListener/FixUrlProtocolListener.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; + +/** + * Adds a protocol to a URL if it doesn't already have one. + * + * @author Bernhard Schussek + */ +class FixUrlProtocolListener implements EventSubscriberInterface +{ + private $defaultProtocol; + + /** + * @param string|null $defaultProtocol The URL scheme to add when there is none or null to not modify the data + */ + public function __construct(?string $defaultProtocol = 'http') + { + $this->defaultProtocol = $defaultProtocol; + } + + public function onSubmit(FormEvent $event) + { + $data = $event->getData(); + + if ($this->defaultProtocol && $data && \is_string($data) && !preg_match('~^(?:[/.]|[\w+.-]+://|[^:/?@#]++@)~', $data)) { + $event->setData($this->defaultProtocol.'://'.$data); + } + } + + public static function getSubscribedEvents() + { + return [FormEvents::SUBMIT => 'onSubmit']; + } +} diff --git a/vendor/symfony/form/Extension/Core/EventListener/MergeCollectionListener.php b/vendor/symfony/form/Extension/Core/EventListener/MergeCollectionListener.php new file mode 100644 index 0000000..cd4a3b5 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/EventListener/MergeCollectionListener.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; + +/** + * @author Bernhard Schussek + */ +class MergeCollectionListener implements EventSubscriberInterface +{ + private $allowAdd; + private $allowDelete; + + /** + * @param bool $allowAdd Whether values might be added to the collection + * @param bool $allowDelete Whether values might be removed from the collection + */ + public function __construct(bool $allowAdd = false, bool $allowDelete = false) + { + $this->allowAdd = $allowAdd; + $this->allowDelete = $allowDelete; + } + + public static function getSubscribedEvents() + { + return [ + FormEvents::SUBMIT => 'onSubmit', + ]; + } + + public function onSubmit(FormEvent $event) + { + $dataToMergeInto = $event->getForm()->getNormData(); + $data = $event->getData(); + + if (null === $data) { + $data = []; + } + + if (!\is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { + throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)'); + } + + if (null !== $dataToMergeInto && !\is_array($dataToMergeInto) && !($dataToMergeInto instanceof \Traversable && $dataToMergeInto instanceof \ArrayAccess)) { + throw new UnexpectedTypeException($dataToMergeInto, 'array or (\Traversable and \ArrayAccess)'); + } + + // If we are not allowed to change anything, return immediately + if ($data === $dataToMergeInto || (!$this->allowAdd && !$this->allowDelete)) { + $event->setData($dataToMergeInto); + + return; + } + + if (null === $dataToMergeInto) { + // No original data was set. Set it if allowed + if ($this->allowAdd) { + $dataToMergeInto = $data; + } + } else { + // Calculate delta + $itemsToAdd = \is_object($data) ? clone $data : $data; + $itemsToDelete = []; + + foreach ($dataToMergeInto as $beforeKey => $beforeItem) { + foreach ($data as $afterKey => $afterItem) { + if ($afterItem === $beforeItem) { + // Item found, next original item + unset($itemsToAdd[$afterKey]); + continue 2; + } + } + + // Item not found, remember for deletion + $itemsToDelete[] = $beforeKey; + } + + // Remove deleted items before adding to free keys that are to be + // replaced + if ($this->allowDelete) { + foreach ($itemsToDelete as $key) { + unset($dataToMergeInto[$key]); + } + } + + // Add remaining items + if ($this->allowAdd) { + foreach ($itemsToAdd as $key => $item) { + if (!isset($dataToMergeInto[$key])) { + $dataToMergeInto[$key] = $item; + } else { + $dataToMergeInto[] = $item; + } + } + } + } + + $event->setData($dataToMergeInto); + } +} diff --git a/vendor/symfony/form/Extension/Core/EventListener/ResizeFormListener.php b/vendor/symfony/form/Extension/Core/EventListener/ResizeFormListener.php new file mode 100644 index 0000000..813456b --- /dev/null +++ b/vendor/symfony/form/Extension/Core/EventListener/ResizeFormListener.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormInterface; + +/** + * Resize a collection form element based on the data sent from the client. + * + * @author Bernhard Schussek + */ +class ResizeFormListener implements EventSubscriberInterface +{ + protected $type; + protected $options; + protected $allowAdd; + protected $allowDelete; + + private $deleteEmpty; + + /** + * @param bool $allowAdd Whether children could be added to the group + * @param bool $allowDelete Whether children could be removed from the group + * @param bool|callable $deleteEmpty + */ + public function __construct(string $type, array $options = [], bool $allowAdd = false, bool $allowDelete = false, $deleteEmpty = false) + { + $this->type = $type; + $this->allowAdd = $allowAdd; + $this->allowDelete = $allowDelete; + $this->options = $options; + $this->deleteEmpty = $deleteEmpty; + } + + public static function getSubscribedEvents() + { + return [ + FormEvents::PRE_SET_DATA => 'preSetData', + FormEvents::PRE_SUBMIT => 'preSubmit', + // (MergeCollectionListener, MergeDoctrineCollectionListener) + FormEvents::SUBMIT => ['onSubmit', 50], + ]; + } + + public function preSetData(FormEvent $event) + { + $form = $event->getForm(); + $data = $event->getData(); + + if (null === $data) { + $data = []; + } + + if (!\is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { + throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)'); + } + + // First remove all rows + foreach ($form as $name => $child) { + $form->remove($name); + } + + // Then add all rows again in the correct order + foreach ($data as $name => $value) { + $form->add($name, $this->type, array_replace([ + 'property_path' => '['.$name.']', + ], $this->options)); + } + } + + public function preSubmit(FormEvent $event) + { + $form = $event->getForm(); + $data = $event->getData(); + + if (!\is_array($data)) { + $data = []; + } + + // Remove all empty rows + if ($this->allowDelete) { + foreach ($form as $name => $child) { + if (!isset($data[$name])) { + $form->remove($name); + } + } + } + + // Add all additional rows + if ($this->allowAdd) { + foreach ($data as $name => $value) { + if (!$form->has($name)) { + $form->add($name, $this->type, array_replace([ + 'property_path' => '['.$name.']', + ], $this->options)); + } + } + } + } + + public function onSubmit(FormEvent $event) + { + $form = $event->getForm(); + $data = $event->getData(); + + // At this point, $data is an array or an array-like object that already contains the + // new entries, which were added by the data mapper. The data mapper ignores existing + // entries, so we need to manually unset removed entries in the collection. + + if (null === $data) { + $data = []; + } + + if (!\is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { + throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)'); + } + + if ($this->deleteEmpty) { + $previousData = $form->getData(); + /** @var FormInterface $child */ + foreach ($form as $name => $child) { + if (!$child->isValid() || !$child->isSynchronized()) { + continue; + } + + $isNew = !isset($previousData[$name]); + $isEmpty = \is_callable($this->deleteEmpty) ? ($this->deleteEmpty)($child->getData()) : $child->isEmpty(); + + // $isNew can only be true if allowAdd is true, so we don't + // need to check allowAdd again + if ($isEmpty && ($isNew || $this->allowDelete)) { + unset($data[$name]); + $form->remove($name); + } + } + } + + // The data mapper only adds, but does not remove items, so do this + // here + if ($this->allowDelete) { + $toDelete = []; + + foreach ($data as $name => $child) { + if (!$form->has($name)) { + $toDelete[] = $name; + } + } + + foreach ($toDelete as $name) { + unset($data[$name]); + } + } + + $event->setData($data); + } +} diff --git a/vendor/symfony/form/Extension/Core/EventListener/TransformationFailureListener.php b/vendor/symfony/form/Extension/Core/EventListener/TransformationFailureListener.php new file mode 100644 index 0000000..dd2a2f2 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/EventListener/TransformationFailureListener.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Christian Flothmann + */ +class TransformationFailureListener implements EventSubscriberInterface +{ + private $translator; + + public function __construct(TranslatorInterface $translator = null) + { + $this->translator = $translator; + } + + public static function getSubscribedEvents() + { + return [ + FormEvents::POST_SUBMIT => ['convertTransformationFailureToFormError', -1024], + ]; + } + + public function convertTransformationFailureToFormError(FormEvent $event) + { + $form = $event->getForm(); + + if (null === $form->getTransformationFailure() || !$form->isValid()) { + return; + } + + foreach ($form as $child) { + if (!$child->isSynchronized()) { + return; + } + } + + $clientDataAsString = is_scalar($form->getViewData()) ? (string) $form->getViewData() : get_debug_type($form->getViewData()); + $messageTemplate = $form->getConfig()->getOption('invalid_message', 'The value {{ value }} is not valid.'); + $messageParameters = array_replace(['{{ value }}' => $clientDataAsString], $form->getConfig()->getOption('invalid_message_parameters', [])); + + if (null !== $this->translator) { + $message = $this->translator->trans($messageTemplate, $messageParameters); + } else { + $message = strtr($messageTemplate, $messageParameters); + } + + $form->addError(new FormError($message, $messageTemplate, $messageParameters, null, $form->getTransformationFailure())); + } +} diff --git a/vendor/symfony/form/Extension/Core/EventListener/TrimListener.php b/vendor/symfony/form/Extension/Core/EventListener/TrimListener.php new file mode 100644 index 0000000..be8c38a --- /dev/null +++ b/vendor/symfony/form/Extension/Core/EventListener/TrimListener.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\Util\StringUtil; + +/** + * Trims string data. + * + * @author Bernhard Schussek + */ +class TrimListener implements EventSubscriberInterface +{ + public function preSubmit(FormEvent $event) + { + $data = $event->getData(); + + if (!\is_string($data)) { + return; + } + + $event->setData(StringUtil::trim($data)); + } + + public static function getSubscribedEvents() + { + return [FormEvents::PRE_SUBMIT => 'preSubmit']; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/BaseType.php b/vendor/symfony/form/Extension/Core/Type/BaseType.php new file mode 100644 index 0000000..4ac58bd --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/BaseType.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractRendererEngine; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * Encapsulates common logic of {@link FormType} and {@link ButtonType}. + * + * This type does not appear in the form's type inheritance chain and as such + * cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed. + * + * @author Bernhard Schussek + */ +abstract class BaseType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->setDisabled($options['disabled']); + $builder->setAutoInitialize($options['auto_initialize']); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $name = $form->getName(); + $blockName = $options['block_name'] ?: $form->getName(); + $translationDomain = $options['translation_domain']; + $labelTranslationParameters = $options['label_translation_parameters']; + $attrTranslationParameters = $options['attr_translation_parameters']; + $labelFormat = $options['label_format']; + + if ($view->parent) { + if ('' !== ($parentFullName = $view->parent->vars['full_name'])) { + $id = sprintf('%s_%s', $view->parent->vars['id'], $name); + $fullName = sprintf('%s[%s]', $parentFullName, $name); + $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName); + } else { + $id = $name; + $fullName = $name; + $uniqueBlockPrefix = '_'.$blockName; + } + + if (null === $translationDomain) { + $translationDomain = $view->parent->vars['translation_domain']; + } + + $labelTranslationParameters = array_merge($view->parent->vars['label_translation_parameters'], $labelTranslationParameters); + $attrTranslationParameters = array_merge($view->parent->vars['attr_translation_parameters'], $attrTranslationParameters); + + if (!$labelFormat) { + $labelFormat = $view->parent->vars['label_format']; + } + } else { + $id = $name; + $fullName = $name; + $uniqueBlockPrefix = '_'.$blockName; + + // Strip leading underscores and digits. These are allowed in + // form names, but not in HTML4 ID attributes. + // https://www.w3.org/TR/html401/struct/global#adef-id + $id = ltrim($id, '_0123456789'); + } + + $blockPrefixes = []; + for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) { + array_unshift($blockPrefixes, $type->getBlockPrefix()); + } + if (null !== $options['block_prefix']) { + $blockPrefixes[] = $options['block_prefix']; + } + $blockPrefixes[] = $uniqueBlockPrefix; + + $view->vars = array_replace($view->vars, [ + 'form' => $view, + 'id' => $id, + 'name' => $name, + 'full_name' => $fullName, + 'disabled' => $form->isDisabled(), + 'label' => $options['label'], + 'label_format' => $labelFormat, + 'label_html' => $options['label_html'], + 'multipart' => false, + 'attr' => $options['attr'], + 'block_prefixes' => $blockPrefixes, + 'unique_block_prefix' => $uniqueBlockPrefix, + 'row_attr' => $options['row_attr'], + 'translation_domain' => $translationDomain, + 'label_translation_parameters' => $labelTranslationParameters, + 'attr_translation_parameters' => $attrTranslationParameters, + 'priority' => $options['priority'], + // Using the block name here speeds up performance in collection + // forms, where each entry has the same full block name. + // Including the type is important too, because if rows of a + // collection form have different types (dynamically), they should + // be rendered differently. + // https://github.com/symfony/symfony/issues/5038 + AbstractRendererEngine::CACHE_KEY_VAR => $uniqueBlockPrefix.'_'.$form->getConfig()->getType()->getBlockPrefix(), + ]); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'block_name' => null, + 'block_prefix' => null, + 'disabled' => false, + 'label' => null, + 'label_format' => null, + 'row_attr' => [], + 'label_html' => false, + 'label_translation_parameters' => [], + 'attr_translation_parameters' => [], + 'attr' => [], + 'translation_domain' => null, + 'auto_initialize' => true, + 'priority' => 0, + ]); + + $resolver->setAllowedTypes('block_prefix', ['null', 'string']); + $resolver->setAllowedTypes('attr', 'array'); + $resolver->setAllowedTypes('row_attr', 'array'); + $resolver->setAllowedTypes('label_html', 'bool'); + $resolver->setAllowedTypes('priority', 'int'); + + $resolver->setInfo('priority', 'The form rendering priority (higher priorities will be rendered first)'); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/BirthdayType.php b/vendor/symfony/form/Extension/Core/Type/BirthdayType.php new file mode 100644 index 0000000..50d8b1e --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/BirthdayType.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class BirthdayType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'years' => range((int) date('Y') - 120, date('Y')), + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid birthdate.'; + }, + ]); + + $resolver->setAllowedTypes('years', 'array'); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return DateType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'birthday'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/ButtonType.php b/vendor/symfony/form/Extension/Core/Type/ButtonType.php new file mode 100644 index 0000000..ba2f8df --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/ButtonType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\ButtonTypeInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A form button. + * + * @author Bernhard Schussek + */ +class ButtonType extends BaseType implements ButtonTypeInterface +{ + /** + * {@inheritdoc} + */ + public function getParent() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'button'; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + parent::configureOptions($resolver); + + $resolver->setDefault('auto_initialize', false); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/CheckboxType.php b/vendor/symfony/form/Extension/Core/Type/CheckboxType.php new file mode 100644 index 0000000..6de35b9 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/CheckboxType.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class CheckboxType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + // Unlike in other types, where the data is NULL by default, it + // needs to be a Boolean here. setData(null) is not acceptable + // for checkboxes and radio buttons (unless a custom model + // transformer handles this case). + // We cannot solve this case via overriding the "data" option, because + // doing so also calls setDataLocked(true). + $builder->setData($options['data'] ?? false); + $builder->addViewTransformer(new BooleanToStringTransformer($options['value'], $options['false_values'])); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars = array_replace($view->vars, [ + 'value' => $options['value'], + 'checked' => null !== $form->getViewData(), + ]); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $emptyData = function (FormInterface $form, $viewData) { + return $viewData; + }; + + $resolver->setDefaults([ + 'value' => '1', + 'empty_data' => $emptyData, + 'compound' => false, + 'false_values' => [null], + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The checkbox has an invalid value.'; + }, + 'is_empty_callback' => static function ($modelData): bool { + return false === $modelData; + }, + ]); + + $resolver->setAllowedTypes('false_values', 'array'); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'checkbox'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/ChoiceType.php b/vendor/symfony/form/Extension/Core/Type/ChoiceType.php new file mode 100644 index 0000000..6b8757c --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/ChoiceType.php @@ -0,0 +1,501 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceAttr; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFieldName; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceFilter; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceLabel; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceLoader; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceTranslationParameters; +use Symfony\Component\Form\ChoiceList\Factory\Cache\ChoiceValue; +use Symfony\Component\Form\ChoiceList\Factory\Cache\GroupBy; +use Symfony\Component\Form\ChoiceList\Factory\Cache\PreferredChoice; +use Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator; +use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; +use Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory; +use Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator; +use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; +use Symfony\Component\Form\ChoiceList\View\ChoiceView; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Extension\Core\DataMapper\CheckboxListMapper; +use Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper; +use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer; +use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Contracts\Translation\TranslatorInterface; + +class ChoiceType extends AbstractType +{ + private $choiceListFactory; + private $translator; + + /** + * @param TranslatorInterface $translator + */ + public function __construct(ChoiceListFactoryInterface $choiceListFactory = null, $translator = null) + { + $this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator( + new PropertyAccessDecorator( + new DefaultChoiceListFactory() + ) + ); + + if (null !== $translator && !$translator instanceof TranslatorInterface) { + throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be han instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator))); + } + $this->translator = $translator; + + // BC, to be removed in 6.0 + if ($this->choiceListFactory instanceof CachingFactoryDecorator) { + return; + } + + $ref = new \ReflectionMethod($this->choiceListFactory, 'createListFromChoices'); + + if ($ref->getNumberOfParameters() < 3) { + trigger_deprecation('symfony/form', '5.1', 'Not defining a third parameter "callable|null $filter" in "%s::%s()" is deprecated.', $ref->class, $ref->name); + } + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $unknownValues = []; + $choiceList = $this->createChoiceList($options); + $builder->setAttribute('choice_list', $choiceList); + + if ($options['expanded']) { + $builder->setDataMapper($options['multiple'] ? new CheckboxListMapper() : new RadioListMapper()); + + // Initialize all choices before doing the index check below. + // This helps in cases where index checks are optimized for non + // initialized choice lists. For example, when using an SQL driver, + // the index check would read in one SQL query and the initialization + // requires another SQL query. When the initialization is done first, + // one SQL query is sufficient. + + $choiceListView = $this->createChoiceListView($choiceList, $options); + $builder->setAttribute('choice_list_view', $choiceListView); + + // Check if the choices already contain the empty value + // Only add the placeholder option if this is not the case + if (null !== $options['placeholder'] && 0 === \count($choiceList->getChoicesForValues(['']))) { + $placeholderView = new ChoiceView(null, '', $options['placeholder']); + + // "placeholder" is a reserved name + $this->addSubForm($builder, 'placeholder', $placeholderView, $options); + } + + $this->addSubForms($builder, $choiceListView->preferredChoices, $options); + $this->addSubForms($builder, $choiceListView->choices, $options); + } + + if ($options['expanded'] || $options['multiple']) { + // Make sure that scalar, submitted values are converted to arrays + // which can be submitted to the checkboxes/radio buttons + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($choiceList, $options, &$unknownValues) { + $form = $event->getForm(); + $data = $event->getData(); + + // Since the type always use mapper an empty array will not be + // considered as empty in Form::submit(), we need to evaluate + // empty data here so its value is submitted to sub forms + if (null === $data) { + $emptyData = $form->getConfig()->getEmptyData(); + $data = $emptyData instanceof \Closure ? $emptyData($form, $data) : $emptyData; + } + + // Convert the submitted data to a string, if scalar, before + // casting it to an array + if (!\is_array($data)) { + if ($options['multiple']) { + throw new TransformationFailedException('Expected an array.'); + } + + $data = (array) (string) $data; + } + + // A map from submitted values to integers + $valueMap = array_flip($data); + + // Make a copy of the value map to determine whether any unknown + // values were submitted + $unknownValues = $valueMap; + + // Reconstruct the data as mapping from child names to values + $knownValues = []; + + if ($options['expanded']) { + /** @var FormInterface $child */ + foreach ($form as $child) { + $value = $child->getConfig()->getOption('value'); + + // Add the value to $data with the child's name as key + if (isset($valueMap[$value])) { + $knownValues[$child->getName()] = $value; + unset($unknownValues[$value]); + continue; + } else { + $knownValues[$child->getName()] = null; + } + } + } else { + foreach ($data as $value) { + if ($choiceList->getChoicesForValues([$value])) { + $knownValues[] = $value; + unset($unknownValues[$value]); + } + } + } + + // The empty value is always known, independent of whether a + // field exists for it or not + unset($unknownValues['']); + + // Throw exception if unknown values were submitted (multiple choices will be handled in a different event listener below) + if (\count($unknownValues) > 0 && !$options['multiple']) { + throw new TransformationFailedException(sprintf('The choices "%s" do not exist in the choice list.', implode('", "', array_keys($unknownValues)))); + } + + $event->setData($knownValues); + }); + } + + if ($options['multiple']) { + $messageTemplate = $options['invalid_message'] ?? 'The value {{ value }} is not valid.'; + + $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use (&$unknownValues, $messageTemplate) { + // Throw exception if unknown values were submitted + if (\count($unknownValues) > 0) { + $form = $event->getForm(); + + $clientDataAsString = is_scalar($form->getViewData()) ? (string) $form->getViewData() : (\is_array($form->getViewData()) ? implode('", "', array_keys($unknownValues)) : \gettype($form->getViewData())); + + if (null !== $this->translator) { + $message = $this->translator->trans($messageTemplate, ['{{ value }}' => $clientDataAsString], 'validators'); + } else { + $message = strtr($messageTemplate, ['{{ value }}' => $clientDataAsString]); + } + + $form->addError(new FormError($message, $messageTemplate, ['{{ value }}' => $clientDataAsString], null, new TransformationFailedException(sprintf('The choices "%s" do not exist in the choice list.', $clientDataAsString)))); + } + }); + + // tag without "multiple" option or list of radio inputs + $builder->addViewTransformer(new ChoiceToValueTransformer($choiceList)); + } + + if ($options['multiple'] && $options['by_reference']) { + // Make sure the collection created during the client->norm + // transformation is merged back into the original collection + $builder->addEventSubscriber(new MergeCollectionListener(true, true)); + } + + // To avoid issues when the submitted choices are arrays (i.e. array to string conversions), + // we have to ensure that all elements of the submitted choice data are NULL, strings or ints. + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { + $data = $event->getData(); + + if (!\is_array($data)) { + return; + } + + foreach ($data as $v) { + if (null !== $v && !\is_string($v) && !\is_int($v)) { + throw new TransformationFailedException('All choices submitted must be NULL, strings or ints.'); + } + } + }, 256); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $choiceTranslationDomain = $options['choice_translation_domain']; + if ($view->parent && null === $choiceTranslationDomain) { + $choiceTranslationDomain = $view->vars['translation_domain']; + } + + /** @var ChoiceListInterface $choiceList */ + $choiceList = $form->getConfig()->getAttribute('choice_list'); + + /** @var ChoiceListView $choiceListView */ + $choiceListView = $form->getConfig()->hasAttribute('choice_list_view') + ? $form->getConfig()->getAttribute('choice_list_view') + : $this->createChoiceListView($choiceList, $options); + + $view->vars = array_replace($view->vars, [ + 'multiple' => $options['multiple'], + 'expanded' => $options['expanded'], + 'preferred_choices' => $choiceListView->preferredChoices, + 'choices' => $choiceListView->choices, + 'separator' => '-------------------', + 'placeholder' => null, + 'choice_translation_domain' => $choiceTranslationDomain, + 'choice_translation_parameters' => $options['choice_translation_parameters'], + ]); + + // The decision, whether a choice is selected, is potentially done + // thousand of times during the rendering of a template. Provide a + // closure here that is optimized for the value of the form, to + // avoid making the type check inside the closure. + if ($options['multiple']) { + $view->vars['is_selected'] = function ($choice, array $values) { + return \in_array($choice, $values, true); + }; + } else { + $view->vars['is_selected'] = function ($choice, $value) { + return $choice === $value; + }; + } + + // Check if the choices already contain the empty value + $view->vars['placeholder_in_choices'] = $choiceListView->hasPlaceholder(); + + // Only add the empty value option if this is not the case + if (null !== $options['placeholder'] && !$view->vars['placeholder_in_choices']) { + $view->vars['placeholder'] = $options['placeholder']; + } + + if ($options['multiple'] && !$options['expanded']) { + // Add "[]" to the name in case a select tag with multiple options is + // displayed. Otherwise only one of the selected options is sent in the + // POST request. + $view->vars['full_name'] .= '[]'; + } + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + if ($options['expanded']) { + // Radio buttons should have the same name as the parent + $childName = $view->vars['full_name']; + + // Checkboxes should append "[]" to allow multiple selection + if ($options['multiple']) { + $childName .= '[]'; + } + + foreach ($view as $childView) { + $childView->vars['full_name'] = $childName; + } + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $emptyData = function (Options $options) { + if ($options['expanded'] && !$options['multiple']) { + return null; + } + + if ($options['multiple']) { + return []; + } + + return ''; + }; + + $placeholderDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $placeholderNormalizer = function (Options $options, $placeholder) { + if ($options['multiple']) { + // never use an empty value for this case + return null; + } elseif ($options['required'] && ($options['expanded'] || isset($options['attr']['size']) && $options['attr']['size'] > 1)) { + // placeholder for required radio buttons or a select with size > 1 does not make sense + return null; + } elseif (false === $placeholder) { + // an empty value should be added but the user decided otherwise + return null; + } elseif ($options['expanded'] && '' === $placeholder) { + // never use an empty label for radio buttons + return 'None'; + } + + // empty value has been set explicitly + return $placeholder; + }; + + $compound = function (Options $options) { + return $options['expanded']; + }; + + $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { + if (true === $choiceTranslationDomain) { + return $options['translation_domain']; + } + + return $choiceTranslationDomain; + }; + + $resolver->setDefaults([ + 'multiple' => false, + 'expanded' => false, + 'choices' => [], + 'choice_filter' => null, + 'choice_loader' => null, + 'choice_label' => null, + 'choice_name' => null, + 'choice_value' => null, + 'choice_attr' => null, + 'choice_translation_parameters' => [], + 'preferred_choices' => [], + 'group_by' => null, + 'empty_data' => $emptyData, + 'placeholder' => $placeholderDefault, + 'error_bubbling' => false, + 'compound' => $compound, + // The view data is always a string or an array of strings, + // even if the "data" option is manually set to an object. + // See https://github.com/symfony/symfony/pull/5582 + 'data_class' => null, + 'choice_translation_domain' => true, + 'trim' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The selected choice is invalid.'; + }, + ]); + + $resolver->setNormalizer('placeholder', $placeholderNormalizer); + $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); + + $resolver->setAllowedTypes('choices', ['null', 'array', \Traversable::class]); + $resolver->setAllowedTypes('choice_translation_domain', ['null', 'bool', 'string']); + $resolver->setAllowedTypes('choice_loader', ['null', ChoiceLoaderInterface::class, ChoiceLoader::class]); + $resolver->setAllowedTypes('choice_filter', ['null', 'callable', 'string', PropertyPath::class, ChoiceFilter::class]); + $resolver->setAllowedTypes('choice_label', ['null', 'bool', 'callable', 'string', PropertyPath::class, ChoiceLabel::class]); + $resolver->setAllowedTypes('choice_name', ['null', 'callable', 'string', PropertyPath::class, ChoiceFieldName::class]); + $resolver->setAllowedTypes('choice_value', ['null', 'callable', 'string', PropertyPath::class, ChoiceValue::class]); + $resolver->setAllowedTypes('choice_attr', ['null', 'array', 'callable', 'string', PropertyPath::class, ChoiceAttr::class]); + $resolver->setAllowedTypes('choice_translation_parameters', ['null', 'array', 'callable', ChoiceTranslationParameters::class]); + $resolver->setAllowedTypes('preferred_choices', ['array', \Traversable::class, 'callable', 'string', PropertyPath::class, PreferredChoice::class]); + $resolver->setAllowedTypes('group_by', ['null', 'callable', 'string', PropertyPath::class, GroupBy::class]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'choice'; + } + + /** + * Adds the sub fields for an expanded choice field. + */ + private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options) + { + foreach ($choiceViews as $name => $choiceView) { + // Flatten groups + if (\is_array($choiceView)) { + $this->addSubForms($builder, $choiceView, $options); + continue; + } + + if ($choiceView instanceof ChoiceGroupView) { + $this->addSubForms($builder, $choiceView->choices, $options); + continue; + } + + $this->addSubForm($builder, $name, $choiceView, $options); + } + } + + private function addSubForm(FormBuilderInterface $builder, string $name, ChoiceView $choiceView, array $options) + { + $choiceOpts = [ + 'value' => $choiceView->value, + 'label' => $choiceView->label, + 'label_html' => $options['label_html'], + 'attr' => $choiceView->attr, + 'label_translation_parameters' => $choiceView->labelTranslationParameters, + 'translation_domain' => $options['choice_translation_domain'], + 'block_name' => 'entry', + ]; + + if ($options['multiple']) { + $choiceType = CheckboxType::class; + // The user can check 0 or more checkboxes. If required + // is true, they are required to check all of them. + $choiceOpts['required'] = false; + } else { + $choiceType = RadioType::class; + } + + $builder->add($name, $choiceType, $choiceOpts); + } + + private function createChoiceList(array $options) + { + if (null !== $options['choice_loader']) { + return $this->choiceListFactory->createListFromLoader( + $options['choice_loader'], + $options['choice_value'], + $options['choice_filter'] + ); + } + + // Harden against NULL values (like in EntityType and ModelType) + $choices = null !== $options['choices'] ? $options['choices'] : []; + + return $this->choiceListFactory->createListFromChoices( + $choices, + $options['choice_value'], + $options['choice_filter'] + ); + } + + private function createChoiceListView(ChoiceListInterface $choiceList, array $options) + { + return $this->choiceListFactory->createView( + $choiceList, + $options['preferred_choices'], + $options['choice_label'], + $options['choice_name'], + $options['group_by'], + $options['choice_attr'], + $options['choice_translation_parameters'] + ); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/CollectionType.php b/vendor/symfony/form/Extension/Core/Type/CollectionType.php new file mode 100644 index 0000000..5cabf16 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/CollectionType.php @@ -0,0 +1,142 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class CollectionType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if ($options['allow_add'] && $options['prototype']) { + $prototypeOptions = array_replace([ + 'required' => $options['required'], + 'label' => $options['prototype_name'].'label__', + ], $options['entry_options']); + + if (null !== $options['prototype_data']) { + $prototypeOptions['data'] = $options['prototype_data']; + } + + $prototype = $builder->create($options['prototype_name'], $options['entry_type'], $prototypeOptions); + $builder->setAttribute('prototype', $prototype->getForm()); + } + + $resizeListener = new ResizeFormListener( + $options['entry_type'], + $options['entry_options'], + $options['allow_add'], + $options['allow_delete'], + $options['delete_empty'] + ); + + $builder->addEventSubscriber($resizeListener); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars = array_replace($view->vars, [ + 'allow_add' => $options['allow_add'], + 'allow_delete' => $options['allow_delete'], + ]); + + if ($form->getConfig()->hasAttribute('prototype')) { + $prototype = $form->getConfig()->getAttribute('prototype'); + $view->vars['prototype'] = $prototype->setParent($form)->createView($view); + } + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + $prefixOffset = -2; + // check if the entry type also defines a block prefix + /** @var FormInterface $entry */ + foreach ($form as $entry) { + if ($entry->getConfig()->getOption('block_prefix')) { + --$prefixOffset; + } + + break; + } + + foreach ($view as $entryView) { + array_splice($entryView->vars['block_prefixes'], $prefixOffset, 0, 'collection_entry'); + } + + /** @var FormInterface $prototype */ + if ($prototype = $form->getConfig()->getAttribute('prototype')) { + if ($view->vars['prototype']->vars['multipart']) { + $view->vars['multipart'] = true; + } + + if ($prefixOffset > -3 && $prototype->getConfig()->getOption('block_prefix')) { + --$prefixOffset; + } + + array_splice($view->vars['prototype']->vars['block_prefixes'], $prefixOffset, 0, 'collection_entry'); + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $entryOptionsNormalizer = function (Options $options, $value) { + $value['block_name'] = 'entry'; + + return $value; + }; + + $resolver->setDefaults([ + 'allow_add' => false, + 'allow_delete' => false, + 'prototype' => true, + 'prototype_data' => null, + 'prototype_name' => '__name__', + 'entry_type' => TextType::class, + 'entry_options' => [], + 'delete_empty' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The collection is invalid.'; + }, + ]); + + $resolver->setNormalizer('entry_options', $entryOptionsNormalizer); + $resolver->setAllowedTypes('delete_empty', ['bool', 'callable']); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'collection'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/ColorType.php b/vendor/symfony/form/Extension/Core/Type/ColorType.php new file mode 100644 index 0000000..f4cc052 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/ColorType.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Contracts\Translation\TranslatorInterface; + +class ColorType extends AbstractType +{ + /** + * @see https://www.w3.org/TR/html52/sec-forms.html#color-state-typecolor + */ + private const HTML5_PATTERN = '/^#[0-9a-f]{6}$/i'; + + private $translator; + + public function __construct(TranslatorInterface $translator = null) + { + $this->translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (!$options['html5']) { + return; + } + + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event): void { + $value = $event->getData(); + if (null === $value || '' === $value) { + return; + } + + if (\is_string($value) && preg_match(self::HTML5_PATTERN, $value)) { + return; + } + + $messageTemplate = 'This value is not a valid HTML5 color.'; + $messageParameters = [ + '{{ value }}' => is_scalar($value) ? (string) $value : \gettype($value), + ]; + $message = $this->translator ? $this->translator->trans($messageTemplate, $messageParameters, 'validators') : $messageTemplate; + + $event->getForm()->addError(new FormError($message, $messageTemplate, $messageParameters)); + }); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'html5' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid color.'; + }, + ]); + + $resolver->setAllowedTypes('html5', 'bool'); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'color'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/CountryType.php b/vendor/symfony/form/Extension/Core/Type/CountryType.php new file mode 100644 index 0000000..85293bc --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/CountryType.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Intl\Countries; +use Symfony\Component\Intl\Intl; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class CountryType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'choice_loader' => function (Options $options) { + if (!class_exists(Intl::class)) { + throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class)); + } + + $choiceTranslationLocale = $options['choice_translation_locale']; + $alpha3 = $options['alpha3']; + + return ChoiceList::loader($this, new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale, $alpha3) { + return array_flip($alpha3 ? Countries::getAlpha3Names($choiceTranslationLocale) : Countries::getNames($choiceTranslationLocale)); + }), [$choiceTranslationLocale, $alpha3]); + }, + 'choice_translation_domain' => false, + 'choice_translation_locale' => null, + 'alpha3' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid country.'; + }, + ]); + + $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); + $resolver->setAllowedTypes('alpha3', 'bool'); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ChoiceType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'country'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/CurrencyType.php b/vendor/symfony/form/Extension/Core/Type/CurrencyType.php new file mode 100644 index 0000000..427b493 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/CurrencyType.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Intl\Currencies; +use Symfony\Component\Intl\Intl; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class CurrencyType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'choice_loader' => function (Options $options) { + if (!class_exists(Intl::class)) { + throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class)); + } + + $choiceTranslationLocale = $options['choice_translation_locale']; + + return ChoiceList::loader($this, new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale) { + return array_flip(Currencies::getNames($choiceTranslationLocale)); + }), $choiceTranslationLocale); + }, + 'choice_translation_domain' => false, + 'choice_translation_locale' => null, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid currency.'; + }, + ]); + + $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ChoiceType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'currency'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/DateIntervalType.php b/vendor/symfony/form/Extension/Core/Type/DateIntervalType.php new file mode 100644 index 0000000..4c05557 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/DateIntervalType.php @@ -0,0 +1,291 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\InvalidConfigurationException; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ReversedTransformer; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Steffen Roßkamp + */ +class DateIntervalType extends AbstractType +{ + private const TIME_PARTS = [ + 'years', + 'months', + 'weeks', + 'days', + 'hours', + 'minutes', + 'seconds', + ]; + private const WIDGETS = [ + 'text' => TextType::class, + 'integer' => IntegerType::class, + 'choice' => ChoiceType::class, + ]; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (!$options['with_years'] && !$options['with_months'] && !$options['with_weeks'] && !$options['with_days'] && !$options['with_hours'] && !$options['with_minutes'] && !$options['with_seconds']) { + throw new InvalidConfigurationException('You must enable at least one interval field.'); + } + if ($options['with_invert'] && 'single_text' === $options['widget']) { + throw new InvalidConfigurationException('The single_text widget does not support invertible intervals.'); + } + if ($options['with_weeks'] && $options['with_days']) { + throw new InvalidConfigurationException('You cannot enable weeks and days fields together.'); + } + $format = 'P'; + $parts = []; + if ($options['with_years']) { + $format .= '%yY'; + $parts[] = 'years'; + } + if ($options['with_months']) { + $format .= '%mM'; + $parts[] = 'months'; + } + if ($options['with_weeks']) { + $format .= '%wW'; + $parts[] = 'weeks'; + } + if ($options['with_days']) { + $format .= '%dD'; + $parts[] = 'days'; + } + if ($options['with_hours'] || $options['with_minutes'] || $options['with_seconds']) { + $format .= 'T'; + } + if ($options['with_hours']) { + $format .= '%hH'; + $parts[] = 'hours'; + } + if ($options['with_minutes']) { + $format .= '%iM'; + $parts[] = 'minutes'; + } + if ($options['with_seconds']) { + $format .= '%sS'; + $parts[] = 'seconds'; + } + if ($options['with_invert']) { + $parts[] = 'invert'; + } + if ('single_text' === $options['widget']) { + $builder->addViewTransformer(new DateIntervalToStringTransformer($format)); + } else { + foreach (self::TIME_PARTS as $part) { + if ($options['with_'.$part]) { + $childOptions = [ + 'error_bubbling' => true, + 'label' => $options['labels'][$part], + // Append generic carry-along options + 'required' => $options['required'], + 'translation_domain' => $options['translation_domain'], + // when compound the array entries are ignored, we need to cascade the configuration here + 'empty_data' => $options['empty_data'][$part] ?? null, + ]; + if ('choice' === $options['widget']) { + $childOptions['choice_translation_domain'] = false; + $childOptions['choices'] = $options[$part]; + $childOptions['placeholder'] = $options['placeholder'][$part]; + } + $childForm = $builder->create($part, self::WIDGETS[$options['widget']], $childOptions); + if ('integer' === $options['widget']) { + $childForm->addModelTransformer( + new ReversedTransformer( + new IntegerToLocalizedStringTransformer() + ) + ); + } + $builder->add($childForm); + } + } + if ($options['with_invert']) { + $builder->add('invert', CheckboxType::class, [ + 'label' => $options['labels']['invert'], + 'error_bubbling' => true, + 'required' => false, + 'translation_domain' => $options['translation_domain'], + ]); + } + $builder->addViewTransformer(new DateIntervalToArrayTransformer($parts, 'text' === $options['widget'])); + } + if ('string' === $options['input']) { + $builder->addModelTransformer( + new ReversedTransformer( + new DateIntervalToStringTransformer($format) + ) + ); + } elseif ('array' === $options['input']) { + $builder->addModelTransformer( + new ReversedTransformer( + new DateIntervalToArrayTransformer($parts) + ) + ); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $vars = [ + 'widget' => $options['widget'], + 'with_invert' => $options['with_invert'], + ]; + foreach (self::TIME_PARTS as $part) { + $vars['with_'.$part] = $options['with_'.$part]; + } + $view->vars = array_replace($view->vars, $vars); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $compound = function (Options $options) { + return 'single_text' !== $options['widget']; + }; + $emptyData = function (Options $options) { + return 'single_text' === $options['widget'] ? '' : []; + }; + + $placeholderDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (\is_array($placeholder)) { + $default = $placeholderDefault($options); + + return array_merge(array_fill_keys(self::TIME_PARTS, $default), $placeholder); + } + + return array_fill_keys(self::TIME_PARTS, $placeholder); + }; + + $labelsNormalizer = function (Options $options, array $labels) { + return array_replace([ + 'years' => null, + 'months' => null, + 'days' => null, + 'weeks' => null, + 'hours' => null, + 'minutes' => null, + 'seconds' => null, + 'invert' => 'Negative interval', + ], array_filter($labels, function ($label) { + return null !== $label; + })); + }; + + $resolver->setDefaults([ + 'with_years' => true, + 'with_months' => true, + 'with_days' => true, + 'with_weeks' => false, + 'with_hours' => false, + 'with_minutes' => false, + 'with_seconds' => false, + 'with_invert' => false, + 'years' => range(0, 100), + 'months' => range(0, 12), + 'weeks' => range(0, 52), + 'days' => range(0, 31), + 'hours' => range(0, 24), + 'minutes' => range(0, 60), + 'seconds' => range(0, 60), + 'widget' => 'choice', + 'input' => 'dateinterval', + 'placeholder' => $placeholderDefault, + 'by_reference' => true, + 'error_bubbling' => false, + // If initialized with a \DateInterval object, FormType initializes + // this option to "\DateInterval". Since the internal, normalized + // representation is not \DateInterval, but an array, we need to unset + // this option. + 'data_class' => null, + 'compound' => $compound, + 'empty_data' => $emptyData, + 'labels' => [], + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please choose a valid date interval.'; + }, + ]); + $resolver->setNormalizer('placeholder', $placeholderNormalizer); + $resolver->setNormalizer('labels', $labelsNormalizer); + + $resolver->setAllowedValues( + 'input', + [ + 'dateinterval', + 'string', + 'array', + ] + ); + $resolver->setAllowedValues( + 'widget', + [ + 'single_text', + 'text', + 'integer', + 'choice', + ] + ); + // Don't clone \DateInterval classes, as i.e. format() + // does not work after that + $resolver->setAllowedValues('by_reference', true); + + $resolver->setAllowedTypes('years', 'array'); + $resolver->setAllowedTypes('months', 'array'); + $resolver->setAllowedTypes('weeks', 'array'); + $resolver->setAllowedTypes('days', 'array'); + $resolver->setAllowedTypes('hours', 'array'); + $resolver->setAllowedTypes('minutes', 'array'); + $resolver->setAllowedTypes('seconds', 'array'); + $resolver->setAllowedTypes('with_years', 'bool'); + $resolver->setAllowedTypes('with_months', 'bool'); + $resolver->setAllowedTypes('with_weeks', 'bool'); + $resolver->setAllowedTypes('with_days', 'bool'); + $resolver->setAllowedTypes('with_hours', 'bool'); + $resolver->setAllowedTypes('with_minutes', 'bool'); + $resolver->setAllowedTypes('with_seconds', 'bool'); + $resolver->setAllowedTypes('with_invert', 'bool'); + $resolver->setAllowedTypes('labels', 'array'); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'dateinterval'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/DateTimeType.php b/vendor/symfony/form/Extension/Core/Type/DateTimeType.php new file mode 100644 index 0000000..2f397f8 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/DateTimeType.php @@ -0,0 +1,362 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ReversedTransformer; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class DateTimeType extends AbstractType +{ + public const DEFAULT_DATE_FORMAT = \IntlDateFormatter::MEDIUM; + public const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM; + + /** + * The HTML5 datetime-local format as defined in + * http://w3c.github.io/html-reference/datatypes.html#form.data.datetime-local. + */ + public const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; + + private const ACCEPTED_FORMATS = [ + \IntlDateFormatter::FULL, + \IntlDateFormatter::LONG, + \IntlDateFormatter::MEDIUM, + \IntlDateFormatter::SHORT, + ]; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $parts = ['year', 'month', 'day', 'hour']; + $dateParts = ['year', 'month', 'day']; + $timeParts = ['hour']; + + if ($options['with_minutes']) { + $parts[] = 'minute'; + $timeParts[] = 'minute'; + } + + if ($options['with_seconds']) { + $parts[] = 'second'; + $timeParts[] = 'second'; + } + + $dateFormat = \is_int($options['date_format']) ? $options['date_format'] : self::DEFAULT_DATE_FORMAT; + $timeFormat = self::DEFAULT_TIME_FORMAT; + $calendar = \IntlDateFormatter::GREGORIAN; + $pattern = \is_string($options['format']) ? $options['format'] : null; + + if (!\in_array($dateFormat, self::ACCEPTED_FORMATS, true)) { + throw new InvalidOptionsException('The "date_format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); + } + + if ('single_text' === $options['widget']) { + if (self::HTML5_FORMAT === $pattern) { + $builder->addViewTransformer(new DateTimeToHtml5LocalDateTimeTransformer( + $options['model_timezone'], + $options['view_timezone'] + )); + } else { + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( + $options['model_timezone'], + $options['view_timezone'], + $dateFormat, + $timeFormat, + $calendar, + $pattern + )); + } + } else { + // when the form is compound the entries of the array are ignored in favor of children data + // so we need to handle the cascade setting here + $emptyData = $builder->getEmptyData() ?: []; + // Only pass a subset of the options to children + $dateOptions = array_intersect_key($options, array_flip([ + 'years', + 'months', + 'days', + 'placeholder', + 'choice_translation_domain', + 'required', + 'translation_domain', + 'html5', + 'invalid_message', + 'invalid_message_parameters', + ])); + + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return $emptyData[$option] ?? ''; + }; + }; + + $dateOptions['empty_data'] = $lazyEmptyData('date'); + } elseif (isset($emptyData['date'])) { + $dateOptions['empty_data'] = $emptyData['date']; + } + + $timeOptions = array_intersect_key($options, array_flip([ + 'hours', + 'minutes', + 'seconds', + 'with_minutes', + 'with_seconds', + 'placeholder', + 'choice_translation_domain', + 'required', + 'translation_domain', + 'html5', + 'invalid_message', + 'invalid_message_parameters', + ])); + + if ($emptyData instanceof \Closure) { + $timeOptions['empty_data'] = $lazyEmptyData('time'); + } elseif (isset($emptyData['time'])) { + $timeOptions['empty_data'] = $emptyData['time']; + } + + if (false === $options['label']) { + $dateOptions['label'] = false; + $timeOptions['label'] = false; + } + + if (null !== $options['date_widget']) { + $dateOptions['widget'] = $options['date_widget']; + } + + if (null !== $options['date_label']) { + $dateOptions['label'] = $options['date_label']; + } + + if (null !== $options['time_widget']) { + $timeOptions['widget'] = $options['time_widget']; + } + + if (null !== $options['time_label']) { + $timeOptions['label'] = $options['time_label']; + } + + if (null !== $options['date_format']) { + $dateOptions['format'] = $options['date_format']; + } + + $dateOptions['input'] = $timeOptions['input'] = 'array'; + $dateOptions['error_bubbling'] = $timeOptions['error_bubbling'] = true; + + $builder + ->addViewTransformer(new DataTransformerChain([ + new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts), + new ArrayToPartsTransformer([ + 'date' => $dateParts, + 'time' => $timeParts, + ]), + ])) + ->add('date', DateType::class, $dateOptions) + ->add('time', TimeType::class, $timeOptions) + ; + } + + if ('datetime_immutable' === $options['input']) { + $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer()); + } elseif ('string' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format']) + )); + } elseif ('timestamp' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) + )); + } elseif ('array' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts) + )); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['widget'] = $options['widget']; + + // Change the input to an HTML5 datetime input if + // * the widget is set to "single_text" + // * the format matches the one expected by HTML5 + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { + $view->vars['type'] = 'datetime-local'; + + // we need to force the browser to display the seconds by + // adding the HTML attribute step if not already defined. + // Otherwise the browser will not display and so not send the seconds + // therefore the value will always be considered as invalid. + if ($options['with_seconds'] && !isset($view->vars['attr']['step'])) { + $view->vars['attr']['step'] = 1; + } + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $compound = function (Options $options) { + return 'single_text' !== $options['widget']; + }; + + // Defaults to the value of "widget" + $dateWidget = function (Options $options) { + return 'single_text' === $options['widget'] ? null : $options['widget']; + }; + + // Defaults to the value of "widget" + $timeWidget = function (Options $options) { + return 'single_text' === $options['widget'] ? null : $options['widget']; + }; + + $resolver->setDefaults([ + 'input' => 'datetime', + 'model_timezone' => null, + 'view_timezone' => null, + 'format' => self::HTML5_FORMAT, + 'date_format' => null, + 'widget' => null, + 'date_widget' => $dateWidget, + 'time_widget' => $timeWidget, + 'with_minutes' => true, + 'with_seconds' => false, + 'html5' => true, + // Don't modify \DateTime classes by reference, we treat + // them like immutable value objects + 'by_reference' => false, + 'error_bubbling' => false, + // If initialized with a \DateTime object, FormType initializes + // this option to "\DateTime". Since the internal, normalized + // representation is not \DateTime, but an array, we need to unset + // this option. + 'data_class' => null, + 'compound' => $compound, + 'date_label' => null, + 'time_label' => null, + 'empty_data' => function (Options $options) { + return $options['compound'] ? [] : ''; + }, + 'input_format' => 'Y-m-d H:i:s', + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid date and time.'; + }, + ]); + + // Don't add some defaults in order to preserve the defaults + // set in DateType and TimeType + $resolver->setDefined([ + 'placeholder', + 'choice_translation_domain', + 'years', + 'months', + 'days', + 'hours', + 'minutes', + 'seconds', + ]); + + $resolver->setAllowedValues('input', [ + 'datetime', + 'datetime_immutable', + 'string', + 'timestamp', + 'array', + ]); + $resolver->setAllowedValues('date_widget', [ + null, // inherit default from DateType + 'single_text', + 'text', + 'choice', + ]); + $resolver->setAllowedValues('time_widget', [ + null, // inherit default from TimeType + 'single_text', + 'text', + 'choice', + ]); + // This option will overwrite "date_widget" and "time_widget" options + $resolver->setAllowedValues('widget', [ + null, // default, don't overwrite options + 'single_text', + 'text', + 'choice', + ]); + + $resolver->setAllowedTypes('input_format', 'string'); + + $resolver->setNormalizer('date_format', function (Options $options, $dateFormat) { + if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { + throw new LogicException(sprintf('Cannot use the "date_format" option of the "%s" with an HTML5 date.', self::class)); + } + + return $dateFormat; + }); + $resolver->setNormalizer('date_widget', function (Options $options, $dateWidget) { + if (null !== $dateWidget && 'single_text' === $options['widget']) { + throw new LogicException(sprintf('Cannot use the "date_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class)); + } + + return $dateWidget; + }); + $resolver->setNormalizer('time_widget', function (Options $options, $timeWidget) { + if (null !== $timeWidget && 'single_text' === $options['widget']) { + throw new LogicException(sprintf('Cannot use the "time_widget" option of the "%s" when the "widget" option is set to "single_text".', self::class)); + } + + return $timeWidget; + }); + $resolver->setNormalizer('html5', function (Options $options, $html5) { + if ($html5 && self::HTML5_FORMAT !== $options['format']) { + throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class)); + } + + return $html5; + }); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'datetime'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/DateType.php b/vendor/symfony/form/Extension/Core/Type/DateType.php new file mode 100644 index 0000000..1a46a80 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/DateType.php @@ -0,0 +1,405 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ReversedTransformer; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class DateType extends AbstractType +{ + public const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM; + public const HTML5_FORMAT = 'yyyy-MM-dd'; + + private const ACCEPTED_FORMATS = [ + \IntlDateFormatter::FULL, + \IntlDateFormatter::LONG, + \IntlDateFormatter::MEDIUM, + \IntlDateFormatter::SHORT, + ]; + + private const WIDGETS = [ + 'text' => TextType::class, + 'choice' => ChoiceType::class, + ]; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $dateFormat = \is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT; + $timeFormat = \IntlDateFormatter::NONE; + $calendar = \IntlDateFormatter::GREGORIAN; + $pattern = \is_string($options['format']) ? $options['format'] : ''; + + if (!\in_array($dateFormat, self::ACCEPTED_FORMATS, true)) { + throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); + } + + if ('single_text' === $options['widget']) { + if ('' !== $pattern && !str_contains($pattern, 'y') && !str_contains($pattern, 'M') && !str_contains($pattern, 'd')) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern)); + } + + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( + $options['model_timezone'], + $options['view_timezone'], + $dateFormat, + $timeFormat, + $calendar, + $pattern + )); + } else { + if ('' !== $pattern && (!str_contains($pattern, 'y') || !str_contains($pattern, 'M') || !str_contains($pattern, 'd'))) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); + } + + $yearOptions = $monthOptions = $dayOptions = [ + 'error_bubbling' => true, + 'empty_data' => '', + ]; + // when the form is compound the entries of the array are ignored in favor of children data + // so we need to handle the cascade setting here + $emptyData = $builder->getEmptyData() ?: []; + + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return $emptyData[$option] ?? ''; + }; + }; + + $yearOptions['empty_data'] = $lazyEmptyData('year'); + $monthOptions['empty_data'] = $lazyEmptyData('month'); + $dayOptions['empty_data'] = $lazyEmptyData('day'); + } else { + if (isset($emptyData['year'])) { + $yearOptions['empty_data'] = $emptyData['year']; + } + if (isset($emptyData['month'])) { + $monthOptions['empty_data'] = $emptyData['month']; + } + if (isset($emptyData['day'])) { + $dayOptions['empty_data'] = $emptyData['day']; + } + } + + if (isset($options['invalid_message'])) { + $dayOptions['invalid_message'] = $options['invalid_message']; + $monthOptions['invalid_message'] = $options['invalid_message']; + $yearOptions['invalid_message'] = $options['invalid_message']; + } + + if (isset($options['invalid_message_parameters'])) { + $dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + } + + $formatter = new \IntlDateFormatter( + \Locale::getDefault(), + $dateFormat, + $timeFormat, + // see https://bugs.php.net/66323 + class_exists(\IntlTimeZone::class, false) ? \IntlTimeZone::createDefault() : null, + $calendar, + $pattern + ); + + // new \IntlDateFormatter may return null instead of false in case of failure, see https://bugs.php.net/66323 + if (!$formatter) { + throw new InvalidOptionsException(intl_get_error_message(), intl_get_error_code()); + } + + $formatter->setLenient(false); + + if ('choice' === $options['widget']) { + // Only pass a subset of the options to children + $yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years'])); + $yearOptions['placeholder'] = $options['placeholder']['year']; + $yearOptions['choice_translation_domain'] = $options['choice_translation_domain']['year']; + $monthOptions['choices'] = $this->formatTimestamps($formatter, '/[M|L]+/', $this->listMonths($options['months'])); + $monthOptions['placeholder'] = $options['placeholder']['month']; + $monthOptions['choice_translation_domain'] = $options['choice_translation_domain']['month']; + $dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days'])); + $dayOptions['placeholder'] = $options['placeholder']['day']; + $dayOptions['choice_translation_domain'] = $options['choice_translation_domain']['day']; + } + + // Append generic carry-along options + foreach (['required', 'translation_domain'] as $passOpt) { + $yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt]; + } + + $builder + ->add('year', self::WIDGETS[$options['widget']], $yearOptions) + ->add('month', self::WIDGETS[$options['widget']], $monthOptions) + ->add('day', self::WIDGETS[$options['widget']], $dayOptions) + ->addViewTransformer(new DateTimeToArrayTransformer( + $options['model_timezone'], $options['view_timezone'], ['year', 'month', 'day'] + )) + ->setAttribute('formatter', $formatter) + ; + } + + if ('datetime_immutable' === $options['input']) { + $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer()); + } elseif ('string' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format']) + )); + } elseif ('timestamp' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) + )); + } elseif ('array' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], ['year', 'month', 'day']) + )); + } + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + $view->vars['widget'] = $options['widget']; + + // Change the input to an HTML5 date input if + // * the widget is set to "single_text" + // * the format matches the one expected by HTML5 + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { + $view->vars['type'] = 'date'; + } + + if ($form->getConfig()->hasAttribute('formatter')) { + $pattern = $form->getConfig()->getAttribute('formatter')->getPattern(); + + // remove special characters unless the format was explicitly specified + if (!\is_string($options['format'])) { + // remove quoted strings first + $pattern = preg_replace('/\'[^\']+\'/', '', $pattern); + + // remove remaining special chars + $pattern = preg_replace('/[^yMd]+/', '', $pattern); + } + + // set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy) + // lookup various formats at http://userguide.icu-project.org/formatparse/datetime + if (preg_match('/^([yMd]+)[^yMd]*([yMd]+)[^yMd]*([yMd]+)$/', $pattern)) { + $pattern = preg_replace(['/y+/', '/M+/', '/d+/'], ['{{ year }}', '{{ month }}', '{{ day }}'], $pattern); + } else { + // default fallback + $pattern = '{{ year }}{{ month }}{{ day }}'; + } + + $view->vars['date_pattern'] = $pattern; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $compound = function (Options $options) { + return 'single_text' !== $options['widget']; + }; + + $placeholderDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (\is_array($placeholder)) { + $default = $placeholderDefault($options); + + return array_merge( + ['year' => $default, 'month' => $default, 'day' => $default], + $placeholder + ); + } + + return [ + 'year' => $placeholder, + 'month' => $placeholder, + 'day' => $placeholder, + ]; + }; + + $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { + if (\is_array($choiceTranslationDomain)) { + $default = false; + + return array_replace( + ['year' => $default, 'month' => $default, 'day' => $default], + $choiceTranslationDomain + ); + } + + return [ + 'year' => $choiceTranslationDomain, + 'month' => $choiceTranslationDomain, + 'day' => $choiceTranslationDomain, + ]; + }; + + $format = function (Options $options) { + return 'single_text' === $options['widget'] ? self::HTML5_FORMAT : self::DEFAULT_FORMAT; + }; + + $resolver->setDefaults([ + 'years' => range((int) date('Y') - 5, (int) date('Y') + 5), + 'months' => range(1, 12), + 'days' => range(1, 31), + 'widget' => 'choice', + 'input' => 'datetime', + 'format' => $format, + 'model_timezone' => null, + 'view_timezone' => null, + 'placeholder' => $placeholderDefault, + 'html5' => true, + // Don't modify \DateTime classes by reference, we treat + // them like immutable value objects + 'by_reference' => false, + 'error_bubbling' => false, + // If initialized with a \DateTime object, FormType initializes + // this option to "\DateTime". Since the internal, normalized + // representation is not \DateTime, but an array, we need to unset + // this option. + 'data_class' => null, + 'compound' => $compound, + 'empty_data' => function (Options $options) { + return $options['compound'] ? [] : ''; + }, + 'choice_translation_domain' => false, + 'input_format' => 'Y-m-d', + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid date.'; + }, + ]); + + $resolver->setNormalizer('placeholder', $placeholderNormalizer); + $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); + + $resolver->setAllowedValues('input', [ + 'datetime', + 'datetime_immutable', + 'string', + 'timestamp', + 'array', + ]); + $resolver->setAllowedValues('widget', [ + 'single_text', + 'text', + 'choice', + ]); + + $resolver->setAllowedTypes('format', ['int', 'string']); + $resolver->setAllowedTypes('years', 'array'); + $resolver->setAllowedTypes('months', 'array'); + $resolver->setAllowedTypes('days', 'array'); + $resolver->setAllowedTypes('input_format', 'string'); + + $resolver->setNormalizer('html5', function (Options $options, $html5) { + if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) { + throw new LogicException(sprintf('Cannot use the "format" option of "%s" when the "html5" option is enabled.', self::class)); + } + + return $html5; + }); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'date'; + } + + private function formatTimestamps(\IntlDateFormatter $formatter, string $regex, array $timestamps) + { + $pattern = $formatter->getPattern(); + $timezone = $formatter->getTimeZoneId(); + $formattedTimestamps = []; + + $formatter->setTimeZone('UTC'); + + if (preg_match($regex, $pattern, $matches)) { + $formatter->setPattern($matches[0]); + + foreach ($timestamps as $timestamp => $choice) { + $formattedTimestamps[$formatter->format($timestamp)] = $choice; + } + + // I'd like to clone the formatter above, but then we get a + // segmentation fault, so let's restore the old state instead + $formatter->setPattern($pattern); + } + + $formatter->setTimeZone($timezone); + + return $formattedTimestamps; + } + + private function listYears(array $years) + { + $result = []; + + foreach ($years as $year) { + $result[\PHP_INT_SIZE === 4 ? \DateTime::createFromFormat('Y e', $year.' UTC')->format('U') : gmmktime(0, 0, 0, 6, 15, $year)] = $year; + } + + return $result; + } + + private function listMonths(array $months) + { + $result = []; + + foreach ($months as $month) { + $result[gmmktime(0, 0, 0, $month, 15)] = $month; + } + + return $result; + } + + private function listDays(array $days) + { + $result = []; + + foreach ($days as $day) { + $result[gmmktime(0, 0, 0, 5, $day)] = $day; + } + + return $result; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/EmailType.php b/vendor/symfony/form/Extension/Core/Type/EmailType.php new file mode 100644 index 0000000..486bc02 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/EmailType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class EmailType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid email address.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'email'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/EnumType.php b/vendor/symfony/form/Extension/Core/Type/EnumType.php new file mode 100644 index 0000000..c251cdb --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/EnumType.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A choice type for native PHP enums. + * + * @author Alexander M. Turek + */ +final class EnumType extends AbstractType +{ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver + ->setRequired(['class']) + ->setAllowedTypes('class', 'string') + ->setAllowedValues('class', \Closure::fromCallable('enum_exists')) + ->setDefault('choices', static function (Options $options): array { + return $options['class']::cases(); + }) + ->setDefault('choice_label', static function (\UnitEnum $choice): string { + return $choice->name; + }) + ->setDefault('choice_value', static function (Options $options): ?\Closure { + if (!is_a($options['class'], \BackedEnum::class, true)) { + return null; + } + + return static function (?\BackedEnum $choice): ?string { + if (null === $choice) { + return null; + } + + return (string) $choice->value; + }; + }) + ; + } + + public function getParent(): string + { + return ChoiceType::class; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/FileType.php b/vendor/symfony/form/Extension/Core/Type/FileType.php new file mode 100644 index 0000000..36e23ec --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/FileType.php @@ -0,0 +1,255 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FileUploadError; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Contracts\Translation\TranslatorInterface; + +class FileType extends AbstractType +{ + public const KIB_BYTES = 1024; + public const MIB_BYTES = 1048576; + + private const SUFFIXES = [ + 1 => 'bytes', + self::KIB_BYTES => 'KiB', + self::MIB_BYTES => 'MiB', + ]; + + private $translator; + + public function __construct(TranslatorInterface $translator = null) + { + $this->translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + // Ensure that submitted data is always an uploaded file or an array of some + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options) { + $form = $event->getForm(); + $requestHandler = $form->getConfig()->getRequestHandler(); + + if ($options['multiple']) { + $data = []; + $files = $event->getData(); + + if (!\is_array($files)) { + $files = []; + } + + foreach ($files as $file) { + if ($requestHandler->isFileUpload($file)) { + $data[] = $file; + + if (method_exists($requestHandler, 'getUploadFileError') && null !== $errorCode = $requestHandler->getUploadFileError($file)) { + $form->addError($this->getFileUploadError($errorCode)); + } + } + } + + // Since the array is never considered empty in the view data format + // on submission, we need to evaluate the configured empty data here + if ([] === $data) { + $emptyData = $form->getConfig()->getEmptyData(); + $data = $emptyData instanceof \Closure ? $emptyData($form, $data) : $emptyData; + } + + $event->setData($data); + } elseif ($requestHandler->isFileUpload($event->getData()) && method_exists($requestHandler, 'getUploadFileError') && null !== $errorCode = $requestHandler->getUploadFileError($event->getData())) { + $form->addError($this->getFileUploadError($errorCode)); + } elseif (!$requestHandler->isFileUpload($event->getData())) { + $event->setData(null); + } + }); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if ($options['multiple']) { + $view->vars['full_name'] .= '[]'; + $view->vars['attr']['multiple'] = 'multiple'; + } + + $view->vars = array_replace($view->vars, [ + 'type' => 'file', + 'value' => '', + ]); + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + $view->vars['multipart'] = true; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $dataClass = null; + if (class_exists(\Symfony\Component\HttpFoundation\File\File::class)) { + $dataClass = function (Options $options) { + return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File'; + }; + } + + $emptyData = function (Options $options) { + return $options['multiple'] ? [] : null; + }; + + $resolver->setDefaults([ + 'compound' => false, + 'data_class' => $dataClass, + 'empty_data' => $emptyData, + 'multiple' => false, + 'allow_file_upload' => true, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid file.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'file'; + } + + private function getFileUploadError(int $errorCode) + { + $messageParameters = []; + + if (\UPLOAD_ERR_INI_SIZE === $errorCode) { + [$limitAsString, $suffix] = $this->factorizeSizes(0, self::getMaxFilesize()); + $messageTemplate = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; + $messageParameters = [ + '{{ limit }}' => $limitAsString, + '{{ suffix }}' => $suffix, + ]; + } elseif (\UPLOAD_ERR_FORM_SIZE === $errorCode) { + $messageTemplate = 'The file is too large.'; + } else { + $messageTemplate = 'The file could not be uploaded.'; + } + + if (null !== $this->translator) { + $message = $this->translator->trans($messageTemplate, $messageParameters, 'validators'); + } else { + $message = strtr($messageTemplate, $messageParameters); + } + + return new FileUploadError($message, $messageTemplate, $messageParameters); + } + + /** + * Returns the maximum size of an uploaded file as configured in php.ini. + * + * This method should be kept in sync with Symfony\Component\HttpFoundation\File\UploadedFile::getMaxFilesize(). + * + * @return int|float The maximum size of an uploaded file in bytes (returns float if size > PHP_INT_MAX) + */ + private static function getMaxFilesize() + { + $iniMax = strtolower(ini_get('upload_max_filesize')); + + if ('' === $iniMax) { + return \PHP_INT_MAX; + } + + $max = ltrim($iniMax, '+'); + if (str_starts_with($max, '0x')) { + $max = \intval($max, 16); + } elseif (str_starts_with($max, '0')) { + $max = \intval($max, 8); + } else { + $max = (int) $max; + } + + switch (substr($iniMax, -1)) { + case 't': $max *= 1024; + // no break + case 'g': $max *= 1024; + // no break + case 'm': $max *= 1024; + // no break + case 'k': $max *= 1024; + } + + return $max; + } + + /** + * Converts the limit to the smallest possible number + * (i.e. try "MB", then "kB", then "bytes"). + * + * This method should be kept in sync with Symfony\Component\Validator\Constraints\FileValidator::factorizeSizes(). + * + * @param int|float $limit + */ + private function factorizeSizes(int $size, $limit) + { + $coef = self::MIB_BYTES; + $coefFactor = self::KIB_BYTES; + + $limitAsString = (string) ($limit / $coef); + + // Restrict the limit to 2 decimals (without rounding! we + // need the precise value) + while (self::moreDecimalsThan($limitAsString, 2)) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + } + + // Convert size to the same measure, but round to 2 decimals + $sizeAsString = (string) round($size / $coef, 2); + + // If the size and limit produce the same string output + // (due to rounding), reduce the coefficient + while ($sizeAsString === $limitAsString) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + $sizeAsString = (string) round($size / $coef, 2); + } + + return [$limitAsString, self::SUFFIXES[$coef]]; + } + + /** + * This method should be kept in sync with Symfony\Component\Validator\Constraints\FileValidator::moreDecimalsThan(). + */ + private static function moreDecimalsThan(string $double, int $numberOfDecimals): bool + { + return \strlen($double) > \strlen(round($double, $numberOfDecimals)); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/FormType.php b/vendor/symfony/form/Extension/Core/Type/FormType.php new file mode 100644 index 0000000..f3bfd4d --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/FormType.php @@ -0,0 +1,257 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataAccessor\CallbackAccessor; +use Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor; +use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor; +use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; +use Symfony\Component\Form\Extension\Core\EventListener\TrimListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormConfigBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Translation\TranslatableMessage; + +class FormType extends BaseType +{ + private $dataMapper; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null) + { + $this->dataMapper = new DataMapper(new ChainAccessor([ + new CallbackAccessor(), + new PropertyPathAccessor($propertyAccessor ?? PropertyAccess::createPropertyAccessor()), + ])); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + parent::buildForm($builder, $options); + + $isDataOptionSet = \array_key_exists('data', $options); + + $builder + ->setRequired($options['required']) + ->setErrorBubbling($options['error_bubbling']) + ->setEmptyData($options['empty_data']) + ->setPropertyPath($options['property_path']) + ->setMapped($options['mapped']) + ->setByReference($options['by_reference']) + ->setInheritData($options['inherit_data']) + ->setCompound($options['compound']) + ->setData($isDataOptionSet ? $options['data'] : null) + ->setDataLocked($isDataOptionSet) + ->setDataMapper($options['compound'] ? $this->dataMapper : null) + ->setMethod($options['method']) + ->setAction($options['action']); + + if ($options['trim']) { + $builder->addEventSubscriber(new TrimListener()); + } + + if (!method_exists($builder, 'setIsEmptyCallback')) { + trigger_deprecation('symfony/form', '5.1', 'Not implementing the "%s::setIsEmptyCallback()" method in "%s" is deprecated.', FormConfigBuilderInterface::class, get_debug_type($builder)); + + return; + } + + $builder->setIsEmptyCallback($options['is_empty_callback']); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + parent::buildView($view, $form, $options); + + $name = $form->getName(); + $helpTranslationParameters = $options['help_translation_parameters']; + + if ($view->parent) { + if ('' === $name) { + throw new LogicException('Form node with empty name can be used only as root form node.'); + } + + // Complex fields are read-only if they themselves or their parents are. + if (!isset($view->vars['attr']['readonly']) && isset($view->parent->vars['attr']['readonly']) && false !== $view->parent->vars['attr']['readonly']) { + $view->vars['attr']['readonly'] = true; + } + + $helpTranslationParameters = array_merge($view->parent->vars['help_translation_parameters'], $helpTranslationParameters); + + $rootFormAttrOption = $form->getRoot()->getConfig()->getOption('form_attr'); + if ($options['form_attr'] || $rootFormAttrOption) { + $view->vars['attr']['form'] = \is_string($rootFormAttrOption) ? $rootFormAttrOption : $form->getRoot()->getName(); + if (empty($view->vars['attr']['form'])) { + throw new LogicException('"form_attr" option must be a string identifier on root form when it has no id.'); + } + } + } elseif (\is_string($options['form_attr'])) { + $view->vars['id'] = $options['form_attr']; + } + + $formConfig = $form->getConfig(); + $view->vars = array_replace($view->vars, [ + 'errors' => $form->getErrors(), + 'valid' => $form->isSubmitted() ? $form->isValid() : true, + 'value' => $form->getViewData(), + 'data' => $form->getNormData(), + 'required' => $form->isRequired(), + 'size' => null, + 'label_attr' => $options['label_attr'], + 'help' => $options['help'], + 'help_attr' => $options['help_attr'], + 'help_html' => $options['help_html'], + 'help_translation_parameters' => $helpTranslationParameters, + 'compound' => $formConfig->getCompound(), + 'method' => $formConfig->getMethod(), + 'action' => $formConfig->getAction(), + 'submitted' => $form->isSubmitted(), + ]); + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + $multipart = false; + + foreach ($view->children as $child) { + if ($child->vars['multipart']) { + $multipart = true; + break; + } + } + + $view->vars['multipart'] = $multipart; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + parent::configureOptions($resolver); + + // Derive "data_class" option from passed "data" object + $dataClass = function (Options $options) { + return isset($options['data']) && \is_object($options['data']) ? \get_class($options['data']) : null; + }; + + // Derive "empty_data" closure from "data_class" option + $emptyData = function (Options $options) { + $class = $options['data_class']; + + if (null !== $class) { + return function (FormInterface $form) use ($class) { + return $form->isEmpty() && !$form->isRequired() ? null : new $class(); + }; + } + + return function (FormInterface $form) { + return $form->getConfig()->getCompound() ? [] : ''; + }; + }; + + // Wrap "post_max_size_message" in a closure to translate it lazily + $uploadMaxSizeMessage = function (Options $options) { + return function () use ($options) { + return $options['post_max_size_message']; + }; + }; + + // For any form that is not represented by a single HTML control, + // errors should bubble up by default + $errorBubbling = function (Options $options) { + return $options['compound'] && !$options['inherit_data']; + }; + + // If data is given, the form is locked to that data + // (independent of its value) + $resolver->setDefined([ + 'data', + ]); + + $resolver->setDefaults([ + 'data_class' => $dataClass, + 'empty_data' => $emptyData, + 'trim' => true, + 'required' => true, + 'property_path' => null, + 'mapped' => true, + 'by_reference' => true, + 'error_bubbling' => $errorBubbling, + 'label_attr' => [], + 'inherit_data' => false, + 'compound' => true, + 'method' => 'POST', + // According to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) + // section 4.2., empty URIs are considered same-document references + 'action' => '', + 'attr' => [], + 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', + 'upload_max_size_message' => $uploadMaxSizeMessage, // internal + 'allow_file_upload' => false, + 'help' => null, + 'help_attr' => [], + 'help_html' => false, + 'help_translation_parameters' => [], + 'invalid_message' => 'This value is not valid.', + 'invalid_message_parameters' => [], + 'is_empty_callback' => null, + 'getter' => null, + 'setter' => null, + 'form_attr' => false, + ]); + + $resolver->setAllowedTypes('label_attr', 'array'); + $resolver->setAllowedTypes('action', 'string'); + $resolver->setAllowedTypes('upload_max_size_message', ['callable']); + $resolver->setAllowedTypes('help', ['string', 'null', TranslatableMessage::class]); + $resolver->setAllowedTypes('help_attr', 'array'); + $resolver->setAllowedTypes('help_html', 'bool'); + $resolver->setAllowedTypes('is_empty_callback', ['null', 'callable']); + $resolver->setAllowedTypes('getter', ['null', 'callable']); + $resolver->setAllowedTypes('setter', ['null', 'callable']); + $resolver->setAllowedTypes('form_attr', ['bool', 'string']); + + $resolver->setInfo('getter', 'A callable that accepts two arguments (the view data and the current form field) and must return a value.'); + $resolver->setInfo('setter', 'A callable that accepts three arguments (a reference to the view data, the submitted value and the current form field).'); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'form'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/HiddenType.php b/vendor/symfony/form/Extension/Core/Type/HiddenType.php new file mode 100644 index 0000000..f4258ec --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/HiddenType.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class HiddenType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + // hidden fields cannot have a required attribute + 'required' => false, + // Pass errors to the parent + 'error_bubbling' => true, + 'compound' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The hidden field is invalid.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'hidden'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/IntegerType.php b/vendor/symfony/form/Extension/Core/Type/IntegerType.php new file mode 100644 index 0000000..a1cd058 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/IntegerType.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class IntegerType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addViewTransformer(new IntegerToLocalizedStringTransformer($options['grouping'], $options['rounding_mode'], !$options['grouping'] ? 'en' : null)); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if ($options['grouping']) { + $view->vars['type'] = 'text'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'grouping' => false, + // Integer cast rounds towards 0, so do the same when displaying fractions + 'rounding_mode' => \NumberFormatter::ROUND_DOWN, + 'compound' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter an integer.'; + }, + ]); + + $resolver->setAllowedValues('rounding_mode', [ + \NumberFormatter::ROUND_FLOOR, + \NumberFormatter::ROUND_DOWN, + \NumberFormatter::ROUND_HALFDOWN, + \NumberFormatter::ROUND_HALFEVEN, + \NumberFormatter::ROUND_HALFUP, + \NumberFormatter::ROUND_UP, + \NumberFormatter::ROUND_CEILING, + ]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'integer'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/LanguageType.php b/vendor/symfony/form/Extension/Core/Type/LanguageType.php new file mode 100644 index 0000000..7bcbda2 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/LanguageType.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Intl\Exception\MissingResourceException; +use Symfony\Component\Intl\Intl; +use Symfony\Component\Intl\Languages; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class LanguageType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'choice_loader' => function (Options $options) { + if (!class_exists(Intl::class)) { + throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class)); + } + $choiceTranslationLocale = $options['choice_translation_locale']; + $useAlpha3Codes = $options['alpha3']; + $choiceSelfTranslation = $options['choice_self_translation']; + + return ChoiceList::loader($this, new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale, $useAlpha3Codes, $choiceSelfTranslation) { + if (true === $choiceSelfTranslation) { + foreach (Languages::getLanguageCodes() as $alpha2Code) { + try { + $languageCode = $useAlpha3Codes ? Languages::getAlpha3Code($alpha2Code) : $alpha2Code; + $languagesList[$languageCode] = Languages::getName($alpha2Code, $alpha2Code); + } catch (MissingResourceException $e) { + // ignore errors like "Couldn't read the indices for the locale 'meta'" + } + } + } else { + $languagesList = $useAlpha3Codes ? Languages::getAlpha3Names($choiceTranslationLocale) : Languages::getNames($choiceTranslationLocale); + } + + return array_flip($languagesList); + }), [$choiceTranslationLocale, $useAlpha3Codes, $choiceSelfTranslation]); + }, + 'choice_translation_domain' => false, + 'choice_translation_locale' => null, + 'alpha3' => false, + 'choice_self_translation' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid language.'; + }, + ]); + + $resolver->setAllowedTypes('choice_self_translation', ['bool']); + $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); + $resolver->setAllowedTypes('alpha3', 'bool'); + + $resolver->setNormalizer('choice_self_translation', function (Options $options, $value) { + if (true === $value && $options['choice_translation_locale']) { + throw new LogicException('Cannot use the "choice_self_translation" and "choice_translation_locale" options at the same time. Remove one of them.'); + } + + return $value; + }); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ChoiceType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'language'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/LocaleType.php b/vendor/symfony/form/Extension/Core/Type/LocaleType.php new file mode 100644 index 0000000..14113e4 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/LocaleType.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Intl\Intl; +use Symfony\Component\Intl\Locales; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class LocaleType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'choice_loader' => function (Options $options) { + if (!class_exists(Intl::class)) { + throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s". Try running "composer require symfony/intl".', static::class)); + } + + $choiceTranslationLocale = $options['choice_translation_locale']; + + return ChoiceList::loader($this, new IntlCallbackChoiceLoader(function () use ($choiceTranslationLocale) { + return array_flip(Locales::getNames($choiceTranslationLocale)); + }), $choiceTranslationLocale); + }, + 'choice_translation_domain' => false, + 'choice_translation_locale' => null, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid locale.'; + }, + ]); + + $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ChoiceType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'locale'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/MoneyType.php b/vendor/symfony/form/Extension/Core/Type/MoneyType.php new file mode 100644 index 0000000..6bf7a20 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/MoneyType.php @@ -0,0 +1,149 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class MoneyType extends AbstractType +{ + protected static $patterns = []; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + // Values used in HTML5 number inputs should be formatted as in "1234.5", ie. 'en' format without grouping, + // according to https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats + $builder + ->addViewTransformer(new MoneyToLocalizedStringTransformer( + $options['scale'], + $options['grouping'], + $options['rounding_mode'], + $options['divisor'], + $options['html5'] ? 'en' : null + )) + ; + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['money_pattern'] = self::getPattern($options['currency']); + + if ($options['html5']) { + $view->vars['type'] = 'number'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'scale' => 2, + 'grouping' => false, + 'rounding_mode' => \NumberFormatter::ROUND_HALFUP, + 'divisor' => 1, + 'currency' => 'EUR', + 'compound' => false, + 'html5' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid money amount.'; + }, + ]); + + $resolver->setAllowedValues('rounding_mode', [ + \NumberFormatter::ROUND_FLOOR, + \NumberFormatter::ROUND_DOWN, + \NumberFormatter::ROUND_HALFDOWN, + \NumberFormatter::ROUND_HALFEVEN, + \NumberFormatter::ROUND_HALFUP, + \NumberFormatter::ROUND_UP, + \NumberFormatter::ROUND_CEILING, + ]); + + $resolver->setAllowedTypes('scale', 'int'); + + $resolver->setAllowedTypes('html5', 'bool'); + + $resolver->setNormalizer('grouping', function (Options $options, $value) { + if ($value && $options['html5']) { + throw new LogicException('Cannot use the "grouping" option when the "html5" option is enabled.'); + } + + return $value; + }); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'money'; + } + + /** + * Returns the pattern for this locale in UTF-8. + * + * The pattern contains the placeholder "{{ widget }}" where the HTML tag should + * be inserted + */ + protected static function getPattern(?string $currency) + { + if (!$currency) { + return '{{ widget }}'; + } + + $locale = \Locale::getDefault(); + + if (!isset(self::$patterns[$locale])) { + self::$patterns[$locale] = []; + } + + if (!isset(self::$patterns[$locale][$currency])) { + $format = new \NumberFormatter($locale, \NumberFormatter::CURRENCY); + $pattern = $format->formatCurrency('123', $currency); + + // the spacings between currency symbol and number are ignored, because + // a single space leads to better readability in combination with input + // fields + + // the regex also considers non-break spaces (0xC2 or 0xA0 in UTF-8) + + preg_match('/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u', $pattern, $matches); + + if (!empty($matches[1])) { + self::$patterns[$locale][$currency] = $matches[1].' {{ widget }}'; + } elseif (!empty($matches[2])) { + self::$patterns[$locale][$currency] = '{{ widget }} '.$matches[2]; + } else { + self::$patterns[$locale][$currency] = '{{ widget }}'; + } + } + + return self::$patterns[$locale][$currency]; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/NumberType.php b/vendor/symfony/form/Extension/Core/Type/NumberType.php new file mode 100644 index 0000000..2f6ac6c --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/NumberType.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\StringToFloatTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class NumberType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addViewTransformer(new NumberToLocalizedStringTransformer( + $options['scale'], + $options['grouping'], + $options['rounding_mode'], + $options['html5'] ? 'en' : null + )); + + if ('string' === $options['input']) { + $builder->addModelTransformer(new StringToFloatTransformer($options['scale'])); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if ($options['html5']) { + $view->vars['type'] = 'number'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + // default scale is locale specific (usually around 3) + 'scale' => null, + 'grouping' => false, + 'rounding_mode' => \NumberFormatter::ROUND_HALFUP, + 'compound' => false, + 'input' => 'number', + 'html5' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a number.'; + }, + ]); + + $resolver->setAllowedValues('rounding_mode', [ + \NumberFormatter::ROUND_FLOOR, + \NumberFormatter::ROUND_DOWN, + \NumberFormatter::ROUND_HALFDOWN, + \NumberFormatter::ROUND_HALFEVEN, + \NumberFormatter::ROUND_HALFUP, + \NumberFormatter::ROUND_UP, + \NumberFormatter::ROUND_CEILING, + ]); + $resolver->setAllowedValues('input', ['number', 'string']); + $resolver->setAllowedTypes('scale', ['null', 'int']); + $resolver->setAllowedTypes('html5', 'bool'); + + $resolver->setNormalizer('grouping', function (Options $options, $value) { + if (true === $value && $options['html5']) { + throw new LogicException('Cannot use the "grouping" option when the "html5" option is enabled.'); + } + + return $value; + }); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'number'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/PasswordType.php b/vendor/symfony/form/Extension/Core/Type/PasswordType.php new file mode 100644 index 0000000..779f94d --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/PasswordType.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class PasswordType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if ($options['always_empty'] || !$form->isSubmitted()) { + $view->vars['value'] = ''; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'always_empty' => true, + 'trim' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The password is invalid.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'password'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/PercentType.php b/vendor/symfony/form/Extension/Core/Type/PercentType.php new file mode 100644 index 0000000..90e8fa6 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/PercentType.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class PercentType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addViewTransformer(new PercentToLocalizedStringTransformer( + $options['scale'], + $options['type'], + $options['rounding_mode'], + $options['html5'] + )); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['symbol'] = $options['symbol']; + + if ($options['html5']) { + $view->vars['type'] = 'number'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'scale' => 0, + 'rounding_mode' => function (Options $options) { + trigger_deprecation('symfony/form', '5.1', 'Not configuring the "rounding_mode" option is deprecated. It will default to "\NumberFormatter::ROUND_HALFUP" in Symfony 6.0.'); + + return null; + }, + 'symbol' => '%', + 'type' => 'fractional', + 'compound' => false, + 'html5' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a percentage value.'; + }, + ]); + + $resolver->setAllowedValues('type', [ + 'fractional', + 'integer', + ]); + $resolver->setAllowedValues('rounding_mode', [ + null, + \NumberFormatter::ROUND_FLOOR, + \NumberFormatter::ROUND_DOWN, + \NumberFormatter::ROUND_HALFDOWN, + \NumberFormatter::ROUND_HALFEVEN, + \NumberFormatter::ROUND_HALFUP, + \NumberFormatter::ROUND_UP, + \NumberFormatter::ROUND_CEILING, + ]); + $resolver->setAllowedTypes('scale', 'int'); + $resolver->setAllowedTypes('symbol', ['bool', 'string']); + $resolver->setDeprecated('rounding_mode', 'symfony/form', '5.1', function (Options $options, $roundingMode) { + if (null === $roundingMode) { + return 'Not configuring the "rounding_mode" option is deprecated. It will default to "\NumberFormatter::ROUND_HALFUP" in Symfony 6.0.'; + } + + return ''; + }); + $resolver->setAllowedTypes('html5', 'bool'); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'percent'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/RadioType.php b/vendor/symfony/form/Extension/Core/Type/RadioType.php new file mode 100644 index 0000000..ed999f5 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/RadioType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class RadioType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid option.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return CheckboxType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'radio'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/RangeType.php b/vendor/symfony/form/Extension/Core/Type/RangeType.php new file mode 100644 index 0000000..73ec6e1 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/RangeType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class RangeType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please choose a valid range.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'range'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/RepeatedType.php b/vendor/symfony/form/Extension/Core/Type/RepeatedType.php new file mode 100644 index 0000000..16fa1a7 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/RepeatedType.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class RepeatedType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + // Overwrite required option for child fields + $options['first_options']['required'] = $options['required']; + $options['second_options']['required'] = $options['required']; + + if (!isset($options['options']['error_bubbling'])) { + $options['options']['error_bubbling'] = $options['error_bubbling']; + } + + // children fields must always be mapped + $defaultOptions = ['mapped' => true]; + + $builder + ->addViewTransformer(new ValueToDuplicatesTransformer([ + $options['first_name'], + $options['second_name'], + ])) + ->add($options['first_name'], $options['type'], array_merge($options['options'], $options['first_options'], $defaultOptions)) + ->add($options['second_name'], $options['type'], array_merge($options['options'], $options['second_options'], $defaultOptions)) + ; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'type' => TextType::class, + 'options' => [], + 'first_options' => [], + 'second_options' => [], + 'first_name' => 'first', + 'second_name' => 'second', + 'error_bubbling' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'The values do not match.'; + }, + ]); + + $resolver->setAllowedTypes('options', 'array'); + $resolver->setAllowedTypes('first_options', 'array'); + $resolver->setAllowedTypes('second_options', 'array'); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'repeated'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/ResetType.php b/vendor/symfony/form/Extension/Core/Type/ResetType.php new file mode 100644 index 0000000..ce8013d --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/ResetType.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ButtonTypeInterface; + +/** + * A reset button. + * + * @author Bernhard Schussek + */ +class ResetType extends AbstractType implements ButtonTypeInterface +{ + /** + * {@inheritdoc} + */ + public function getParent() + { + return ButtonType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'reset'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/SearchType.php b/vendor/symfony/form/Extension/Core/Type/SearchType.php new file mode 100644 index 0000000..682277e --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/SearchType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class SearchType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid search term.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'search'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/SubmitType.php b/vendor/symfony/form/Extension/Core/Type/SubmitType.php new file mode 100644 index 0000000..945156e --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/SubmitType.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\SubmitButtonTypeInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A submit button. + * + * @author Bernhard Schussek + */ +class SubmitType extends AbstractType implements SubmitButtonTypeInterface +{ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['clicked'] = $form->isClicked(); + + if (!$options['validate']) { + $view->vars['attr']['formnovalidate'] = true; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefault('validate', true); + $resolver->setAllowedTypes('validate', 'bool'); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ButtonType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'submit'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TelType.php b/vendor/symfony/form/Extension/Core/Type/TelType.php new file mode 100644 index 0000000..bc25fd9 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TelType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class TelType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please provide a valid phone number.'; + }, + ]); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'tel'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TextType.php b/vendor/symfony/form/Extension/Core/Type/TextType.php new file mode 100644 index 0000000..72d21c3 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TextType.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class TextType extends AbstractType implements DataTransformerInterface +{ + public function buildForm(FormBuilderInterface $builder, array $options) + { + // When empty_data is explicitly set to an empty string, + // a string should always be returned when NULL is submitted + // This gives more control and thus helps preventing some issues + // with PHP 7 which allows type hinting strings in functions + // See https://github.com/symfony/symfony/issues/5906#issuecomment-203189375 + if ('' === $options['empty_data']) { + $builder->addViewTransformer($this); + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'compound' => false, + ]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'text'; + } + + /** + * {@inheritdoc} + */ + public function transform($data) + { + // Model data should not be transformed + return $data; + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($data) + { + return $data ?? ''; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TextareaType.php b/vendor/symfony/form/Extension/Core/Type/TextareaType.php new file mode 100644 index 0000000..173b7ef --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TextareaType.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; + +class TextareaType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['pattern'] = null; + unset($view->vars['attr']['pattern']); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'textarea'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TimeType.php b/vendor/symfony/form/Extension/Core/Type/TimeType.php new file mode 100644 index 0000000..c4df4a1 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TimeType.php @@ -0,0 +1,386 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\InvalidConfigurationException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ReversedTransformer; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class TimeType extends AbstractType +{ + private const WIDGETS = [ + 'text' => TextType::class, + 'choice' => ChoiceType::class, + ]; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $parts = ['hour']; + $format = 'H'; + + if ($options['with_seconds'] && !$options['with_minutes']) { + throw new InvalidConfigurationException('You cannot disable minutes if you have enabled seconds.'); + } + + if (null !== $options['reference_date'] && $options['reference_date']->getTimezone()->getName() !== $options['model_timezone']) { + throw new InvalidConfigurationException(sprintf('The configured "model_timezone" (%s) must match the timezone of the "reference_date" (%s).', $options['model_timezone'], $options['reference_date']->getTimezone()->getName())); + } + + if ($options['with_minutes']) { + $format .= ':i'; + $parts[] = 'minute'; + } + + if ($options['with_seconds']) { + $format .= ':s'; + $parts[] = 'second'; + } + + if ('single_text' === $options['widget']) { + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $e) use ($options) { + $data = $e->getData(); + if ($data && preg_match('/^(?P\d{2}):(?P\d{2})(?::(?P\d{2})(?:\.\d+)?)?$/', $data, $matches)) { + if ($options['with_seconds']) { + // handle seconds ignored by user's browser when with_seconds enabled + // https://codereview.chromium.org/450533009/ + $e->setData(sprintf('%s:%s:%s', $matches['hours'], $matches['minutes'], $matches['seconds'] ?? '00')); + } else { + $e->setData(sprintf('%s:%s', $matches['hours'], $matches['minutes'])); + } + } + }); + + if (null !== $options['reference_date']) { + $format = 'Y-m-d '.$format; + + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options) { + $data = $event->getData(); + + if (preg_match('/^\d{2}:\d{2}(:\d{2})?$/', $data)) { + $event->setData($options['reference_date']->format('Y-m-d ').$data); + } + }); + } + + $builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format)); + } else { + $hourOptions = $minuteOptions = $secondOptions = [ + 'error_bubbling' => true, + 'empty_data' => '', + ]; + // when the form is compound the entries of the array are ignored in favor of children data + // so we need to handle the cascade setting here + $emptyData = $builder->getEmptyData() ?: []; + + if ($emptyData instanceof \Closure) { + $lazyEmptyData = static function ($option) use ($emptyData) { + return static function (FormInterface $form) use ($emptyData, $option) { + $emptyData = $emptyData($form->getParent()); + + return $emptyData[$option] ?? ''; + }; + }; + + $hourOptions['empty_data'] = $lazyEmptyData('hour'); + } elseif (isset($emptyData['hour'])) { + $hourOptions['empty_data'] = $emptyData['hour']; + } + + if (isset($options['invalid_message'])) { + $hourOptions['invalid_message'] = $options['invalid_message']; + $minuteOptions['invalid_message'] = $options['invalid_message']; + $secondOptions['invalid_message'] = $options['invalid_message']; + } + + if (isset($options['invalid_message_parameters'])) { + $hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + } + + if ('choice' === $options['widget']) { + $hours = $minutes = []; + + foreach ($options['hours'] as $hour) { + $hours[str_pad($hour, 2, '0', \STR_PAD_LEFT)] = $hour; + } + + // Only pass a subset of the options to children + $hourOptions['choices'] = $hours; + $hourOptions['placeholder'] = $options['placeholder']['hour']; + $hourOptions['choice_translation_domain'] = $options['choice_translation_domain']['hour']; + + if ($options['with_minutes']) { + foreach ($options['minutes'] as $minute) { + $minutes[str_pad($minute, 2, '0', \STR_PAD_LEFT)] = $minute; + } + + $minuteOptions['choices'] = $minutes; + $minuteOptions['placeholder'] = $options['placeholder']['minute']; + $minuteOptions['choice_translation_domain'] = $options['choice_translation_domain']['minute']; + } + + if ($options['with_seconds']) { + $seconds = []; + + foreach ($options['seconds'] as $second) { + $seconds[str_pad($second, 2, '0', \STR_PAD_LEFT)] = $second; + } + + $secondOptions['choices'] = $seconds; + $secondOptions['placeholder'] = $options['placeholder']['second']; + $secondOptions['choice_translation_domain'] = $options['choice_translation_domain']['second']; + } + + // Append generic carry-along options + foreach (['required', 'translation_domain'] as $passOpt) { + $hourOptions[$passOpt] = $options[$passOpt]; + + if ($options['with_minutes']) { + $minuteOptions[$passOpt] = $options[$passOpt]; + } + + if ($options['with_seconds']) { + $secondOptions[$passOpt] = $options[$passOpt]; + } + } + } + + $builder->add('hour', self::WIDGETS[$options['widget']], $hourOptions); + + if ($options['with_minutes']) { + if ($emptyData instanceof \Closure) { + $minuteOptions['empty_data'] = $lazyEmptyData('minute'); + } elseif (isset($emptyData['minute'])) { + $minuteOptions['empty_data'] = $emptyData['minute']; + } + $builder->add('minute', self::WIDGETS[$options['widget']], $minuteOptions); + } + + if ($options['with_seconds']) { + if ($emptyData instanceof \Closure) { + $secondOptions['empty_data'] = $lazyEmptyData('second'); + } elseif (isset($emptyData['second'])) { + $secondOptions['empty_data'] = $emptyData['second']; + } + $builder->add('second', self::WIDGETS[$options['widget']], $secondOptions); + } + + $builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget'], $options['reference_date'])); + } + + if ('datetime_immutable' === $options['input']) { + $builder->addModelTransformer(new DateTimeImmutableToDateTimeTransformer()); + } elseif ('string' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], $options['input_format']) + )); + } elseif ('timestamp' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) + )); + } elseif ('array' === $options['input']) { + $builder->addModelTransformer(new ReversedTransformer( + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts, 'text' === $options['widget'], $options['reference_date']) + )); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars = array_replace($view->vars, [ + 'widget' => $options['widget'], + 'with_minutes' => $options['with_minutes'], + 'with_seconds' => $options['with_seconds'], + ]); + + // Change the input to an HTML5 time input if + // * the widget is set to "single_text" + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget']) { + $view->vars['type'] = 'time'; + + // we need to force the browser to display the seconds by + // adding the HTML attribute step if not already defined. + // Otherwise the browser will not display and so not send the seconds + // therefore the value will always be considered as invalid. + if ($options['with_seconds'] && !isset($view->vars['attr']['step'])) { + $view->vars['attr']['step'] = 1; + } + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $compound = function (Options $options) { + return 'single_text' !== $options['widget']; + }; + + $placeholderDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (\is_array($placeholder)) { + $default = $placeholderDefault($options); + + return array_merge( + ['hour' => $default, 'minute' => $default, 'second' => $default], + $placeholder + ); + } + + return [ + 'hour' => $placeholder, + 'minute' => $placeholder, + 'second' => $placeholder, + ]; + }; + + $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { + if (\is_array($choiceTranslationDomain)) { + $default = false; + + return array_replace( + ['hour' => $default, 'minute' => $default, 'second' => $default], + $choiceTranslationDomain + ); + } + + return [ + 'hour' => $choiceTranslationDomain, + 'minute' => $choiceTranslationDomain, + 'second' => $choiceTranslationDomain, + ]; + }; + + $modelTimezone = static function (Options $options, $value): ?string { + if (null !== $value) { + return $value; + } + + if (null !== $options['reference_date']) { + return $options['reference_date']->getTimezone()->getName(); + } + + return null; + }; + + $viewTimezone = static function (Options $options, $value): ?string { + if (null !== $value) { + return $value; + } + + if (null !== $options['model_timezone'] && null === $options['reference_date']) { + return $options['model_timezone']; + } + + return null; + }; + + $resolver->setDefaults([ + 'hours' => range(0, 23), + 'minutes' => range(0, 59), + 'seconds' => range(0, 59), + 'widget' => 'choice', + 'input' => 'datetime', + 'input_format' => 'H:i:s', + 'with_minutes' => true, + 'with_seconds' => false, + 'model_timezone' => $modelTimezone, + 'view_timezone' => $viewTimezone, + 'reference_date' => null, + 'placeholder' => $placeholderDefault, + 'html5' => true, + // Don't modify \DateTime classes by reference, we treat + // them like immutable value objects + 'by_reference' => false, + 'error_bubbling' => false, + // If initialized with a \DateTime object, FormType initializes + // this option to "\DateTime". Since the internal, normalized + // representation is not \DateTime, but an array, we need to unset + // this option. + 'data_class' => null, + 'empty_data' => function (Options $options) { + return $options['compound'] ? [] : ''; + }, + 'compound' => $compound, + 'choice_translation_domain' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid time.'; + }, + ]); + + $resolver->setNormalizer('view_timezone', function (Options $options, $viewTimezone): ?string { + if (null !== $options['model_timezone'] && $viewTimezone !== $options['model_timezone'] && null === $options['reference_date']) { + throw new LogicException('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'); + } + + return $viewTimezone; + }); + + $resolver->setNormalizer('placeholder', $placeholderNormalizer); + $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); + + $resolver->setAllowedValues('input', [ + 'datetime', + 'datetime_immutable', + 'string', + 'timestamp', + 'array', + ]); + $resolver->setAllowedValues('widget', [ + 'single_text', + 'text', + 'choice', + ]); + + $resolver->setAllowedTypes('hours', 'array'); + $resolver->setAllowedTypes('minutes', 'array'); + $resolver->setAllowedTypes('seconds', 'array'); + $resolver->setAllowedTypes('input_format', 'string'); + $resolver->setAllowedTypes('model_timezone', ['null', 'string']); + $resolver->setAllowedTypes('view_timezone', ['null', 'string']); + $resolver->setAllowedTypes('reference_date', ['null', \DateTimeInterface::class]); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'time'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TimezoneType.php b/vendor/symfony/form/Extension/Core/Type/TimezoneType.php new file mode 100644 index 0000000..31b5df5 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TimezoneType.php @@ -0,0 +1,143 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\ChoiceList\ChoiceList; +use Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\IntlTimeZoneToStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Intl\Intl; +use Symfony\Component\Intl\Timezones; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class TimezoneType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if ('datetimezone' === $options['input']) { + $builder->addModelTransformer(new DateTimeZoneToStringTransformer($options['multiple'])); + } elseif ('intltimezone' === $options['input']) { + $builder->addModelTransformer(new IntlTimeZoneToStringTransformer($options['multiple'])); + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'intl' => false, + 'choice_loader' => function (Options $options) { + $input = $options['input']; + + if ($options['intl']) { + if (!class_exists(Intl::class)) { + throw new LogicException(sprintf('The "symfony/intl" component is required to use "%s" with option "intl=true". Try running "composer require symfony/intl".', static::class)); + } + + $choiceTranslationLocale = $options['choice_translation_locale']; + + return ChoiceList::loader($this, new IntlCallbackChoiceLoader(function () use ($input, $choiceTranslationLocale) { + return self::getIntlTimezones($input, $choiceTranslationLocale); + }), [$input, $choiceTranslationLocale]); + } + + return ChoiceList::lazy($this, function () use ($input) { + return self::getPhpTimezones($input); + }, $input); + }, + 'choice_translation_domain' => false, + 'choice_translation_locale' => null, + 'input' => 'string', + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please select a valid timezone.'; + }, + 'regions' => \DateTimeZone::ALL, + ]); + + $resolver->setAllowedTypes('intl', ['bool']); + + $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']); + $resolver->setNormalizer('choice_translation_locale', function (Options $options, $value) { + if (null !== $value && !$options['intl']) { + throw new LogicException('The "choice_translation_locale" option can only be used if the "intl" option is set to true.'); + } + + return $value; + }); + + $resolver->setAllowedValues('input', ['string', 'datetimezone', 'intltimezone']); + $resolver->setNormalizer('input', function (Options $options, $value) { + if ('intltimezone' === $value && !class_exists(\IntlTimeZone::class)) { + throw new LogicException('Cannot use "intltimezone" input because the PHP intl extension is not available.'); + } + + return $value; + }); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return ChoiceType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'timezone'; + } + + private static function getPhpTimezones(string $input): array + { + $timezones = []; + + foreach (\DateTimeZone::listIdentifiers(\DateTimeZone::ALL) as $timezone) { + if ('intltimezone' === $input && 'Etc/Unknown' === \IntlTimeZone::createTimeZone($timezone)->getID()) { + continue; + } + + $timezones[str_replace(['/', '_'], [' / ', ' '], $timezone)] = $timezone; + } + + return $timezones; + } + + private static function getIntlTimezones(string $input, string $locale = null): array + { + $timezones = array_flip(Timezones::getNames($locale)); + + if ('intltimezone' === $input) { + foreach ($timezones as $name => $timezone) { + if ('Etc/Unknown' === \IntlTimeZone::createTimeZone($timezone)->getID()) { + unset($timezones[$name]); + } + } + } + + return $timezones; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/TransformationFailureExtension.php b/vendor/symfony/form/Extension/Core/Type/TransformationFailureExtension.php new file mode 100644 index 0000000..f766633 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/TransformationFailureExtension.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\EventListener\TransformationFailureListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Christian Flothmann + */ +class TransformationFailureExtension extends AbstractTypeExtension +{ + private $translator; + + public function __construct(TranslatorInterface $translator = null) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (!isset($options['constraints'])) { + $builder->addEventSubscriber(new TransformationFailureListener($this->translator)); + } + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/UlidType.php b/vendor/symfony/form/Extension/Core/Type/UlidType.php new file mode 100644 index 0000000..640d38f --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/UlidType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\UlidToStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Pavel Dyakonov + */ +class UlidType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->addViewTransformer(new UlidToStringTransformer()) + ; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'compound' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid ULID.'; + }, + ]); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/UrlType.php b/vendor/symfony/form/Extension/Core/Type/UrlType.php new file mode 100644 index 0000000..f294a10 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/UrlType.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class UrlType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (null !== $options['default_protocol']) { + $builder->addEventSubscriber(new FixUrlProtocolListener($options['default_protocol'])); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if ($options['default_protocol']) { + $view->vars['attr']['inputmode'] = 'url'; + $view->vars['type'] = 'text'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'default_protocol' => 'http', + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid URL.'; + }, + ]); + + $resolver->setAllowedTypes('default_protocol', ['null', 'string']); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return TextType::class; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'url'; + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/UuidType.php b/vendor/symfony/form/Extension/Core/Type/UuidType.php new file mode 100644 index 0000000..0c27802 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/UuidType.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\DataTransformer\UuidToStringTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Pavel Dyakonov + */ +class UuidType extends AbstractType +{ + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->addViewTransformer(new UuidToStringTransformer()) + ; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'compound' => false, + 'invalid_message' => function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) + ? $previousValue + : 'Please enter a valid UUID.'; + }, + ]); + } +} diff --git a/vendor/symfony/form/Extension/Core/Type/WeekType.php b/vendor/symfony/form/Extension/Core/Type/WeekType.php new file mode 100644 index 0000000..b7f8887 --- /dev/null +++ b/vendor/symfony/form/Extension/Core/Type/WeekType.php @@ -0,0 +1,195 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Extension\Core\DataTransformer\WeekToArrayTransformer; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ReversedTransformer; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class WeekType extends AbstractType +{ + private const WIDGETS = [ + 'text' => IntegerType::class, + 'choice' => ChoiceType::class, + ]; + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if ('string' === $options['input']) { + $builder->addModelTransformer(new WeekToArrayTransformer()); + } + + if ('single_text' === $options['widget']) { + $builder->addViewTransformer(new ReversedTransformer(new WeekToArrayTransformer())); + } else { + $yearOptions = $weekOptions = [ + 'error_bubbling' => true, + 'empty_data' => '', + ]; + // when the form is compound the entries of the array are ignored in favor of children data + // so we need to handle the cascade setting here + $emptyData = $builder->getEmptyData() ?: []; + + $yearOptions['empty_data'] = $emptyData['year'] ?? ''; + $weekOptions['empty_data'] = $emptyData['week'] ?? ''; + + if (isset($options['invalid_message'])) { + $yearOptions['invalid_message'] = $options['invalid_message']; + $weekOptions['invalid_message'] = $options['invalid_message']; + } + + if (isset($options['invalid_message_parameters'])) { + $yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $weekOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + } + + if ('choice' === $options['widget']) { + // Only pass a subset of the options to children + $yearOptions['choices'] = array_combine($options['years'], $options['years']); + $yearOptions['placeholder'] = $options['placeholder']['year']; + $yearOptions['choice_translation_domain'] = $options['choice_translation_domain']['year']; + + $weekOptions['choices'] = array_combine($options['weeks'], $options['weeks']); + $weekOptions['placeholder'] = $options['placeholder']['week']; + $weekOptions['choice_translation_domain'] = $options['choice_translation_domain']['week']; + + // Append generic carry-along options + foreach (['required', 'translation_domain'] as $passOpt) { + $yearOptions[$passOpt] = $options[$passOpt]; + $weekOptions[$passOpt] = $options[$passOpt]; + } + } + + $builder->add('year', self::WIDGETS[$options['widget']], $yearOptions); + $builder->add('week', self::WIDGETS[$options['widget']], $weekOptions); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['widget'] = $options['widget']; + + if ($options['html5']) { + $view->vars['type'] = 'week'; + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $compound = function (Options $options) { + return 'single_text' !== $options['widget']; + }; + + $placeholderDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $placeholderNormalizer = function (Options $options, $placeholder) use ($placeholderDefault) { + if (\is_array($placeholder)) { + $default = $placeholderDefault($options); + + return array_merge( + ['year' => $default, 'week' => $default], + $placeholder + ); + } + + return [ + 'year' => $placeholder, + 'week' => $placeholder, + ]; + }; + + $choiceTranslationDomainNormalizer = function (Options $options, $choiceTranslationDomain) { + if (\is_array($choiceTranslationDomain)) { + $default = false; + + return array_replace( + ['year' => $default, 'week' => $default], + $choiceTranslationDomain + ); + } + + return [ + 'year' => $choiceTranslationDomain, + 'week' => $choiceTranslationDomain, + ]; + }; + + $resolver->setDefaults([ + 'years' => range(date('Y') - 10, date('Y') + 10), + 'weeks' => array_combine(range(1, 53), range(1, 53)), + 'widget' => 'single_text', + 'input' => 'array', + 'placeholder' => $placeholderDefault, + 'html5' => static function (Options $options) { + return 'single_text' === $options['widget']; + }, + 'error_bubbling' => false, + 'empty_data' => function (Options $options) { + return $options['compound'] ? [] : ''; + }, + 'compound' => $compound, + 'choice_translation_domain' => false, + 'invalid_message' => static function (Options $options, $previousValue) { + return ($options['legacy_error_messages'] ?? true) ? $previousValue : 'Please enter a valid week.'; + }, + ]); + + $resolver->setNormalizer('placeholder', $placeholderNormalizer); + $resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer); + $resolver->setNormalizer('html5', function (Options $options, $html5) { + if ($html5 && 'single_text' !== $options['widget']) { + throw new LogicException(sprintf('The "widget" option of "%s" must be set to "single_text" when the "html5" option is enabled.', self::class)); + } + + return $html5; + }); + + $resolver->setAllowedValues('input', [ + 'string', + 'array', + ]); + + $resolver->setAllowedValues('widget', [ + 'single_text', + 'text', + 'choice', + ]); + + $resolver->setAllowedTypes('years', 'int[]'); + $resolver->setAllowedTypes('weeks', 'int[]'); + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return 'week'; + } +} diff --git a/vendor/symfony/form/Extension/Csrf/CsrfExtension.php b/vendor/symfony/form/Extension/Csrf/CsrfExtension.php new file mode 100644 index 0000000..609a371 --- /dev/null +++ b/vendor/symfony/form/Extension/Csrf/CsrfExtension.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Csrf; + +use Symfony\Component\Form\AbstractExtension; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * This extension protects forms by using a CSRF token. + * + * @author Bernhard Schussek + */ +class CsrfExtension extends AbstractExtension +{ + private $tokenManager; + private $translator; + private $translationDomain; + + public function __construct(CsrfTokenManagerInterface $tokenManager, TranslatorInterface $translator = null, string $translationDomain = null) + { + $this->tokenManager = $tokenManager; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + } + + /** + * {@inheritdoc} + */ + protected function loadTypeExtensions() + { + return [ + new Type\FormTypeCsrfExtension($this->tokenManager, true, '_token', $this->translator, $this->translationDomain), + ]; + } +} diff --git a/vendor/symfony/form/Extension/Csrf/EventListener/CsrfValidationListener.php b/vendor/symfony/form/Extension/Csrf/EventListener/CsrfValidationListener.php new file mode 100644 index 0000000..37548ef --- /dev/null +++ b/vendor/symfony/form/Extension/Csrf/EventListener/CsrfValidationListener.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Csrf\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\Util\ServerParams; +use Symfony\Component\Security\Csrf\CsrfToken; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Bernhard Schussek + */ +class CsrfValidationListener implements EventSubscriberInterface +{ + private $fieldName; + private $tokenManager; + private $tokenId; + private $errorMessage; + private $translator; + private $translationDomain; + private $serverParams; + + public static function getSubscribedEvents() + { + return [ + FormEvents::PRE_SUBMIT => 'preSubmit', + ]; + } + + public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, TranslatorInterface $translator = null, string $translationDomain = null, ServerParams $serverParams = null) + { + $this->fieldName = $fieldName; + $this->tokenManager = $tokenManager; + $this->tokenId = $tokenId; + $this->errorMessage = $errorMessage; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->serverParams = $serverParams ?? new ServerParams(); + } + + public function preSubmit(FormEvent $event) + { + $form = $event->getForm(); + $postRequestSizeExceeded = 'POST' === $form->getConfig()->getMethod() && $this->serverParams->hasPostMaxSizeBeenExceeded(); + + if ($form->isRoot() && $form->getConfig()->getOption('compound') && !$postRequestSizeExceeded) { + $data = $event->getData(); + + $csrfValue = \is_string($data[$this->fieldName] ?? null) ? $data[$this->fieldName] : null; + $csrfToken = new CsrfToken($this->tokenId, $csrfValue); + + if (null === $csrfValue || !$this->tokenManager->isTokenValid($csrfToken)) { + $errorMessage = $this->errorMessage; + + if (null !== $this->translator) { + $errorMessage = $this->translator->trans($errorMessage, [], $this->translationDomain); + } + + $form->addError(new FormError($errorMessage, $errorMessage, [], null, $csrfToken)); + } + + if (\is_array($data)) { + unset($data[$this->fieldName]); + $event->setData($data); + } + } + } +} diff --git a/vendor/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/vendor/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php new file mode 100644 index 0000000..cd17b8e --- /dev/null +++ b/vendor/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Csrf\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\Util\ServerParams; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Bernhard Schussek + */ +class FormTypeCsrfExtension extends AbstractTypeExtension +{ + private $defaultTokenManager; + private $defaultEnabled; + private $defaultFieldName; + private $translator; + private $translationDomain; + private $serverParams; + + public function __construct(CsrfTokenManagerInterface $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '_token', TranslatorInterface $translator = null, string $translationDomain = null, ServerParams $serverParams = null) + { + $this->defaultTokenManager = $defaultTokenManager; + $this->defaultEnabled = $defaultEnabled; + $this->defaultFieldName = $defaultFieldName; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->serverParams = $serverParams; + } + + /** + * Adds a CSRF field to the form when the CSRF protection is enabled. + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (!$options['csrf_protection']) { + return; + } + + $builder + ->addEventSubscriber(new CsrfValidationListener( + $options['csrf_field_name'], + $options['csrf_token_manager'], + $options['csrf_token_id'] ?: ($builder->getName() ?: \get_class($builder->getType()->getInnerType())), + $options['csrf_message'], + $this->translator, + $this->translationDomain, + $this->serverParams + )) + ; + } + + /** + * Adds a CSRF field to the root form view. + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + if ($options['csrf_protection'] && !$view->parent && $options['compound']) { + $factory = $form->getConfig()->getFormFactory(); + $tokenId = $options['csrf_token_id'] ?: ($form->getName() ?: \get_class($form->getConfig()->getType()->getInnerType())); + $data = (string) $options['csrf_token_manager']->getToken($tokenId); + + $csrfForm = $factory->createNamed($options['csrf_field_name'], HiddenType::class, $data, [ + 'block_prefix' => 'csrf_token', + 'mapped' => false, + ]); + + $view->children[$options['csrf_field_name']] = $csrfForm->createView($view); + } + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'csrf_protection' => $this->defaultEnabled, + 'csrf_field_name' => $this->defaultFieldName, + 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', + 'csrf_token_manager' => $this->defaultTokenManager, + 'csrf_token_id' => null, + ]); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/DataCollectorExtension.php b/vendor/symfony/form/Extension/DataCollector/DataCollectorExtension.php new file mode 100644 index 0000000..4b23513 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/DataCollectorExtension.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector; + +use Symfony\Component\Form\AbstractExtension; + +/** + * Extension for collecting data of the forms on a page. + * + * @author Robert Schönthal + * @author Bernhard Schussek + */ +class DataCollectorExtension extends AbstractExtension +{ + private $dataCollector; + + public function __construct(FormDataCollectorInterface $dataCollector) + { + $this->dataCollector = $dataCollector; + } + + /** + * {@inheritdoc} + */ + protected function loadTypeExtensions() + { + return [ + new Type\DataCollectorTypeExtension($this->dataCollector), + ]; + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/EventListener/DataCollectorListener.php b/vendor/symfony/form/Extension/DataCollector/EventListener/DataCollectorListener.php new file mode 100644 index 0000000..77595ab --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/EventListener/DataCollectorListener.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; + +/** + * Listener that invokes a data collector for the {@link FormEvents::POST_SET_DATA} + * and {@link FormEvents::POST_SUBMIT} events. + * + * @author Bernhard Schussek + */ +class DataCollectorListener implements EventSubscriberInterface +{ + private $dataCollector; + + public function __construct(FormDataCollectorInterface $dataCollector) + { + $this->dataCollector = $dataCollector; + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [ + // High priority in order to be called as soon as possible + FormEvents::POST_SET_DATA => ['postSetData', 255], + // Low priority in order to be called as late as possible + FormEvents::POST_SUBMIT => ['postSubmit', -255], + ]; + } + + /** + * Listener for the {@link FormEvents::POST_SET_DATA} event. + */ + public function postSetData(FormEvent $event) + { + if ($event->getForm()->isRoot()) { + // Collect basic information about each form + $this->dataCollector->collectConfiguration($event->getForm()); + + // Collect the default data + $this->dataCollector->collectDefaultData($event->getForm()); + } + } + + /** + * Listener for the {@link FormEvents::POST_SUBMIT} event. + */ + public function postSubmit(FormEvent $event) + { + if ($event->getForm()->isRoot()) { + // Collect the submitted data of each form + $this->dataCollector->collectSubmittedData($event->getForm()); + + // Assemble a form tree + // This is done again after the view is built, but we need it here as the view is not always created. + $this->dataCollector->buildPreliminaryFormTree($event->getForm()); + } + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/FormDataCollector.php b/vendor/symfony/form/Extension/DataCollector/FormDataCollector.php new file mode 100644 index 0000000..2fe2fbe --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/FormDataCollector.php @@ -0,0 +1,343 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Caster\ClassStub; +use Symfony\Component\VarDumper\Caster\StubCaster; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Data collector for {@link FormInterface} instances. + * + * @author Robert Schönthal + * @author Bernhard Schussek + * + * @final + */ +class FormDataCollector extends DataCollector implements FormDataCollectorInterface +{ + private $dataExtractor; + + /** + * Stores the collected data per {@link FormInterface} instance. + * + * Uses the hashes of the forms as keys. This is preferable over using + * {@link \SplObjectStorage}, because in this way no references are kept + * to the {@link FormInterface} instances. + * + * @var array + */ + private $dataByForm; + + /** + * Stores the collected data per {@link FormView} instance. + * + * Uses the hashes of the views as keys. This is preferable over using + * {@link \SplObjectStorage}, because in this way no references are kept + * to the {@link FormView} instances. + * + * @var array + */ + private $dataByView; + + /** + * Connects {@link FormView} with {@link FormInterface} instances. + * + * Uses the hashes of the views as keys and the hashes of the forms as + * values. This is preferable over storing the objects directly, because + * this way they can safely be discarded by the GC. + * + * @var array + */ + private $formsByView; + + public function __construct(FormDataExtractorInterface $dataExtractor) + { + if (!class_exists(ClassStub::class)) { + throw new \LogicException(sprintf('The VarDumper component is needed for using the "%s" class. Install symfony/var-dumper version 3.4 or above.', __CLASS__)); + } + + $this->dataExtractor = $dataExtractor; + + $this->reset(); + } + + /** + * Does nothing. The data is collected during the form event listeners. + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + } + + public function reset() + { + $this->data = [ + 'forms' => [], + 'forms_by_hash' => [], + 'nb_errors' => 0, + ]; + } + + /** + * {@inheritdoc} + */ + public function associateFormWithView(FormInterface $form, FormView $view) + { + $this->formsByView[spl_object_hash($view)] = spl_object_hash($form); + } + + /** + * {@inheritdoc} + */ + public function collectConfiguration(FormInterface $form) + { + $hash = spl_object_hash($form); + + if (!isset($this->dataByForm[$hash])) { + $this->dataByForm[$hash] = []; + } + + $this->dataByForm[$hash] = array_replace( + $this->dataByForm[$hash], + $this->dataExtractor->extractConfiguration($form) + ); + + foreach ($form as $child) { + $this->collectConfiguration($child); + } + } + + /** + * {@inheritdoc} + */ + public function collectDefaultData(FormInterface $form) + { + $hash = spl_object_hash($form); + + if (!isset($this->dataByForm[$hash])) { + // field was created by form event + $this->collectConfiguration($form); + } + + $this->dataByForm[$hash] = array_replace( + $this->dataByForm[$hash], + $this->dataExtractor->extractDefaultData($form) + ); + + foreach ($form as $child) { + $this->collectDefaultData($child); + } + } + + /** + * {@inheritdoc} + */ + public function collectSubmittedData(FormInterface $form) + { + $hash = spl_object_hash($form); + + if (!isset($this->dataByForm[$hash])) { + // field was created by form event + $this->collectConfiguration($form); + $this->collectDefaultData($form); + } + + $this->dataByForm[$hash] = array_replace( + $this->dataByForm[$hash], + $this->dataExtractor->extractSubmittedData($form) + ); + + // Count errors + if (isset($this->dataByForm[$hash]['errors'])) { + $this->data['nb_errors'] += \count($this->dataByForm[$hash]['errors']); + } + + foreach ($form as $child) { + $this->collectSubmittedData($child); + + // Expand current form if there are children with errors + if (empty($this->dataByForm[$hash]['has_children_error'])) { + $childData = $this->dataByForm[spl_object_hash($child)]; + $this->dataByForm[$hash]['has_children_error'] = !empty($childData['has_children_error']) || !empty($childData['errors']); + } + } + } + + /** + * {@inheritdoc} + */ + public function collectViewVariables(FormView $view) + { + $hash = spl_object_hash($view); + + if (!isset($this->dataByView[$hash])) { + $this->dataByView[$hash] = []; + } + + $this->dataByView[$hash] = array_replace( + $this->dataByView[$hash], + $this->dataExtractor->extractViewVariables($view) + ); + + foreach ($view->children as $child) { + $this->collectViewVariables($child); + } + } + + /** + * {@inheritdoc} + */ + public function buildPreliminaryFormTree(FormInterface $form) + { + $this->data['forms'][$form->getName()] = &$this->recursiveBuildPreliminaryFormTree($form, $this->data['forms_by_hash']); + } + + /** + * {@inheritdoc} + */ + public function buildFinalFormTree(FormInterface $form, FormView $view) + { + $this->data['forms'][$form->getName()] = &$this->recursiveBuildFinalFormTree($form, $view, $this->data['forms_by_hash']); + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return 'form'; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + return $this->data; + } + + /** + * @internal + */ + public function __sleep(): array + { + foreach ($this->data['forms_by_hash'] as &$form) { + if (isset($form['type_class']) && !$form['type_class'] instanceof ClassStub) { + $form['type_class'] = new ClassStub($form['type_class']); + } + } + + $this->data = $this->cloneVar($this->data); + + return parent::__sleep(); + } + + /** + * {@inheritdoc} + */ + protected function getCasters(): array + { + return parent::getCasters() + [ + \Exception::class => function (\Exception $e, array $a, Stub $s) { + foreach (["\0Exception\0previous", "\0Exception\0trace"] as $k) { + if (isset($a[$k])) { + unset($a[$k]); + ++$s->cut; + } + } + + return $a; + }, + FormInterface::class => function (FormInterface $f, array $a) { + return [ + Caster::PREFIX_VIRTUAL.'name' => $f->getName(), + Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(\get_class($f->getConfig()->getType()->getInnerType())), + ]; + }, + FormView::class => [StubCaster::class, 'cutInternals'], + ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) { + return [ + Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(), + Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(), + Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(), + ]; + }, + ]; + } + + private function &recursiveBuildPreliminaryFormTree(FormInterface $form, array &$outputByHash) + { + $hash = spl_object_hash($form); + + $output = &$outputByHash[$hash]; + $output = $this->dataByForm[$hash] + ?? []; + + $output['children'] = []; + + foreach ($form as $name => $child) { + $output['children'][$name] = &$this->recursiveBuildPreliminaryFormTree($child, $outputByHash); + } + + return $output; + } + + private function &recursiveBuildFinalFormTree(FormInterface $form = null, FormView $view, array &$outputByHash) + { + $viewHash = spl_object_hash($view); + $formHash = null; + + if (null !== $form) { + $formHash = spl_object_hash($form); + } elseif (isset($this->formsByView[$viewHash])) { + // The FormInterface instance of the CSRF token is never contained in + // the FormInterface tree of the form, so we need to get the + // corresponding FormInterface instance for its view in a different way + $formHash = $this->formsByView[$viewHash]; + } + if (null !== $formHash) { + $output = &$outputByHash[$formHash]; + } + + $output = $this->dataByView[$viewHash] + ?? []; + + if (null !== $formHash) { + $output = array_replace( + $output, + $this->dataByForm[$formHash] + ?? [] + ); + } + + $output['children'] = []; + + foreach ($view->children as $name => $childView) { + // The CSRF token, for example, is never added to the form tree. + // It is only present in the view. + $childForm = null !== $form && $form->has($name) + ? $form->get($name) + : null; + + $output['children'][$name] = &$this->recursiveBuildFinalFormTree($childForm, $childView, $outputByHash); + } + + return $output; + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/FormDataCollectorInterface.php b/vendor/symfony/form/Extension/DataCollector/FormDataCollectorInterface.php new file mode 100644 index 0000000..64b8f83 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/FormDataCollectorInterface.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; +use Symfony\Component\VarDumper\Cloner\Data; + +/** + * Collects and structures information about forms. + * + * @author Bernhard Schussek + */ +interface FormDataCollectorInterface extends DataCollectorInterface +{ + /** + * Stores configuration data of the given form and its children. + */ + public function collectConfiguration(FormInterface $form); + + /** + * Stores the default data of the given form and its children. + */ + public function collectDefaultData(FormInterface $form); + + /** + * Stores the submitted data of the given form and its children. + */ + public function collectSubmittedData(FormInterface $form); + + /** + * Stores the view variables of the given form view and its children. + */ + public function collectViewVariables(FormView $view); + + /** + * Specifies that the given objects represent the same conceptual form. + */ + public function associateFormWithView(FormInterface $form, FormView $view); + + /** + * Assembles the data collected about the given form and its children as + * a tree-like data structure. + * + * The result can be queried using {@link getData()}. + */ + public function buildPreliminaryFormTree(FormInterface $form); + + /** + * Assembles the data collected about the given form and its children as + * a tree-like data structure. + * + * The result can be queried using {@link getData()}. + * + * Contrary to {@link buildPreliminaryFormTree()}, a {@link FormView} + * object has to be passed. The tree structure of this view object will be + * used for structuring the resulting data. That means, if a child is + * present in the view, but not in the form, it will be present in the final + * data array anyway. + * + * When {@link FormView} instances are present in the view tree, for which + * no corresponding {@link FormInterface} objects can be found in the form + * tree, only the view data will be included in the result. If a + * corresponding {@link FormInterface} exists otherwise, call + * {@link associateFormWithView()} before calling this method. + */ + public function buildFinalFormTree(FormInterface $form, FormView $view); + + /** + * Returns all collected data. + * + * @return array|Data + */ + public function getData(); +} diff --git a/vendor/symfony/form/Extension/DataCollector/FormDataExtractor.php b/vendor/symfony/form/Extension/DataCollector/FormDataExtractor.php new file mode 100644 index 0000000..9cecc72 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/FormDataExtractor.php @@ -0,0 +1,168 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Validator\ConstraintViolationInterface; + +/** + * Default implementation of {@link FormDataExtractorInterface}. + * + * @author Bernhard Schussek + */ +class FormDataExtractor implements FormDataExtractorInterface +{ + /** + * {@inheritdoc} + */ + public function extractConfiguration(FormInterface $form) + { + $data = [ + 'id' => $this->buildId($form), + 'name' => $form->getName(), + 'type_class' => \get_class($form->getConfig()->getType()->getInnerType()), + 'synchronized' => $form->isSynchronized(), + 'passed_options' => [], + 'resolved_options' => [], + ]; + + foreach ($form->getConfig()->getAttribute('data_collector/passed_options', []) as $option => $value) { + $data['passed_options'][$option] = $value; + } + + foreach ($form->getConfig()->getOptions() as $option => $value) { + $data['resolved_options'][$option] = $value; + } + + ksort($data['passed_options']); + ksort($data['resolved_options']); + + return $data; + } + + /** + * {@inheritdoc} + */ + public function extractDefaultData(FormInterface $form) + { + $data = [ + 'default_data' => [ + 'norm' => $form->getNormData(), + ], + 'submitted_data' => [], + ]; + + if ($form->getData() !== $form->getNormData()) { + $data['default_data']['model'] = $form->getData(); + } + + if ($form->getViewData() !== $form->getNormData()) { + $data['default_data']['view'] = $form->getViewData(); + } + + return $data; + } + + /** + * {@inheritdoc} + */ + public function extractSubmittedData(FormInterface $form) + { + $data = [ + 'submitted_data' => [ + 'norm' => $form->getNormData(), + ], + 'errors' => [], + ]; + + if ($form->getViewData() !== $form->getNormData()) { + $data['submitted_data']['view'] = $form->getViewData(); + } + + if ($form->getData() !== $form->getNormData()) { + $data['submitted_data']['model'] = $form->getData(); + } + + foreach ($form->getErrors() as $error) { + $errorData = [ + 'message' => $error->getMessage(), + 'origin' => \is_object($error->getOrigin()) + ? spl_object_hash($error->getOrigin()) + : null, + 'trace' => [], + ]; + + $cause = $error->getCause(); + + while (null !== $cause) { + if ($cause instanceof ConstraintViolationInterface) { + $errorData['trace'][] = $cause; + $cause = method_exists($cause, 'getCause') ? $cause->getCause() : null; + + continue; + } + + if ($cause instanceof \Exception) { + $errorData['trace'][] = $cause; + $cause = $cause->getPrevious(); + + continue; + } + + $errorData['trace'][] = $cause; + + break; + } + + $data['errors'][] = $errorData; + } + + $data['synchronized'] = $form->isSynchronized(); + + return $data; + } + + /** + * {@inheritdoc} + */ + public function extractViewVariables(FormView $view) + { + $data = [ + 'id' => $view->vars['id'] ?? null, + 'name' => $view->vars['name'] ?? null, + 'view_vars' => [], + ]; + + foreach ($view->vars as $varName => $value) { + $data['view_vars'][$varName] = $value; + } + + ksort($data['view_vars']); + + return $data; + } + + /** + * Recursively builds an HTML ID for a form. + */ + private function buildId(FormInterface $form): string + { + $id = $form->getName(); + + if (null !== $form->getParent()) { + $id = $this->buildId($form->getParent()).'_'.$id; + } + + return $id; + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/FormDataExtractorInterface.php b/vendor/symfony/form/Extension/DataCollector/FormDataExtractorInterface.php new file mode 100644 index 0000000..7e82286 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/FormDataExtractorInterface.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; + +/** + * Extracts arrays of information out of forms. + * + * @author Bernhard Schussek + */ +interface FormDataExtractorInterface +{ + /** + * Extracts the configuration data of a form. + * + * @return array + */ + public function extractConfiguration(FormInterface $form); + + /** + * Extracts the default data of a form. + * + * @return array + */ + public function extractDefaultData(FormInterface $form); + + /** + * Extracts the submitted data of a form. + * + * @return array + */ + public function extractSubmittedData(FormInterface $form); + + /** + * Extracts the view variables of a form. + * + * @return array + */ + public function extractViewVariables(FormView $view); +} diff --git a/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php b/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php new file mode 100644 index 0000000..54358d5 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector\Proxy; + +use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\ResolvedFormTypeInterface; + +/** + * Proxy that invokes a data collector when creating a form and its view. + * + * @author Bernhard Schussek + */ +class ResolvedTypeDataCollectorProxy implements ResolvedFormTypeInterface +{ + private $proxiedType; + private $dataCollector; + + public function __construct(ResolvedFormTypeInterface $proxiedType, FormDataCollectorInterface $dataCollector) + { + $this->proxiedType = $proxiedType; + $this->dataCollector = $dataCollector; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return $this->proxiedType->getBlockPrefix(); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return $this->proxiedType->getParent(); + } + + /** + * {@inheritdoc} + */ + public function getInnerType() + { + return $this->proxiedType->getInnerType(); + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions() + { + return $this->proxiedType->getTypeExtensions(); + } + + /** + * {@inheritdoc} + */ + public function createBuilder(FormFactoryInterface $factory, string $name, array $options = []) + { + $builder = $this->proxiedType->createBuilder($factory, $name, $options); + + $builder->setAttribute('data_collector/passed_options', $options); + $builder->setType($this); + + return $builder; + } + + /** + * {@inheritdoc} + */ + public function createView(FormInterface $form, FormView $parent = null) + { + return $this->proxiedType->createView($form, $parent); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $this->proxiedType->buildForm($builder, $options); + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + $this->proxiedType->buildView($view, $form, $options); + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + $this->proxiedType->finishView($view, $form, $options); + + // Remember which view belongs to which form instance, so that we can + // get the collected data for a view when its form instance is not + // available (e.g. CSRF token) + $this->dataCollector->associateFormWithView($form, $view); + + // Since the CSRF token is only present in the FormView tree, we also + // need to check the FormView tree instead of calling isRoot() on the + // FormInterface tree + if (null === $view->parent) { + $this->dataCollector->collectViewVariables($view); + + // Re-assemble data, in case FormView instances were added, for + // which no FormInterface instances were present (e.g. CSRF token). + // Since finishView() is called after finishing the views of all + // children, we can safely assume that information has been + // collected about the complete form tree. + $this->dataCollector->buildFinalFormTree($form, $view); + } + } + + /** + * {@inheritdoc} + */ + public function getOptionsResolver() + { + return $this->proxiedType->getOptionsResolver(); + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php b/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php new file mode 100644 index 0000000..068d5cc --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector\Proxy; + +use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; +use Symfony\Component\Form\FormTypeInterface; +use Symfony\Component\Form\ResolvedFormTypeFactoryInterface; +use Symfony\Component\Form\ResolvedFormTypeInterface; + +/** + * Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy} + * instances. + * + * @author Bernhard Schussek + */ +class ResolvedTypeFactoryDataCollectorProxy implements ResolvedFormTypeFactoryInterface +{ + private $proxiedFactory; + private $dataCollector; + + public function __construct(ResolvedFormTypeFactoryInterface $proxiedFactory, FormDataCollectorInterface $dataCollector) + { + $this->proxiedFactory = $proxiedFactory; + $this->dataCollector = $dataCollector; + } + + /** + * {@inheritdoc} + */ + public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null) + { + return new ResolvedTypeDataCollectorProxy( + $this->proxiedFactory->createResolvedType($type, $typeExtensions, $parent), + $this->dataCollector + ); + } +} diff --git a/vendor/symfony/form/Extension/DataCollector/Type/DataCollectorTypeExtension.php b/vendor/symfony/form/Extension/DataCollector/Type/DataCollectorTypeExtension.php new file mode 100644 index 0000000..d25fd13 --- /dev/null +++ b/vendor/symfony/form/Extension/DataCollector/Type/DataCollectorTypeExtension.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DataCollector\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\DataCollector\EventListener\DataCollectorListener; +use Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface; +use Symfony\Component\Form\FormBuilderInterface; + +/** + * Type extension for collecting data of a form with this type. + * + * @author Robert Schönthal + * @author Bernhard Schussek + */ +class DataCollectorTypeExtension extends AbstractTypeExtension +{ + /** + * @var DataCollectorListener + */ + private $listener; + + public function __construct(FormDataCollectorInterface $dataCollector) + { + $this->listener = new DataCollectorListener($dataCollector); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addEventSubscriber($this->listener); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php b/vendor/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php new file mode 100644 index 0000000..5d61a06 --- /dev/null +++ b/vendor/symfony/form/Extension/DependencyInjection/DependencyInjectionExtension.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\DependencyInjection; + +use Psr\Container\ContainerInterface; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\FormExtensionInterface; +use Symfony\Component\Form\FormTypeGuesserChain; + +class DependencyInjectionExtension implements FormExtensionInterface +{ + private $guesser; + private $guesserLoaded = false; + private $typeContainer; + private $typeExtensionServices; + private $guesserServices; + + /** + * @param iterable[] $typeExtensionServices + */ + public function __construct(ContainerInterface $typeContainer, array $typeExtensionServices, iterable $guesserServices) + { + $this->typeContainer = $typeContainer; + $this->typeExtensionServices = $typeExtensionServices; + $this->guesserServices = $guesserServices; + } + + /** + * {@inheritdoc} + */ + public function getType(string $name) + { + if (!$this->typeContainer->has($name)) { + throw new InvalidArgumentException(sprintf('The field type "%s" is not registered in the service container.', $name)); + } + + return $this->typeContainer->get($name); + } + + /** + * {@inheritdoc} + */ + public function hasType(string $name) + { + return $this->typeContainer->has($name); + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions(string $name) + { + $extensions = []; + + if (isset($this->typeExtensionServices[$name])) { + foreach ($this->typeExtensionServices[$name] as $extension) { + $extensions[] = $extension; + + $extendedTypes = []; + foreach ($extension::getExtendedTypes() as $extendedType) { + $extendedTypes[] = $extendedType; + } + + // validate the result of getExtendedTypes() to ensure it is consistent with the service definition + if (!\in_array($name, $extendedTypes, true)) { + throw new InvalidArgumentException(sprintf('The extended type "%s" specified for the type extension class "%s" does not match any of the actual extended types (["%s"]).', $name, \get_class($extension), implode('", "', $extendedTypes))); + } + } + } + + return $extensions; + } + + /** + * {@inheritdoc} + */ + public function hasTypeExtensions(string $name) + { + return isset($this->typeExtensionServices[$name]); + } + + /** + * {@inheritdoc} + */ + public function getTypeGuesser() + { + if (!$this->guesserLoaded) { + $this->guesserLoaded = true; + $guessers = []; + + foreach ($this->guesserServices as $serviceId => $service) { + $guessers[] = $service; + } + + if ($guessers) { + $this->guesser = new FormTypeGuesserChain($guessers); + } + } + + return $this->guesser; + } +} diff --git a/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationExtension.php b/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationExtension.php new file mode 100644 index 0000000..27305ad --- /dev/null +++ b/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationExtension.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\HttpFoundation; + +use Symfony\Component\Form\AbstractExtension; + +/** + * Integrates the HttpFoundation component with the Form library. + * + * @author Bernhard Schussek + */ +class HttpFoundationExtension extends AbstractExtension +{ + protected function loadTypeExtensions() + { + return [ + new Type\FormTypeHttpFoundationExtension(), + ]; + } +} diff --git a/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php b/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php new file mode 100644 index 0000000..05503ff --- /dev/null +++ b/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\HttpFoundation; + +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\RequestHandlerInterface; +use Symfony\Component\Form\Util\ServerParams; +use Symfony\Component\HttpFoundation\File\File; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Request; + +/** + * A request processor using the {@link Request} class of the HttpFoundation + * component. + * + * @author Bernhard Schussek + */ +class HttpFoundationRequestHandler implements RequestHandlerInterface +{ + private $serverParams; + + public function __construct(ServerParams $serverParams = null) + { + $this->serverParams = $serverParams ?? new ServerParams(); + } + + /** + * {@inheritdoc} + */ + public function handleRequest(FormInterface $form, $request = null) + { + if (!$request instanceof Request) { + throw new UnexpectedTypeException($request, 'Symfony\Component\HttpFoundation\Request'); + } + + $name = $form->getName(); + $method = $form->getConfig()->getMethod(); + + if ($method !== $request->getMethod()) { + return; + } + + // For request methods that must not have a request body we fetch data + // from the query string. Otherwise we look for data in the request body. + if ('GET' === $method || 'HEAD' === $method || 'TRACE' === $method) { + if ('' === $name) { + $data = $request->query->all(); + } else { + // Don't submit GET requests if the form's name does not exist + // in the request + if (!$request->query->has($name)) { + return; + } + + $data = $request->query->all()[$name]; + } + } else { + // Mark the form with an error if the uploaded size was too large + // This is done here and not in FormValidator because $_POST is + // empty when that error occurs. Hence the form is never submitted. + if ($this->serverParams->hasPostMaxSizeBeenExceeded()) { + // Submit the form, but don't clear the default values + $form->submit(null, false); + + $form->addError(new FormError( + $form->getConfig()->getOption('upload_max_size_message')(), + null, + ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()] + )); + + return; + } + + if ('' === $name) { + $params = $request->request->all(); + $files = $request->files->all(); + } elseif ($request->request->has($name) || $request->files->has($name)) { + $default = $form->getConfig()->getCompound() ? [] : null; + $params = $request->request->all()[$name] ?? $default; + $files = $request->files->get($name, $default); + } else { + // Don't submit the form if it is not present in the request + return; + } + + if (\is_array($params) && \is_array($files)) { + $data = array_replace_recursive($params, $files); + } else { + $data = $params ?: $files; + } + } + + // Don't auto-submit the form unless at least one field is present. + if ('' === $name && \count(array_intersect_key($data, $form->all())) <= 0) { + return; + } + + $form->submit($data, 'PATCH' !== $method); + } + + /** + * {@inheritdoc} + */ + public function isFileUpload($data) + { + return $data instanceof File; + } + + /** + * @return int|null + */ + public function getUploadFileError($data) + { + if (!$data instanceof UploadedFile || $data->isValid()) { + return null; + } + + return $data->getError(); + } +} diff --git a/vendor/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/vendor/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php new file mode 100644 index 0000000..0d77f06 --- /dev/null +++ b/vendor/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\HttpFoundation\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\RequestHandlerInterface; + +/** + * @author Bernhard Schussek + */ +class FormTypeHttpFoundationExtension extends AbstractTypeExtension +{ + private $requestHandler; + + public function __construct(RequestHandlerInterface $requestHandler = null) + { + $this->requestHandler = $requestHandler ?? new HttpFoundationRequestHandler(); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->setRequestHandler($this->requestHandler); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Constraints/Form.php b/vendor/symfony/form/Extension/Validator/Constraints/Form.php new file mode 100644 index 0000000..49291e6 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Constraints/Form.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @author Bernhard Schussek + */ +class Form extends Constraint +{ + public const NOT_SYNCHRONIZED_ERROR = '1dafa156-89e1-4736-b832-419c2e501fca'; + public const NO_SUCH_FIELD_ERROR = '6e5212ed-a197-4339-99aa-5654798a4854'; + + protected static $errorNames = [ + self::NOT_SYNCHRONIZED_ERROR => 'NOT_SYNCHRONIZED_ERROR', + self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', + ]; + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Constraints/FormValidator.php b/vendor/symfony/form/Extension/Validator/Constraints/FormValidator.php new file mode 100644 index 0000000..eb18ba2 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Constraints/FormValidator.php @@ -0,0 +1,279 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Constraints; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class FormValidator extends ConstraintValidator +{ + /** + * @var \SplObjectStorage> + */ + private $resolvedGroups; + + /** + * {@inheritdoc} + */ + public function validate($form, Constraint $formConstraint) + { + if (!$formConstraint instanceof Form) { + throw new UnexpectedTypeException($formConstraint, Form::class); + } + + if (!$form instanceof FormInterface) { + return; + } + + /* @var FormInterface $form */ + $config = $form->getConfig(); + + $validator = $this->context->getValidator()->inContext($this->context); + + if ($form->isSubmitted() && $form->isSynchronized()) { + // Validate the form data only if transformation succeeded + $groups = $this->getValidationGroups($form); + + if (!$groups) { + return; + } + + $data = $form->getData(); + // Validate the data against its own constraints + $validateDataGraph = $form->isRoot() + && (\is_object($data) || \is_array($data)) + && (($groups && \is_array($groups)) || ($groups instanceof GroupSequence && $groups->groups)) + ; + + // Validate the data against the constraints defined in the form + /** @var Constraint[] $constraints */ + $constraints = $config->getOption('constraints', []); + + $hasChildren = $form->count() > 0; + + if ($hasChildren && $form->isRoot()) { + $this->resolvedGroups = new \SplObjectStorage(); + } + + if ($groups instanceof GroupSequence) { + // Validate the data, the form AND nested fields in sequence + $violationsCount = $this->context->getViolations()->count(); + + foreach ($groups->groups as $group) { + if ($validateDataGraph) { + $validator->atPath('data')->validate($data, null, $group); + } + + if ($groupedConstraints = self::getConstraintsInGroups($constraints, $group)) { + $validator->atPath('data')->validate($data, $groupedConstraints, $group); + } + + foreach ($form->all() as $field) { + if ($field->isSubmitted()) { + // remember to validate this field in one group only + // otherwise resolving the groups would reuse the same + // sequence recursively, thus some fields could fail + // in different steps without breaking early enough + $this->resolvedGroups[$field] = (array) $group; + $fieldFormConstraint = new Form(); + $fieldFormConstraint->groups = $group; + $this->context->setNode($this->context->getValue(), $field, $this->context->getMetadata(), $this->context->getPropertyPath()); + $validator->atPath(sprintf('children[%s]', $field->getName()))->validate($field, $fieldFormConstraint, $group); + } + } + + if ($violationsCount < $this->context->getViolations()->count()) { + break; + } + } + } else { + if ($validateDataGraph) { + $validator->atPath('data')->validate($data, null, $groups); + } + + $groupedConstraints = []; + + foreach ($constraints as $constraint) { + // For the "Valid" constraint, validate the data in all groups + if ($constraint instanceof Valid) { + if (\is_object($data) || \is_array($data)) { + $validator->atPath('data')->validate($data, $constraint, $groups); + } + + continue; + } + + // Otherwise validate a constraint only once for the first + // matching group + foreach ($groups as $group) { + if (\in_array($group, $constraint->groups)) { + $groupedConstraints[$group][] = $constraint; + + // Prevent duplicate validation + if (!$constraint instanceof Composite) { + continue 2; + } + } + } + } + + foreach ($groupedConstraints as $group => $constraint) { + $validator->atPath('data')->validate($data, $constraint, $group); + } + + foreach ($form->all() as $field) { + if ($field->isSubmitted()) { + $this->resolvedGroups[$field] = $groups; + $this->context->setNode($this->context->getValue(), $field, $this->context->getMetadata(), $this->context->getPropertyPath()); + $validator->atPath(sprintf('children[%s]', $field->getName()))->validate($field, $formConstraint); + } + } + } + + if ($hasChildren && $form->isRoot()) { + // destroy storage to avoid memory leaks + $this->resolvedGroups = new \SplObjectStorage(); + } + } elseif (!$form->isSynchronized()) { + $childrenSynchronized = true; + + /** @var FormInterface $child */ + foreach ($form as $child) { + if (!$child->isSynchronized()) { + $childrenSynchronized = false; + $this->context->setNode($this->context->getValue(), $child, $this->context->getMetadata(), $this->context->getPropertyPath()); + $validator->atPath(sprintf('children[%s]', $child->getName()))->validate($child, $formConstraint); + } + } + + // Mark the form with an error if it is not synchronized BUT all + // of its children are synchronized. If any child is not + // synchronized, an error is displayed there already and showing + // a second error in its parent form is pointless, or worse, may + // lead to duplicate errors if error bubbling is enabled on the + // child. + // See also https://github.com/symfony/symfony/issues/4359 + if ($childrenSynchronized) { + $clientDataAsString = is_scalar($form->getViewData()) + ? (string) $form->getViewData() + : get_debug_type($form->getViewData()); + + $failure = $form->getTransformationFailure(); + + $this->context->setConstraint($formConstraint); + $this->context->buildViolation($failure->getInvalidMessage() ?? $config->getOption('invalid_message')) + ->setParameters(array_replace( + ['{{ value }}' => $clientDataAsString], + $config->getOption('invalid_message_parameters'), + $failure->getInvalidMessageParameters() + )) + ->setInvalidValue($form->getViewData()) + ->setCode(Form::NOT_SYNCHRONIZED_ERROR) + ->setCause($failure) + ->addViolation(); + } + } + + // Mark the form with an error if it contains extra fields + if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) { + $this->context->setConstraint($formConstraint); + $this->context->buildViolation($config->getOption('extra_fields_message', '')) + ->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"') + ->setPlural(\count($form->getExtraData())) + ->setInvalidValue($form->getExtraData()) + ->setCode(Form::NO_SUCH_FIELD_ERROR) + ->addViolation(); + } + } + + /** + * Returns the validation groups of the given form. + * + * @return string|GroupSequence|array + */ + private function getValidationGroups(FormInterface $form) + { + // Determine the clicked button of the complete form tree + $clickedButton = null; + + if (method_exists($form, 'getClickedButton')) { + $clickedButton = $form->getClickedButton(); + } + + if (null !== $clickedButton) { + $groups = $clickedButton->getConfig()->getOption('validation_groups'); + + if (null !== $groups) { + return self::resolveValidationGroups($groups, $form); + } + } + + do { + $groups = $form->getConfig()->getOption('validation_groups'); + + if (null !== $groups) { + return self::resolveValidationGroups($groups, $form); + } + + if (isset($this->resolvedGroups[$form])) { + return $this->resolvedGroups[$form]; + } + + $form = $form->getParent(); + } while (null !== $form); + + return [Constraint::DEFAULT_GROUP]; + } + + /** + * Post-processes the validation groups option for a given form. + * + * @param string|GroupSequence|array|callable $groups The validation groups + * + * @return GroupSequence|array + */ + private static function resolveValidationGroups($groups, FormInterface $form) + { + if (!\is_string($groups) && \is_callable($groups)) { + $groups = $groups($form); + } + + if ($groups instanceof GroupSequence) { + return $groups; + } + + return (array) $groups; + } + + private static function getConstraintsInGroups($constraints, $group) + { + $groups = (array) $group; + + return array_filter($constraints, static function (Constraint $constraint) use ($groups) { + foreach ($groups as $group) { + if (\in_array($group, $constraint->groups, true)) { + return true; + } + } + + return false; + }); + } +} diff --git a/vendor/symfony/form/Extension/Validator/EventListener/ValidationListener.php b/vendor/symfony/form/Extension/Validator/EventListener/ValidationListener.php new file mode 100644 index 0000000..867a576 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/EventListener/ValidationListener.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\Extension\Validator\Constraints\Form; +use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * @author Bernhard Schussek + */ +class ValidationListener implements EventSubscriberInterface +{ + private $validator; + + private $violationMapper; + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [FormEvents::POST_SUBMIT => 'validateForm']; + } + + public function __construct(ValidatorInterface $validator, ViolationMapperInterface $violationMapper) + { + $this->validator = $validator; + $this->violationMapper = $violationMapper; + } + + public function validateForm(FormEvent $event) + { + $form = $event->getForm(); + + if ($form->isRoot()) { + // Form groups are validated internally (FormValidator). Here we don't set groups as they are retrieved into the validator. + foreach ($this->validator->validate($form) as $violation) { + // Allow the "invalid" constraint to be put onto + // non-synchronized forms + $allowNonSynchronized = $violation->getConstraint() instanceof Form && Form::NOT_SYNCHRONIZED_ERROR === $violation->getCode(); + + $this->violationMapper->mapViolation($violation, $form, $allowNonSynchronized); + } + } + } +} diff --git a/vendor/symfony/form/Extension/Validator/Type/BaseValidatorExtension.php b/vendor/symfony/form/Extension/Validator/Type/BaseValidatorExtension.php new file mode 100644 index 0000000..0e9e2a9 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Type/BaseValidatorExtension.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Validator\Constraints\GroupSequence; + +/** + * Encapsulates common logic of {@link FormTypeValidatorExtension} and + * {@link SubmitTypeValidatorExtension}. + * + * @author Bernhard Schussek + */ +abstract class BaseValidatorExtension extends AbstractTypeExtension +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + // Make sure that validation groups end up as null, closure or array + $validationGroupsNormalizer = function (Options $options, $groups) { + if (false === $groups) { + return []; + } + + if (empty($groups)) { + return null; + } + + if (\is_callable($groups)) { + return $groups; + } + + if ($groups instanceof GroupSequence) { + return $groups; + } + + return (array) $groups; + }; + + $resolver->setDefaults([ + 'validation_groups' => null, + ]); + + $resolver->setNormalizer('validation_groups', $validationGroupsNormalizer); + } +} diff --git a/vendor/symfony/form/Extension/Validator/Type/FormTypeValidatorExtension.php b/vendor/symfony/form/Extension/Validator/Type/FormTypeValidatorExtension.php new file mode 100644 index 0000000..d4c520c --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Type/FormTypeValidatorExtension.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Type; + +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener; +use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormRendererInterface; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Bernhard Schussek + */ +class FormTypeValidatorExtension extends BaseValidatorExtension +{ + private $validator; + private $violationMapper; + private $legacyErrorMessages; + + public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null) + { + $this->validator = $validator; + $this->violationMapper = new ViolationMapper($formRenderer, $translator); + $this->legacyErrorMessages = $legacyErrorMessages; + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->addEventSubscriber(new ValidationListener($this->validator, $this->violationMapper)); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + parent::configureOptions($resolver); + + // Constraint should always be converted to an array + $constraintsNormalizer = function (Options $options, $constraints) { + return \is_object($constraints) ? [$constraints] : (array) $constraints; + }; + + $resolver->setDefaults([ + 'error_mapping' => [], + 'constraints' => [], + 'invalid_message' => 'This value is not valid.', + 'invalid_message_parameters' => [], + 'legacy_error_messages' => $this->legacyErrorMessages, + 'allow_extra_fields' => false, + 'extra_fields_message' => 'This form should not contain extra fields.', + ]); + $resolver->setAllowedTypes('constraints', [Constraint::class, Constraint::class.'[]']); + $resolver->setAllowedTypes('legacy_error_messages', 'bool'); + $resolver->setDeprecated('legacy_error_messages', 'symfony/form', '5.2', function (Options $options, $value) { + if (true === $value) { + return 'Setting the "legacy_error_messages" option to "true" is deprecated. It will be disabled in Symfony 6.0.'; + } + + return ''; + }); + + $resolver->setNormalizer('constraints', $constraintsNormalizer); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php b/vendor/symfony/form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php new file mode 100644 index 0000000..4bda0b2 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\RepeatedType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Bernhard Schussek + */ +class RepeatedTypeValidatorExtension extends AbstractTypeExtension +{ + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + // Map errors to the first field + $errorMapping = function (Options $options) { + return ['.' => $options['first_name']]; + }; + + $resolver->setDefaults([ + 'error_mapping' => $errorMapping, + ]); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [RepeatedType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Type/SubmitTypeValidatorExtension.php b/vendor/symfony/form/Extension/Validator/Type/SubmitTypeValidatorExtension.php new file mode 100644 index 0000000..ea273d0 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Type/SubmitTypeValidatorExtension.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Type; + +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + +/** + * @author Bernhard Schussek + */ +class SubmitTypeValidatorExtension extends BaseValidatorExtension +{ + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [SubmitType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Type/UploadValidatorExtension.php b/vendor/symfony/form/Extension/Validator/Type/UploadValidatorExtension.php new file mode 100644 index 0000000..21e4fe2 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Type/UploadValidatorExtension.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Type; + +use Symfony\Component\Form\AbstractTypeExtension; +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Abdellatif Ait boudad + * @author David Badura + */ +class UploadValidatorExtension extends AbstractTypeExtension +{ + private $translator; + private $translationDomain; + + public function __construct(TranslatorInterface $translator, string $translationDomain = null) + { + $this->translator = $translator; + $this->translationDomain = $translationDomain; + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) + { + $translator = $this->translator; + $translationDomain = $this->translationDomain; + $resolver->setNormalizer('upload_max_size_message', function (Options $options, $message) use ($translator, $translationDomain) { + return function () use ($translator, $translationDomain, $message) { + return $translator->trans($message(), [], $translationDomain); + }; + }); + } + + /** + * {@inheritdoc} + */ + public static function getExtendedTypes(): iterable + { + return [FormType::class]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/Util/ServerParams.php b/vendor/symfony/form/Extension/Validator/Util/ServerParams.php new file mode 100644 index 0000000..98e9f0c --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/Util/ServerParams.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\Util; + +use Symfony\Component\Form\Util\ServerParams as BaseServerParams; + +trigger_deprecation('symfony/form', '5.1', 'The "%s" class is deprecated. Use "%s" instead.', ServerParams::class, BaseServerParams::class); + +/** + * @author Bernhard Schussek + * + * @deprecated since Symfony 5.1. Use {@see BaseServerParams} instead. + */ +class ServerParams extends BaseServerParams +{ +} diff --git a/vendor/symfony/form/Extension/Validator/ValidatorExtension.php b/vendor/symfony/form/Extension/Validator/ValidatorExtension.php new file mode 100644 index 0000000..3a5728a --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ValidatorExtension.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator; + +use Symfony\Component\Form\AbstractExtension; +use Symfony\Component\Form\Extension\Validator\Constraints\Form; +use Symfony\Component\Form\FormRendererInterface; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * Extension supporting the Symfony Validator component in forms. + * + * @author Bernhard Schussek + */ +class ValidatorExtension extends AbstractExtension +{ + private $validator; + private $formRenderer; + private $translator; + private $legacyErrorMessages; + + public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null) + { + $this->legacyErrorMessages = $legacyErrorMessages; + + $metadata = $validator->getMetadataFor('Symfony\Component\Form\Form'); + + // Register the form constraints in the validator programmatically. + // This functionality is required when using the Form component without + // the DIC, where the XML file is loaded automatically. Thus the following + // code must be kept synchronized with validation.xml + + /* @var $metadata ClassMetadata */ + $metadata->addConstraint(new Form()); + $metadata->addConstraint(new Traverse(false)); + + $this->validator = $validator; + $this->formRenderer = $formRenderer; + $this->translator = $translator; + } + + public function loadTypeGuesser() + { + return new ValidatorTypeGuesser($this->validator); + } + + protected function loadTypeExtensions() + { + return [ + new Type\FormTypeValidatorExtension($this->validator, $this->legacyErrorMessages, $this->formRenderer, $this->translator), + new Type\RepeatedTypeValidatorExtension(), + new Type\SubmitTypeValidatorExtension(), + ]; + } +} diff --git a/vendor/symfony/form/Extension/Validator/ValidatorTypeGuesser.php b/vendor/symfony/form/Extension/Validator/ValidatorTypeGuesser.php new file mode 100644 index 0000000..24470ba --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ValidatorTypeGuesser.php @@ -0,0 +1,283 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator; + +use Symfony\Component\Form\FormTypeGuesserInterface; +use Symfony\Component\Form\Guess\Guess; +use Symfony\Component\Form\Guess\TypeGuess; +use Symfony\Component\Form\Guess\ValueGuess; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; + +class ValidatorTypeGuesser implements FormTypeGuesserInterface +{ + private $metadataFactory; + + public function __construct(MetadataFactoryInterface $metadataFactory) + { + $this->metadataFactory = $metadataFactory; + } + + /** + * {@inheritdoc} + */ + public function guessType(string $class, string $property) + { + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessTypeForConstraint($constraint); + }); + } + + /** + * {@inheritdoc} + */ + public function guessRequired(string $class, string $property) + { + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessRequiredForConstraint($constraint); + // If we don't find any constraint telling otherwise, we can assume + // that a field is not required (with LOW_CONFIDENCE) + }, false); + } + + /** + * {@inheritdoc} + */ + public function guessMaxLength(string $class, string $property) + { + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessMaxLengthForConstraint($constraint); + }); + } + + /** + * {@inheritdoc} + */ + public function guessPattern(string $class, string $property) + { + return $this->guess($class, $property, function (Constraint $constraint) { + return $this->guessPatternForConstraint($constraint); + }); + } + + /** + * Guesses a field class name for a given constraint. + * + * @return TypeGuess|null + */ + public function guessTypeForConstraint(Constraint $constraint) + { + switch (\get_class($constraint)) { + case 'Symfony\Component\Validator\Constraints\Type': + switch ($constraint->type) { + case 'array': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE); + case 'boolean': + case 'bool': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE); + + case 'double': + case 'float': + case 'numeric': + case 'real': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE); + + case 'integer': + case 'int': + case 'long': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE); + + case \DateTime::class: + case '\DateTime': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', [], Guess::MEDIUM_CONFIDENCE); + + case 'string': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Country': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CountryType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Currency': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CurrencyType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Date': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'string'], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\DateTime': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'string'], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Email': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\EmailType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\File': + case 'Symfony\Component\Validator\Constraints\Image': + $options = []; + if ($constraint->mimeTypes) { + $options = ['attr' => ['accept' => implode(',', (array) $constraint->mimeTypes)]]; + } + + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\FileType', $options, Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Language': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\LanguageType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Locale': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\LocaleType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Time': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TimeType', ['input' => 'string'], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Url': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\UrlType', [], Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Ip': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::MEDIUM_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Length': + case 'Symfony\Component\Validator\Constraints\Regex': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\TextType', [], Guess::LOW_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Range': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::LOW_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\Count': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::LOW_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\IsTrue': + case 'Symfony\Component\Validator\Constraints\IsFalse': + return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE); + } + + return null; + } + + /** + * Guesses whether a field is required based on the given constraint. + * + * @return ValueGuess|null + */ + public function guessRequiredForConstraint(Constraint $constraint) + { + switch (\get_class($constraint)) { + case 'Symfony\Component\Validator\Constraints\NotNull': + case 'Symfony\Component\Validator\Constraints\NotBlank': + case 'Symfony\Component\Validator\Constraints\IsTrue': + return new ValueGuess(true, Guess::HIGH_CONFIDENCE); + } + + return null; + } + + /** + * Guesses a field's maximum length based on the given constraint. + * + * @return ValueGuess|null + */ + public function guessMaxLengthForConstraint(Constraint $constraint) + { + switch (\get_class($constraint)) { + case 'Symfony\Component\Validator\Constraints\Length': + if (is_numeric($constraint->max)) { + return new ValueGuess($constraint->max, Guess::HIGH_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Type': + if (\in_array($constraint->type, ['double', 'float', 'numeric', 'real'])) { + return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Range': + if (is_numeric($constraint->max)) { + return new ValueGuess(\strlen((string) $constraint->max), Guess::LOW_CONFIDENCE); + } + break; + } + + return null; + } + + /** + * Guesses a field's pattern based on the given constraint. + * + * @return ValueGuess|null + */ + public function guessPatternForConstraint(Constraint $constraint) + { + switch (\get_class($constraint)) { + case 'Symfony\Component\Validator\Constraints\Length': + if (is_numeric($constraint->min)) { + return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Regex': + $htmlPattern = $constraint->getHtmlPattern(); + + if (null !== $htmlPattern) { + return new ValueGuess($htmlPattern, Guess::HIGH_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Range': + if (is_numeric($constraint->min)) { + return new ValueGuess(sprintf('.{%s,}', \strlen((string) $constraint->min)), Guess::LOW_CONFIDENCE); + } + break; + + case 'Symfony\Component\Validator\Constraints\Type': + if (\in_array($constraint->type, ['double', 'float', 'numeric', 'real'])) { + return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); + } + break; + } + + return null; + } + + /** + * Iterates over the constraints of a property, executes a constraints on + * them and returns the best guess. + * + * @param \Closure $closure The closure that returns a guess + * for a given constraint + * @param mixed $defaultValue The default value assumed if no other value + * can be guessed + * + * @return Guess|null + */ + protected function guess(string $class, string $property, \Closure $closure, $defaultValue = null) + { + $guesses = []; + $classMetadata = $this->metadataFactory->getMetadataFor($class); + + if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) { + foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) { + foreach ($memberMetadata->getConstraints() as $constraint) { + if ($guess = $closure($constraint)) { + $guesses[] = $guess; + } + } + } + } + + if (null !== $defaultValue) { + $guesses[] = new ValueGuess($defaultValue, Guess::LOW_CONFIDENCE); + } + + return Guess::getBestGuess($guesses); + } +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/MappingRule.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/MappingRule.php new file mode 100644 index 0000000..d9342de --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/MappingRule.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\Form\Exception\ErrorMappingException; +use Symfony\Component\Form\FormInterface; + +/** + * @author Bernhard Schussek + */ +class MappingRule +{ + private $origin; + private $propertyPath; + private $targetPath; + + public function __construct(FormInterface $origin, string $propertyPath, string $targetPath) + { + $this->origin = $origin; + $this->propertyPath = $propertyPath; + $this->targetPath = $targetPath; + } + + /** + * @return FormInterface + */ + public function getOrigin() + { + return $this->origin; + } + + /** + * Matches a property path against the rule path. + * + * If the rule matches, the form mapped by the rule is returned. + * Otherwise this method returns false. + * + * @return FormInterface|null + */ + public function match(string $propertyPath) + { + return $propertyPath === $this->propertyPath ? $this->getTarget() : null; + } + + /** + * Matches a property path against a prefix of the rule path. + * + * @return bool + */ + public function isPrefix(string $propertyPath) + { + $length = \strlen($propertyPath); + $prefix = substr($this->propertyPath, 0, $length); + $next = $this->propertyPath[$length] ?? null; + + return $prefix === $propertyPath && ('[' === $next || '.' === $next); + } + + /** + * @return FormInterface + * + * @throws ErrorMappingException + */ + public function getTarget() + { + $childNames = explode('.', $this->targetPath); + $target = $this->origin; + + foreach ($childNames as $childName) { + if (!$target->has($childName)) { + throw new ErrorMappingException(sprintf('The child "%s" of "%s" mapped by the rule "%s" in "%s" does not exist.', $childName, $target->getName(), $this->targetPath, $this->origin->getName())); + } + $target = $target->get($childName); + } + + return $target; + } +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/RelativePath.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/RelativePath.php new file mode 100644 index 0000000..0efd168 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/RelativePath.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\PropertyAccess\PropertyPath; + +/** + * @author Bernhard Schussek + */ +class RelativePath extends PropertyPath +{ + private $root; + + public function __construct(FormInterface $root, string $propertyPath) + { + parent::__construct($propertyPath); + + $this->root = $root; + } + + /** + * @return FormInterface + */ + public function getRoot() + { + return $this->root; + } +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapper.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapper.php new file mode 100644 index 0000000..1fb1d1f --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -0,0 +1,343 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\Form\FileUploadError; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Form\FormRendererInterface; +use Symfony\Component\Form\Util\InheritDataAwareIterator; +use Symfony\Component\PropertyAccess\PropertyPathBuilder; +use Symfony\Component\PropertyAccess\PropertyPathIterator; +use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface; +use Symfony\Component\Validator\Constraints\File; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Bernhard Schussek + */ +class ViolationMapper implements ViolationMapperInterface +{ + private $formRenderer; + private $translator; + private $allowNonSynchronized = false; + + public function __construct(FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null) + { + $this->formRenderer = $formRenderer; + $this->translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function mapViolation(ConstraintViolation $violation, FormInterface $form, bool $allowNonSynchronized = false) + { + $this->allowNonSynchronized = $allowNonSynchronized; + + // The scope is the currently found most specific form that + // an error should be mapped to. After setting the scope, the + // mapper will try to continue to find more specific matches in + // the children of scope. If it cannot, the error will be + // mapped to this scope. + $scope = null; + + $violationPath = null; + $relativePath = null; + $match = false; + + // Don't create a ViolationPath instance for empty property paths + if ('' !== $violation->getPropertyPath()) { + $violationPath = new ViolationPath($violation->getPropertyPath()); + $relativePath = $this->reconstructPath($violationPath, $form); + } + + // This case happens if the violation path is empty and thus + // the violation should be mapped to the root form + if (null === $violationPath) { + $scope = $form; + } + + // In general, mapping happens from the root form to the leaf forms + // First, the rules of the root form are applied to determine + // the subsequent descendant. The rules of this descendant are then + // applied to find the next and so on, until we have found the + // most specific form that matches the violation. + + // If any of the forms found in this process is not synchronized, + // mapping is aborted. Non-synchronized forms could not reverse + // transform the value entered by the user, thus any further violations + // caused by the (invalid) reverse transformed value should be + // ignored. + + if (null !== $relativePath) { + // Set the scope to the root of the relative path + // This root will usually be $form. If the path contains + // an unmapped form though, the last unmapped form found + // will be the root of the path. + $scope = $relativePath->getRoot(); + $it = new PropertyPathIterator($relativePath); + + while ($this->acceptsErrors($scope) && null !== ($child = $this->matchChild($scope, $it))) { + $scope = $child; + $it->next(); + $match = true; + } + } + + // This case happens if an error happened in the data under a + // form inheriting its parent data that does not match any of the + // children of that form. + if (null !== $violationPath && !$match) { + // If we could not map the error to anything more specific + // than the root element, map it to the innermost directly + // mapped form of the violation path + // e.g. "children[foo].children[bar].data.baz" + // Here the innermost directly mapped child is "bar" + + $scope = $form; + $it = new ViolationPathIterator($violationPath); + + // Note: acceptsErrors() will always return true for forms inheriting + // their parent data, because these forms can never be non-synchronized + // (they don't do any data transformation on their own) + while ($this->acceptsErrors($scope) && $it->valid() && $it->mapsForm()) { + if (!$scope->has($it->current())) { + // Break if we find a reference to a non-existing child + break; + } + + $scope = $scope->get($it->current()); + $it->next(); + } + } + + // Follow dot rules until we have the final target + $mapping = $scope->getConfig()->getOption('error_mapping'); + + while ($this->acceptsErrors($scope) && isset($mapping['.'])) { + $dotRule = new MappingRule($scope, '.', $mapping['.']); + $scope = $dotRule->getTarget(); + $mapping = $scope->getConfig()->getOption('error_mapping'); + } + + // Only add the error if the form is synchronized + if ($this->acceptsErrors($scope)) { + if ($violation->getConstraint() instanceof File && (string) \UPLOAD_ERR_INI_SIZE === $violation->getCode()) { + $errorsTarget = $scope; + + while (null !== $errorsTarget->getParent() && $errorsTarget->getConfig()->getErrorBubbling()) { + $errorsTarget = $errorsTarget->getParent(); + } + + $errors = $errorsTarget->getErrors(); + $errorsTarget->clearErrors(); + + foreach ($errors as $error) { + if (!$error instanceof FileUploadError) { + $errorsTarget->addError($error); + } + } + } + + $message = $violation->getMessage(); + $messageTemplate = $violation->getMessageTemplate(); + + if (false !== strpos($message, '{{ label }}') || false !== strpos($messageTemplate, '{{ label }}')) { + $form = $scope; + + do { + $labelFormat = $form->getConfig()->getOption('label_format'); + } while (null === $labelFormat && null !== $form = $form->getParent()); + + if (null !== $labelFormat) { + $label = str_replace( + [ + '%name%', + '%id%', + ], + [ + $scope->getName(), + (string) $scope->getPropertyPath(), + ], + $labelFormat + ); + } else { + $label = $scope->getConfig()->getOption('label'); + } + + if (false !== $label) { + if (null === $label && null !== $this->formRenderer) { + $label = $this->formRenderer->humanize($scope->getName()); + } elseif (null === $label) { + $label = $scope->getName(); + } + + if (null !== $this->translator) { + $form = $scope; + $translationParameters[] = $form->getConfig()->getOption('label_translation_parameters', []); + + do { + $translationDomain = $form->getConfig()->getOption('translation_domain'); + array_unshift( + $translationParameters, + $form->getConfig()->getOption('label_translation_parameters', []) + ); + } while (null === $translationDomain && null !== $form = $form->getParent()); + + $translationParameters = array_merge([], ...$translationParameters); + + $label = $this->translator->trans( + $label, + $translationParameters, + $translationDomain + ); + } + + $message = str_replace('{{ label }}', $label, $message); + $messageTemplate = str_replace('{{ label }}', $label, $messageTemplate); + } + } + + $scope->addError(new FormError( + $message, + $messageTemplate, + $violation->getParameters(), + $violation->getPlural(), + $violation + )); + } + } + + /** + * Tries to match the beginning of the property path at the + * current position against the children of the scope. + * + * If a matching child is found, it is returned. Otherwise + * null is returned. + */ + private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it): ?FormInterface + { + $target = null; + $chunk = ''; + $foundAtIndex = null; + + // Construct mapping rules for the given form + $rules = []; + + foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) { + // Dot rules are considered at the very end + if ('.' !== $propertyPath) { + $rules[] = new MappingRule($form, $propertyPath, $targetPath); + } + } + + $children = iterator_to_array(new \RecursiveIteratorIterator(new InheritDataAwareIterator($form)), false); + + while ($it->valid()) { + if ($it->isIndex()) { + $chunk .= '['.$it->current().']'; + } else { + $chunk .= ('' === $chunk ? '' : '.').$it->current(); + } + + // Test mapping rules as long as we have any + foreach ($rules as $key => $rule) { + /* @var MappingRule $rule */ + + // Mapping rule matches completely, terminate. + if (null !== ($form = $rule->match($chunk))) { + return $form; + } + + // Keep only rules that have $chunk as prefix + if (!$rule->isPrefix($chunk)) { + unset($rules[$key]); + } + } + + /** @var FormInterface $child */ + foreach ($children as $i => $child) { + $childPath = (string) $child->getPropertyPath(); + if ($childPath === $chunk) { + $target = $child; + $foundAtIndex = $it->key(); + } elseif (str_starts_with($childPath, $chunk)) { + continue; + } + + unset($children[$i]); + } + + $it->next(); + } + + if (null !== $foundAtIndex) { + $it->seek($foundAtIndex); + } + + return $target; + } + + /** + * Reconstructs a property path from a violation path and a form tree. + */ + private function reconstructPath(ViolationPath $violationPath, FormInterface $origin): ?RelativePath + { + $propertyPathBuilder = new PropertyPathBuilder($violationPath); + $it = $violationPath->getIterator(); + $scope = $origin; + + // Remember the current index in the builder + $i = 0; + + // Expand elements that map to a form (like "children[address]") + for ($it->rewind(); $it->valid() && $it->mapsForm(); $it->next()) { + if (!$scope->has($it->current())) { + // Scope relates to a form that does not exist + // Bail out + break; + } + + // Process child form + $scope = $scope->get($it->current()); + + if ($scope->getConfig()->getInheritData()) { + // Form inherits its parent data + // Cut the piece out of the property path and proceed + $propertyPathBuilder->remove($i); + } else { + /* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */ + $propertyPath = $scope->getPropertyPath(); + + if (null === $propertyPath) { + // Property path of a mapped form is null + // Should not happen, bail out + break; + } + + $propertyPathBuilder->replace($i, 1, $propertyPath); + $i += $propertyPath->getLength(); + } + } + + $finalPath = $propertyPathBuilder->getPropertyPath(); + + return null !== $finalPath ? new RelativePath($origin, $finalPath) : null; + } + + private function acceptsErrors(FormInterface $form): bool + { + return $this->allowNonSynchronized || $form->isSynchronized(); + } +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php new file mode 100644 index 0000000..57ed1c8 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\Validator\ConstraintViolation; + +/** + * @author Bernhard Schussek + */ +interface ViolationMapperInterface +{ + /** + * Maps a constraint violation to a form in the form tree under + * the given form. + * + * @param bool $allowNonSynchronized Whether to allow mapping to non-synchronized forms + */ + public function mapViolation(ConstraintViolation $violation, FormInterface $form, bool $allowNonSynchronized = false); +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPath.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPath.php new file mode 100644 index 0000000..625c0b9 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPath.php @@ -0,0 +1,256 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\Form\Exception\OutOfBoundsException; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class ViolationPath implements \IteratorAggregate, PropertyPathInterface +{ + /** + * @var list + */ + private $elements = []; + + /** + * @var array + */ + private $isIndex = []; + + /** + * @var array + */ + private $mapsForm = []; + + /** + * @var string + */ + private $pathAsString = ''; + + /** + * @var int + */ + private $length = 0; + + /** + * Creates a new violation path from a string. + * + * @param string $violationPath The property path of a {@link \Symfony\Component\Validator\ConstraintViolation} object + */ + public function __construct(string $violationPath) + { + $path = new PropertyPath($violationPath); + $elements = $path->getElements(); + $data = false; + + for ($i = 0, $l = \count($elements); $i < $l; ++$i) { + if (!$data) { + // The element "data" has not yet been passed + if ('children' === $elements[$i] && $path->isProperty($i)) { + // Skip element "children" + ++$i; + + // Next element must exist and must be an index + // Otherwise consider this the end of the path + if ($i >= $l || !$path->isIndex($i)) { + break; + } + + // All the following index items (regardless if .children is + // explicitly used) are children and grand-children + for (; $i < $l && $path->isIndex($i); ++$i) { + $this->elements[] = $elements[$i]; + $this->isIndex[] = true; + $this->mapsForm[] = true; + } + + // Rewind the pointer as the last element above didn't match + // (even if the pointer was moved forward) + --$i; + } elseif ('data' === $elements[$i] && $path->isProperty($i)) { + // Skip element "data" + ++$i; + + // End of path + if ($i >= $l) { + break; + } + + $this->elements[] = $elements[$i]; + $this->isIndex[] = $path->isIndex($i); + $this->mapsForm[] = false; + $data = true; + } else { + // Neither "children" nor "data" property found + // Consider this the end of the path + break; + } + } else { + // Already after the "data" element + // Pick everything as is + $this->elements[] = $elements[$i]; + $this->isIndex[] = $path->isIndex($i); + $this->mapsForm[] = false; + } + } + + $this->length = \count($this->elements); + + $this->buildString(); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->pathAsString; + } + + /** + * {@inheritdoc} + */ + public function getLength() + { + return $this->length; + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + if ($this->length <= 1) { + return null; + } + + $parent = clone $this; + + --$parent->length; + array_pop($parent->elements); + array_pop($parent->isIndex); + array_pop($parent->mapsForm); + + $parent->buildString(); + + return $parent; + } + + /** + * {@inheritdoc} + */ + public function getElements() + { + return $this->elements; + } + + /** + * {@inheritdoc} + */ + public function getElement(int $index) + { + if (!isset($this->elements[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index)); + } + + return $this->elements[$index]; + } + + /** + * {@inheritdoc} + */ + public function isProperty(int $index) + { + if (!isset($this->isIndex[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index)); + } + + return !$this->isIndex[$index]; + } + + /** + * {@inheritdoc} + */ + public function isIndex(int $index) + { + if (!isset($this->isIndex[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index)); + } + + return $this->isIndex[$index]; + } + + /** + * Returns whether an element maps directly to a form. + * + * Consider the following violation path: + * + * children[address].children[office].data.street + * + * In this example, "address" and "office" map to forms, while + * "street does not. + * + * @return bool + * + * @throws OutOfBoundsException if the offset is invalid + */ + public function mapsForm(int $index) + { + if (!isset($this->mapsForm[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the violation path.', $index)); + } + + return $this->mapsForm[$index]; + } + + /** + * Returns a new iterator for this path. + * + * @return ViolationPathIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new ViolationPathIterator($this); + } + + /** + * Builds the string representation from the elements. + */ + private function buildString() + { + $this->pathAsString = ''; + $data = false; + + foreach ($this->elements as $index => $element) { + if ($this->mapsForm[$index]) { + $this->pathAsString .= ".children[$element]"; + } elseif (!$data) { + $this->pathAsString .= '.data'.($this->isIndex[$index] ? "[$element]" : ".$element"); + $data = true; + } else { + $this->pathAsString .= $this->isIndex[$index] ? "[$element]" : ".$element"; + } + } + + if ('' !== $this->pathAsString) { + // remove leading dot + $this->pathAsString = substr($this->pathAsString, 1); + } + } +} diff --git a/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPathIterator.php b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPathIterator.php new file mode 100644 index 0000000..50baa45 --- /dev/null +++ b/vendor/symfony/form/Extension/Validator/ViolationMapper/ViolationPathIterator.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; + +use Symfony\Component\PropertyAccess\PropertyPathIterator; + +/** + * @author Bernhard Schussek + */ +class ViolationPathIterator extends PropertyPathIterator +{ + public function __construct(ViolationPath $violationPath) + { + parent::__construct($violationPath); + } + + public function mapsForm() + { + return $this->path->mapsForm($this->key()); + } +} diff --git a/vendor/symfony/form/FileUploadError.php b/vendor/symfony/form/FileUploadError.php new file mode 100644 index 0000000..20142b2 --- /dev/null +++ b/vendor/symfony/form/FileUploadError.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @internal + */ +class FileUploadError extends FormError +{ +} diff --git a/vendor/symfony/form/Form.php b/vendor/symfony/form/Form.php new file mode 100644 index 0000000..1f02ea8 --- /dev/null +++ b/vendor/symfony/form/Form.php @@ -0,0 +1,1194 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Event\PostSetDataEvent; +use Symfony\Component\Form\Event\PostSubmitEvent; +use Symfony\Component\Form\Event\PreSetDataEvent; +use Symfony\Component\Form\Event\PreSubmitEvent; +use Symfony\Component\Form\Event\SubmitEvent; +use Symfony\Component\Form\Exception\AlreadySubmittedException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\OutOfBoundsException; +use Symfony\Component\Form\Exception\RuntimeException; +use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Util\FormUtil; +use Symfony\Component\Form\Util\InheritDataAwareIterator; +use Symfony\Component\Form\Util\OrderedHashMap; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * Form represents a form. + * + * To implement your own form fields, you need to have a thorough understanding + * of the data flow within a form. A form stores its data in three different + * representations: + * + * (1) the "model" format required by the form's object + * (2) the "normalized" format for internal processing + * (3) the "view" format used for display simple fields + * or map children model data for compound fields + * + * A date field, for example, may store a date as "Y-m-d" string (1) in the + * object. To facilitate processing in the field, this value is normalized + * to a DateTime object (2). In the HTML representation of your form, a + * localized string (3) may be presented to and modified by the user, or it could be an array of values + * to be mapped to choices fields. + * + * In most cases, format (1) and format (2) will be the same. For example, + * a checkbox field uses a Boolean value for both internal processing and + * storage in the object. In these cases you need to set a view transformer + * to convert between formats (2) and (3). You can do this by calling + * addViewTransformer(). + * + * In some cases though it makes sense to make format (1) configurable. To + * demonstrate this, let's extend our above date field to store the value + * either as "Y-m-d" string or as timestamp. Internally we still want to + * use a DateTime object for processing. To convert the data from string/integer + * to DateTime you can set a model transformer by calling + * addModelTransformer(). The normalized data is then converted to the displayed + * data as described before. + * + * The conversions (1) -> (2) -> (3) use the transform methods of the transformers. + * The conversions (3) -> (2) -> (1) use the reverseTransform methods of the transformers. + * + * @author Fabien Potencier + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterface +{ + /** + * @var FormConfigInterface + */ + private $config; + + /** + * @var FormInterface|null + */ + private $parent; + + /** + * A map of FormInterface instances. + * + * @var OrderedHashMap + */ + private $children; + + /** + * @var FormError[] + */ + private $errors = []; + + /** + * @var bool + */ + private $submitted = false; + + /** + * The button that was used to submit the form. + * + * @var FormInterface|ClickableInterface|null + */ + private $clickedButton; + + /** + * @var mixed + */ + private $modelData; + + /** + * @var mixed + */ + private $normData; + + /** + * @var mixed + */ + private $viewData; + + /** + * The submitted values that don't belong to any children. + * + * @var array + */ + private $extraData = []; + + /** + * The transformation failure generated during submission, if any. + * + * @var TransformationFailedException|null + */ + private $transformationFailure; + + /** + * Whether the form's data has been initialized. + * + * When the data is initialized with its default value, that default value + * is passed through the transformer chain in order to synchronize the + * model, normalized and view format for the first time. This is done + * lazily in order to save performance when {@link setData()} is called + * manually, making the initialization with the configured default value + * superfluous. + * + * @var bool + */ + private $defaultDataSet = false; + + /** + * Whether setData() is currently being called. + * + * @var bool + */ + private $lockSetData = false; + + /** + * @var string + */ + private $name = ''; + + /** + * Whether the form inherits its underlying data from its parent. + * + * @var bool + */ + private $inheritData; + + /** + * @var PropertyPathInterface|null + */ + private $propertyPath; + + /** + * @throws LogicException if a data mapper is not provided for a compound form + */ + public function __construct(FormConfigInterface $config) + { + // Compound forms always need a data mapper, otherwise calls to + // `setData` and `add` will not lead to the correct population of + // the child forms. + if ($config->getCompound() && !$config->getDataMapper()) { + throw new LogicException('Compound forms need a data mapper.'); + } + + // If the form inherits the data from its parent, it is not necessary + // to call setData() with the default data. + if ($this->inheritData = $config->getInheritData()) { + $this->defaultDataSet = true; + } + + $this->config = $config; + $this->children = new OrderedHashMap(); + $this->name = $config->getName(); + } + + public function __clone() + { + $this->children = clone $this->children; + + foreach ($this->children as $key => $child) { + $this->children[$key] = clone $child; + } + } + + /** + * {@inheritdoc} + */ + public function getConfig() + { + return $this->config; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath() + { + if ($this->propertyPath || $this->propertyPath = $this->config->getPropertyPath()) { + return $this->propertyPath; + } + + if ('' === $this->name) { + return null; + } + + $parent = $this->parent; + + while ($parent && $parent->getConfig()->getInheritData()) { + $parent = $parent->getParent(); + } + + if ($parent && null === $parent->getConfig()->getDataClass()) { + $this->propertyPath = new PropertyPath('['.$this->name.']'); + } else { + $this->propertyPath = new PropertyPath($this->name); + } + + return $this->propertyPath; + } + + /** + * {@inheritdoc} + */ + public function isRequired() + { + if (null === $this->parent || $this->parent->isRequired()) { + return $this->config->getRequired(); + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function isDisabled() + { + if (null === $this->parent || !$this->parent->isDisabled()) { + return $this->config->getDisabled(); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function setParent(FormInterface $parent = null) + { + if ($this->submitted) { + throw new AlreadySubmittedException('You cannot set the parent of a submitted form.'); + } + + if (null !== $parent && '' === $this->name) { + throw new LogicException('A form with an empty name cannot have a parent form.'); + } + + $this->parent = $parent; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->parent ? $this->parent->getRoot() : $this; + } + + /** + * {@inheritdoc} + */ + public function isRoot() + { + return null === $this->parent; + } + + /** + * {@inheritdoc} + */ + public function setData($modelData) + { + // If the form is submitted while disabled, it is set to submitted, but the data is not + // changed. In such cases (i.e. when the form is not initialized yet) don't + // abort this method. + if ($this->submitted && $this->defaultDataSet) { + throw new AlreadySubmittedException('You cannot change the data of a submitted form.'); + } + + // If the form inherits its parent's data, disallow data setting to + // prevent merge conflicts + if ($this->inheritData) { + throw new RuntimeException('You cannot change the data of a form inheriting its parent data.'); + } + + // Don't allow modifications of the configured data if the data is locked + if ($this->config->getDataLocked() && $modelData !== $this->config->getData()) { + return $this; + } + + if (\is_object($modelData) && !$this->config->getByReference()) { + $modelData = clone $modelData; + } + + if ($this->lockSetData) { + throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call setData(). You should call setData() on the FormEvent object instead.'); + } + + $this->lockSetData = true; + $dispatcher = $this->config->getEventDispatcher(); + + // Hook to change content of the model data before transformation and mapping children + if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA)) { + $event = new PreSetDataEvent($this, $modelData); + $dispatcher->dispatch($event, FormEvents::PRE_SET_DATA); + $modelData = $event->getData(); + } + + // Treat data as strings unless a transformer exists + if (is_scalar($modelData) && !$this->config->getViewTransformers() && !$this->config->getModelTransformers()) { + $modelData = (string) $modelData; + } + + // Synchronize representations - must not change the content! + // Transformation exceptions are not caught on initialization + $normData = $this->modelToNorm($modelData); + $viewData = $this->normToView($normData); + + // Validate if view data matches data class (unless empty) + if (!FormUtil::isEmpty($viewData)) { + $dataClass = $this->config->getDataClass(); + + if (null !== $dataClass && !$viewData instanceof $dataClass) { + $actualType = get_debug_type($viewData); + + throw new LogicException('The form\'s view data is expected to be a "'.$dataClass.'", but it is a "'.$actualType.'". You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms "'.$actualType.'" to an instance of "'.$dataClass.'".'); + } + } + + $this->modelData = $modelData; + $this->normData = $normData; + $this->viewData = $viewData; + $this->defaultDataSet = true; + $this->lockSetData = false; + + // Compound forms don't need to invoke this method if they don't have children + if (\count($this->children) > 0) { + // Update child forms from the data (unless their config data is locked) + $this->config->getDataMapper()->mapDataToForms($viewData, new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children))); + } + + if ($dispatcher->hasListeners(FormEvents::POST_SET_DATA)) { + $event = new PostSetDataEvent($this, $modelData); + $dispatcher->dispatch($event, FormEvents::POST_SET_DATA); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + if ($this->inheritData) { + if (!$this->parent) { + throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); + } + + return $this->parent->getData(); + } + + if (!$this->defaultDataSet) { + if ($this->lockSetData) { + throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getData() if the form data has not already been set. You should call getData() on the FormEvent object instead.'); + } + + $this->setData($this->config->getData()); + } + + return $this->modelData; + } + + /** + * {@inheritdoc} + */ + public function getNormData() + { + if ($this->inheritData) { + if (!$this->parent) { + throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); + } + + return $this->parent->getNormData(); + } + + if (!$this->defaultDataSet) { + if ($this->lockSetData) { + throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getNormData() if the form data has not already been set.'); + } + + $this->setData($this->config->getData()); + } + + return $this->normData; + } + + /** + * {@inheritdoc} + */ + public function getViewData() + { + if ($this->inheritData) { + if (!$this->parent) { + throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.'); + } + + return $this->parent->getViewData(); + } + + if (!$this->defaultDataSet) { + if ($this->lockSetData) { + throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call getViewData() if the form data has not already been set.'); + } + + $this->setData($this->config->getData()); + } + + return $this->viewData; + } + + /** + * {@inheritdoc} + */ + public function getExtraData() + { + return $this->extraData; + } + + /** + * {@inheritdoc} + */ + public function initialize() + { + if (null !== $this->parent) { + throw new RuntimeException('Only root forms should be initialized.'); + } + + // Guarantee that the *_SET_DATA events have been triggered once the + // form is initialized. This makes sure that dynamically added or + // removed fields are already visible after initialization. + if (!$this->defaultDataSet) { + $this->setData($this->config->getData()); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function handleRequest($request = null) + { + $this->config->getRequestHandler()->handleRequest($this, $request); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function submit($submittedData, bool $clearMissing = true) + { + if ($this->submitted) { + throw new AlreadySubmittedException('A form can only be submitted once.'); + } + + // Initialize errors in the very beginning so we're sure + // they are collectable during submission only + $this->errors = []; + + // Obviously, a disabled form should not change its data upon submission. + if ($this->isDisabled()) { + $this->submitted = true; + + return $this; + } + + // The data must be initialized if it was not initialized yet. + // This is necessary to guarantee that the *_SET_DATA listeners + // are always invoked before submit() takes place. + if (!$this->defaultDataSet) { + $this->setData($this->config->getData()); + } + + // Treat false as NULL to support binding false to checkboxes. + // Don't convert NULL to a string here in order to determine later + // whether an empty value has been submitted or whether no value has + // been submitted at all. This is important for processing checkboxes + // and radio buttons with empty values. + if (false === $submittedData) { + $submittedData = null; + } elseif (is_scalar($submittedData)) { + $submittedData = (string) $submittedData; + } elseif ($this->config->getRequestHandler()->isFileUpload($submittedData)) { + if (!$this->config->getOption('allow_file_upload')) { + $submittedData = null; + $this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, file upload given.'); + } + } elseif (\is_array($submittedData) && !$this->config->getCompound() && !$this->config->hasOption('multiple')) { + $submittedData = null; + $this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, array given.'); + } + + $dispatcher = $this->config->getEventDispatcher(); + + $modelData = null; + $normData = null; + $viewData = null; + + try { + if (null !== $this->transformationFailure) { + throw $this->transformationFailure; + } + + // Hook to change content of the data submitted by the browser + if ($dispatcher->hasListeners(FormEvents::PRE_SUBMIT)) { + $event = new PreSubmitEvent($this, $submittedData); + $dispatcher->dispatch($event, FormEvents::PRE_SUBMIT); + $submittedData = $event->getData(); + } + + // Check whether the form is compound. + // This check is preferable over checking the number of children, + // since forms without children may also be compound. + // (think of empty collection forms) + if ($this->config->getCompound()) { + if (null === $submittedData) { + $submittedData = []; + } + + if (!\is_array($submittedData)) { + throw new TransformationFailedException('Compound forms expect an array or NULL on submission.'); + } + + foreach ($this->children as $name => $child) { + $isSubmitted = \array_key_exists($name, $submittedData); + + if ($isSubmitted || $clearMissing) { + $child->submit($isSubmitted ? $submittedData[$name] : null, $clearMissing); + unset($submittedData[$name]); + + if (null !== $this->clickedButton) { + continue; + } + + if ($child instanceof ClickableInterface && $child->isClicked()) { + $this->clickedButton = $child; + + continue; + } + + if (method_exists($child, 'getClickedButton') && null !== $child->getClickedButton()) { + $this->clickedButton = $child->getClickedButton(); + } + } + } + + $this->extraData = $submittedData; + } + + // Forms that inherit their parents' data also are not processed, + // because then it would be too difficult to merge the changes in + // the child and the parent form. Instead, the parent form also takes + // changes in the grandchildren (i.e. children of the form that inherits + // its parent's data) into account. + // (see InheritDataAwareIterator below) + if (!$this->inheritData) { + // If the form is compound, the view data is merged with the data + // of the children using the data mapper. + // If the form is not compound, the view data is assigned to the submitted data. + $viewData = $this->config->getCompound() ? $this->viewData : $submittedData; + + if (FormUtil::isEmpty($viewData)) { + $emptyData = $this->config->getEmptyData(); + + if ($emptyData instanceof \Closure) { + $emptyData = $emptyData($this, $viewData); + } + + $viewData = $emptyData; + } + + // Merge form data from children into existing view data + // It is not necessary to invoke this method if the form has no children, + // even if it is compound. + if (\count($this->children) > 0) { + // Use InheritDataAwareIterator to process children of + // descendants that inherit this form's data. + // These descendants will not be submitted normally (see the check + // for $this->config->getInheritData() above) + $this->config->getDataMapper()->mapFormsToData( + new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)), + $viewData + ); + } + + // Normalize data to unified representation + $normData = $this->viewToNorm($viewData); + + // Hook to change content of the data in the normalized + // representation + if ($dispatcher->hasListeners(FormEvents::SUBMIT)) { + $event = new SubmitEvent($this, $normData); + $dispatcher->dispatch($event, FormEvents::SUBMIT); + $normData = $event->getData(); + } + + // Synchronize representations - must not change the content! + $modelData = $this->normToModel($normData); + $viewData = $this->normToView($normData); + } + } catch (TransformationFailedException $e) { + $this->transformationFailure = $e; + + // If $viewData was not yet set, set it to $submittedData so that + // the erroneous data is accessible on the form. + // Forms that inherit data never set any data, because the getters + // forward to the parent form's getters anyway. + if (null === $viewData && !$this->inheritData) { + $viewData = $submittedData; + } + } + + $this->submitted = true; + $this->modelData = $modelData; + $this->normData = $normData; + $this->viewData = $viewData; + + if ($dispatcher->hasListeners(FormEvents::POST_SUBMIT)) { + $event = new PostSubmitEvent($this, $viewData); + $dispatcher->dispatch($event, FormEvents::POST_SUBMIT); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addError(FormError $error) + { + if (null === $error->getOrigin()) { + $error->setOrigin($this); + } + + if ($this->parent && $this->config->getErrorBubbling()) { + $this->parent->addError($error); + } else { + $this->errors[] = $error; + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function isSubmitted() + { + return $this->submitted; + } + + /** + * {@inheritdoc} + */ + public function isSynchronized() + { + return null === $this->transformationFailure; + } + + /** + * {@inheritdoc} + */ + public function getTransformationFailure() + { + return $this->transformationFailure; + } + + /** + * {@inheritdoc} + */ + public function isEmpty() + { + foreach ($this->children as $child) { + if (!$child->isEmpty()) { + return false; + } + } + + if (!method_exists($this->config, 'getIsEmptyCallback')) { + trigger_deprecation('symfony/form', '5.1', 'Not implementing the "%s::getIsEmptyCallback()" method in "%s" is deprecated.', FormConfigInterface::class, \get_class($this->config)); + + $isEmptyCallback = null; + } else { + $isEmptyCallback = $this->config->getIsEmptyCallback(); + } + + if (null !== $isEmptyCallback) { + return $isEmptyCallback($this->modelData); + } + + return FormUtil::isEmpty($this->modelData) || + // arrays, countables + ((\is_array($this->modelData) || $this->modelData instanceof \Countable) && 0 === \count($this->modelData)) || + // traversables that are not countable + ($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData)); + } + + /** + * {@inheritdoc} + */ + public function isValid() + { + if (!$this->submitted) { + throw new LogicException('Cannot check if an unsubmitted form is valid. Call Form::isSubmitted() before Form::isValid().'); + } + + if ($this->isDisabled()) { + return true; + } + + return 0 === \count($this->getErrors(true)); + } + + /** + * Returns the button that was used to submit the form. + * + * @return FormInterface|ClickableInterface|null + */ + public function getClickedButton() + { + if ($this->clickedButton) { + return $this->clickedButton; + } + + return $this->parent && method_exists($this->parent, 'getClickedButton') ? $this->parent->getClickedButton() : null; + } + + /** + * {@inheritdoc} + */ + public function getErrors(bool $deep = false, bool $flatten = true) + { + $errors = $this->errors; + + // Copy the errors of nested forms to the $errors array + if ($deep) { + foreach ($this as $child) { + /** @var FormInterface $child */ + if ($child->isSubmitted() && $child->isValid()) { + continue; + } + + $iterator = $child->getErrors(true, $flatten); + + if (0 === \count($iterator)) { + continue; + } + + if ($flatten) { + foreach ($iterator as $error) { + $errors[] = $error; + } + } else { + $errors[] = $iterator; + } + } + } + + return new FormErrorIterator($this, $errors); + } + + /** + * {@inheritdoc} + */ + public function clearErrors(bool $deep = false): self + { + $this->errors = []; + + if ($deep) { + // Clear errors from children + foreach ($this as $child) { + if ($child instanceof ClearableErrorsInterface) { + $child->clearErrors(true); + } + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function all() + { + return iterator_to_array($this->children); + } + + /** + * {@inheritdoc} + */ + public function add($child, string $type = null, array $options = []) + { + if ($this->submitted) { + throw new AlreadySubmittedException('You cannot add children to a submitted form.'); + } + + if (!$this->config->getCompound()) { + throw new LogicException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?'); + } + + if (!$child instanceof FormInterface) { + if (!\is_string($child) && !\is_int($child)) { + throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormInterface'); + } + + $child = (string) $child; + + if (null !== $type && !\is_string($type)) { + throw new UnexpectedTypeException($type, 'string or null'); + } + + // Never initialize child forms automatically + $options['auto_initialize'] = false; + + if (null === $type && null === $this->config->getDataClass()) { + $type = TextType::class; + } + + if (null === $type) { + $child = $this->config->getFormFactory()->createForProperty($this->config->getDataClass(), $child, null, $options); + } else { + $child = $this->config->getFormFactory()->createNamed($child, $type, null, $options); + } + } elseif ($child->getConfig()->getAutoInitialize()) { + throw new RuntimeException(sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName())); + } + + $this->children[$child->getName()] = $child; + + $child->setParent($this); + + // If setData() is currently being called, there is no need to call + // mapDataToForms() here, as mapDataToForms() is called at the end + // of setData() anyway. Not doing this check leads to an endless + // recursion when initializing the form lazily and an event listener + // (such as ResizeFormListener) adds fields depending on the data: + // + // * setData() is called, the form is not initialized yet + // * add() is called by the listener (setData() is not complete, so + // the form is still not initialized) + // * getViewData() is called + // * setData() is called since the form is not initialized yet + // * ... endless recursion ... + // + // Also skip data mapping if setData() has not been called yet. + // setData() will be called upon form initialization and data mapping + // will take place by then. + if (!$this->lockSetData && $this->defaultDataSet && !$this->inheritData) { + $viewData = $this->getViewData(); + $this->config->getDataMapper()->mapDataToForms( + $viewData, + new \RecursiveIteratorIterator(new InheritDataAwareIterator(new \ArrayIterator([$child->getName() => $child]))) + ); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function remove(string $name) + { + if ($this->submitted) { + throw new AlreadySubmittedException('You cannot remove children from a submitted form.'); + } + + if (isset($this->children[$name])) { + if (!$this->children[$name]->isSubmitted()) { + $this->children[$name]->setParent(null); + } + + unset($this->children[$name]); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function has(string $name) + { + return isset($this->children[$name]); + } + + /** + * {@inheritdoc} + */ + public function get(string $name) + { + if (isset($this->children[$name])) { + return $this->children[$name]; + } + + throw new OutOfBoundsException(sprintf('Child "%s" does not exist.', $name)); + } + + /** + * Returns whether a child with the given name exists (implements the \ArrayAccess interface). + * + * @param string $name The name of the child + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($name) + { + return $this->has($name); + } + + /** + * Returns the child with the given name (implements the \ArrayAccess interface). + * + * @param string $name The name of the child + * + * @return FormInterface + * + * @throws OutOfBoundsException if the named child does not exist + */ + #[\ReturnTypeWillChange] + public function offsetGet($name) + { + return $this->get($name); + } + + /** + * Adds a child to the form (implements the \ArrayAccess interface). + * + * @param string $name Ignored. The name of the child is used + * @param FormInterface $child The child to be added + * + * @return void + * + * @throws AlreadySubmittedException if the form has already been submitted + * @throws LogicException when trying to add a child to a non-compound form + * + * @see self::add() + */ + #[\ReturnTypeWillChange] + public function offsetSet($name, $child) + { + $this->add($child); + } + + /** + * Removes the child with the given name from the form (implements the \ArrayAccess interface). + * + * @param string $name The name of the child to remove + * + * @return void + * + * @throws AlreadySubmittedException if the form has already been submitted + */ + #[\ReturnTypeWillChange] + public function offsetUnset($name) + { + $this->remove($name); + } + + /** + * Returns the iterator for this group. + * + * @return \Traversable + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return $this->children; + } + + /** + * Returns the number of form children (implements the \Countable interface). + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->children); + } + + /** + * {@inheritdoc} + */ + public function createView(FormView $parent = null) + { + if (null === $parent && $this->parent) { + $parent = $this->parent->createView(); + } + + $type = $this->config->getType(); + $options = $this->config->getOptions(); + + // The methods createView(), buildView() and finishView() are called + // explicitly here in order to be able to override either of them + // in a custom resolved form type. + $view = $type->createView($this, $parent); + + $type->buildView($view, $this, $options); + + foreach ($this->children as $name => $child) { + $view->children[$name] = $child->createView($view); + } + + $this->sort($view->children); + + $type->finishView($view, $this, $options); + + return $view; + } + + /** + * Sorts view fields based on their priority value. + */ + private function sort(array &$children): void + { + $c = []; + $i = 0; + $needsSorting = false; + foreach ($children as $name => $child) { + $c[$name] = ['p' => $child->vars['priority'] ?? 0, 'i' => $i++]; + + if (0 !== $c[$name]['p']) { + $needsSorting = true; + } + } + + if (!$needsSorting) { + return; + } + + uksort($children, static function ($a, $b) use ($c): int { + return [$c[$b]['p'], $c[$a]['i']] <=> [$c[$a]['p'], $c[$b]['i']]; + }); + } + + /** + * Normalizes the underlying data if a model transformer is set. + * + * @return mixed + * + * @throws TransformationFailedException If the underlying data cannot be transformed to "normalized" format + */ + private function modelToNorm($value) + { + try { + foreach ($this->config->getModelTransformers() as $transformer) { + $value = $transformer->transform($value); + } + } catch (TransformationFailedException $exception) { + throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters()); + } + + return $value; + } + + /** + * Reverse transforms a value if a model transformer is set. + * + * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "model" format + */ + private function normToModel($value) + { + try { + $transformers = $this->config->getModelTransformers(); + + for ($i = \count($transformers) - 1; $i >= 0; --$i) { + $value = $transformers[$i]->reverseTransform($value); + } + } catch (TransformationFailedException $exception) { + throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters()); + } + + return $value; + } + + /** + * Transforms the value if a view transformer is set. + * + * @return mixed + * + * @throws TransformationFailedException If the normalized value cannot be transformed to "view" format + */ + private function normToView($value) + { + // Scalar values should be converted to strings to + // facilitate differentiation between empty ("") and zero (0). + // Only do this for simple forms, as the resulting value in + // compound forms is passed to the data mapper and thus should + // not be converted to a string before. + if (!($transformers = $this->config->getViewTransformers()) && !$this->config->getCompound()) { + return null === $value || is_scalar($value) ? (string) $value : $value; + } + + try { + foreach ($transformers as $transformer) { + $value = $transformer->transform($value); + } + } catch (TransformationFailedException $exception) { + throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters()); + } + + return $value; + } + + /** + * Reverse transforms a value if a view transformer is set. + * + * @return mixed + * + * @throws TransformationFailedException If the submitted value cannot be transformed to "normalized" format + */ + private function viewToNorm($value) + { + if (!$transformers = $this->config->getViewTransformers()) { + return '' === $value ? null : $value; + } + + try { + for ($i = \count($transformers) - 1; $i >= 0; --$i) { + $value = $transformers[$i]->reverseTransform($value); + } + } catch (TransformationFailedException $exception) { + throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception, $exception->getInvalidMessage(), $exception->getInvalidMessageParameters()); + } + + return $value; + } +} diff --git a/vendor/symfony/form/FormBuilder.php b/vendor/symfony/form/FormBuilder.php new file mode 100644 index 0000000..37fca95 --- /dev/null +++ b/vendor/symfony/form/FormBuilder.php @@ -0,0 +1,254 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Extension\Core\Type\TextType; + +/** + * A builder for creating {@link Form} instances. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormBuilderInterface +{ + /** + * The children of the form builder. + * + * @var FormBuilderInterface[] + */ + private $children = []; + + /** + * The data of children who haven't been converted to form builders yet. + * + * @var array + */ + private $unresolvedChildren = []; + + public function __construct(?string $name, ?string $dataClass, EventDispatcherInterface $dispatcher, FormFactoryInterface $factory, array $options = []) + { + parent::__construct($name, $dataClass, $dispatcher, $options); + + $this->setFormFactory($factory); + } + + /** + * {@inheritdoc} + */ + public function add($child, string $type = null, array $options = []) + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if ($child instanceof FormBuilderInterface) { + $this->children[$child->getName()] = $child; + + // In case an unresolved child with the same name exists + unset($this->unresolvedChildren[$child->getName()]); + + return $this; + } + + if (!\is_string($child) && !\is_int($child)) { + throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormBuilderInterface'); + } + + if (null !== $type && !\is_string($type)) { + throw new UnexpectedTypeException($type, 'string or null'); + } + + // Add to "children" to maintain order + $this->children[$child] = null; + $this->unresolvedChildren[$child] = [$type, $options]; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function create($name, string $type = null, array $options = []) + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if (null === $type && null === $this->getDataClass()) { + $type = TextType::class; + } + + if (null !== $type) { + return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options); + } + + return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options); + } + + /** + * {@inheritdoc} + */ + public function get($name) + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if (isset($this->unresolvedChildren[$name])) { + return $this->resolveChild($name); + } + + if (isset($this->children[$name])) { + return $this->children[$name]; + } + + throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name)); + } + + /** + * {@inheritdoc} + */ + public function remove($name) + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + unset($this->unresolvedChildren[$name], $this->children[$name]); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function has($name) + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + return isset($this->unresolvedChildren[$name]) || isset($this->children[$name]); + } + + /** + * {@inheritdoc} + */ + public function all() + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->resolveChildren(); + + return $this->children; + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + return \count($this->children); + } + + /** + * {@inheritdoc} + */ + public function getFormConfig() + { + /** @var $config self */ + $config = parent::getFormConfig(); + + $config->children = []; + $config->unresolvedChildren = []; + + return $config; + } + + /** + * {@inheritdoc} + */ + public function getForm() + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->resolveChildren(); + + $form = new Form($this->getFormConfig()); + + foreach ($this->children as $child) { + // Automatic initialization is only supported on root forms + $form->add($child->setAutoInitialize(false)->getForm()); + } + + if ($this->getAutoInitialize()) { + // Automatically initialize the form if it is configured so + $form->initialize(); + } + + return $form; + } + + /** + * {@inheritdoc} + * + * @return \Traversable + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + if ($this->locked) { + throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + return new \ArrayIterator($this->all()); + } + + /** + * Converts an unresolved child into a {@link FormBuilderInterface} instance. + */ + private function resolveChild(string $name): FormBuilderInterface + { + [$type, $options] = $this->unresolvedChildren[$name]; + + unset($this->unresolvedChildren[$name]); + + return $this->children[$name] = $this->create($name, $type, $options); + } + + /** + * Converts all unresolved children into {@link FormBuilder} instances. + */ + private function resolveChildren() + { + foreach ($this->unresolvedChildren as $name => $info) { + $this->children[$name] = $this->create($name, $info[0], $info[1]); + } + + $this->unresolvedChildren = []; + } +} diff --git a/vendor/symfony/form/FormBuilderInterface.php b/vendor/symfony/form/FormBuilderInterface.php new file mode 100644 index 0000000..52bf5b6 --- /dev/null +++ b/vendor/symfony/form/FormBuilderInterface.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @author Bernhard Schussek + * + * @extends \Traversable + */ +interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface +{ + /** + * Adds a new field to this group. A field must have a unique name within + * the group. Otherwise the existing field is overwritten. + * + * If you add a nested group, this group should also be represented in the + * object hierarchy. + * + * @param string|FormBuilderInterface $child + * @param array $options + * + * @return static + */ + public function add($child, string $type = null, array $options = []); + + /** + * Creates a form builder. + * + * @param string $name The name of the form or the name of the property + * @param string|null $type The type of the form or null if name is a property + * @param array $options + * + * @return self + */ + public function create(string $name, string $type = null, array $options = []); + + /** + * Returns a child by name. + * + * @return self + * + * @throws Exception\InvalidArgumentException if the given child does not exist + */ + public function get(string $name); + + /** + * Removes the field with the given name. + * + * @return static + */ + public function remove(string $name); + + /** + * Returns whether a field with the given name exists. + * + * @return bool + */ + public function has(string $name); + + /** + * Returns the children. + * + * @return array + */ + public function all(); + + /** + * Creates the form. + * + * @return FormInterface + */ + public function getForm(); +} diff --git a/vendor/symfony/form/FormConfigBuilder.php b/vendor/symfony/form/FormConfigBuilder.php new file mode 100644 index 0000000..b511c2f --- /dev/null +++ b/vendor/symfony/form/FormConfigBuilder.php @@ -0,0 +1,811 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; +use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\PropertyAccess\PropertyPath; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * A basic form configuration. + * + * @author Bernhard Schussek + */ +class FormConfigBuilder implements FormConfigBuilderInterface +{ + /** + * Caches a globally unique {@link NativeRequestHandler} instance. + * + * @var NativeRequestHandler + */ + private static $nativeRequestHandler; + + protected $locked = false; + private $dispatcher; + private $name; + + /** + * @var PropertyPathInterface|string|null + */ + private $propertyPath; + + private $mapped = true; + private $byReference = true; + private $inheritData = false; + private $compound = false; + + /** + * @var ResolvedFormTypeInterface + */ + private $type; + + private $viewTransformers = []; + private $modelTransformers = []; + + /** + * @var DataMapperInterface|null + */ + private $dataMapper; + + private $required = true; + private $disabled = false; + private $errorBubbling = false; + + /** + * @var mixed + */ + private $emptyData; + + private $attributes = []; + + /** + * @var mixed + */ + private $data; + + /** + * @var string|null + */ + private $dataClass; + + private $dataLocked = false; + + /** + * @var FormFactoryInterface|null + */ + private $formFactory; + + private $action = ''; + private $method = 'POST'; + + /** + * @var RequestHandlerInterface|null + */ + private $requestHandler; + + private $autoInitialize = false; + private $options; + private $isEmptyCallback; + + /** + * Creates an empty form configuration. + * + * @param string|null $name The form name + * @param string|null $dataClass The class of the form's data + * + * @throws InvalidArgumentException if the data class is not a valid class or if + * the name contains invalid characters + */ + public function __construct(?string $name, ?string $dataClass, EventDispatcherInterface $dispatcher, array $options = []) + { + self::validateName($name); + + if (null !== $dataClass && !class_exists($dataClass) && !interface_exists($dataClass, false)) { + throw new InvalidArgumentException(sprintf('Class "%s" not found. Is the "data_class" form option set correctly?', $dataClass)); + } + + $this->name = (string) $name; + $this->dataClass = $dataClass; + $this->dispatcher = $dispatcher; + $this->options = $options; + } + + /** + * {@inheritdoc} + */ + public function addEventListener(string $eventName, callable $listener, int $priority = 0) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->dispatcher->addListener($eventName, $listener, $priority); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addEventSubscriber(EventSubscriberInterface $subscriber) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->dispatcher->addSubscriber($subscriber); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if ($forcePrepend) { + array_unshift($this->viewTransformers, $viewTransformer); + } else { + $this->viewTransformers[] = $viewTransformer; + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function resetViewTransformers() + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->viewTransformers = []; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if ($forceAppend) { + $this->modelTransformers[] = $modelTransformer; + } else { + array_unshift($this->modelTransformers, $modelTransformer); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function resetModelTransformers() + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->modelTransformers = []; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getEventDispatcher() + { + if ($this->locked && !$this->dispatcher instanceof ImmutableEventDispatcher) { + $this->dispatcher = new ImmutableEventDispatcher($this->dispatcher); + } + + return $this->dispatcher; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath() + { + return $this->propertyPath; + } + + /** + * {@inheritdoc} + */ + public function getMapped() + { + return $this->mapped; + } + + /** + * {@inheritdoc} + */ + public function getByReference() + { + return $this->byReference; + } + + /** + * {@inheritdoc} + */ + public function getInheritData() + { + return $this->inheritData; + } + + /** + * {@inheritdoc} + */ + public function getCompound() + { + return $this->compound; + } + + /** + * {@inheritdoc} + */ + public function getType() + { + return $this->type; + } + + /** + * {@inheritdoc} + */ + public function getViewTransformers() + { + return $this->viewTransformers; + } + + /** + * {@inheritdoc} + */ + public function getModelTransformers() + { + return $this->modelTransformers; + } + + /** + * {@inheritdoc} + */ + public function getDataMapper() + { + return $this->dataMapper; + } + + /** + * {@inheritdoc} + */ + public function getRequired() + { + return $this->required; + } + + /** + * {@inheritdoc} + */ + public function getDisabled() + { + return $this->disabled; + } + + /** + * {@inheritdoc} + */ + public function getErrorBubbling() + { + return $this->errorBubbling; + } + + /** + * {@inheritdoc} + */ + public function getEmptyData() + { + return $this->emptyData; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function hasAttribute(string $name) + { + return \array_key_exists($name, $this->attributes); + } + + /** + * {@inheritdoc} + */ + public function getAttribute(string $name, $default = null) + { + return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + return $this->data; + } + + /** + * {@inheritdoc} + */ + public function getDataClass() + { + return $this->dataClass; + } + + /** + * {@inheritdoc} + */ + public function getDataLocked() + { + return $this->dataLocked; + } + + /** + * {@inheritdoc} + */ + public function getFormFactory() + { + if (!isset($this->formFactory)) { + throw new BadMethodCallException('The form factory must be set before retrieving it.'); + } + + return $this->formFactory; + } + + /** + * {@inheritdoc} + */ + public function getAction() + { + return $this->action; + } + + /** + * {@inheritdoc} + */ + public function getMethod() + { + return $this->method; + } + + /** + * {@inheritdoc} + */ + public function getRequestHandler() + { + if (null === $this->requestHandler) { + if (null === self::$nativeRequestHandler) { + self::$nativeRequestHandler = new NativeRequestHandler(); + } + $this->requestHandler = self::$nativeRequestHandler; + } + + return $this->requestHandler; + } + + /** + * {@inheritdoc} + */ + public function getAutoInitialize() + { + return $this->autoInitialize; + } + + /** + * {@inheritdoc} + */ + public function getOptions() + { + return $this->options; + } + + /** + * {@inheritdoc} + */ + public function hasOption(string $name) + { + return \array_key_exists($name, $this->options); + } + + /** + * {@inheritdoc} + */ + public function getOption(string $name, $default = null) + { + return \array_key_exists($name, $this->options) ? $this->options[$name] : $default; + } + + /** + * {@inheritdoc} + */ + public function getIsEmptyCallback(): ?callable + { + return $this->isEmptyCallback; + } + + /** + * {@inheritdoc} + */ + public function setAttribute(string $name, $value) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->attributes[$name] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setAttributes(array $attributes) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->attributes = $attributes; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setDataMapper(DataMapperInterface $dataMapper = null) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->dataMapper = $dataMapper; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setDisabled(bool $disabled) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->disabled = $disabled; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setEmptyData($emptyData) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->emptyData = $emptyData; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setErrorBubbling(bool $errorBubbling) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->errorBubbling = $errorBubbling; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setRequired(bool $required) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->required = $required; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setPropertyPath($propertyPath) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + if (null !== $propertyPath && !$propertyPath instanceof PropertyPathInterface) { + $propertyPath = new PropertyPath($propertyPath); + } + + $this->propertyPath = $propertyPath; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMapped(bool $mapped) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->mapped = $mapped; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setByReference(bool $byReference) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->byReference = $byReference; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setInheritData(bool $inheritData) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->inheritData = $inheritData; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCompound(bool $compound) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->compound = $compound; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setType(ResolvedFormTypeInterface $type) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->type = $type; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setData($data) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->data = $data; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setDataLocked(bool $locked) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->dataLocked = $locked; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setFormFactory(FormFactoryInterface $formFactory) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->formFactory = $formFactory; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setAction(string $action) + { + if ($this->locked) { + throw new BadMethodCallException('The config builder cannot be modified anymore.'); + } + + $this->action = $action; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setMethod(string $method) + { + if ($this->locked) { + throw new BadMethodCallException('The config builder cannot be modified anymore.'); + } + + $this->method = strtoupper($method); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setRequestHandler(RequestHandlerInterface $requestHandler) + { + if ($this->locked) { + throw new BadMethodCallException('The config builder cannot be modified anymore.'); + } + + $this->requestHandler = $requestHandler; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setAutoInitialize(bool $initialize) + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + $this->autoInitialize = $initialize; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormConfig() + { + if ($this->locked) { + throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.'); + } + + // This method should be idempotent, so clone the builder + $config = clone $this; + $config->locked = true; + + return $config; + } + + /** + * {@inheritdoc} + */ + public function setIsEmptyCallback(?callable $isEmptyCallback) + { + $this->isEmptyCallback = $isEmptyCallback; + + return $this; + } + + /** + * Validates whether the given variable is a valid form name. + * + * @throws InvalidArgumentException if the name contains invalid characters + * + * @internal + */ + final public static function validateName(?string $name) + { + if (!self::isValidName($name)) { + throw new InvalidArgumentException(sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name)); + } + } + + /** + * Returns whether the given variable contains a valid form name. + * + * A name is accepted if it + * + * * is empty + * * starts with a letter, digit or underscore + * * contains only letters, digits, numbers, underscores ("_"), + * hyphens ("-") and colons (":") + */ + final public static function isValidName(?string $name): bool + { + return '' === $name || null === $name || preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_\-:]*$/D', $name); + } +} diff --git a/vendor/symfony/form/FormConfigBuilderInterface.php b/vendor/symfony/form/FormConfigBuilderInterface.php new file mode 100644 index 0000000..757fa25 --- /dev/null +++ b/vendor/symfony/form/FormConfigBuilderInterface.php @@ -0,0 +1,254 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * @author Bernhard Schussek + * + * @method $this setIsEmptyCallback(callable|null $isEmptyCallback) Sets the callback that will be called to determine if the model data of the form is empty or not - not implementing it is deprecated since Symfony 5.1 + */ +interface FormConfigBuilderInterface extends FormConfigInterface +{ + /** + * Adds an event listener to an event on this form. + * + * @param int $priority The priority of the listener. Listeners + * with a higher priority are called before + * listeners with a lower priority. + * + * @return $this + */ + public function addEventListener(string $eventName, callable $listener, int $priority = 0); + + /** + * Adds an event subscriber for events on this form. + * + * @return $this + */ + public function addEventSubscriber(EventSubscriberInterface $subscriber); + + /** + * Appends / prepends a transformer to the view transformer chain. + * + * The transform method of the transformer is used to convert data from the + * normalized to the view format. + * The reverseTransform method of the transformer is used to convert from the + * view to the normalized format. + * + * @param bool $forcePrepend If set to true, prepend instead of appending + * + * @return $this + */ + public function addViewTransformer(DataTransformerInterface $viewTransformer, bool $forcePrepend = false); + + /** + * Clears the view transformers. + * + * @return $this + */ + public function resetViewTransformers(); + + /** + * Prepends / appends a transformer to the normalization transformer chain. + * + * The transform method of the transformer is used to convert data from the + * model to the normalized format. + * The reverseTransform method of the transformer is used to convert from the + * normalized to the model format. + * + * @param bool $forceAppend If set to true, append instead of prepending + * + * @return $this + */ + public function addModelTransformer(DataTransformerInterface $modelTransformer, bool $forceAppend = false); + + /** + * Clears the normalization transformers. + * + * @return $this + */ + public function resetModelTransformers(); + + /** + * Sets the value for an attribute. + * + * @param mixed $value The value of the attribute + * + * @return $this + */ + public function setAttribute(string $name, $value); + + /** + * Sets the attributes. + * + * @return $this + */ + public function setAttributes(array $attributes); + + /** + * Sets the data mapper used by the form. + * + * @return $this + */ + public function setDataMapper(DataMapperInterface $dataMapper = null); + + /** + * Sets whether the form is disabled. + * + * @return $this + */ + public function setDisabled(bool $disabled); + + /** + * Sets the data used for the client data when no value is submitted. + * + * @param mixed $emptyData The empty data + * + * @return $this + */ + public function setEmptyData($emptyData); + + /** + * Sets whether errors bubble up to the parent. + * + * @return $this + */ + public function setErrorBubbling(bool $errorBubbling); + + /** + * Sets whether this field is required to be filled out when submitted. + * + * @return $this + */ + public function setRequired(bool $required); + + /** + * Sets the property path that the form should be mapped to. + * + * @param string|PropertyPathInterface|null $propertyPath The property path or null if the path should be set + * automatically based on the form's name + * + * @return $this + */ + public function setPropertyPath($propertyPath); + + /** + * Sets whether the form should be mapped to an element of its + * parent's data. + * + * @return $this + */ + public function setMapped(bool $mapped); + + /** + * Sets whether the form's data should be modified by reference. + * + * @return $this + */ + public function setByReference(bool $byReference); + + /** + * Sets whether the form should read and write the data of its parent. + * + * @return $this + */ + public function setInheritData(bool $inheritData); + + /** + * Sets whether the form should be compound. + * + * @return $this + * + * @see FormConfigInterface::getCompound() + */ + public function setCompound(bool $compound); + + /** + * Sets the resolved type. + * + * @return $this + */ + public function setType(ResolvedFormTypeInterface $type); + + /** + * Sets the initial data of the form. + * + * @param mixed $data The data of the form in model format + * + * @return $this + */ + public function setData($data); + + /** + * Locks the form's data to the data passed in the configuration. + * + * A form with locked data is restricted to the data passed in + * this configuration. The data can only be modified then by + * submitting the form or using PRE_SET_DATA event. + * + * It means data passed to a factory method or mapped from the + * parent will be ignored. + * + * @return $this + */ + public function setDataLocked(bool $locked); + + /** + * Sets the form factory used for creating new forms. + */ + public function setFormFactory(FormFactoryInterface $formFactory); + + /** + * Sets the target URL of the form. + * + * @return $this + */ + public function setAction(string $action); + + /** + * Sets the HTTP method used by the form. + * + * @return $this + */ + public function setMethod(string $method); + + /** + * Sets the request handler used by the form. + * + * @return $this + */ + public function setRequestHandler(RequestHandlerInterface $requestHandler); + + /** + * Sets whether the form should be initialized automatically. + * + * Should be set to true only for root forms. + * + * @param bool $initialize True to initialize the form automatically, + * false to suppress automatic initialization. + * In the second case, you need to call + * {@link FormInterface::initialize()} manually. + * + * @return $this + */ + public function setAutoInitialize(bool $initialize); + + /** + * Builds and returns the form configuration. + * + * @return FormConfigInterface + */ + public function getFormConfig(); +} diff --git a/vendor/symfony/form/FormConfigInterface.php b/vendor/symfony/form/FormConfigInterface.php new file mode 100644 index 0000000..e332feb --- /dev/null +++ b/vendor/symfony/form/FormConfigInterface.php @@ -0,0 +1,249 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * The configuration of a {@link Form} object. + * + * @author Bernhard Schussek + * + * @method callable|null getIsEmptyCallback() Returns a callable that takes the model data as argument and that returns if it is empty or not - not implementing it is deprecated since Symfony 5.1 + */ +interface FormConfigInterface +{ + /** + * Returns the event dispatcher used to dispatch form events. + * + * @return EventDispatcherInterface + */ + public function getEventDispatcher(); + + /** + * Returns the name of the form used as HTTP parameter. + * + * @return string + */ + public function getName(); + + /** + * Returns the property path that the form should be mapped to. + * + * @return PropertyPathInterface|null + */ + public function getPropertyPath(); + + /** + * Returns whether the form should be mapped to an element of its + * parent's data. + * + * @return bool + */ + public function getMapped(); + + /** + * Returns whether the form's data should be modified by reference. + * + * @return bool + */ + public function getByReference(); + + /** + * Returns whether the form should read and write the data of its parent. + * + * @return bool + */ + public function getInheritData(); + + /** + * Returns whether the form is compound. + * + * This property is independent of whether the form actually has + * children. A form can be compound and have no children at all, like + * for example an empty collection form. + * The contrary is not possible, a form which is not compound + * cannot have any children. + * + * @return bool + */ + public function getCompound(); + + /** + * Returns the resolved form type used to construct the form. + * + * @return ResolvedFormTypeInterface + */ + public function getType(); + + /** + * Returns the view transformers of the form. + * + * @return DataTransformerInterface[] + */ + public function getViewTransformers(); + + /** + * Returns the model transformers of the form. + * + * @return DataTransformerInterface[] + */ + public function getModelTransformers(); + + /** + * Returns the data mapper of the compound form or null for a simple form. + * + * @return DataMapperInterface|null + */ + public function getDataMapper(); + + /** + * Returns whether the form is required. + * + * @return bool + */ + public function getRequired(); + + /** + * Returns whether the form is disabled. + * + * @return bool + */ + public function getDisabled(); + + /** + * Returns whether errors attached to the form will bubble to its parent. + * + * @return bool + */ + public function getErrorBubbling(); + + /** + * Used when the view data is empty on submission. + * + * When the form is compound it will also be used to map the + * children data. + * + * The empty data must match the view format as it will passed to the first view transformer's + * "reverseTransform" method. + * + * @return mixed + */ + public function getEmptyData(); + + /** + * Returns additional attributes of the form. + * + * @return array + */ + public function getAttributes(); + + /** + * Returns whether the attribute with the given name exists. + * + * @return bool + */ + public function hasAttribute(string $name); + + /** + * Returns the value of the given attribute. + * + * @param mixed $default The value returned if the attribute does not exist + * + * @return mixed + */ + public function getAttribute(string $name, $default = null); + + /** + * Returns the initial data of the form. + * + * @return mixed + */ + public function getData(); + + /** + * Returns the class of the view data or null if the data is scalar or an array. + * + * @return string|null + */ + public function getDataClass(); + + /** + * Returns whether the form's data is locked. + * + * A form with locked data is restricted to the data passed in + * this configuration. The data can only be modified then by + * submitting the form. + * + * @return bool + */ + public function getDataLocked(); + + /** + * Returns the form factory used for creating new forms. + * + * @return FormFactoryInterface + */ + public function getFormFactory(); + + /** + * Returns the target URL of the form. + * + * @return string + */ + public function getAction(); + + /** + * Returns the HTTP method used by the form. + * + * @return string + */ + public function getMethod(); + + /** + * Returns the request handler used by the form. + * + * @return RequestHandlerInterface + */ + public function getRequestHandler(); + + /** + * Returns whether the form should be initialized upon creation. + * + * @return bool + */ + public function getAutoInitialize(); + + /** + * Returns all options passed during the construction of the form. + * + * @return array The passed options + */ + public function getOptions(); + + /** + * Returns whether a specific option exists. + * + * @return bool + */ + public function hasOption(string $name); + + /** + * Returns the value of a specific option. + * + * @param mixed $default The value returned if the option does not exist + * + * @return mixed + */ + public function getOption(string $name, $default = null); +} diff --git a/vendor/symfony/form/FormError.php b/vendor/symfony/form/FormError.php new file mode 100644 index 0000000..e03f3ee --- /dev/null +++ b/vendor/symfony/form/FormError.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\BadMethodCallException; + +/** + * Wraps errors in forms. + * + * @author Bernhard Schussek + */ +class FormError +{ + protected $messageTemplate; + protected $messageParameters; + protected $messagePluralization; + + private $message; + private $cause; + + /** + * The form that spawned this error. + * + * @var FormInterface + */ + private $origin; + + /** + * Any array key in $messageParameters will be used as a placeholder in + * $messageTemplate. + * + * @param string $message The translated error message + * @param string|null $messageTemplate The template for the error message + * @param array $messageParameters The parameters that should be + * substituted in the message template + * @param int|null $messagePluralization The value for error message pluralization + * @param mixed $cause The cause of the error + * + * @see \Symfony\Component\Translation\Translator + */ + public function __construct(string $message, string $messageTemplate = null, array $messageParameters = [], int $messagePluralization = null, $cause = null) + { + $this->message = $message; + $this->messageTemplate = $messageTemplate ?: $message; + $this->messageParameters = $messageParameters; + $this->messagePluralization = $messagePluralization; + $this->cause = $cause; + } + + /** + * Returns the error message. + * + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Returns the error message template. + * + * @return string + */ + public function getMessageTemplate() + { + return $this->messageTemplate; + } + + /** + * Returns the parameters to be inserted in the message template. + * + * @return array + */ + public function getMessageParameters() + { + return $this->messageParameters; + } + + /** + * Returns the value for error message pluralization. + * + * @return int|null + */ + public function getMessagePluralization() + { + return $this->messagePluralization; + } + + /** + * Returns the cause of this error. + * + * @return mixed + */ + public function getCause() + { + return $this->cause; + } + + /** + * Sets the form that caused this error. + * + * This method must only be called once. + * + * @throws BadMethodCallException If the method is called more than once + */ + public function setOrigin(FormInterface $origin) + { + if (null !== $this->origin) { + throw new BadMethodCallException('setOrigin() must only be called once.'); + } + + $this->origin = $origin; + } + + /** + * Returns the form that caused this error. + * + * @return FormInterface|null + */ + public function getOrigin() + { + return $this->origin; + } +} diff --git a/vendor/symfony/form/FormErrorIterator.php b/vendor/symfony/form/FormErrorIterator.php new file mode 100644 index 0000000..9ee2f0e --- /dev/null +++ b/vendor/symfony/form/FormErrorIterator.php @@ -0,0 +1,316 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\OutOfBoundsException; +use Symfony\Component\Validator\ConstraintViolation; + +/** + * Iterates over the errors of a form. + * + * This class supports recursive iteration. In order to iterate recursively, + * pass a structure of {@link FormError} and {@link FormErrorIterator} objects + * to the $errors constructor argument. + * + * You can also wrap the iterator into a {@link \RecursiveIteratorIterator} to + * flatten the recursive structure into a flat list of errors. + * + * @author Bernhard Schussek + * + * @template T of FormError|FormErrorIterator + * + * @implements \ArrayAccess + * @implements \RecursiveIterator + * @implements \SeekableIterator + */ +class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable +{ + /** + * The prefix used for indenting nested error messages. + */ + public const INDENTATION = ' '; + + private $form; + + /** + * @var list + */ + private $errors; + + /** + * @param list $errors + * + * @throws InvalidArgumentException If the errors are invalid + */ + public function __construct(FormInterface $form, array $errors) + { + foreach ($errors as $error) { + if (!($error instanceof FormError || $error instanceof self)) { + throw new InvalidArgumentException(sprintf('The errors must be instances of "Symfony\Component\Form\FormError" or "%s". Got: "%s".', __CLASS__, get_debug_type($error))); + } + } + + $this->form = $form; + $this->errors = $errors; + } + + /** + * Returns all iterated error messages as string. + * + * @return string + */ + public function __toString() + { + $string = ''; + + foreach ($this->errors as $error) { + if ($error instanceof FormError) { + $string .= 'ERROR: '.$error->getMessage()."\n"; + } else { + /* @var self $error */ + $string .= $error->getForm()->getName().":\n"; + $string .= self::indent((string) $error); + } + } + + return $string; + } + + /** + * Returns the iterated form. + * + * @return FormInterface + */ + public function getForm() + { + return $this->form; + } + + /** + * Returns the current element of the iterator. + * + * @return T An error or an iterator containing nested errors + */ + #[\ReturnTypeWillChange] + public function current() + { + return current($this->errors); + } + + /** + * Advances the iterator to the next position. + */ + #[\ReturnTypeWillChange] + public function next() + { + next($this->errors); + } + + /** + * Returns the current position of the iterator. + * + * @return int + */ + #[\ReturnTypeWillChange] + public function key() + { + return key($this->errors); + } + + /** + * Returns whether the iterator's position is valid. + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function valid() + { + return null !== key($this->errors); + } + + /** + * Sets the iterator's position to the beginning. + * + * This method detects if errors have been added to the form since the + * construction of the iterator. + */ + #[\ReturnTypeWillChange] + public function rewind() + { + reset($this->errors); + } + + /** + * Returns whether a position exists in the iterator. + * + * @param int $position The position + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($position) + { + return isset($this->errors[$position]); + } + + /** + * Returns the element at a position in the iterator. + * + * @param int $position The position + * + * @return T + * + * @throws OutOfBoundsException If the given position does not exist + */ + #[\ReturnTypeWillChange] + public function offsetGet($position) + { + if (!isset($this->errors[$position])) { + throw new OutOfBoundsException('The offset '.$position.' does not exist.'); + } + + return $this->errors[$position]; + } + + /** + * Unsupported method. + * + * @return void + * + * @throws BadMethodCallException + */ + #[\ReturnTypeWillChange] + public function offsetSet($position, $value) + { + throw new BadMethodCallException('The iterator doesn\'t support modification of elements.'); + } + + /** + * Unsupported method. + * + * @return void + * + * @throws BadMethodCallException + */ + #[\ReturnTypeWillChange] + public function offsetUnset($position) + { + throw new BadMethodCallException('The iterator doesn\'t support modification of elements.'); + } + + /** + * Returns whether the current element of the iterator can be recursed + * into. + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function hasChildren() + { + return current($this->errors) instanceof self; + } + + /** + * @return self + */ + #[\ReturnTypeWillChange] + public function getChildren() + { + if (!$this->hasChildren()) { + trigger_deprecation('symfony/form', '5.4', 'Calling "%s()" if the current element is not iterable is deprecated, call "%s" to get the current element.', __METHOD__, self::class.'::current()'); + // throw new LogicException(sprintf('The current element is not iterable. Use "%s" to get the current element.', self::class.'::current()')); + } + + /** @var self $children */ + $children = current($this->errors); + + return $children; + } + + /** + * Returns the number of elements in the iterator. + * + * Note that this is not the total number of errors, if the constructor + * parameter $deep was set to true! In that case, you should wrap the + * iterator into a {@link \RecursiveIteratorIterator} with the standard mode + * {@link \RecursiveIteratorIterator::LEAVES_ONLY} and count the result. + * + * $iterator = new \RecursiveIteratorIterator($form->getErrors(true)); + * $count = count(iterator_to_array($iterator)); + * + * Alternatively, set the constructor argument $flatten to true as well. + * + * $count = count($form->getErrors(true, true)); + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->errors); + } + + /** + * Sets the position of the iterator. + * + * @param int $position The new position + * + * @return void + * + * @throws OutOfBoundsException If the position is invalid + */ + #[\ReturnTypeWillChange] + public function seek($position) + { + if (!isset($this->errors[$position])) { + throw new OutOfBoundsException('The offset '.$position.' does not exist.'); + } + + reset($this->errors); + + while ($position !== key($this->errors)) { + next($this->errors); + } + } + + /** + * Creates iterator for errors with specific codes. + * + * @param string|string[] $codes The codes to find + * + * @return static + */ + public function findByCodes($codes) + { + $codes = (array) $codes; + $errors = []; + foreach ($this as $error) { + $cause = $error->getCause(); + if ($cause instanceof ConstraintViolation && \in_array($cause->getCode(), $codes, true)) { + $errors[] = $error; + } + } + + return new static($this->form, $errors); + } + + /** + * Utility function for indenting multi-line strings. + */ + private static function indent(string $string): string + { + return rtrim(self::INDENTATION.str_replace("\n", "\n".self::INDENTATION, $string), ' '); + } +} diff --git a/vendor/symfony/form/FormEvent.php b/vendor/symfony/form/FormEvent.php new file mode 100644 index 0000000..c466faf --- /dev/null +++ b/vendor/symfony/form/FormEvent.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Contracts\EventDispatcher\Event; + +/** + * @author Bernhard Schussek + */ +class FormEvent extends Event +{ + private $form; + protected $data; + + /** + * @param mixed $data The data + */ + public function __construct(FormInterface $form, $data) + { + $this->form = $form; + $this->data = $data; + } + + /** + * Returns the form at the source of the event. + * + * @return FormInterface + */ + public function getForm() + { + return $this->form; + } + + /** + * Returns the data associated with this event. + * + * @return mixed + */ + public function getData() + { + return $this->data; + } + + /** + * Allows updating with some filtered data. + * + * @param mixed $data + */ + public function setData($data) + { + $this->data = $data; + } +} diff --git a/vendor/symfony/form/FormEvents.php b/vendor/symfony/form/FormEvents.php new file mode 100644 index 0000000..cf4d97f --- /dev/null +++ b/vendor/symfony/form/FormEvents.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Event\PostSetDataEvent; +use Symfony\Component\Form\Event\PostSubmitEvent; +use Symfony\Component\Form\Event\PreSetDataEvent; +use Symfony\Component\Form\Event\PreSubmitEvent; +use Symfony\Component\Form\Event\SubmitEvent; + +/** + * To learn more about how form events work check the documentation + * entry at {@link https://symfony.com/doc/any/components/form/form_events.html}. + * + * To learn how to dynamically modify forms using events check the cookbook + * entry at {@link https://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}. + * + * @author Bernhard Schussek + */ +final class FormEvents +{ + /** + * The PRE_SUBMIT event is dispatched at the beginning of the Form::submit() method. + * + * It can be used to: + * - Change data from the request, before submitting the data to the form. + * - Add or remove form fields, before submitting the data to the form. + * + * @Event("Symfony\Component\Form\Event\PreSubmitEvent") + */ + public const PRE_SUBMIT = 'form.pre_submit'; + + /** + * The SUBMIT event is dispatched after the Form::submit() method + * has changed the view data by the request data, or submitted and mapped + * the children if the form is compound, and after reverse transformation + * to normalized representation. + * + * It's also dispatched just before the Form::submit() method transforms back + * the normalized data to the model and view data. + * + * So at this stage children of compound forms are submitted and synchronized, unless + * their transformation failed, but a parent would still be at the PRE_SUBMIT level. + * + * Since the current form is not synchronized yet, it is still possible to add and + * remove fields. + * + * @Event("Symfony\Component\Form\Event\SubmitEvent") + */ + public const SUBMIT = 'form.submit'; + + /** + * The FormEvents::POST_SUBMIT event is dispatched at the very end of the Form::submit(). + * + * It this stage the model and view data may have been denormalized. Otherwise the form + * is desynchronized because transformation failed during submission. + * + * It can be used to fetch data after denormalization. + * + * The event attaches the current view data. To know whether this is the renormalized data + * or the invalid request data, call Form::isSynchronized() first. + * + * @Event("Symfony\Component\Form\Event\PostSubmitEvent") + */ + public const POST_SUBMIT = 'form.post_submit'; + + /** + * The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method. + * + * It can be used to: + * - Modify the data given during pre-population; + * - Keep synchronized the form depending on the data (adding or removing fields dynamically). + * + * @Event("Symfony\Component\Form\Event\PreSetDataEvent") + */ + public const PRE_SET_DATA = 'form.pre_set_data'; + + /** + * The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method. + * + * This event can be used to modify the form depending on the final state of the underlying data + * accessible in every representation: model, normalized and view. + * + * @Event("Symfony\Component\Form\Event\PostSetDataEvent") + */ + public const POST_SET_DATA = 'form.post_set_data'; + + /** + * Event aliases. + * + * These aliases can be consumed by RegisterListenersPass. + */ + public const ALIASES = [ + PreSubmitEvent::class => self::PRE_SUBMIT, + SubmitEvent::class => self::SUBMIT, + PostSubmitEvent::class => self::POST_SUBMIT, + PreSetDataEvent::class => self::PRE_SET_DATA, + PostSetDataEvent::class => self::POST_SET_DATA, + ]; + + private function __construct() + { + } +} diff --git a/vendor/symfony/form/FormExtensionInterface.php b/vendor/symfony/form/FormExtensionInterface.php new file mode 100644 index 0000000..8fafcee --- /dev/null +++ b/vendor/symfony/form/FormExtensionInterface.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Interface for extensions which provide types, type extensions and a guesser. + */ +interface FormExtensionInterface +{ + /** + * Returns a type by name. + * + * @param string $name The name of the type + * + * @return FormTypeInterface + * + * @throws Exception\InvalidArgumentException if the given type is not supported by this extension + */ + public function getType(string $name); + + /** + * Returns whether the given type is supported. + * + * @param string $name The name of the type + * + * @return bool + */ + public function hasType(string $name); + + /** + * Returns the extensions for the given type. + * + * @param string $name The name of the type + * + * @return FormTypeExtensionInterface[] + */ + public function getTypeExtensions(string $name); + + /** + * Returns whether this extension provides type extensions for the given type. + * + * @param string $name The name of the type + * + * @return bool + */ + public function hasTypeExtensions(string $name); + + /** + * Returns the type guesser provided by this extension. + * + * @return FormTypeGuesserInterface|null + */ + public function getTypeGuesser(); +} diff --git a/vendor/symfony/form/FormFactory.php b/vendor/symfony/form/FormFactory.php new file mode 100644 index 0000000..b3185d1 --- /dev/null +++ b/vendor/symfony/form/FormFactory.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\Form\Extension\Core\Type\TextType; + +class FormFactory implements FormFactoryInterface +{ + private $registry; + + public function __construct(FormRegistryInterface $registry) + { + $this->registry = $registry; + } + + /** + * {@inheritdoc} + */ + public function create(string $type = FormType::class, $data = null, array $options = []) + { + return $this->createBuilder($type, $data, $options)->getForm(); + } + + /** + * {@inheritdoc} + */ + public function createNamed(string $name, string $type = FormType::class, $data = null, array $options = []) + { + return $this->createNamedBuilder($name, $type, $data, $options)->getForm(); + } + + /** + * {@inheritdoc} + */ + public function createForProperty(string $class, string $property, $data = null, array $options = []) + { + return $this->createBuilderForProperty($class, $property, $data, $options)->getForm(); + } + + /** + * {@inheritdoc} + */ + public function createBuilder(string $type = FormType::class, $data = null, array $options = []) + { + return $this->createNamedBuilder($this->registry->getType($type)->getBlockPrefix(), $type, $data, $options); + } + + /** + * {@inheritdoc} + */ + public function createNamedBuilder(string $name, string $type = FormType::class, $data = null, array $options = []) + { + if (null !== $data && !\array_key_exists('data', $options)) { + $options['data'] = $data; + } + + $type = $this->registry->getType($type); + + $builder = $type->createBuilder($this, $name, $options); + + // Explicitly call buildForm() in order to be able to override either + // createBuilder() or buildForm() in the resolved form type + $type->buildForm($builder, $builder->getOptions()); + + return $builder; + } + + /** + * {@inheritdoc} + */ + public function createBuilderForProperty(string $class, string $property, $data = null, array $options = []) + { + if (null === $guesser = $this->registry->getTypeGuesser()) { + return $this->createNamedBuilder($property, TextType::class, $data, $options); + } + + $typeGuess = $guesser->guessType($class, $property); + $maxLengthGuess = $guesser->guessMaxLength($class, $property); + $requiredGuess = $guesser->guessRequired($class, $property); + $patternGuess = $guesser->guessPattern($class, $property); + + $type = $typeGuess ? $typeGuess->getType() : TextType::class; + + $maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null; + $pattern = $patternGuess ? $patternGuess->getValue() : null; + + if (null !== $pattern) { + $options = array_replace_recursive(['attr' => ['pattern' => $pattern]], $options); + } + + if (null !== $maxLength) { + $options = array_replace_recursive(['attr' => ['maxlength' => $maxLength]], $options); + } + + if ($requiredGuess) { + $options = array_merge(['required' => $requiredGuess->getValue()], $options); + } + + // user options may override guessed options + if ($typeGuess) { + $attrs = []; + $typeGuessOptions = $typeGuess->getOptions(); + if (isset($typeGuessOptions['attr']) && isset($options['attr'])) { + $attrs = ['attr' => array_merge($typeGuessOptions['attr'], $options['attr'])]; + } + + $options = array_merge($typeGuessOptions, $options, $attrs); + } + + return $this->createNamedBuilder($property, $type, $data, $options); + } +} diff --git a/vendor/symfony/form/FormFactoryBuilder.php b/vendor/symfony/form/FormFactoryBuilder.php new file mode 100644 index 0000000..735a17e --- /dev/null +++ b/vendor/symfony/form/FormFactoryBuilder.php @@ -0,0 +1,187 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Extension\Core\CoreExtension; + +/** + * The default implementation of FormFactoryBuilderInterface. + * + * @author Bernhard Schussek + */ +class FormFactoryBuilder implements FormFactoryBuilderInterface +{ + private $forceCoreExtension; + + /** + * @var ResolvedFormTypeFactoryInterface + */ + private $resolvedTypeFactory; + + /** + * @var FormExtensionInterface[] + */ + private $extensions = []; + + /** + * @var FormTypeInterface[] + */ + private $types = []; + + /** + * @var FormTypeExtensionInterface[][] + */ + private $typeExtensions = []; + + /** + * @var FormTypeGuesserInterface[] + */ + private $typeGuessers = []; + + public function __construct(bool $forceCoreExtension = false) + { + $this->forceCoreExtension = $forceCoreExtension; + } + + /** + * {@inheritdoc} + */ + public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory) + { + $this->resolvedTypeFactory = $resolvedTypeFactory; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addExtension(FormExtensionInterface $extension) + { + $this->extensions[] = $extension; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addExtensions(array $extensions) + { + $this->extensions = array_merge($this->extensions, $extensions); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addType(FormTypeInterface $type) + { + $this->types[] = $type; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addTypes(array $types) + { + foreach ($types as $type) { + $this->types[] = $type; + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addTypeExtension(FormTypeExtensionInterface $typeExtension) + { + foreach ($typeExtension::getExtendedTypes() as $extendedType) { + $this->typeExtensions[$extendedType][] = $typeExtension; + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addTypeExtensions(array $typeExtensions) + { + foreach ($typeExtensions as $typeExtension) { + $this->addTypeExtension($typeExtension); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser) + { + $this->typeGuessers[] = $typeGuesser; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addTypeGuessers(array $typeGuessers) + { + $this->typeGuessers = array_merge($this->typeGuessers, $typeGuessers); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFormFactory() + { + $extensions = $this->extensions; + + if ($this->forceCoreExtension) { + $hasCoreExtension = false; + + foreach ($extensions as $extension) { + if ($extension instanceof CoreExtension) { + $hasCoreExtension = true; + break; + } + } + + if (!$hasCoreExtension) { + array_unshift($extensions, new CoreExtension()); + } + } + + if (\count($this->types) > 0 || \count($this->typeExtensions) > 0 || \count($this->typeGuessers) > 0) { + if (\count($this->typeGuessers) > 1) { + $typeGuesser = new FormTypeGuesserChain($this->typeGuessers); + } else { + $typeGuesser = $this->typeGuessers[0] ?? null; + } + + $extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser); + } + + $registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?? new ResolvedFormTypeFactory()); + + return new FormFactory($registry); + } +} diff --git a/vendor/symfony/form/FormFactoryBuilderInterface.php b/vendor/symfony/form/FormFactoryBuilderInterface.php new file mode 100644 index 0000000..e3b0a7b --- /dev/null +++ b/vendor/symfony/form/FormFactoryBuilderInterface.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A builder for FormFactoryInterface objects. + * + * @author Bernhard Schussek + */ +interface FormFactoryBuilderInterface +{ + /** + * Sets the factory for creating ResolvedFormTypeInterface instances. + * + * @return $this + */ + public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory); + + /** + * Adds an extension to be loaded by the factory. + * + * @return $this + */ + public function addExtension(FormExtensionInterface $extension); + + /** + * Adds a list of extensions to be loaded by the factory. + * + * @param FormExtensionInterface[] $extensions The extensions + * + * @return $this + */ + public function addExtensions(array $extensions); + + /** + * Adds a form type to the factory. + * + * @return $this + */ + public function addType(FormTypeInterface $type); + + /** + * Adds a list of form types to the factory. + * + * @param FormTypeInterface[] $types The form types + * + * @return $this + */ + public function addTypes(array $types); + + /** + * Adds a form type extension to the factory. + * + * @return $this + */ + public function addTypeExtension(FormTypeExtensionInterface $typeExtension); + + /** + * Adds a list of form type extensions to the factory. + * + * @param FormTypeExtensionInterface[] $typeExtensions The form type extensions + * + * @return $this + */ + public function addTypeExtensions(array $typeExtensions); + + /** + * Adds a type guesser to the factory. + * + * @return $this + */ + public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser); + + /** + * Adds a list of type guessers to the factory. + * + * @param FormTypeGuesserInterface[] $typeGuessers The type guessers + * + * @return $this + */ + public function addTypeGuessers(array $typeGuessers); + + /** + * Builds and returns the factory. + * + * @return FormFactoryInterface + */ + public function getFormFactory(); +} diff --git a/vendor/symfony/form/FormFactoryInterface.php b/vendor/symfony/form/FormFactoryInterface.php new file mode 100644 index 0000000..c5f2485 --- /dev/null +++ b/vendor/symfony/form/FormFactoryInterface.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Extension\Core\Type\FormType; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; + +/** + * Allows creating a form based on a name, a class or a property. + * + * @author Bernhard Schussek + */ +interface FormFactoryInterface +{ + /** + * Returns a form. + * + * @see createBuilder() + * + * @param mixed $data The initial data + * + * @return FormInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the given type + */ + public function create(string $type = FormType::class, $data = null, array $options = []); + + /** + * Returns a form. + * + * @see createNamedBuilder() + * + * @param mixed $data The initial data + * + * @return FormInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the given type + */ + public function createNamed(string $name, string $type = FormType::class, $data = null, array $options = []); + + /** + * Returns a form for a property of a class. + * + * @see createBuilderForProperty() + * + * @param string $class The fully qualified class name + * @param string $property The name of the property to guess for + * @param mixed $data The initial data + * + * @return FormInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the form type + */ + public function createForProperty(string $class, string $property, $data = null, array $options = []); + + /** + * Returns a form builder. + * + * @param mixed $data The initial data + * + * @return FormBuilderInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the given type + */ + public function createBuilder(string $type = FormType::class, $data = null, array $options = []); + + /** + * Returns a form builder. + * + * @param mixed $data The initial data + * + * @return FormBuilderInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the given type + */ + public function createNamedBuilder(string $name, string $type = FormType::class, $data = null, array $options = []); + + /** + * Returns a form builder for a property of a class. + * + * If any of the 'required' and type options can be guessed, + * and are not provided in the options argument, the guessed value is used. + * + * @param string $class The fully qualified class name + * @param string $property The name of the property to guess for + * @param mixed $data The initial data + * + * @return FormBuilderInterface + * + * @throws InvalidOptionsException if any given option is not applicable to the form type + */ + public function createBuilderForProperty(string $class, string $property, $data = null, array $options = []); +} diff --git a/vendor/symfony/form/FormInterface.php b/vendor/symfony/form/FormInterface.php new file mode 100644 index 0000000..6cc6b4e --- /dev/null +++ b/vendor/symfony/form/FormInterface.php @@ -0,0 +1,328 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * A form group bundling multiple forms in a hierarchical structure. + * + * @author Bernhard Schussek + * + * @extends \ArrayAccess + * @extends \Traversable + */ +interface FormInterface extends \ArrayAccess, \Traversable, \Countable +{ + /** + * Sets the parent form. + * + * @param FormInterface|null $parent The parent form or null if it's the root + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the form has already been submitted + * @throws Exception\LogicException when trying to set a parent for a form with + * an empty name + */ + public function setParent(self $parent = null); + + /** + * Returns the parent form. + * + * @return self|null + */ + public function getParent(); + + /** + * Adds or replaces a child to the form. + * + * @param FormInterface|string $child The FormInterface instance or the name of the child + * @param string|null $type The child's type, if a name was passed + * @param array $options The child's options, if a name was passed + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the form has already been submitted + * @throws Exception\LogicException when trying to add a child to a non-compound form + * @throws Exception\UnexpectedTypeException if $child or $type has an unexpected type + */ + public function add($child, string $type = null, array $options = []); + + /** + * Returns the child with the given name. + * + * @return self + * + * @throws Exception\OutOfBoundsException if the named child does not exist + */ + public function get(string $name); + + /** + * Returns whether a child with the given name exists. + * + * @return bool + */ + public function has(string $name); + + /** + * Removes a child from the form. + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the form has already been submitted + */ + public function remove(string $name); + + /** + * Returns all children in this group. + * + * @return self[] + */ + public function all(); + + /** + * Returns the errors of this form. + * + * @param bool $deep Whether to include errors of child forms as well + * @param bool $flatten Whether to flatten the list of errors in case + * $deep is set to true + * + * @return FormErrorIterator + */ + public function getErrors(bool $deep = false, bool $flatten = true); + + /** + * Updates the form with default model data. + * + * @param mixed $modelData The data formatted as expected for the underlying object + * + * @return $this + * + * @throws Exception\AlreadySubmittedException If the form has already been submitted + * @throws Exception\LogicException if the view data does not match the expected type + * according to {@link FormConfigInterface::getDataClass} + * @throws Exception\RuntimeException If listeners try to call setData in a cycle or if + * the form inherits data from its parent + * @throws Exception\TransformationFailedException if the synchronization failed + */ + public function setData($modelData); + + /** + * Returns the model data in the format needed for the underlying object. + * + * @return mixed When the field is not submitted, the default data is returned. + * When the field is submitted, the default data has been bound + * to the submitted view data. + * + * @throws Exception\RuntimeException If the form inherits data but has no parent + */ + public function getData(); + + /** + * Returns the normalized data of the field, used as internal bridge + * between model data and view data. + * + * @return mixed When the field is not submitted, the default data is returned. + * When the field is submitted, the normalized submitted data + * is returned if the field is synchronized with the view data, + * null otherwise. + * + * @throws Exception\RuntimeException If the form inherits data but has no parent + */ + public function getNormData(); + + /** + * Returns the view data of the field. + * + * It may be defined by {@link FormConfigInterface::getDataClass}. + * + * There are two cases: + * + * - When the form is compound the view data is mapped to the children. + * Each child will use its mapped data as model data. + * It can be an array, an object or null. + * + * - When the form is simple its view data is used to be bound + * to the submitted data. + * It can be a string or an array. + * + * In both cases the view data is the actual altered data on submission. + * + * @return mixed + * + * @throws Exception\RuntimeException If the form inherits data but has no parent + */ + public function getViewData(); + + /** + * Returns the extra submitted data. + * + * @return array The submitted data which do not belong to a child + */ + public function getExtraData(); + + /** + * Returns the form's configuration. + * + * @return FormConfigInterface + */ + public function getConfig(); + + /** + * Returns whether the form is submitted. + * + * @return bool + */ + public function isSubmitted(); + + /** + * Returns the name by which the form is identified in forms. + * + * Only root forms are allowed to have an empty name. + * + * @return string + */ + public function getName(); + + /** + * Returns the property path that the form is mapped to. + * + * @return PropertyPathInterface|null + */ + public function getPropertyPath(); + + /** + * Adds an error to this form. + * + * @return $this + */ + public function addError(FormError $error); + + /** + * Returns whether the form and all children are valid. + * + * @throws Exception\LogicException if the form is not submitted + * + * @return bool + */ + public function isValid(); + + /** + * Returns whether the form is required to be filled out. + * + * If the form has a parent and the parent is not required, this method + * will always return false. Otherwise the value set with setRequired() + * is returned. + * + * @return bool + */ + public function isRequired(); + + /** + * Returns whether this form is disabled. + * + * The content of a disabled form is displayed, but not allowed to be + * modified. The validation of modified disabled forms should fail. + * + * Forms whose parents are disabled are considered disabled regardless of + * their own state. + * + * @return bool + */ + public function isDisabled(); + + /** + * Returns whether the form is empty. + * + * @return bool + */ + public function isEmpty(); + + /** + * Returns whether the data in the different formats is synchronized. + * + * If the data is not synchronized, you can get the transformation failure + * by calling {@link getTransformationFailure()}. + * + * If the form is not submitted, this method always returns true. + * + * @return bool + */ + public function isSynchronized(); + + /** + * Returns the data transformation failure, if any, during submission. + * + * @return Exception\TransformationFailedException|null + */ + public function getTransformationFailure(); + + /** + * Initializes the form tree. + * + * Should be called on the root form after constructing the tree. + * + * @return $this + * + * @throws Exception\RuntimeException If the form is not the root + */ + public function initialize(); + + /** + * Inspects the given request and calls {@link submit()} if the form was + * submitted. + * + * Internally, the request is forwarded to the configured + * {@link RequestHandlerInterface} instance, which determines whether to + * submit the form or not. + * + * @param mixed $request The request to handle + * + * @return $this + */ + public function handleRequest($request = null); + + /** + * Submits data to the form. + * + * @param string|array|null $submittedData The submitted data + * @param bool $clearMissing Whether to set fields to NULL + * when they are missing in the + * submitted data. This argument + * is only used in compound form + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the form has already been submitted + */ + public function submit($submittedData, bool $clearMissing = true); + + /** + * Returns the root of the form tree. + * + * @return self + */ + public function getRoot(); + + /** + * Returns whether the field is the root of the form tree. + * + * @return bool + */ + public function isRoot(); + + /** + * @return FormView + */ + public function createView(FormView $parent = null); +} diff --git a/vendor/symfony/form/FormRegistry.php b/vendor/symfony/form/FormRegistry.php new file mode 100644 index 0000000..90087a6 --- /dev/null +++ b/vendor/symfony/form/FormRegistry.php @@ -0,0 +1,176 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\ExceptionInterface; +use Symfony\Component\Form\Exception\InvalidArgumentException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; + +/** + * The central registry of the Form component. + * + * @author Bernhard Schussek + */ +class FormRegistry implements FormRegistryInterface +{ + /** + * @var FormExtensionInterface[] + */ + private $extensions = []; + + /** + * @var ResolvedFormTypeInterface[] + */ + private $types = []; + + /** + * @var FormTypeGuesserInterface|false|null + */ + private $guesser = false; + + /** + * @var ResolvedFormTypeFactoryInterface + */ + private $resolvedTypeFactory; + + private $checkedTypes = []; + + /** + * @param FormExtensionInterface[] $extensions + * + * @throws UnexpectedTypeException if any extension does not implement FormExtensionInterface + */ + public function __construct(array $extensions, ResolvedFormTypeFactoryInterface $resolvedTypeFactory) + { + foreach ($extensions as $extension) { + if (!$extension instanceof FormExtensionInterface) { + throw new UnexpectedTypeException($extension, FormExtensionInterface::class); + } + } + + $this->extensions = $extensions; + $this->resolvedTypeFactory = $resolvedTypeFactory; + } + + /** + * {@inheritdoc} + */ + public function getType(string $name) + { + if (!isset($this->types[$name])) { + $type = null; + + foreach ($this->extensions as $extension) { + if ($extension->hasType($name)) { + $type = $extension->getType($name); + break; + } + } + + if (!$type) { + // Support fully-qualified class names + if (!class_exists($name)) { + throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not exist.', $name)); + } + if (!is_subclass_of($name, FormTypeInterface::class)) { + throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not implement "Symfony\Component\Form\FormTypeInterface".', $name)); + } + + $type = new $name(); + } + + $this->types[$name] = $this->resolveType($type); + } + + return $this->types[$name]; + } + + /** + * Wraps a type into a ResolvedFormTypeInterface implementation and connects it with its parent type. + */ + private function resolveType(FormTypeInterface $type): ResolvedFormTypeInterface + { + $parentType = $type->getParent(); + $fqcn = \get_class($type); + + if (isset($this->checkedTypes[$fqcn])) { + $types = implode(' > ', array_merge(array_keys($this->checkedTypes), [$fqcn])); + throw new LogicException(sprintf('Circular reference detected for form type "%s" (%s).', $fqcn, $types)); + } + + $this->checkedTypes[$fqcn] = true; + + $typeExtensions = []; + try { + foreach ($this->extensions as $extension) { + $typeExtensions[] = $extension->getTypeExtensions($fqcn); + } + + return $this->resolvedTypeFactory->createResolvedType( + $type, + array_merge([], ...$typeExtensions), + $parentType ? $this->getType($parentType) : null + ); + } finally { + unset($this->checkedTypes[$fqcn]); + } + } + + /** + * {@inheritdoc} + */ + public function hasType(string $name) + { + if (isset($this->types[$name])) { + return true; + } + + try { + $this->getType($name); + } catch (ExceptionInterface $e) { + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function getTypeGuesser() + { + if (false === $this->guesser) { + $guessers = []; + + foreach ($this->extensions as $extension) { + $guesser = $extension->getTypeGuesser(); + + if ($guesser) { + $guessers[] = $guesser; + } + } + + $this->guesser = !empty($guessers) ? new FormTypeGuesserChain($guessers) : null; + } + + return $this->guesser; + } + + /** + * {@inheritdoc} + */ + public function getExtensions() + { + return $this->extensions; + } +} diff --git a/vendor/symfony/form/FormRegistryInterface.php b/vendor/symfony/form/FormRegistryInterface.php new file mode 100644 index 0000000..f39174b --- /dev/null +++ b/vendor/symfony/form/FormRegistryInterface.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * The central registry of the Form component. + * + * @author Bernhard Schussek + */ +interface FormRegistryInterface +{ + /** + * Returns a form type by name. + * + * This methods registers the type extensions from the form extensions. + * + * @return ResolvedFormTypeInterface + * + * @throws Exception\InvalidArgumentException if the type cannot be retrieved from any extension + */ + public function getType(string $name); + + /** + * Returns whether the given form type is supported. + * + * @return bool + */ + public function hasType(string $name); + + /** + * Returns the guesser responsible for guessing types. + * + * @return FormTypeGuesserInterface|null + */ + public function getTypeGuesser(); + + /** + * Returns the extensions loaded by the framework. + * + * @return FormExtensionInterface[] + */ + public function getExtensions(); +} diff --git a/vendor/symfony/form/FormRenderer.php b/vendor/symfony/form/FormRenderer.php new file mode 100644 index 0000000..2f8f351 --- /dev/null +++ b/vendor/symfony/form/FormRenderer.php @@ -0,0 +1,303 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\BadMethodCallException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Twig\Environment; + +/** + * Renders a form into HTML using a rendering engine. + * + * @author Bernhard Schussek + */ +class FormRenderer implements FormRendererInterface +{ + public const CACHE_KEY_VAR = 'unique_block_prefix'; + + private $engine; + private $csrfTokenManager; + private $blockNameHierarchyMap = []; + private $hierarchyLevelMap = []; + private $variableStack = []; + + public function __construct(FormRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null) + { + $this->engine = $engine; + $this->csrfTokenManager = $csrfTokenManager; + } + + /** + * {@inheritdoc} + */ + public function getEngine() + { + return $this->engine; + } + + /** + * {@inheritdoc} + */ + public function setTheme(FormView $view, $themes, bool $useDefaultThemes = true) + { + $this->engine->setTheme($view, $themes, $useDefaultThemes); + } + + /** + * {@inheritdoc} + */ + public function renderCsrfToken(string $tokenId) + { + if (null === $this->csrfTokenManager) { + throw new BadMethodCallException('CSRF tokens can only be generated if a CsrfTokenManagerInterface is injected in FormRenderer::__construct(). Try running "composer require symfony/security-csrf".'); + } + + return $this->csrfTokenManager->getToken($tokenId)->getValue(); + } + + /** + * {@inheritdoc} + */ + public function renderBlock(FormView $view, string $blockName, array $variables = []) + { + $resource = $this->engine->getResourceForBlockName($view, $blockName); + + if (!$resource) { + throw new LogicException(sprintf('No block "%s" found while rendering the form.', $blockName)); + } + + $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; + + // The variables are cached globally for a view (instead of for the + // current suffix) + if (!isset($this->variableStack[$viewCacheKey])) { + $this->variableStack[$viewCacheKey] = []; + + // The default variable scope contains all view variables, merged with + // the variables passed explicitly to the helper + $scopeVariables = $view->vars; + + $varInit = true; + } else { + // Reuse the current scope and merge it with the explicitly passed variables + $scopeVariables = end($this->variableStack[$viewCacheKey]); + + $varInit = false; + } + + // Merge the passed with the existing attributes + if (isset($variables['attr']) && isset($scopeVariables['attr'])) { + $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']); + } + + // Merge the passed with the exist *label* attributes + if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) { + $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']); + } + + // Do not use array_replace_recursive(), otherwise array variables + // cannot be overwritten + $variables = array_replace($scopeVariables, $variables); + + $this->variableStack[$viewCacheKey][] = $variables; + + // Do the rendering + $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); + + // Clear the stack + array_pop($this->variableStack[$viewCacheKey]); + + if ($varInit) { + unset($this->variableStack[$viewCacheKey]); + } + + return $html; + } + + /** + * {@inheritdoc} + */ + public function searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = []) + { + $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix; + + if ($renderOnlyOnce && $view->isRendered()) { + // This is not allowed, because it would result in rendering same IDs multiple times, which is not valid. + throw new BadMethodCallException(sprintf('Field "%s" has already been rendered, save the result of previous render call to a variable and output that instead.', $view->vars['name'])); + } + + // The cache key for storing the variables and types + $viewCacheKey = $view->vars[self::CACHE_KEY_VAR]; + $viewAndSuffixCacheKey = $viewCacheKey.$blockNameSuffix; + + // In templates, we have to deal with two kinds of block hierarchies: + // + // +---------+ +---------+ + // | Theme B | -------> | Theme A | + // +---------+ +---------+ + // + // form_widget -------> form_widget + // ^ + // | + // choice_widget -----> choice_widget + // + // The first kind of hierarchy is the theme hierarchy. This allows to + // override the block "choice_widget" from Theme A in the extending + // Theme B. This kind of inheritance needs to be supported by the + // template engine and, for example, offers "parent()" or similar + // functions to fall back from the custom to the parent implementation. + // + // The second kind of hierarchy is the form type hierarchy. This allows + // to implement a custom "choice_widget" block (no matter in which theme), + // or to fallback to the block of the parent type, which would be + // "form_widget" in this example (again, no matter in which theme). + // If the designer wants to explicitly fallback to "form_widget" in their + // custom "choice_widget", for example because they only want to wrap + // a
around the original implementation, they can call the + // widget() function again to render the block for the parent type. + // + // The second kind is implemented in the following blocks. + if (!isset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey])) { + // INITIAL CALL + // Calculate the hierarchy of template blocks and start on + // the bottom level of the hierarchy (= "__
" block) + $blockNameHierarchy = []; + foreach ($view->vars['block_prefixes'] as $blockNamePrefix) { + $blockNameHierarchy[] = $blockNamePrefix.'_'.$blockNameSuffix; + } + $hierarchyLevel = \count($blockNameHierarchy) - 1; + + $hierarchyInit = true; + } else { + // RECURSIVE CALL + // If a block recursively calls searchAndRenderBlock() again, resume rendering + // using the parent type in the hierarchy. + $blockNameHierarchy = $this->blockNameHierarchyMap[$viewAndSuffixCacheKey]; + $hierarchyLevel = $this->hierarchyLevelMap[$viewAndSuffixCacheKey] - 1; + + $hierarchyInit = false; + } + + // The variables are cached globally for a view (instead of for the + // current suffix) + if (!isset($this->variableStack[$viewCacheKey])) { + $this->variableStack[$viewCacheKey] = []; + + // The default variable scope contains all view variables, merged with + // the variables passed explicitly to the helper + $scopeVariables = $view->vars; + + $varInit = true; + } else { + // Reuse the current scope and merge it with the explicitly passed variables + $scopeVariables = end($this->variableStack[$viewCacheKey]); + + $varInit = false; + } + + // Load the resource where this block can be found + $resource = $this->engine->getResourceForBlockNameHierarchy($view, $blockNameHierarchy, $hierarchyLevel); + + // Update the current hierarchy level to the one at which the resource was + // found. For example, if looking for "choice_widget", but only a resource + // is found for its parent "form_widget", then the level is updated here + // to the parent level. + $hierarchyLevel = $this->engine->getResourceHierarchyLevel($view, $blockNameHierarchy, $hierarchyLevel); + + // The actually existing block name in $resource + $blockName = $blockNameHierarchy[$hierarchyLevel]; + + // Escape if no resource exists for this block + if (!$resource) { + if (\count($blockNameHierarchy) !== \count(array_unique($blockNameHierarchy))) { + throw new LogicException(sprintf('Unable to render the form because the block names array contains duplicates: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); + } + + throw new LogicException(sprintf('Unable to render the form as none of the following blocks exist: "%s".', implode('", "', array_reverse($blockNameHierarchy)))); + } + + // Merge the passed with the existing attributes + if (isset($variables['attr']) && isset($scopeVariables['attr'])) { + $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']); + } + + // Merge the passed with the exist *label* attributes + if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) { + $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']); + } + + // Do not use array_replace_recursive(), otherwise array variables + // cannot be overwritten + $variables = array_replace($scopeVariables, $variables); + + // In order to make recursive calls possible, we need to store the block hierarchy, + // the current level of the hierarchy and the variables so that this method can + // resume rendering one level higher of the hierarchy when it is called recursively. + // + // We need to store these values in maps (associative arrays) because within a + // call to widget() another call to widget() can be made, but for a different view + // object. These nested calls should not override each other. + $this->blockNameHierarchyMap[$viewAndSuffixCacheKey] = $blockNameHierarchy; + $this->hierarchyLevelMap[$viewAndSuffixCacheKey] = $hierarchyLevel; + + // We also need to store the variables for the view so that we can render other + // blocks for the same view using the same variables as in the outer block. + $this->variableStack[$viewCacheKey][] = $variables; + + // Do the rendering + $html = $this->engine->renderBlock($view, $resource, $blockName, $variables); + + // Clear the stack + array_pop($this->variableStack[$viewCacheKey]); + + // Clear the caches if they were filled for the first time within + // this function call + if ($hierarchyInit) { + unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey], $this->hierarchyLevelMap[$viewAndSuffixCacheKey]); + } + + if ($varInit) { + unset($this->variableStack[$viewCacheKey]); + } + + if ($renderOnlyOnce) { + $view->setRendered(); + } + + return $html; + } + + /** + * {@inheritdoc} + */ + public function humanize(string $text) + { + return ucfirst(strtolower(trim(preg_replace(['/([A-Z])/', '/[_\s]+/'], ['_$1', ' '], $text)))); + } + + /** + * @internal + */ + public function encodeCurrency(Environment $environment, string $text, string $widget = ''): string + { + if ('UTF-8' === $charset = $environment->getCharset()) { + $text = htmlspecialchars($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); + } else { + $text = htmlentities($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); + $text = iconv('UTF-8', $charset, $text); + $widget = iconv('UTF-8', $charset, $widget); + } + + return str_replace('{{ widget }}', $widget, $text); + } +} diff --git a/vendor/symfony/form/FormRendererEngineInterface.php b/vendor/symfony/form/FormRendererEngineInterface.php new file mode 100644 index 0000000..67b88c9 --- /dev/null +++ b/vendor/symfony/form/FormRendererEngineInterface.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Adapter for rendering form templates with a specific templating engine. + * + * @author Bernhard Schussek + */ +interface FormRendererEngineInterface +{ + /** + * Sets the theme(s) to be used for rendering a view and its children. + * + * @param FormView $view The view to assign the theme(s) to + * @param mixed $themes The theme(s). The type of these themes + * is open to the implementation. + */ + public function setTheme(FormView $view, $themes, bool $useDefaultThemes = true); + + /** + * Returns the resource for a block name. + * + * The resource is first searched in the themes attached to $view, then + * in the themes of its parent view and so on, until a resource was found. + * + * The type of the resource is decided by the implementation. The resource + * is later passed to {@link renderBlock()} by the rendering algorithm. + * + * @param FormView $view The view for determining the used themes. + * First the themes attached directly to the + * view with {@link setTheme()} are considered, + * then the ones of its parent etc. + * + * @return mixed the renderer resource or false, if none was found + */ + public function getResourceForBlockName(FormView $view, string $blockName); + + /** + * Returns the resource for a block hierarchy. + * + * A block hierarchy is an array which starts with the root of the hierarchy + * and continues with the child of that root, the child of that child etc. + * The following is an example for a block hierarchy: + * + * form_widget + * text_widget + * url_widget + * + * In this example, "url_widget" is the most specific block, while the other + * blocks are its ancestors in the hierarchy. + * + * The second parameter $hierarchyLevel determines the level of the hierarchy + * that should be rendered. For example, if $hierarchyLevel is 2 for the + * above hierarchy, the engine will first look for the block "url_widget", + * then, if that does not exist, for the block "text_widget" etc. + * + * The type of the resource is decided by the implementation. The resource + * is later passed to {@link renderBlock()} by the rendering algorithm. + * + * @param FormView $view The view for determining the used themes. + * First the themes attached directly to + * the view with {@link setTheme()} are + * considered, then the ones of its parent etc. + * @param string[] $blockNameHierarchy The block name hierarchy, with the root block + * at the beginning + * @param int $hierarchyLevel The level in the hierarchy at which to start + * looking. Level 0 indicates the root block, i.e. + * the first element of $blockNameHierarchy. + * + * @return mixed The renderer resource or false, if none was found + */ + public function getResourceForBlockNameHierarchy(FormView $view, array $blockNameHierarchy, int $hierarchyLevel); + + /** + * Returns the hierarchy level at which a resource can be found. + * + * A block hierarchy is an array which starts with the root of the hierarchy + * and continues with the child of that root, the child of that child etc. + * The following is an example for a block hierarchy: + * + * form_widget + * text_widget + * url_widget + * + * The second parameter $hierarchyLevel determines the level of the hierarchy + * that should be rendered. + * + * If we call this method with the hierarchy level 2, the engine will first + * look for a resource for block "url_widget". If such a resource exists, + * the method returns 2. Otherwise it tries to find a resource for block + * "text_widget" (at level 1) and, again, returns 1 if a resource was found. + * The method continues to look for resources until the root level was + * reached and nothing was found. In this case false is returned. + * + * The type of the resource is decided by the implementation. The resource + * is later passed to {@link renderBlock()} by the rendering algorithm. + * + * @param FormView $view The view for determining the used themes. + * First the themes attached directly to + * the view with {@link setTheme()} are + * considered, then the ones of its parent etc. + * @param string[] $blockNameHierarchy The block name hierarchy, with the root block + * at the beginning + * @param int $hierarchyLevel The level in the hierarchy at which to start + * looking. Level 0 indicates the root block, i.e. + * the first element of $blockNameHierarchy. + * + * @return int|false + */ + public function getResourceHierarchyLevel(FormView $view, array $blockNameHierarchy, int $hierarchyLevel); + + /** + * Renders a block in the given renderer resource. + * + * The resource can be obtained by calling {@link getResourceForBlock()} + * or {@link getResourceForBlockHierarchy()}. The type of the resource is + * decided by the implementation. + * + * @param FormView $view The view to render + * @param mixed $resource The renderer resource + * @param array $variables The variables to pass to the template + * + * @return string + */ + public function renderBlock(FormView $view, $resource, string $blockName, array $variables = []); +} diff --git a/vendor/symfony/form/FormRendererInterface.php b/vendor/symfony/form/FormRendererInterface.php new file mode 100644 index 0000000..04af58b --- /dev/null +++ b/vendor/symfony/form/FormRendererInterface.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Renders a form into HTML. + * + * @author Bernhard Schussek + */ +interface FormRendererInterface +{ + /** + * Returns the engine used by this renderer. + * + * @return FormRendererEngineInterface + */ + public function getEngine(); + + /** + * Sets the theme(s) to be used for rendering a view and its children. + * + * @param FormView $view The view to assign the theme(s) to + * @param mixed $themes The theme(s). The type of these themes + * is open to the implementation. + * @param bool $useDefaultThemes If true, will use default themes specified + * in the renderer + */ + public function setTheme(FormView $view, $themes, bool $useDefaultThemes = true); + + /** + * Renders a named block of the form theme. + * + * @param FormView $view The view for which to render the block + * @param array $variables The variables to pass to the template + * + * @return string + */ + public function renderBlock(FormView $view, string $blockName, array $variables = []); + + /** + * Searches and renders a block for a given name suffix. + * + * The block is searched by combining the block names stored in the + * form view with the given suffix. If a block name is found, that + * block is rendered. + * + * If this method is called recursively, the block search is continued + * where a block was found before. + * + * @param FormView $view The view for which to render the block + * @param array $variables The variables to pass to the template + * + * @return string + */ + public function searchAndRenderBlock(FormView $view, string $blockNameSuffix, array $variables = []); + + /** + * Renders a CSRF token. + * + * Use this helper for CSRF protection without the overhead of creating a + * form. + * + * + * + * Check the token in your action using the same token ID. + * + * // $csrfProvider being an instance of Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface + * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { + * throw new \RuntimeException('CSRF attack detected.'); + * } + * + * @return string + */ + public function renderCsrfToken(string $tokenId); + + /** + * Makes a technical name human readable. + * + * Sequences of underscores are replaced by single spaces. The first letter + * of the resulting string is capitalized, while all other letters are + * turned to lowercase. + * + * @return string + */ + public function humanize(string $text); +} diff --git a/vendor/symfony/form/FormTypeExtensionInterface.php b/vendor/symfony/form/FormTypeExtensionInterface.php new file mode 100644 index 0000000..6810f0a --- /dev/null +++ b/vendor/symfony/form/FormTypeExtensionInterface.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Bernhard Schussek + */ +interface FormTypeExtensionInterface +{ + /** + * Builds the form. + * + * This method is called after the extended type has built the form to + * further modify it. + * + * @see FormTypeInterface::buildForm() + */ + public function buildForm(FormBuilderInterface $builder, array $options); + + /** + * Builds the view. + * + * This method is called after the extended type has built the view to + * further modify it. + * + * @see FormTypeInterface::buildView() + */ + public function buildView(FormView $view, FormInterface $form, array $options); + + /** + * Finishes the view. + * + * This method is called after the extended type has finished the view to + * further modify it. + * + * @see FormTypeInterface::finishView() + */ + public function finishView(FormView $view, FormInterface $form, array $options); + + public function configureOptions(OptionsResolver $resolver); + + /** + * Gets the extended types. + * + * @return string[] + */ + public static function getExtendedTypes(): iterable; +} diff --git a/vendor/symfony/form/FormTypeGuesserChain.php b/vendor/symfony/form/FormTypeGuesserChain.php new file mode 100644 index 0000000..2763d90 --- /dev/null +++ b/vendor/symfony/form/FormTypeGuesserChain.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\Component\Form; + +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Guess\Guess; + +class FormTypeGuesserChain implements FormTypeGuesserInterface +{ + private $guessers = []; + + /** + * @param FormTypeGuesserInterface[] $guessers + * + * @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface + */ + public function __construct(iterable $guessers) + { + $tmpGuessers = []; + foreach ($guessers as $guesser) { + if (!$guesser instanceof FormTypeGuesserInterface) { + throw new UnexpectedTypeException($guesser, FormTypeGuesserInterface::class); + } + + if ($guesser instanceof self) { + $tmpGuessers[] = $guesser->guessers; + } else { + $tmpGuessers[] = [$guesser]; + } + } + + $this->guessers = array_merge([], ...$tmpGuessers); + } + + /** + * {@inheritdoc} + */ + public function guessType(string $class, string $property) + { + return $this->guess(function ($guesser) use ($class, $property) { + return $guesser->guessType($class, $property); + }); + } + + /** + * {@inheritdoc} + */ + public function guessRequired(string $class, string $property) + { + return $this->guess(function ($guesser) use ($class, $property) { + return $guesser->guessRequired($class, $property); + }); + } + + /** + * {@inheritdoc} + */ + public function guessMaxLength(string $class, string $property) + { + return $this->guess(function ($guesser) use ($class, $property) { + return $guesser->guessMaxLength($class, $property); + }); + } + + /** + * {@inheritdoc} + */ + public function guessPattern(string $class, string $property) + { + return $this->guess(function ($guesser) use ($class, $property) { + return $guesser->guessPattern($class, $property); + }); + } + + /** + * Executes a closure for each guesser and returns the best guess from the + * return values. + * + * @param \Closure $closure The closure to execute. Accepts a guesser + * as argument and should return a Guess instance + */ + private function guess(\Closure $closure): ?Guess + { + $guesses = []; + + foreach ($this->guessers as $guesser) { + if ($guess = $closure($guesser)) { + $guesses[] = $guess; + } + } + + return Guess::getBestGuess($guesses); + } +} diff --git a/vendor/symfony/form/FormTypeGuesserInterface.php b/vendor/symfony/form/FormTypeGuesserInterface.php new file mode 100644 index 0000000..61e2c5f --- /dev/null +++ b/vendor/symfony/form/FormTypeGuesserInterface.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @author Bernhard Schussek + */ +interface FormTypeGuesserInterface +{ + /** + * Returns a field guess for a property name of a class. + * + * @return Guess\TypeGuess|null + */ + public function guessType(string $class, string $property); + + /** + * Returns a guess whether a property of a class is required. + * + * @return Guess\ValueGuess|null + */ + public function guessRequired(string $class, string $property); + + /** + * Returns a guess about the field's maximum length. + * + * @return Guess\ValueGuess|null + */ + public function guessMaxLength(string $class, string $property); + + /** + * Returns a guess about the field's pattern. + * + * - When you have a min value, you guess a min length of this min (LOW_CONFIDENCE) + * - Then line below, if this value is a float type, this is wrong so you guess null with MEDIUM_CONFIDENCE to override the previous guess. + * Example: + * You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5) + * + * @see https://github.com/symfony/symfony/pull/3927 + * + * @return Guess\ValueGuess|null + */ + public function guessPattern(string $class, string $property); +} diff --git a/vendor/symfony/form/FormTypeInterface.php b/vendor/symfony/form/FormTypeInterface.php new file mode 100644 index 0000000..2b9066a --- /dev/null +++ b/vendor/symfony/form/FormTypeInterface.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Bernhard Schussek + */ +interface FormTypeInterface +{ + /** + * Builds the form. + * + * This method is called for each type in the hierarchy starting from the + * top most type. Type extensions can further modify the form. + * + * @param array $options + * + * @see FormTypeExtensionInterface::buildForm() + */ + public function buildForm(FormBuilderInterface $builder, array $options); + + /** + * Builds the form view. + * + * This method is called for each type in the hierarchy starting from the + * top most type. Type extensions can further modify the view. + * + * A view of a form is built before the views of the child forms are built. + * This means that you cannot access child views in this method. If you need + * to do so, move your logic to {@link finishView()} instead. + * + * @param array $options + * + * @see FormTypeExtensionInterface::buildView() + */ + public function buildView(FormView $view, FormInterface $form, array $options); + + /** + * Finishes the form view. + * + * This method gets called for each type in the hierarchy starting from the + * top most type. Type extensions can further modify the view. + * + * When this method is called, views of the form's children have already + * been built and finished and can be accessed. You should only implement + * such logic in this method that actually accesses child views. For everything + * else you are recommended to implement {@link buildView()} instead. + * + * @param array $options + * + * @see FormTypeExtensionInterface::finishView() + */ + public function finishView(FormView $view, FormInterface $form, array $options); + + /** + * Configures the options for this type. + */ + public function configureOptions(OptionsResolver $resolver); + + /** + * Returns the prefix of the template block name for this type. + * + * The block prefix defaults to the underscored short class name with + * the "Type" suffix removed (e.g. "UserProfileType" => "user_profile"). + * + * @return string + */ + public function getBlockPrefix(); + + /** + * Returns the name of the parent type. + * + * @return string|null + */ + public function getParent(); +} diff --git a/vendor/symfony/form/FormView.php b/vendor/symfony/form/FormView.php new file mode 100644 index 0000000..0162208 --- /dev/null +++ b/vendor/symfony/form/FormView.php @@ -0,0 +1,180 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\BadMethodCallException; + +/** + * @author Bernhard Schussek + * + * @implements \ArrayAccess + * @implements \IteratorAggregate + */ +class FormView implements \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * The variables assigned to this view. + */ + public $vars = [ + 'value' => null, + 'attr' => [], + ]; + + /** + * The parent view. + */ + public $parent; + + /** + * The child views. + * + * @var array + */ + public $children = []; + + /** + * Is the form attached to this renderer rendered? + * + * Rendering happens when either the widget or the row method was called. + * Row implicitly includes widget, however certain rendering mechanisms + * have to skip widget rendering when a row is rendered. + * + * @var bool + */ + private $rendered = false; + + private $methodRendered = false; + + public function __construct(self $parent = null) + { + $this->parent = $parent; + } + + /** + * Returns whether the view was already rendered. + * + * @return bool + */ + public function isRendered() + { + if (true === $this->rendered || 0 === \count($this->children)) { + return $this->rendered; + } + + foreach ($this->children as $child) { + if (!$child->isRendered()) { + return false; + } + } + + return $this->rendered = true; + } + + /** + * Marks the view as rendered. + * + * @return $this + */ + public function setRendered() + { + $this->rendered = true; + + return $this; + } + + /** + * @return bool + */ + public function isMethodRendered() + { + return $this->methodRendered; + } + + public function setMethodRendered() + { + $this->methodRendered = true; + } + + /** + * Returns a child by name (implements \ArrayAccess). + * + * @param int|string $name The child name + * + * @return self + */ + #[\ReturnTypeWillChange] + public function offsetGet($name) + { + return $this->children[$name]; + } + + /** + * Returns whether the given child exists (implements \ArrayAccess). + * + * @param int|string $name The child name + * + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($name) + { + return isset($this->children[$name]); + } + + /** + * Implements \ArrayAccess. + * + * @return void + * + * @throws BadMethodCallException always as setting a child by name is not allowed + */ + #[\ReturnTypeWillChange] + public function offsetSet($name, $value) + { + throw new BadMethodCallException('Not supported.'); + } + + /** + * Removes a child (implements \ArrayAccess). + * + * @param int|string $name The child name + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($name) + { + unset($this->children[$name]); + } + + /** + * Returns an iterator to iterate over children (implements \IteratorAggregate). + * + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \ArrayIterator($this->children); + } + + /** + * Implements \Countable. + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->children); + } +} diff --git a/vendor/symfony/form/Forms.php b/vendor/symfony/form/Forms.php new file mode 100644 index 0000000..020e75e --- /dev/null +++ b/vendor/symfony/form/Forms.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Entry point of the Form component. + * + * Use this class to conveniently create new form factories: + * + * use Symfony\Component\Form\Forms; + * + * $formFactory = Forms::createFormFactory(); + * + * $form = $formFactory->createBuilder() + * ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') + * ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType') + * ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType') + * ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', [ + * 'choices' => ['Red' => 'r', 'Blue' => 'b'], + * ]) + * ->getForm(); + * + * You can also add custom extensions to the form factory: + * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new AcmeExtension()) + * ->getFormFactory(); + * + * If you create custom form types or type extensions, it is + * generally recommended to create your own extensions that lazily + * load these types and type extensions. In projects where performance + * does not matter that much, you can also pass them directly to the + * form factory: + * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addType(new PersonType()) + * ->addType(new PhoneNumberType()) + * ->addTypeExtension(new FormTypeHelpTextExtension()) + * ->getFormFactory(); + * + * Support for the Validator component is provided by ValidatorExtension. + * This extension needs a validator object to function properly: + * + * use Symfony\Component\Validator\Validation; + * use Symfony\Component\Form\Extension\Validator\ValidatorExtension; + * + * $validator = Validation::createValidator(); + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new ValidatorExtension($validator)) + * ->getFormFactory(); + * + * @author Bernhard Schussek + */ +final class Forms +{ + /** + * Creates a form factory with the default configuration. + */ + public static function createFormFactory(): FormFactoryInterface + { + return self::createFormFactoryBuilder()->getFormFactory(); + } + + /** + * Creates a form factory builder with the default configuration. + */ + public static function createFormFactoryBuilder(): FormFactoryBuilderInterface + { + return new FormFactoryBuilder(true); + } + + /** + * This class cannot be instantiated. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/form/Guess/Guess.php b/vendor/symfony/form/Guess/Guess.php new file mode 100644 index 0000000..935bbfe --- /dev/null +++ b/vendor/symfony/form/Guess/Guess.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Guess; + +use Symfony\Component\Form\Exception\InvalidArgumentException; + +/** + * Base class for guesses made by TypeGuesserInterface implementation. + * + * Each instance contains a confidence value about the correctness of the guess. + * Thus an instance with confidence HIGH_CONFIDENCE is more likely to be + * correct than an instance with confidence LOW_CONFIDENCE. + * + * @author Bernhard Schussek + */ +abstract class Guess +{ + /** + * Marks an instance with a value that is extremely likely to be correct. + */ + public const VERY_HIGH_CONFIDENCE = 3; + + /** + * Marks an instance with a value that is very likely to be correct. + */ + public const HIGH_CONFIDENCE = 2; + + /** + * Marks an instance with a value that is likely to be correct. + */ + public const MEDIUM_CONFIDENCE = 1; + + /** + * Marks an instance with a value that may be correct. + */ + public const LOW_CONFIDENCE = 0; + + /** + * The confidence about the correctness of the value. + * + * One of VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE, MEDIUM_CONFIDENCE + * and LOW_CONFIDENCE. + * + * @var int + */ + private $confidence; + + /** + * Returns the guess most likely to be correct from a list of guesses. + * + * If there are multiple guesses with the same, highest confidence, the + * returned guess is any of them. + * + * @param static[] $guesses An array of guesses + * + * @return static|null + */ + public static function getBestGuess(array $guesses) + { + $result = null; + $maxConfidence = -1; + + foreach ($guesses as $guess) { + if ($maxConfidence < $confidence = $guess->getConfidence()) { + $maxConfidence = $confidence; + $result = $guess; + } + } + + return $result; + } + + /** + * @throws InvalidArgumentException if the given value of confidence is unknown + */ + public function __construct(int $confidence) + { + if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence && + self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) { + throw new InvalidArgumentException('The confidence should be one of the constants defined in Guess.'); + } + + $this->confidence = $confidence; + } + + /** + * Returns the confidence that the guessed value is correct. + * + * @return int One of the constants VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE, + * MEDIUM_CONFIDENCE and LOW_CONFIDENCE + */ + public function getConfidence() + { + return $this->confidence; + } +} diff --git a/vendor/symfony/form/Guess/TypeGuess.php b/vendor/symfony/form/Guess/TypeGuess.php new file mode 100644 index 0000000..ff0c6a7 --- /dev/null +++ b/vendor/symfony/form/Guess/TypeGuess.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Guess; + +/** + * Contains a guessed class name and a list of options for creating an instance + * of that class. + * + * @author Bernhard Schussek + */ +class TypeGuess extends Guess +{ + private $type; + private $options; + + /** + * @param string $type The guessed field type + * @param array $options The options for creating instances of the + * guessed class + * @param int $confidence The confidence that the guessed class name + * is correct + */ + public function __construct(string $type, array $options, int $confidence) + { + parent::__construct($confidence); + + $this->type = $type; + $this->options = $options; + } + + /** + * Returns the guessed field type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Returns the guessed options for creating instances of the guessed type. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } +} diff --git a/vendor/symfony/form/Guess/ValueGuess.php b/vendor/symfony/form/Guess/ValueGuess.php new file mode 100644 index 0000000..fe19dfe --- /dev/null +++ b/vendor/symfony/form/Guess/ValueGuess.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Guess; + +/** + * Contains a guessed value. + * + * @author Bernhard Schussek + */ +class ValueGuess extends Guess +{ + private $value; + + /** + * @param string|int|bool|null $value The guessed value + * @param int $confidence The confidence that the guessed class name + * is correct + */ + public function __construct($value, int $confidence) + { + parent::__construct($confidence); + + $this->value = $value; + } + + /** + * Returns the guessed value. + * + * @return string|int|bool|null + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/symfony/form/LICENSE b/vendor/symfony/form/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/form/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/form/NativeRequestHandler.php b/vendor/symfony/form/NativeRequestHandler.php new file mode 100644 index 0000000..7b39ad3 --- /dev/null +++ b/vendor/symfony/form/NativeRequestHandler.php @@ -0,0 +1,256 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Util\ServerParams; + +/** + * A request handler using PHP super globals $_GET, $_POST and $_SERVER. + * + * @author Bernhard Schussek + */ +class NativeRequestHandler implements RequestHandlerInterface +{ + private $serverParams; + + /** + * The allowed keys of the $_FILES array. + */ + private const FILE_KEYS = [ + 'error', + 'name', + 'size', + 'tmp_name', + 'type', + ]; + + public function __construct(ServerParams $params = null) + { + $this->serverParams = $params ?? new ServerParams(); + } + + /** + * {@inheritdoc} + * + * @throws Exception\UnexpectedTypeException If the $request is not null + */ + public function handleRequest(FormInterface $form, $request = null) + { + if (null !== $request) { + throw new UnexpectedTypeException($request, 'null'); + } + + $name = $form->getName(); + $method = $form->getConfig()->getMethod(); + + if ($method !== self::getRequestMethod()) { + return; + } + + // For request methods that must not have a request body we fetch data + // from the query string. Otherwise we look for data in the request body. + if ('GET' === $method || 'HEAD' === $method || 'TRACE' === $method) { + if ('' === $name) { + $data = $_GET; + } else { + // Don't submit GET requests if the form's name does not exist + // in the request + if (!isset($_GET[$name])) { + return; + } + + $data = $_GET[$name]; + } + } else { + // Mark the form with an error if the uploaded size was too large + // This is done here and not in FormValidator because $_POST is + // empty when that error occurs. Hence the form is never submitted. + if ($this->serverParams->hasPostMaxSizeBeenExceeded()) { + // Submit the form, but don't clear the default values + $form->submit(null, false); + + $form->addError(new FormError( + $form->getConfig()->getOption('upload_max_size_message')(), + null, + ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()] + )); + + return; + } + + $fixedFiles = []; + foreach ($_FILES as $fileKey => $file) { + $fixedFiles[$fileKey] = self::stripEmptyFiles(self::fixPhpFilesArray($file)); + } + + if ('' === $name) { + $params = $_POST; + $files = $fixedFiles; + } elseif (\array_key_exists($name, $_POST) || \array_key_exists($name, $fixedFiles)) { + $default = $form->getConfig()->getCompound() ? [] : null; + $params = \array_key_exists($name, $_POST) ? $_POST[$name] : $default; + $files = \array_key_exists($name, $fixedFiles) ? $fixedFiles[$name] : $default; + } else { + // Don't submit the form if it is not present in the request + return; + } + + if (\is_array($params) && \is_array($files)) { + $data = array_replace_recursive($params, $files); + } else { + $data = $params ?: $files; + } + } + + // Don't auto-submit the form unless at least one field is present. + if ('' === $name && \count(array_intersect_key($data, $form->all())) <= 0) { + return; + } + + if (\is_array($data) && \array_key_exists('_method', $data) && $method === $data['_method'] && !$form->has('_method')) { + unset($data['_method']); + } + + $form->submit($data, 'PATCH' !== $method); + } + + /** + * {@inheritdoc} + */ + public function isFileUpload($data) + { + // POST data will always be strings or arrays of strings. Thus, we can be sure + // that the submitted data is a file upload if the "error" value is an integer + // (this value must have been injected by PHP itself). + return \is_array($data) && isset($data['error']) && \is_int($data['error']); + } + + /** + * @return int|null + */ + public function getUploadFileError($data) + { + if (!\is_array($data)) { + return null; + } + + if (!isset($data['error'])) { + return null; + } + + if (!\is_int($data['error'])) { + return null; + } + + if (\UPLOAD_ERR_OK === $data['error']) { + return null; + } + + return $data['error']; + } + + /** + * Returns the method used to submit the request to the server. + */ + private static function getRequestMethod(): string + { + $method = isset($_SERVER['REQUEST_METHOD']) + ? strtoupper($_SERVER['REQUEST_METHOD']) + : 'GET'; + + if ('POST' === $method && isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { + $method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); + } + + return $method; + } + + /** + * Fixes a malformed PHP $_FILES array. + * + * PHP has a bug that the format of the $_FILES array differs, depending on + * whether the uploaded file fields had normal field names or array-like + * field names ("normal" vs. "parent[child]"). + * + * This method fixes the array to look like the "normal" $_FILES array. + * + * It's safe to pass an already converted array, in which case this method + * just returns the original array unmodified. + * + * This method is identical to {@link \Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray} + * and should be kept as such in order to port fixes quickly and easily. + * + * @return mixed + */ + private static function fixPhpFilesArray($data) + { + if (!\is_array($data)) { + return $data; + } + + // Remove extra key added by PHP 8.1. + unset($data['full_path']); + $keys = array_keys($data); + sort($keys); + + if (self::FILE_KEYS !== $keys || !isset($data['name']) || !\is_array($data['name'])) { + return $data; + } + + $files = $data; + foreach (self::FILE_KEYS as $k) { + unset($files[$k]); + } + + foreach ($data['name'] as $key => $name) { + $files[$key] = self::fixPhpFilesArray([ + 'error' => $data['error'][$key], + 'name' => $name, + 'type' => $data['type'][$key], + 'tmp_name' => $data['tmp_name'][$key], + 'size' => $data['size'][$key], + ]); + } + + return $files; + } + + /** + * Sets empty uploaded files to NULL in the given uploaded files array. + * + * @return mixed + */ + private static function stripEmptyFiles($data) + { + if (!\is_array($data)) { + return $data; + } + + $keys = array_keys($data); + sort($keys); + + if (self::FILE_KEYS === $keys) { + if (\UPLOAD_ERR_NO_FILE === $data['error']) { + return null; + } + + return $data; + } + + foreach ($data as $key => $value) { + $data[$key] = self::stripEmptyFiles($value); + } + + return $data; + } +} diff --git a/vendor/symfony/form/PreloadedExtension.php b/vendor/symfony/form/PreloadedExtension.php new file mode 100644 index 0000000..c6767dc --- /dev/null +++ b/vendor/symfony/form/PreloadedExtension.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\InvalidArgumentException; + +/** + * A form extension with preloaded types, type extensions and type guessers. + * + * @author Bernhard Schussek + */ +class PreloadedExtension implements FormExtensionInterface +{ + private $types = []; + private $typeExtensions = []; + private $typeGuesser; + + /** + * Creates a new preloaded extension. + * + * @param FormTypeInterface[] $types The types that the extension should support + * @param FormTypeExtensionInterface[][] $typeExtensions The type extensions that the extension should support + */ + public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null) + { + $this->typeExtensions = $typeExtensions; + $this->typeGuesser = $typeGuesser; + + foreach ($types as $type) { + $this->types[\get_class($type)] = $type; + } + } + + /** + * {@inheritdoc} + */ + public function getType(string $name) + { + if (!isset($this->types[$name])) { + throw new InvalidArgumentException(sprintf('The type "%s" cannot be loaded by this extension.', $name)); + } + + return $this->types[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasType(string $name) + { + return isset($this->types[$name]); + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions(string $name) + { + return $this->typeExtensions[$name] + ?? []; + } + + /** + * {@inheritdoc} + */ + public function hasTypeExtensions(string $name) + { + return !empty($this->typeExtensions[$name]); + } + + /** + * {@inheritdoc} + */ + public function getTypeGuesser() + { + return $this->typeGuesser; + } +} diff --git a/vendor/symfony/form/README.md b/vendor/symfony/form/README.md new file mode 100644 index 0000000..0cda654 --- /dev/null +++ b/vendor/symfony/form/README.md @@ -0,0 +1,13 @@ +Form Component +============== + +The Form component allows you to easily create, process and reuse HTML forms. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/form.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/form/RequestHandlerInterface.php b/vendor/symfony/form/RequestHandlerInterface.php new file mode 100644 index 0000000..65d86e2 --- /dev/null +++ b/vendor/symfony/form/RequestHandlerInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Submits forms if they were submitted. + * + * @author Bernhard Schussek + */ +interface RequestHandlerInterface +{ + /** + * Submits a form if it was submitted. + * + * @param mixed $request The current request + */ + public function handleRequest(FormInterface $form, $request = null); + + /** + * Returns true if the given data is a file upload. + * + * @param mixed $data The form field data + * + * @return bool + */ + public function isFileUpload($data); +} diff --git a/vendor/symfony/form/ResolvedFormType.php b/vendor/symfony/form/ResolvedFormType.php new file mode 100644 index 0000000..b484c91 --- /dev/null +++ b/vendor/symfony/form/ResolvedFormType.php @@ -0,0 +1,224 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\OptionsResolver\Exception\ExceptionInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A wrapper for a form type and its extensions. + * + * @author Bernhard Schussek + */ +class ResolvedFormType implements ResolvedFormTypeInterface +{ + /** + * @var FormTypeInterface + */ + private $innerType; + + /** + * @var FormTypeExtensionInterface[] + */ + private $typeExtensions; + + /** + * @var ResolvedFormTypeInterface|null + */ + private $parent; + + /** + * @var OptionsResolver + */ + private $optionsResolver; + + /** + * @param FormTypeExtensionInterface[] $typeExtensions + */ + public function __construct(FormTypeInterface $innerType, array $typeExtensions = [], ResolvedFormTypeInterface $parent = null) + { + foreach ($typeExtensions as $extension) { + if (!$extension instanceof FormTypeExtensionInterface) { + throw new UnexpectedTypeException($extension, FormTypeExtensionInterface::class); + } + } + + $this->innerType = $innerType; + $this->typeExtensions = $typeExtensions; + $this->parent = $parent; + } + + /** + * {@inheritdoc} + */ + public function getBlockPrefix() + { + return $this->innerType->getBlockPrefix(); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritdoc} + */ + public function getInnerType() + { + return $this->innerType; + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions() + { + return $this->typeExtensions; + } + + /** + * {@inheritdoc} + */ + public function createBuilder(FormFactoryInterface $factory, string $name, array $options = []) + { + try { + $options = $this->getOptionsResolver()->resolve($options); + } catch (ExceptionInterface $e) { + throw new $e(sprintf('An error has occurred resolving the options of the form "%s": ', get_debug_type($this->getInnerType())).$e->getMessage(), $e->getCode(), $e); + } + + // Should be decoupled from the specific option at some point + $dataClass = $options['data_class'] ?? null; + + $builder = $this->newBuilder($name, $dataClass, $factory, $options); + $builder->setType($this); + + return $builder; + } + + /** + * {@inheritdoc} + */ + public function createView(FormInterface $form, FormView $parent = null) + { + return $this->newView($parent); + } + + /** + * {@inheritdoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + if (null !== $this->parent) { + $this->parent->buildForm($builder, $options); + } + + $this->innerType->buildForm($builder, $options); + + foreach ($this->typeExtensions as $extension) { + $extension->buildForm($builder, $options); + } + } + + /** + * {@inheritdoc} + */ + public function buildView(FormView $view, FormInterface $form, array $options) + { + if (null !== $this->parent) { + $this->parent->buildView($view, $form, $options); + } + + $this->innerType->buildView($view, $form, $options); + + foreach ($this->typeExtensions as $extension) { + $extension->buildView($view, $form, $options); + } + } + + /** + * {@inheritdoc} + */ + public function finishView(FormView $view, FormInterface $form, array $options) + { + if (null !== $this->parent) { + $this->parent->finishView($view, $form, $options); + } + + $this->innerType->finishView($view, $form, $options); + + foreach ($this->typeExtensions as $extension) { + /* @var FormTypeExtensionInterface $extension */ + $extension->finishView($view, $form, $options); + } + } + + /** + * {@inheritdoc} + */ + public function getOptionsResolver() + { + if (null === $this->optionsResolver) { + if (null !== $this->parent) { + $this->optionsResolver = clone $this->parent->getOptionsResolver(); + } else { + $this->optionsResolver = new OptionsResolver(); + } + + $this->innerType->configureOptions($this->optionsResolver); + + foreach ($this->typeExtensions as $extension) { + $extension->configureOptions($this->optionsResolver); + } + } + + return $this->optionsResolver; + } + + /** + * Creates a new builder instance. + * + * Override this method if you want to customize the builder class. + * + * @return FormBuilderInterface + */ + protected function newBuilder(string $name, ?string $dataClass, FormFactoryInterface $factory, array $options) + { + if ($this->innerType instanceof ButtonTypeInterface) { + return new ButtonBuilder($name, $options); + } + + if ($this->innerType instanceof SubmitButtonTypeInterface) { + return new SubmitButtonBuilder($name, $options); + } + + return new FormBuilder($name, $dataClass, new EventDispatcher(), $factory, $options); + } + + /** + * Creates a new view instance. + * + * Override this method if you want to customize the view class. + * + * @return FormView + */ + protected function newView(FormView $parent = null) + { + return new FormView($parent); + } +} diff --git a/vendor/symfony/form/ResolvedFormTypeFactory.php b/vendor/symfony/form/ResolvedFormTypeFactory.php new file mode 100644 index 0000000..d93d1c0 --- /dev/null +++ b/vendor/symfony/form/ResolvedFormTypeFactory.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * @author Bernhard Schussek + */ +class ResolvedFormTypeFactory implements ResolvedFormTypeFactoryInterface +{ + /** + * {@inheritdoc} + */ + public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null) + { + return new ResolvedFormType($type, $typeExtensions, $parent); + } +} diff --git a/vendor/symfony/form/ResolvedFormTypeFactoryInterface.php b/vendor/symfony/form/ResolvedFormTypeFactoryInterface.php new file mode 100644 index 0000000..4f133e0 --- /dev/null +++ b/vendor/symfony/form/ResolvedFormTypeFactoryInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Creates ResolvedFormTypeInterface instances. + * + * This interface allows you to use your custom ResolvedFormTypeInterface + * implementation, within which you can customize the concrete FormBuilderInterface + * implementations or FormView subclasses that are used by the framework. + * + * @author Bernhard Schussek + */ +interface ResolvedFormTypeFactoryInterface +{ + /** + * Resolves a form type. + * + * @param FormTypeExtensionInterface[] $typeExtensions + * + * @return ResolvedFormTypeInterface + * + * @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string + * @throws Exception\InvalidArgumentException if the types parent cannot be retrieved from any extension + */ + public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null); +} diff --git a/vendor/symfony/form/ResolvedFormTypeInterface.php b/vendor/symfony/form/ResolvedFormTypeInterface.php new file mode 100644 index 0000000..6074af9 --- /dev/null +++ b/vendor/symfony/form/ResolvedFormTypeInterface.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A wrapper for a form type and its extensions. + * + * @author Bernhard Schussek + */ +interface ResolvedFormTypeInterface +{ + /** + * Returns the prefix of the template block name for this type. + * + * @return string + */ + public function getBlockPrefix(); + + /** + * Returns the parent type. + * + * @return self|null + */ + public function getParent(); + + /** + * Returns the wrapped form type. + * + * @return FormTypeInterface + */ + public function getInnerType(); + + /** + * Returns the extensions of the wrapped form type. + * + * @return FormTypeExtensionInterface[] + */ + public function getTypeExtensions(); + + /** + * Creates a new form builder for this type. + * + * @param string $name The name for the builder + * + * @return FormBuilderInterface + */ + public function createBuilder(FormFactoryInterface $factory, string $name, array $options = []); + + /** + * Creates a new form view for a form of this type. + * + * @return FormView + */ + public function createView(FormInterface $form, FormView $parent = null); + + /** + * Configures a form builder for the type hierarchy. + */ + public function buildForm(FormBuilderInterface $builder, array $options); + + /** + * Configures a form view for the type hierarchy. + * + * It is called before the children of the view are built. + */ + public function buildView(FormView $view, FormInterface $form, array $options); + + /** + * Finishes a form view for the type hierarchy. + * + * It is called after the children of the view have been built. + */ + public function finishView(FormView $view, FormInterface $form, array $options); + + /** + * Returns the configured options resolver used for this type. + * + * @return OptionsResolver + */ + public function getOptionsResolver(); +} diff --git a/vendor/symfony/form/Resources/config/validation.xml b/vendor/symfony/form/Resources/config/validation.xml new file mode 100644 index 0000000..918f101 --- /dev/null +++ b/vendor/symfony/form/Resources/config/validation.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.af.xlf b/vendor/symfony/form/Resources/translations/validators.af.xlf new file mode 100644 index 0000000..58cd939 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.af.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Hierdie vorm moet nie ekstra velde bevat nie. + + + The uploaded file was too large. Please try to upload a smaller file. + Die opgelaaide lêer was te groot. Probeer asseblief 'n kleiner lêer. + + + The CSRF token is invalid. Please try to resubmit the form. + Die CSRF-teken is ongeldig. Probeer asseblief om die vorm weer in te dien. + + + This value is not a valid HTML5 color. + Hierdie waarde is nie 'n geldige HTML5 kleur nie. + + + Please enter a valid birthdate. + Voer asseblief 'n geldige geboortedatum in. + + + The selected choice is invalid. + Die gekiesde opsie is nie geldig nie. + + + The collection is invalid. + Die versameling is nie geldig nie. + + + Please select a valid color. + Kies asseblief 'n geldige kleur. + + + Please select a valid country. + Kies asseblief 'n geldige land. + + + Please select a valid currency. + Kies asseblief 'n geldige geldeenheid. + + + Please choose a valid date interval. + Kies asseblief 'n geldige datum interval. + + + Please enter a valid date and time. + Voer asseblilef 'n geldige datum en tyd in. + + + Please enter a valid date. + Voer asseblief 'n geldige datum in. + + + Please select a valid file. + Kies asseblief 'n geldige lêer. + + + The hidden field is invalid. + Die versteekte veld is nie geldig nie. + + + Please enter an integer. + Voer asseblief 'n geldige heeltal in. + + + Please select a valid language. + Kies assblief 'n geldige taal. + + + Please select a valid locale. + Voer assebliefn 'n geldige locale in. + + + Please enter a valid money amount. + Voer asseblief 'n geldige bedrag in. + + + Please enter a number. + Voer asseblief 'n nommer in. + + + The password is invalid. + Die wagwoord is ongeldig. + + + Please enter a percentage value. + Voer asseblief 'n geldige persentasie waarde in. + + + The values do not match. + Die waardes is nie dieselfde nie. + + + Please enter a valid time. + Voer asseblief 'n geldige tyd in time. + + + Please select a valid timezone. + Kies asseblief 'n geldige tydsone. + + + Please enter a valid URL. + Voer asseblief 'n geldige URL in. + + + Please enter a valid search term. + Voer asseblief 'n geldige soek term in. + + + Please provide a valid phone number. + Verskaf asseblief 'n geldige telefoonnommer. + + + The checkbox has an invalid value. + Die blokkie het 'n ongeldige waarde. + + + Please enter a valid email address. + Voer asseblief 'n geldige e-pos adres in. + + + Please select a valid option. + Kies asseblief 'n geldige opsie. + + + Please select a valid range. + Kies asseblief 'n geldige reeks. + + + Please enter a valid week. + Voer assblief 'n geldige week in. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.ar.xlf b/vendor/symfony/form/Resources/translations/validators.ar.xlf new file mode 100644 index 0000000..e30daaf --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.ar.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + هذا النموذج يجب الا يحتوى على اى حقول اضافية. + + + The uploaded file was too large. Please try to upload a smaller file. + مساحة الملف المرسل كبيرة. من فضلك حاول ارسال ملف اصغر. + + + The CSRF token is invalid. Please try to resubmit the form. + قيمة رمز الموقع غير صحيحة. من فضلك اعد ارسال النموذج. + + + This value is not a valid HTML5 color. + هذه القيمة ليست لون HTML5 صالحًا. + + + Please enter a valid birthdate. + الرجاء ادخال تاريخ ميلاد صالح. + + + The selected choice is invalid. + الاختيار المحدد غير صالح. + + + The collection is invalid. + المجموعة غير صالحة. + + + Please select a valid color. + الرجاء اختيار لون صالح. + + + Please select a valid country. + الرجاء اختيار بلد صالح. + + + Please select a valid currency. + الرجاء اختيار عملة صالحة. + + + Please choose a valid date interval. + الرجاء اختيار فاصل زمني صالح. + + + Please enter a valid date and time. + الرجاء إدخال تاريخ ووقت صالحين. + + + Please enter a valid date. + الرجاء إدخال تاريخ صالح. + + + Please select a valid file. + الرجاء اختيار ملف صالح. + + + The hidden field is invalid. + الحقل المخفي غير صالح. + + + Please enter an integer. + الرجاء إدخال عدد صحيح. + + + Please select a valid language. + الرجاء اختيار لغة صالحة. + + + Please select a valid locale. + الرجاء اختيار لغة صالحة. + + + Please enter a valid money amount. + الرجاء إدخال مبلغ مالي صالح. + + + Please enter a number. + الرجاء إدخال رقم. + + + The password is invalid. + كلمة المرور غير صحيحة. + + + Please enter a percentage value. + الرجاء إدخال قيمة النسبة المئوية. + + + The values do not match. + القيم لا تتطابق. + + + Please enter a valid time. + الرجاء إدخال وقت صالح. + + + Please select a valid timezone. + الرجاء تحديد منطقة زمنية صالحة. + + + Please enter a valid URL. + أدخل عنوان الرابط صحيح من فضلك. + + + Please enter a valid search term. + الرجاء إدخال مصطلح البحث ساري المفعول. + + + Please provide a valid phone number. + يرجى تقديم رقم هاتف صالح. + + + The checkbox has an invalid value. + خانة الاختيار لها قيمة غير صالحة. + + + Please enter a valid email address. + رجاء قم بإدخال بريد الكتروني صحيح + + + Please select a valid option. + الرجاء تحديد خيار صالح. + + + Please select a valid range. + يرجى تحديد نطاق صالح. + + + Please enter a valid week. + الرجاء إدخال أسبوع صالح. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.az.xlf b/vendor/symfony/form/Resources/translations/validators.az.xlf new file mode 100644 index 0000000..b926970 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.az.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Bu formada əlavə sahə olmamalıdır. + + + The uploaded file was too large. Please try to upload a smaller file. + Yüklənən fayl çox böyükdür. Lütfən daha kiçik fayl yükləyin. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF nişanı yanlışdır. Lütfen formanı yenidən göndərin. + + + This value is not a valid HTML5 color. + Bu dəyər doğru bir HTML5 rəngi deyil. + + + Please enter a valid birthdate. + Zəhmət olmasa doğru bir doğum günü daxil edin. + + + The selected choice is invalid. + Seçilmiş seçim doğru deyil. + + + The collection is invalid. + Kolleksiya doğru deyil. + + + Please select a valid color. + Zəhmət olmasa doğru bir rəng seçin. + + + Please select a valid country. + Zəhmət olmasa doğru bir ölkə seçin. + + + Please select a valid currency. + Zəhmət olmasa doğru bir valyuta seçin. + + + Please choose a valid date interval. + Zəhmət olmasa doğru bir tarix aralığı seçin. + + + Please enter a valid date and time. + Zəhmət olmasa doğru bir tarix ve saat daxil edin. + + + Please enter a valid date. + Zəhmət olmasa doğru bir tarix daxil edin. + + + Please select a valid file. + Zəhmət olmasa doğru bir fayl seçin. + + + The hidden field is invalid. + Gizli sahə doğru deyil. + + + Please enter an integer. + Zəhmət olmasa bir tam ədəd daxil edin. + + + Please select a valid language. + Zəhmət olmasa doğru bir dil seçin. + + + Please select a valid locale. + Zəhmət olmasa doğru bir yer seçin. + + + Please enter a valid money amount. + Zəhmət olmasa doğru bir pul miqdarı daxil edin. + + + Please enter a number. + Zəhmət olmasa doğru bir rəqəm daxil edin. + + + The password is invalid. + Parol doğru deyil. + + + Please enter a percentage value. + Zəhmət olmasa doğru bir faiz dəyəri daxil edin. + + + The values do not match. + Dəyərlər örtüşmür. + + + Please enter a valid time. + Zəhmət olmasa doğru bir saat daxil edin. + + + Please select a valid timezone. + Zəhmət olmasa doğru bir saat qurşağı seçin. + + + Please enter a valid URL. + Zəhmət olmasa doğru bir URL daxil edin. + + + Please enter a valid search term. + Zəhmət olmasa doğru bir axtarış termini daxil edin. + + + Please provide a valid phone number. + Zəhmət olmasa doğru bir telefon nömrəsi seçin. + + + The checkbox has an invalid value. + Seçim qutusunda doğru olmayan dəyər var. + + + Please enter a valid email address. + Zəhmət olmasa doğru bir e-poçt seçin. + + + Please select a valid option. + Zəhmət olmasa doğru bir variant seçin. + + + Please select a valid range. + Zəhmət olmasa doğru bir aralıq seçin. + + + Please enter a valid week. + Zəhmət olmasa doğru bir həftə seçin. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.be.xlf b/vendor/symfony/form/Resources/translations/validators.be.xlf new file mode 100644 index 0000000..0513ca1 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.be.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Гэта форма не павінна мець дадатковых палей. + + + The uploaded file was too large. Please try to upload a smaller file. + Запампаваны файл быў занадта вялікім. Калі ласка, паспрабуйце запампаваць файл меншага памеру. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-токен не сапраўдны. Калі ласка, паспрабуйце яшчэ раз адправіць форму. + + + This value is not a valid HTML5 color. + Значэнне не з'яўляецца карэктным HTML5 колерам. + + + Please enter a valid birthdate. + Калі ласка, увядзіце карэктную дату нараджэння. + + + The selected choice is invalid. + Выбраны варыянт некарэктны. + + + The collection is invalid. + Калекцыя некарэктна. + + + Please select a valid color. + Калі ласка, выберыце карэктны колер. + + + Please select a valid country. + Калі ласка, выберыце карэктную краіну. + + + Please select a valid currency. + Калі ласка, выберыце карэктную валюту. + + + Please choose a valid date interval. + Калі ласка, выберыце карэктны інтэрвал дат. + + + Please enter a valid date and time. + Калі ласка, увядзіце карэктныя дату і час. + + + Please enter a valid date. + Калі ласка, увядзіце карэктную дату. + + + Please select a valid file. + Калі ласка, выберыце карэктны файл. + + + The hidden field is invalid. + Значэнне схаванага поля некарэктна. + + + Please enter an integer. + Калі ласка, увядзіце цэлы лік. + + + Please select a valid language. + Калі ласка, выберыце карэктную мову. + + + Please select a valid locale. + Калі ласка, выберыце карэктную лакаль. + + + Please enter a valid money amount. + Калі ласка, увядзіце карэктную колькасць грошай. + + + Please enter a number. + Калі ласка, увядзіце нумар. + + + The password is invalid. + Няправільны пароль. + + + Please enter a percentage value. + Калі ласка, увядзіце працэнтнае значэнне. + + + The values do not match. + Значэнні не супадаюць. + + + Please enter a valid time. + Калі ласка, увядзіце карэктны час. + + + Please select a valid timezone. + Калі ласка, выберыце карэктны гадзінны пояс. + + + Please enter a valid URL. + Калі ласка, увядзіце карэктны URL. + + + Please enter a valid search term. + Калі ласка, увядзіце карэктны пошукавы запыт. + + + Please provide a valid phone number. + Калі ласка, увядзіце карэктны нумар тэлефона. + + + The checkbox has an invalid value. + Флажок мае некарэктнае значэнне. + + + Please enter a valid email address. + Калі ласка, увядзіце карэктны адрас электроннай пошты. + + + Please select a valid option. + Калі ласка, выберыце карэктны варыянт. + + + Please select a valid range. + Калі ласка, выберыце карэктны дыяпазон. + + + Please enter a valid week. + Калі ласка, увядзіце карэктны тыдзень. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.bg.xlf b/vendor/symfony/form/Resources/translations/validators.bg.xlf new file mode 100644 index 0000000..32fa943 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.bg.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Тази форма не трябва да съдържа допълнителни полета. + + + The uploaded file was too large. Please try to upload a smaller file. + Каченият файл е твърде голям. Моля, опитайте да качите по-малък файл. + + + The CSRF token is invalid. Please try to resubmit the form. + Невалиден CSRF токен. Моля, опитайте да изпратите формата отново. + + + This value is not a valid HTML5 color. + Стойността не е валиден HTML5 цвят. + + + Please enter a valid birthdate. + Моля въведете валидна дата на раждане. + + + The selected choice is invalid. + Избраните стойности не са валидни. + + + The collection is invalid. + Колекцията не е валидна. + + + Please select a valid color. + Моля изберете валиден цвят. + + + Please select a valid country. + Моля изберете валидна държава. + + + Please select a valid currency. + Моля изберете валидна валута. + + + Please choose a valid date interval. + Моля изберете валиден интервал от дати. + + + Please enter a valid date and time. + Моля въведете валидни дата и час. + + + Please enter a valid date. + Моля въведете валидна дата. + + + Please select a valid file. + Моля изберете валиден файл. + + + The hidden field is invalid. + Скритото поле е невалидно. + + + Please enter an integer. + Моля попълнете цяло число. + + + Please select a valid language. + Моля изберете валиден език. + + + Please select a valid locale. + Моля изберете валиден език. + + + Please enter a valid money amount. + Моля въведете валидна парична сума. + + + Please enter a number. + Моля въведете число. + + + The password is invalid. + Паролата е невалидна. + + + Please enter a percentage value. + Моля въведете процентна стойност. + + + The values do not match. + Стойностите не съвпадат. + + + Please enter a valid time. + Моля въведете валидно време. + + + Please select a valid timezone. + Моля изберете валидна часова зона. + + + Please enter a valid URL. + Моля въведете валиден URL. + + + Please enter a valid search term. + Моля въведете валидно търсене. + + + Please provide a valid phone number. + Моля осигурете валиден телефонен номер. + + + The checkbox has an invalid value. + Отметката има невалидна стойност. + + + Please enter a valid email address. + Моля въведете валидна ел. поща. + + + Please select a valid option. + Моля изберете валидна опция. + + + Please select a valid range. + Моля изберете валиден обхват. + + + Please enter a valid week. + Моля въведете валидна седмица. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.bs.xlf b/vendor/symfony/form/Resources/translations/validators.bs.xlf new file mode 100644 index 0000000..319f915 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.bs.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ovaj obrazac ne bi trebalo da sadrži dodatna polja. + + + The uploaded file was too large. Please try to upload a smaller file. + Prenijeta (uploaded) datoteka je prevelika. Molim pokušajte prenijeti manju datoteku. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF vrijednost nije ispravna. Molim pokušajte ponovo da pošaljete obrazac. + + + This value is not a valid HTML5 color. + Ova vrijednost nije važeća HTML5 boja. + + + Please enter a valid birthdate. + Molim upišite ispravan datum rođenja. + + + The selected choice is invalid. + Odabrani izbor nije ispravan. + + + The collection is invalid. + Ova kolekcija nije ispravna. + + + Please select a valid color. + Molim izaberite ispravnu boju. + + + Please select a valid country. + Molim izaberite ispravnu državu. + + + Please select a valid currency. + Molim izaberite ispravnu valutu. + + + Please choose a valid date interval. + Molim izaberite ispravan datumski interval. + + + Please enter a valid date and time. + Molim upišite ispravan datum i vrijeme. + + + Please enter a valid date. + Molim upišite ispravan datum. + + + Please select a valid file. + Molim izaberite ispravnu datoteku. + + + The hidden field is invalid. + Skriveno polje nije ispravno. + + + Please enter an integer. + Molim upišite cijeli broj (integer). + + + Please select a valid language. + Molim izaberite ispravan jezik. + + + Please select a valid locale. + Molim izaberite ispravnu lokalizaciju. + + + Please enter a valid money amount. + Molim upišite ispravnu količinu novca. + + + Please enter a number. + Molim upišite broj. + + + The password is invalid. + Ova lozinka nije ispravna. + + + Please enter a percentage value. + Molim upišite procentualnu vrijednost. + + + The values do not match. + Date vrijednosti se ne poklapaju. + + + Please enter a valid time. + Molim upišite ispravno vrijeme. + + + Please select a valid timezone. + Molim izaberite ispravnu vremensku zonu. + + + Please enter a valid URL. + Molim upišite ispravan URL. + + + Please enter a valid search term. + Molim upišite ispravan termin za pretragu. + + + Please provide a valid phone number. + Molim navedite ispravan broj telefona. + + + The checkbox has an invalid value. + Polje za potvrdu sadrži neispravnu vrijednost. + + + Please enter a valid email address. + Molim upišite ispravnu email adresu. + + + Please select a valid option. + Molim izaberite ispravnu opciju. + + + Please select a valid range. + Molim izaberite ispravan opseg. + + + Please enter a valid week. + Molim upišite ispravnu sedmicu. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.ca.xlf b/vendor/symfony/form/Resources/translations/validators.ca.xlf new file mode 100644 index 0000000..6937960 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.ca.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Aquest formulari no hauria de contenir camps addicionals. + + + The uploaded file was too large. Please try to upload a smaller file. + L'arxiu pujat és massa gran. Per favor, pugi un arxiu més petit. + + + The CSRF token is invalid. Please try to resubmit the form. + El token CSRF no és vàlid. Per favor, provi d'enviar novament el formulari. + + + This value is not a valid HTML5 color. + Aquest valor no és un color HTML5 valid. + + + Please enter a valid birthdate. + Per favor introdueix una data d'aniversari valida. + + + The selected choice is invalid. + L'opció escollida és invalida. + + + The collection is invalid. + La col·lecció és invalida. + + + Please select a valid color. + Per favor selecciona un color vàlid. + + + Please select a valid country. + Per favor selecciona una ciutat vàlida. + + + Please select a valid currency. + Per favor selecciona una moneda vàlida. + + + Please choose a valid date interval. + Per favor escull un interval de dates vàlides. + + + Please enter a valid date and time. + Per favor introdueix una data i temps vàlid. + + + Please enter a valid date. + Per favor introdueix una data vàlida. + + + Please select a valid file. + Per favor selecciona un arxiu vàlid. + + + The hidden field is invalid. + El camp ocult és invàlid. + + + Please enter an integer. + Per favor introdueix un enter. + + + Please select a valid language. + Per favor selecciona un idioma vàlid. + + + Please select a valid locale. + Per favor seleccioneu una configuració regional vàlida + + + Please enter a valid money amount. + Per favor introdueix una quantitat de diners vàlids. + + + Please enter a number. + Per favor introdueix un número. + + + The password is invalid. + La contrasenya es invàlida. + + + Please enter a percentage value. + Per favor introdueix un valor percentual. + + + The values do not match. + Els valors no coincideixen. + + + Please enter a valid time. + Per favor introdueix un temps vàlid. + + + Please select a valid timezone. + Per favor selecciona una zona horària vàlida. + + + Please enter a valid URL. + Per favor introdueix una URL vàlida. + + + Please enter a valid search term. + Per favor introdueix un concepte de cerca vàlid. + + + Please provide a valid phone number. + Per favor introdueix un número de telèfon vàlid. + + + The checkbox has an invalid value. + La casella de selecció te un valor invàlid. + + + Please enter a valid email address. + Per favor introdueix un correu electrònic vàlid. + + + Please select a valid option. + Per favor selecciona una opció vàlida. + + + Please select a valid range. + Per favor selecciona un rang vàlid. + + + Please enter a valid week. + Per favor introdueix una setmana vàlida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.cs.xlf b/vendor/symfony/form/Resources/translations/validators.cs.xlf new file mode 100644 index 0000000..3c4052b --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.cs.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Tato skupina polí nesmí obsahovat další pole. + + + The uploaded file was too large. Please try to upload a smaller file. + Nahraný soubor je příliš velký. Nahrajte prosím menší soubor. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF token je neplatný. Zkuste prosím znovu odeslat formulář. + + + This value is not a valid HTML5 color. + Tato hodnota není platná HTML5 barva. + + + Please enter a valid birthdate. + Prosím zadejte platný datum narození. + + + The selected choice is invalid. + Vybraná možnost není platná. + + + The collection is invalid. + Kolekce není platná. + + + Please select a valid color. + Prosím vyberte platnou barvu. + + + Please select a valid country. + Prosím vyberte platnou zemi. + + + Please select a valid currency. + Prosím vyberte platnou měnu. + + + Please choose a valid date interval. + Prosím vyberte platné rozpětí dat. + + + Please enter a valid date and time. + Prosím zadejte platný datum a čas. + + + Please enter a valid date. + Prosím zadejte platný datum. + + + Please select a valid file. + Prosím vyberte platný soubor. + + + The hidden field is invalid. + Skryté pole není platné. + + + Please enter an integer. + Prosím zadejte číslo. + + + Please select a valid language. + Prosím zadejte platný jazyk. + + + Please select a valid locale. + Prosím zadejte platný jazyk. + + + Please enter a valid money amount. + Prosím zadejte platnou částku. + + + Please enter a number. + Prosím zadejte číslo. + + + The password is invalid. + Heslo není platné. + + + Please enter a percentage value. + Prosím zadejte procentuální hodnotu. + + + The values do not match. + Hodnoty se neshodují. + + + Please enter a valid time. + Prosím zadejte platný čas. + + + Please select a valid timezone. + Prosím vyberte platné časové pásmo. + + + Please enter a valid URL. + Prosím zadejte platnou URL. + + + Please enter a valid search term. + Prosím zadejte platný výraz k vyhledání. + + + Please provide a valid phone number. + Prosím zadejte platné telefonní číslo. + + + The checkbox has an invalid value. + Zaškrtávací políčko má neplatnou hodnotu. + + + Please enter a valid email address. + Prosím zadejte platnou emailovou adresu. + + + Please select a valid option. + Prosím vyberte platnou možnost. + + + Please select a valid range. + Prosím vyberte platný rozsah. + + + Please enter a valid week. + Prosím zadejte platný týden. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.da.xlf b/vendor/symfony/form/Resources/translations/validators.da.xlf new file mode 100644 index 0000000..b4f078f --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.da.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Feltgruppen må ikke indeholde ekstra felter. + + + The uploaded file was too large. Please try to upload a smaller file. + Den uploadede fil var for stor. Upload venligst en mindre fil. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-token er ugyldig. Prøv venligst at genindsende. + + + This value is not a valid HTML5 color. + Værdien er ikke en gyldig HTML5 farve. + + + Please enter a valid birthdate. + Indtast venligst en gyldig fødselsdato. + + + The selected choice is invalid. + Den valgte mulighed er ugyldig . + + + The collection is invalid. + Samlingen er ugyldig. + + + Please select a valid color. + Vælg venligst en gyldig farve. + + + Please select a valid country. + Vælg venligst et gyldigt land. + + + Please select a valid currency. + Vælg venligst en gyldig valuta. + + + Please choose a valid date interval. + Vælg venligst et gyldigt datointerval. + + + Please enter a valid date and time. + Vælg venligst en gyldig dato og tid. + + + Please enter a valid date. + Vælg venligst en gyldig dato. + + + Please select a valid file. + Vælg venligst en gyldig fil. + + + The hidden field is invalid. + Det skjulte felt er ugyldigt. + + + Please enter an integer. + Indsæt veligst et heltal. + + + Please select a valid language. + Vælg venligst et gyldigt sprog. + + + Please select a valid locale. + Vælg venligst en gyldigt sprogkode. + + + Please enter a valid money amount. + Vælg venligst et gyldigt beløb. + + + Please enter a number. + Indtast venligst et nummer. + + + The password is invalid. + Passwordet er ugyldigt. + + + Please enter a percentage value. + Indtast venligst en procentværdi. + + + The values do not match. + Værdierne er ikke ens. + + + Please enter a valid time. + Indtast venligst en gyldig tid. + + + Please select a valid timezone. + Vælg venligst en gyldig tidszone. + + + Please enter a valid URL. + Indtast venligst en gyldig URL. + + + Please enter a valid search term. + Indtast venligst et gyldigt søgeord. + + + Please provide a valid phone number. + Giv venligst et gyldigt telefonnummer. + + + The checkbox has an invalid value. + Checkboxen har en ugyldigt værdi. + + + Please enter a valid email address. + Indtast venligst en gyldig e-mailadresse. + + + Please select a valid option. + Vælg venligst en gyldig mulighed. + + + Please select a valid range. + Vælg venligst et gyldigt interval . + + + Please enter a valid week. + Indtast venligst en gyldig uge. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.de.xlf b/vendor/symfony/form/Resources/translations/validators.de.xlf new file mode 100644 index 0000000..bc8e46d --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.de.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Dieses Formular sollte keine zusätzlichen Felder enthalten. + + + The uploaded file was too large. Please try to upload a smaller file. + Die hochgeladene Datei ist zu groß. Versuchen Sie bitte eine kleinere Datei hochzuladen. + + + The CSRF token is invalid. Please try to resubmit the form. + Der CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden. + + + This value is not a valid HTML5 color. + Dieser Wert ist keine gültige HTML5 Farbe. + + + Please enter a valid birthdate. + Bitte geben Sie ein gültiges Geburtsdatum ein. + + + The selected choice is invalid. + Die Auswahl ist ungültig. + + + The collection is invalid. + Diese Gruppe von Feldern ist ungültig. + + + Please select a valid color. + Bitte geben Sie eine gültige Farbe ein. + + + Please select a valid country. + Bitte wählen Sie ein gültiges Land aus. + + + Please select a valid currency. + Bitte wählen Sie eine gültige Währung aus. + + + Please choose a valid date interval. + Bitte wählen Sie ein gültiges Datumsintervall. + + + Please enter a valid date and time. + Bitte geben Sie ein gültiges Datum samt Uhrzeit ein. + + + Please enter a valid date. + Bitte geben Sie ein gültiges Datum ein. + + + Please select a valid file. + Bitte wählen Sie eine gültige Datei. + + + The hidden field is invalid. + Das versteckte Feld ist ungültig. + + + Please enter an integer. + Bitte geben Sie eine ganze Zahl ein. + + + Please select a valid language. + Bitte wählen Sie eine gültige Sprache. + + + Please select a valid locale. + Bitte wählen Sie eine gültige Locale-Einstellung aus. + + + Please enter a valid money amount. + Bitte geben Sie einen gültigen Geldbetrag ein. + + + Please enter a number. + Bitte geben Sie eine gültige Zahl ein. + + + The password is invalid. + Das Kennwort ist ungültig. + + + Please enter a percentage value. + Bitte geben Sie einen gültigen Prozentwert ein. + + + The values do not match. + Die Werte stimmen nicht überein. + + + Please enter a valid time. + Bitte geben Sie eine gültige Uhrzeit ein. + + + Please select a valid timezone. + Bitte wählen Sie eine gültige Zeitzone. + + + Please enter a valid URL. + Bitte geben Sie eine gültige URL ein. + + + Please enter a valid search term. + Bitte geben Sie einen gültigen Suchbegriff ein. + + + Please provide a valid phone number. + Bitte geben Sie eine gültige Telefonnummer ein. + + + The checkbox has an invalid value. + Das Kontrollkästchen hat einen ungültigen Wert. + + + Please enter a valid email address. + Bitte geben Sie eine gültige E-Mail-Adresse ein. + + + Please select a valid option. + Bitte wählen Sie eine gültige Option. + + + Please select a valid range. + Bitte wählen Sie einen gültigen Bereich. + + + Please enter a valid week. + Bitte geben Sie eine gültige Woche ein. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.el.xlf b/vendor/symfony/form/Resources/translations/validators.el.xlf new file mode 100644 index 0000000..595630e --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.el.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Αυτή η φόρμα δεν πρέπει να περιέχει επιπλέον πεδία. + + + The uploaded file was too large. Please try to upload a smaller file. + Το αρχείο είναι πολύ μεγάλο. Παρακαλούμε προσπαθήστε να ανεβάσετε ένα μικρότερο αρχείο. + + + The CSRF token is invalid. Please try to resubmit the form. + Το CSRF token δεν είναι έγκυρο. Παρακαλούμε δοκιμάστε να υποβάλετε τη φόρμα ξανά. + + + This value is not a valid HTML5 color. + Αυτή η τιμή δέν έναι έγκυρο χρώμα HTML5. + + + Please enter a valid birthdate. + Παρακαλόυμε ειχάγεται μία έγκυρη ημερομηνία γέννησης. + + + The selected choice is invalid. + Η επιλεγμένη επιλογή δέν είναι έγκυρη. + + + The collection is invalid. + Η συλλογή δέν είναι έγκυρη. + + + Please select a valid color. + Παρακαλούμε επιλέξτε ένα έγκυρο χρώμα. + + + Please select a valid country. + Παρακαλούμε επιλέξτε μία έγκυρη χώρα. + + + Please select a valid currency. + Παρακαλούμε επιλέξτε ένα έγυρο νόμισμα. + + + Please choose a valid date interval. + Παρακαλούμε επιλέξτε ένα έγκυρο διάστημα ημερομηνίας. + + + Please enter a valid date and time. + Παρακαλούμε εισαγάγετε μια έγκυρη ημερομηνία και ώρα. + + + Please enter a valid date. + Παρακαλούμε εισάγετε μία έγκυρη ημερομηνία. + + + Please select a valid file. + Παρακαλούμε επιλέξτε ένα έγκυρο αρχείο. + + + The hidden field is invalid. + Το κρυφό πεδίο δέν είναι έγκυρο. + + + Please enter an integer. + Παρακαλούμε εισάγετε έναν ακέραιο αριθμό. + + + Please select a valid language. + Παρακαλούμε επιλέξτε μία έγκυρη γλώσσα. + + + Please select a valid locale. + Παρακαλούμε επιλέξτε μία έγκυρη τοπικοποίηση. + + + Please enter a valid money amount. + Παρακαλούμε εισάγετε ένα έγκυρο χρηματικό ποσό. + + + Please enter a number. + Παρακαλούμε εισάγετε έναν αριθμό. + + + The password is invalid. + Ο κωδικός δέν είναι έγκυρος. + + + Please enter a percentage value. + Παρακαλούμε εισάγετε μία ποσοστιαία τιμή. + + + The values do not match. + Οι τιμές δέν ταιριάζουν. + + + Please enter a valid time. + Παρακαλούμε εισάγετε μία έγκυρη ώρα. + + + Please select a valid timezone. + Παρακαλούμε επιλέξτε μία έγυρη ζώνη ώρας. + + + Please enter a valid URL. + Παρακαλούμε εισάγετε μια έγκυρη διεύθυνση URL. + + + Please enter a valid search term. + Παρακαλούμε εισάγετε έναν έγκυρο όρο αναζήτησης. + + + Please provide a valid phone number. + Παρακαλούμε καταχωρίστε έναν έγκυρο αριθμό τηλεφώνου. + + + The checkbox has an invalid value. + Το πλαίσιο ελέγχου έχει μή έγκυρη τιμή. + + + Please enter a valid email address. + Παρακαλούμε εισάγετε μία έγκυρη ηλεκτρονική διεύθυνση. + + + Please select a valid option. + Παρακαλούμε επιλέξτε μία έγκυρη επιλογή. + + + Please select a valid range. + Παρακαλούμε επιλέξτε ένα έγυρο εύρος. + + + Please enter a valid week. + Παρακαλούμε εισάγετε μία έγκυρη εβδομάδα. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.en.xlf b/vendor/symfony/form/Resources/translations/validators.en.xlf new file mode 100644 index 0000000..e556c40 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.en.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + This form should not contain extra fields. + + + The uploaded file was too large. Please try to upload a smaller file. + The uploaded file was too large. Please try to upload a smaller file. + + + The CSRF token is invalid. Please try to resubmit the form. + The CSRF token is invalid. Please try to resubmit the form. + + + This value is not a valid HTML5 color. + This value is not a valid HTML5 color. + + + Please enter a valid birthdate. + Please enter a valid birthdate. + + + The selected choice is invalid. + The selected choice is invalid. + + + The collection is invalid. + The collection is invalid. + + + Please select a valid color. + Please select a valid color. + + + Please select a valid country. + Please select a valid country. + + + Please select a valid currency. + Please select a valid currency. + + + Please choose a valid date interval. + Please choose a valid date interval. + + + Please enter a valid date and time. + Please enter a valid date and time. + + + Please enter a valid date. + Please enter a valid date. + + + Please select a valid file. + Please select a valid file. + + + The hidden field is invalid. + The hidden field is invalid. + + + Please enter an integer. + Please enter an integer. + + + Please select a valid language. + Please select a valid language. + + + Please select a valid locale. + Please select a valid locale. + + + Please enter a valid money amount. + Please enter a valid money amount. + + + Please enter a number. + Please enter a number. + + + The password is invalid. + The password is invalid. + + + Please enter a percentage value. + Please enter a percentage value. + + + The values do not match. + The values do not match. + + + Please enter a valid time. + Please enter a valid time. + + + Please select a valid timezone. + Please select a valid timezone. + + + Please enter a valid URL. + Please enter a valid URL. + + + Please enter a valid search term. + Please enter a valid search term. + + + Please provide a valid phone number. + Please provide a valid phone number. + + + The checkbox has an invalid value. + The checkbox has an invalid value. + + + Please enter a valid email address. + Please enter a valid email address. + + + Please select a valid option. + Please select a valid option. + + + Please select a valid range. + Please select a valid range. + + + Please enter a valid week. + Please enter a valid week. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.es.xlf b/vendor/symfony/form/Resources/translations/validators.es.xlf new file mode 100644 index 0000000..c143e00 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.es.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Este formulario no debería contener campos adicionales. + + + The uploaded file was too large. Please try to upload a smaller file. + El archivo subido es demasiado grande. Por favor, suba un archivo más pequeño. + + + The CSRF token is invalid. Please try to resubmit the form. + El token CSRF no es válido. Por favor, pruebe a enviar nuevamente el formulario. + + + This value is not a valid HTML5 color. + Este valor no es un color HTML5 válido. + + + Please enter a valid birthdate. + Por favor, ingrese una fecha de cumpleaños válida. + + + The selected choice is invalid. + La opción seleccionada no es válida. + + + The collection is invalid. + La colección no es válida. + + + Please select a valid color. + Por favor, seleccione un color válido. + + + Please select a valid country. + Por favor, seleccione un país válido. + + + Please select a valid currency. + Por favor, seleccione una moneda válida. + + + Please choose a valid date interval. + Por favor, elija un intervalo de fechas válido. + + + Please enter a valid date and time. + Por favor, ingrese una fecha y hora válidas. + + + Please enter a valid date. + Por favor, ingrese una fecha valida. + + + Please select a valid file. + Por favor, seleccione un archivo válido. + + + The hidden field is invalid. + El campo oculto no es válido. + + + Please enter an integer. + Por favor, ingrese un número entero. + + + Please select a valid language. + Por favor, seleccione un idioma válido. + + + Please select a valid locale. + Por favor, seleccione una configuración regional válida. + + + Please enter a valid money amount. + Por favor, ingrese una cantidad de dinero válida. + + + Please enter a number. + Por favor, ingrese un número. + + + The password is invalid. + La contraseña no es válida. + + + Please enter a percentage value. + Por favor, ingrese un valor porcentual. + + + The values do not match. + Los valores no coinciden. + + + Please enter a valid time. + Por favor, ingrese una hora válida. + + + Please select a valid timezone. + Por favor, seleccione una zona horaria válida. + + + Please enter a valid URL. + Por favor, ingrese una URL válida. + + + Please enter a valid search term. + Por favor, ingrese un término de búsqueda válido. + + + Please provide a valid phone number. + Por favor, proporcione un número de teléfono válido. + + + The checkbox has an invalid value. + La casilla de verificación tiene un valor inválido. + + + Please enter a valid email address. + Por favor, ingrese una dirección de correo electrónico válida. + + + Please select a valid option. + Por favor, seleccione una opción válida. + + + Please select a valid range. + Por favor, seleccione un rango válido. + + + Please enter a valid week. + Por favor, ingrese una semana válida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.et.xlf b/vendor/symfony/form/Resources/translations/validators.et.xlf new file mode 100644 index 0000000..6524c86 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.et.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Väljade grupp ei tohiks sisalda lisaväljasid. + + + The uploaded file was too large. Please try to upload a smaller file. + Üleslaaditud fail oli liiga suur. Palun proovi uuesti väiksema failiga. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-märgis on vigane. Palun proovi vormi uuesti esitada. + + + This value is not a valid HTML5 color. + See väärtus ei ole korrektne HTML5 värv. + + + Please enter a valid birthdate. + Palun sisesta korrektne sünnikuupäev. + + + The selected choice is invalid. + Tehtud valik on vigane. + + + The collection is invalid. + Kogum on vigane. + + + Please select a valid color. + Palun vali korrektne värv. + + + Please select a valid country. + Palun vali korrektne riik. + + + Please select a valid currency. + Palun vali korrektne valuuta. + + + Please choose a valid date interval. + Palun vali korrektne kuupäevade vahemik. + + + Please enter a valid date and time. + Palun sisesta korrektne kuupäev ja kellaaeg. + + + Please enter a valid date. + Palun sisesta korrektne kuupäev. + + + Please select a valid file. + Palun vali korrektne fail. + + + The hidden field is invalid. + Peidetud väli on vigane. + + + Please enter an integer. + Palun sisesta täisarv. + + + Please select a valid language. + Palun vali korrektne keel. + + + Please select a valid locale. + Palun vali korrektne keelekood. + + + Please enter a valid money amount. + Palun sisesta korrektne rahaline väärtus. + + + Please enter a number. + Palun sisesta number. + + + The password is invalid. + Vigane parool. + + + Please enter a percentage value. + Palun sisesta protsendiline väärtus. + + + The values do not match. + Väärtused ei klapi. + + + Please enter a valid time. + Palun sisesta korrektne aeg. + + + Please select a valid timezone. + Palun vali korrektne ajavöönd. + + + Please enter a valid URL. + Palun sisesta korrektne URL. + + + Please enter a valid search term. + Palun sisesta korrektne otsingutermin. + + + Please provide a valid phone number. + Palun sisesta korrektne telefoninumber. + + + The checkbox has an invalid value. + Märkeruudu väärtus on vigane. + + + Please enter a valid email address. + Palun sisesta korrektne e-posti aadress. + + + Please select a valid option. + Palun tee korrektne valik. + + + Please select a valid range. + Palun vali korrektne vahemik. + + + Please enter a valid week. + Palun sisesta korrektne nädal. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.eu.xlf b/vendor/symfony/form/Resources/translations/validators.eu.xlf new file mode 100644 index 0000000..f43ab35 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.eu.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Formulario honek ez luke aparteko eremurik eduki behar. + + + The uploaded file was too large. Please try to upload a smaller file. + Igotako fitxategia handiegia da. Mesedez saiatu fitxategi txikiago bat igotzen. + + + The CSRF token is invalid. + CSRF tokena ez da egokia. + + + This value is not a valid HTML5 color. + Balio hori ez da HTML5 kolore onargarria. + + + Please enter a valid birthdate. + Mesedez, sartu baliozko urtebetetze-eguna. + + + The selected choice is invalid. + Hautatutako aukera ez da egokia. + + + The collection is invalid. + Bilduma ez da baliozkoa. + + + Please select a valid color. + Mesedez, hautatu baliozko kolore bat. + + + Please select a valid country. + Mesedez, hautatu baliozko herrialde bat. + + + Please select a valid currency. + Mesedez, hautatu baliozko moneta bat. + + + Please choose a valid date interval. + Mesedez, hautatu baliozko data-tarte bat. + + + Please enter a valid date and time. + Mesedez, sartu baliozko data eta ordua. + + + Please enter a valid date. + Mesedez, sartu baliozko data bat. + + + Please select a valid file. + Mesedez, hautatu baliozko fitxategi bat. + + + The hidden field is invalid. + Eremu ezkutua ez da baliozkoa. + + + Please enter an integer. + Mesedez, sartu zenbaki oso bat. + + + Please select a valid language. + Mesedez, hautatu baliozko hizkuntza bat. + + + Please select a valid locale. + Mesedez, hautatu baliozko eskualde-konfigurazio bat. + + + Please enter a valid money amount. + Mesedez, sartu baliozko diru-kopuru bat. + + + Please enter a number. + Mesedez, sartu zenbaki bat. + + + The password is invalid. + Pasahitza ez da zuzena. + + + Please enter a percentage value. + Mesedez, sartu portzentajezko balio bat. + + + The values do not match. + Balioak ez datoz bat. + + + Please enter a valid time. + Mesedez, sartu baliozko ordu bat. + + + Please select a valid timezone. + Mesedez, hautatu baliozko ordu-eremua. + + + Please enter a valid URL. + Mesedez, sartu baliozko URL bat. + + + Please enter a valid search term. + Mesedez, sartu bilaketa-termino onargarri bat. + + + Please provide a valid phone number. + Mesedez, eman baliozko telefono-zenbaki bat. + + + The checkbox has an invalid value. + Egiaztatze-laukiak balio baliogabea du. + + + Please enter a valid email address. + Mesedez, sartu baliozko helbide elektroniko bat. + + + Please select a valid option. + Mesedez, hautatu baliozko aukera bat. + + + Please select a valid range. + Mesedez, hautatu baliozko tarte bat. + + + Please enter a valid week. + Mesedez, sartu baliozko aste bat. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.fa.xlf b/vendor/symfony/form/Resources/translations/validators.fa.xlf new file mode 100644 index 0000000..4a98eea --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.fa.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + این فرم نباید شامل فیلدهای اضافی باشد. + + + The uploaded file was too large. Please try to upload a smaller file. + فایل بارگذاری‌شده بسیار بزرگ است. لطفاً فایل کوچک‌تری را بارگذاری نمایید. + + + The CSRF token is invalid. Please try to resubmit the form. + توکن CSRF نامعتبر است. لطفاً فرم را مجدداً ارسال نمایید. + + + This value is not a valid HTML5 color. + این مقدار یک رنگ معتبر HTML5 نیست. + + + Please enter a valid birthdate. + لطفاً یک تاریخ تولد معتبر وارد نمایید. + + + The selected choice is invalid. + گزینه‌ انتخاب‌ شده نامعتبر است. + + + The collection is invalid. + این مجموعه نامعتبر است. + + + Please select a valid color. + لطفاً یک رنگ معتبر انتخاب کنید. + + + Please select a valid country. + لطفاً یک کشور معتبر انتخاب کنید. + + + Please select a valid currency. + لطفاً یک واحد پول معتبر انتخاب کنید. + + + Please choose a valid date interval. + لطفاً یک بازه‌ زمانی معتبر انتخاب کنید. + + + Please enter a valid date and time. + لطفاً یک تاریخ و زمان معتبر وارد کنید. + + + Please enter a valid date. + لطفاً یک تاریخ معتبر وارد کنید. + + + Please select a valid file. + لطفاً یک فایل معتبر انتخاب کنید. + + + The hidden field is invalid. + فیلد مخفی نامعتبر است. + + + Please enter an integer. + لطفاً یک عدد صحیح وارد کنید. + + + Please select a valid language. + لطفاً یک زبان معتبر انتخاب کنید. + + + Please select a valid locale. + لطفاً یک منطقه‌جغرافیایی (locale) معتبر انتخاب کنید. + + + Please enter a valid money amount. + لطفاً یک مقدار پول معتبر وارد کنید. + + + Please enter a number. + لطفاً یک عدد وارد کنید. + + + The password is invalid. + رمزعبور نامعتبر است. + + + Please enter a percentage value. + لطفاً یک درصد معتبر وارد کنید. + + + The values do not match. + مقادیر تطابق ندارند. + + + Please enter a valid time. + لطفاً یک زمان معتبر وارد کنید. + + + Please select a valid timezone. + لطفاً یک منطقه‌زمانی معتبر وارد کنید. + + + Please enter a valid URL. + لطفاً یک URL معتبر وارد کنید. + + + Please enter a valid search term. + لطفاً یک عبارت جستجوی معتبر وارد کنید. + + + Please provide a valid phone number. + لطفاً یک شماره تلفن معتبر وارد کنید. + + + The checkbox has an invalid value. + کادر انتخاب (checkbox) دارای مقداری نامعتبر است. + + + Please enter a valid email address. + لطفاً یک آدرس رایانامه (ایمیل) معتبر وارد کنید. + + + Please select a valid option. + لطفاً یک گزینه‌ معتبر انتخاب کنید. + + + Please select a valid range. + لطفاً یک محدوده‌ معتبر انتخاب کنید. + + + Please enter a valid week. + لطفاً یک هفته‌ معتبر وارد کنید. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.fi.xlf b/vendor/symfony/form/Resources/translations/validators.fi.xlf new file mode 100644 index 0000000..7ad87b5 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.fi.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Tämä lomake ei voi sisältää ylimääräisiä kenttiä. + + + The uploaded file was too large. Please try to upload a smaller file. + Ladattu tiedosto on liian iso. Ole hyvä ja lataa pienempi tiedosto. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-tarkiste on virheellinen. Ole hyvä ja yritä lähettää lomake uudestaan. + + + This value is not a valid HTML5 color. + Tämä arvo ei ole kelvollinen HTML5-väri. + + + Please enter a valid birthdate. + Syötä kelvollinen syntymäaika. + + + The selected choice is invalid. + Valittu vaihtoehto ei kelpaa. + + + The collection is invalid. + Ryhmä ei kelpaa. + + + Please select a valid color. + Valitse kelvollinen väri. + + + Please select a valid country. + Valitse kelvollinen maa. + + + Please select a valid currency. + Valitse kelvollinen valuutta. + + + Please choose a valid date interval. + Valitse kelvollinen aikaväli. + + + Please enter a valid date and time. + Syötä kelvolliset päivä ja aika. + + + Please enter a valid date. + Syötä kelvollinen päivä. + + + Please select a valid file. + Valitse kelvollinen tiedosto. + + + The hidden field is invalid. + Piilotettu kenttä ei ole kelvollinen. + + + Please enter an integer. + Syötä kokonaisluku. + + + Please select a valid language. + Valitse kelvollinen kieli. + + + Please select a valid locale. + Valitse kelvollinen kielikoodi. + + + Please enter a valid money amount. + Syötä kelvollinen rahasumma. + + + Please enter a number. + Syötä numero. + + + The password is invalid. + Salasana ei kelpaa. + + + Please enter a percentage value. + Syötä prosenttiluku. + + + The values do not match. + Arvot eivät vastaa toisiaan. + + + Please enter a valid time. + Syötä kelvollinen kellonaika. + + + Please select a valid timezone. + Valitse kelvollinen aikavyöhyke. + + + Please enter a valid URL. + Syötä kelvollinen URL. + + + Please enter a valid search term. + Syötä kelvollinen hakusana. + + + Please provide a valid phone number. + Anna kelvollinen puhelinnumero. + + + The checkbox has an invalid value. + Valintaruudun arvo ei kelpaa. + + + Please enter a valid email address. + Syötä kelvollinen sähköpostiosoite. + + + Please select a valid option. + Valitse kelvollinen vaihtoehto. + + + Please select a valid range. + Valitse kelvollinen väli. + + + Please enter a valid week. + Syötä kelvollinen viikko. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.fr.xlf b/vendor/symfony/form/Resources/translations/validators.fr.xlf new file mode 100644 index 0000000..d658264 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.fr.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ce formulaire ne doit pas contenir de champs supplémentaires. + + + The uploaded file was too large. Please try to upload a smaller file. + Le fichier téléchargé est trop volumineux. Merci d'essayer d'envoyer un fichier plus petit. + + + The CSRF token is invalid. Please try to resubmit the form. + Le jeton CSRF est invalide. Veuillez renvoyer le formulaire. + + + This value is not a valid HTML5 color. + Cette valeur n'est pas une couleur HTML5 valide. + + + Please enter a valid birthdate. + Veuillez entrer une date de naissance valide. + + + The selected choice is invalid. + Le choix sélectionné est invalide. + + + The collection is invalid. + La collection est invalide. + + + Please select a valid color. + Veuillez sélectionner une couleur valide. + + + Please select a valid country. + Veuillez sélectionner un pays valide. + + + Please select a valid currency. + Veuillez sélectionner une devise valide. + + + Please choose a valid date interval. + Veuillez choisir un intervalle de dates valide. + + + Please enter a valid date and time. + Veuillez saisir une date et une heure valides. + + + Please enter a valid date. + Veuillez entrer une date valide. + + + Please select a valid file. + Veuillez sélectionner un fichier valide. + + + The hidden field is invalid. + Le champ masqué n'est pas valide. + + + Please enter an integer. + Veuillez saisir un entier. + + + Please select a valid language. + Veuillez sélectionner une langue valide. + + + Please select a valid locale. + Veuillez sélectionner une langue valide. + + + Please enter a valid money amount. + Veuillez saisir un montant valide. + + + Please enter a number. + Veuillez saisir un nombre. + + + The password is invalid. + Le mot de passe est invalide. + + + Please enter a percentage value. + Veuillez saisir un pourcentage valide. + + + The values do not match. + Les valeurs ne correspondent pas. + + + Please enter a valid time. + Veuillez saisir une heure valide. + + + Please select a valid timezone. + Veuillez sélectionner un fuseau horaire valide. + + + Please enter a valid URL. + Veuillez saisir une URL valide. + + + Please enter a valid search term. + Veuillez saisir un terme de recherche valide. + + + Please provide a valid phone number. + Veuillez fournir un numéro de téléphone valide. + + + The checkbox has an invalid value. + La case à cocher a une valeur non valide. + + + Please enter a valid email address. + Veuillez saisir une adresse email valide. + + + Please select a valid option. + Veuillez sélectionner une option valide. + + + Please select a valid range. + Veuillez sélectionner une plage valide. + + + Please enter a valid week. + Veuillez entrer une semaine valide. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.gl.xlf b/vendor/symfony/form/Resources/translations/validators.gl.xlf new file mode 100644 index 0000000..5ef404a --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.gl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Este formulario non debería conter campos adicionais. + + + The uploaded file was too large. Please try to upload a smaller file. + O arquivo subido é demasiado grande. Por favor, suba un arquivo máis pequeno. + + + The CSRF token is invalid. Please try to resubmit the form. + O token CSRF non é válido. Por favor, probe a enviar novamente o formulario. + + + This value is not a valid HTML5 color. + Este valor non é unha cor HTML5 válida. + + + Please enter a valid birthdate. + Insire unha data de aniversario válida. + + + The selected choice is invalid. + A opción seleccionada non é válida. + + + The collection is invalid. + A colección non é válida. + + + Please select a valid color. + Por favor, seleccione unha cor válida. + + + Please select a valid country. + Por favor, seleccione un país válido. + + + Please select a valid currency. + Por favor, seleccione unha moeda válida. + + + Please choose a valid date interval. + Por favor, escolla un intervalo de datas válido. + + + Please enter a valid date and time. + Por favor, introduza unha data e hora válidas. + + + Please enter a valid date. + Por favor, introduce unha data válida. + + + Please select a valid file. + Por favor, seleccione un ficheiro válido. + + + The hidden field is invalid. + O campo oculto non é válido. + + + Please enter an integer. + Por favor, introduza un número enteiro. + + + Please select a valid language. + Por favor, selecciona un idioma válido. + + + Please select a valid locale. + Por favor, seleccione unha configuración rexional válida. + + + Please enter a valid money amount. + Por favor, introduza unha cantidade de diñeiro válida. + + + Please enter a number. + Por favor, introduza un número. + + + The password is invalid. + O contrasinal non é válido. + + + Please enter a percentage value. + Por favor, introduza un valor porcentual. + + + The values do not match. + Os valores non coinciden. + + + Please enter a valid time. + Por favor, introduza unha hora válida. + + + Please select a valid timezone. + Por favor, selecciona unha zona horaria válida. + + + Please enter a valid URL. + Por favor, introduce un URL válido. + + + Please enter a valid search term. + Por favor, introduce un termo de busca válido. + + + Please provide a valid phone number. + Por favor, fornecer un número de teléfono válido. + + + The checkbox has an invalid value. + A caixa de verificación ten un valor non válido. + + + Please enter a valid email address. + Por favor, introduce un enderezo de correo electrónico válido. + + + Please select a valid option. + Por favor, seleccione unha opción válida. + + + Please select a valid range. + Por favor, seleccione un intervalo válido. + + + Please enter a valid week. + Por favor, introduce unha semana válida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.he.xlf b/vendor/symfony/form/Resources/translations/validators.he.xlf new file mode 100644 index 0000000..efd68b8 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.he.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + הטופס לא צריך להכיל שדות נוספים. + + + The uploaded file was too large. Please try to upload a smaller file. + הקובץ שהועלה גדול מדי. נסה להעלות קובץ קטן יותר. + + + The CSRF token is invalid. Please try to resubmit the form. + אסימון CSRF אינו חוקי. אנא נסה לשלוח שוב את הטופס. + + + This value is not a valid HTML5 color. + ערך זה אינו צבע HTML5 חוקי. + + + Please enter a valid birthdate. + נא להזין את תאריך לידה תקני. + + + The selected choice is invalid. + הבחירה שנבחרה אינה חוקית. + + + The collection is invalid. + האוסף אינו חוקי. + + + Please select a valid color. + אנא בחר צבע חוקי. + + + Please select a valid country. + אנא בחר מדינה חוקית. + + + Please select a valid currency. + אנא בחר מטבע חוקי. + + + Please choose a valid date interval. + אנא בחר מרווח תאריכים חוקי. + + + Please enter a valid date and time. + אנא הזן תאריך ושעה תקנים. + + + Please enter a valid date. + נא להזין תאריך חוקי. + + + Please select a valid file. + אנא בחר קובץ חוקי. + + + The hidden field is invalid. + השדה הנסתר אינו חוקי. + + + Please enter an integer. + אנא הזן מספר שלם. + + + Please select a valid language. + אנא בחר שפה חוקי. + + + Please select a valid locale. + אנא בחר שפה מקומית. + + + Please enter a valid money amount. + אנא הזן סכום כסף חוקי. + + + Please enter a number. + אנא הזן מספר. + + + The password is invalid. + הסיסמה אינה חוקית. + + + Please enter a percentage value. + אנא הזן ערך באחוזים. + + + The values do not match. + הערכים אינם תואמים. + + + Please enter a valid time. + אנא הזן שעה חוקי. + + + Please select a valid timezone. + אנא בחר אזור זמן חוקי. + + + Please enter a valid URL. + נא להזין את כתובת אתר חוקית. + + + Please enter a valid search term. + אנא הזן מונח חיפוש חוקי. + + + Please provide a valid phone number. + אנא ספק מספר טלפון חוקי. + + + The checkbox has an invalid value. + לתיבת הסימון יש ערך לא חוקי. + + + Please enter a valid email address. + אנא הזן כתובת דוא"ל תקנית. + + + Please select a valid option. + אנא בחר אפשרות חוקית. + + + Please select a valid range. + אנא בחר טווח חוקי. + + + Please enter a valid week. + אנא הזן שבוע תקף. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.hr.xlf b/vendor/symfony/form/Resources/translations/validators.hr.xlf new file mode 100644 index 0000000..9f17b5e --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.hr.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ovaj obrazac ne smije sadržavati dodatna polja. + + + The uploaded file was too large. Please try to upload a smaller file. + Prenesena datoteka je prevelika. Molim pokušajte prenijeti manju datoteku. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF vrijednost nije ispravna. Pokušajte ponovo poslati obrazac. + + + This value is not a valid HTML5 color. + Ova vrijednost nije važeća HTML5 boja. + + + Please enter a valid birthdate. + Molim upišite ispravan datum rođenja. + + + The selected choice is invalid. + Odabrani izbor nije ispravan. + + + The collection is invalid. + Kolekcija nije ispravna. + + + Please select a valid color. + Molim odaberite ispravnu boju. + + + Please select a valid country. + Molim odaberite ispravnu državu. + + + Please select a valid currency. + Molim odaberite ispravnu valutu. + + + Please choose a valid date interval. + Molim odaberite ispravni vremenski interval. + + + Please enter a valid date and time. + Molim unesite ispravni datum i vrijeme. + + + Please enter a valid date. + Molim odaberite ispravan datum. + + + Please select a valid file. + Molim odaberite ispravnu datoteku. + + + The hidden field is invalid. + Skriveno polje nije ispravno. + + + Please enter an integer. + Molim unesite cijeli broj. + + + Please select a valid language. + Molim odaberite ispravan jezik. + + + Please select a valid locale. + Molim odaberite ispravnu lokalizaciju. + + + Please enter a valid money amount. + Molim unesite ispravan iznos novca. + + + Please enter a number. + Molim unesite broj. + + + The password is invalid. + Ova lozinka nije ispravna. + + + Please enter a percentage value. + Molim unesite vrijednost postotka. + + + The values do not match. + Ove vrijednosti se ne poklapaju. + + + Please enter a valid time. + Molim unesite ispravno vrijeme. + + + Please select a valid timezone. + Molim odaberite ispravnu vremensku zonu. + + + Please enter a valid URL. + Molim unesite ispravan URL. + + + Please enter a valid search term. + Molim unesite ispravan pojam za pretraživanje. + + + Please provide a valid phone number. + Molim navedite ispravan telefonski broj. + + + The checkbox has an invalid value. + Polje za potvrdu sadrži neispravnu vrijednost. + + + Please enter a valid email address. + Molim unesite valjanu adresu elektronske pošte. + + + Please select a valid option. + Molim odaberite ispravnu opciju. + + + Please select a valid range. + Molim odaberite ispravan raspon. + + + Please enter a valid week. + Molim unesite ispravni tjedan. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.hu.xlf b/vendor/symfony/form/Resources/translations/validators.hu.xlf new file mode 100644 index 0000000..3b70461 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.hu.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ez a mezőcsoport nem tartalmazhat extra mezőket. + + + The uploaded file was too large. Please try to upload a smaller file. + A feltöltött fájl túl nagy. Kérem, próbáljon egy kisebb fájlt feltölteni. + + + The CSRF token is invalid. Please try to resubmit the form. + Érvénytelen CSRF token. Kérem, próbálja újra elküldeni az űrlapot. + + + This value is not a valid HTML5 color. + Ez az érték nem egy érvényes HTML5 szín. + + + Please enter a valid birthdate. + Kérjük, adjon meg egy valós születési dátumot. + + + The selected choice is invalid. + A kiválasztott opció érvénytelen. + + + The collection is invalid. + A gyűjtemény érvénytelen. + + + Please select a valid color. + Kérjük, válasszon egy érvényes színt. + + + Please select a valid country. + Kérjük, válasszon egy érvényes országot. + + + Please select a valid currency. + Kérjük, válasszon egy érvényes pénznemet. + + + Please choose a valid date interval. + Kérjük, válasszon egy érvényes dátumintervallumot. + + + Please enter a valid date and time. + Kérjük, adjon meg egy érvényes dátumot és időpontot. + + + Please enter a valid date. + Kérjük, adjon meg egy érvényes dátumot. + + + Please select a valid file. + Kérjük, válasszon egy érvényes fájlt. + + + The hidden field is invalid. + A rejtett mező érvénytelen. + + + Please enter an integer. + Kérjük, adjon meg egy egész számot. + + + Please select a valid language. + Kérjük, válasszon egy érvényes nyelvet. + + + Please select a valid locale. + Kérjük, válasszon egy érvényes területi beállítást. + + + Please enter a valid money amount. + Kérjük, adjon meg egy érvényes pénzösszeget. + + + Please enter a number. + Kérjük, adjon meg egy számot. + + + The password is invalid. + A jelszó érvénytelen. + + + Please enter a percentage value. + Kérjük, adjon meg egy százalékos értéket. + + + The values do not match. + Az értékek nem egyeznek. + + + Please enter a valid time. + Kérjük, adjon meg egy érvényes időpontot. + + + Please select a valid timezone. + Kérjük, válasszon érvényes időzónát. + + + Please enter a valid URL. + Kérjük, adjon meg egy érvényes URL-t. + + + Please enter a valid search term. + Kérjük, adjon meg egy érvényes keresési kifejezést. + + + Please provide a valid phone number. + Kérjük, adjon egy érvényes telefonszámot + + + The checkbox has an invalid value. + A jelölőnégyzet értéke érvénytelen. + + + Please enter a valid email address. + Kérjük valós e-mail címet adjon meg. + + + Please select a valid option. + Kérjük, válasszon egy érvényes beállítást. + + + Please select a valid range. + Kérjük, válasszon egy érvényes tartományt. + + + Please enter a valid week. + Kérjük, adjon meg egy érvényes hetet. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.hy.xlf b/vendor/symfony/form/Resources/translations/validators.hy.xlf new file mode 100644 index 0000000..10ac326 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.hy.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Այս ձևը չպետք է պարունակի լրացուցիչ տողեր։ + + + The uploaded file was too large. Please try to upload a smaller file. + Վերբեռնված ֆայլը չափազանց մեծ է. Խնդրվում է վերբեռնել ավելի փոքր չափսի ֆայլ։ + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF արժեքը անթույլատրելի է. Փորձեք նորից ուղարկել ձևը։ + + + This value is not a valid HTML5 color. + Այս արժեքը վավեր HTML5 գույն չէ։ + + + Please enter a valid birthdate. + Խնդրում ենք մուտքագրել վավեր ծննդյան ամսաթիվ։ + + + The selected choice is invalid. + Ընտրված ընտրությունն անվավեր է։ + + + The collection is invalid. + Համախումբն անվավեր է։ + + + Please select a valid color. + Խնդրում ենք ընտրել վավեր գույն։ + + + Please select a valid country. + Խնդրում ենք ընտրել վավեր երկիր։ + + + Please select a valid currency. + Խնդրում ենք ընտրել վավեր արժույթ։ + + + Please choose a valid date interval. + Խնդրում ենք ընտրել ճիշտ ամսաթվերի միջակայք։ + + + Please enter a valid date and time. + Խնդրում ենք մուտքագրել վավեր ամսաթիվ և ժամ։ + + + Please enter a valid date. + Խնդրում ենք մուտքագրել վավեր ամսաթիվ։ + + + Please select a valid file. + Խնդրում ենք ընտրել վավեր ֆայլ։ + + + The hidden field is invalid. + Թաքնված դաշտը անվավեր է։ + + + Please enter an integer. + Խնդրում ենք մուտքագրել ամբողջ թիվ։ + + + Please select a valid language. + Խնդրում ենք ընտրել վավեր լեզու։ + + + Please select a valid locale. + Խնդրում ենք ընտրել վավեր տեղայնացում։ + + + Please enter a valid money amount. + Խնդրում ենք մուտքագրել վավեր գումար։ + + + Please enter a number. + Խնդրում ենք մուտքագրել համար։ + + + The password is invalid. + Գաղտնաբառն անվավեր է։ + + + Please enter a percentage value. + Խնդրում ենք մուտքագրել տոկոսային արժեք։ + + + The values do not match. + Արժեքները չեն համընկնում։ + + + Please enter a valid time. + Մուտքագրեք վավեր ժամանակ։ + + + Please select a valid timezone. + Խնդրում ենք ընտրել վավեր ժամային գոտի։ + + + Please enter a valid URL. + Խնդրում ենք մուտքագրել վավեր URL։ + + + Please enter a valid search term. + Խնդրում ենք մուտքագրել վավեր որոնման տերմին։ + + + Please provide a valid phone number. + Խնդրում ենք տրամադրել վավեր հեռախոսահամար։ + + + The checkbox has an invalid value. + Նշման վանդակը անվավեր արժեք ունի։ + + + Please enter a valid email address. + Խնդրում ենք մուտքագրել վավեր էլ-հասցե։ + + + Please select a valid option. + Խնդրում ենք ընտրել ճիշտ տարբերակ։ + + + Please select a valid range. + Խնդրում ենք ընտրել վավեր տիրույթ։ + + + Please enter a valid week. + Մուտքագրեք վավեր շաբաթ։ + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.id.xlf b/vendor/symfony/form/Resources/translations/validators.id.xlf new file mode 100644 index 0000000..535f9e6 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.id.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Gabungan kolom tidak boleh mengandung kolom tambahan. + + + The uploaded file was too large. Please try to upload a smaller file. + Berkas yang di unggah terlalu besar. Silahkan coba unggah berkas yang lebih kecil. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-Token tidak sah. Silahkan coba kirim ulang formulir. + + + This value is not a valid HTML5 color. + Nilai ini bukan merupakan HTML5 color yang sah. + + + Please enter a valid birthdate. + Silahkan masukkan tanggal lahir yang sah. + + + The selected choice is invalid. + Pilihan yang dipilih tidak sah. + + + The collection is invalid. + Koleksi tidak sah. + + + Please select a valid color. + Silahkan pilih warna yang sah. + + + Please select a valid country. + Silahkan pilih negara yang sah. + + + Please select a valid currency. + Silahkan pilih mata uang yang sah. + + + Please choose a valid date interval. + Silahkan pilih interval tanggal yang sah. + + + Please enter a valid date and time. + Silahkan masukkan tanggal dan waktu yang sah. + + + Please enter a valid date. + Silahkan masukkan tanggal yang sah. + + + Please select a valid file. + Silahkan pilih berkas yang sah. + + + The hidden field is invalid. + Ruas yang tersembunyi tidak sah. + + + Please enter an integer. + Silahkan masukkan angka. + + + Please select a valid language. + Silahlan pilih bahasa yang sah. + + + Please select a valid locale. + Silahkan pilih local yang sah. + + + Please enter a valid money amount. + Silahkan masukkan nilai uang yang sah. + + + Please enter a number. + Silahkan masukkan sebuah angka + + + The password is invalid. + Kata sandi tidak sah. + + + Please enter a percentage value. + Silahkan masukkan sebuah nilai persentase. + + + The values do not match. + Nilainya tidak cocok. + + + Please enter a valid time. + Silahkan masukkan waktu yang sah. + + + Please select a valid timezone. + Silahkan pilih zona waktu yang sah. + + + Please enter a valid URL. + Silahkan masukkan URL yang sah. + + + Please enter a valid search term. + Silahkan masukkan kata pencarian yang sah. + + + Please provide a valid phone number. + Silahkan sediakan nomor telepon yang sah. + + + The checkbox has an invalid value. + Nilai dari checkbox tidak sah. + + + Please enter a valid email address. + Silahkan masukkan alamat surel yang sah. + + + Please select a valid option. + Silahkan pilih opsi yang sah. + + + Please select a valid range. + Silahkan pilih rentang yang sah. + + + Please enter a valid week. + Silahkan masukkan minggu yang sah. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.it.xlf b/vendor/symfony/form/Resources/translations/validators.it.xlf new file mode 100644 index 0000000..8e4665c --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.it.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Questo form non dovrebbe contenere nessun campo extra. + + + The uploaded file was too large. Please try to upload a smaller file. + Il file caricato è troppo grande. Per favore, carica un file più piccolo. + + + The CSRF token is invalid. Please try to resubmit the form. + Il token CSRF non è valido. Prova a reinviare il form. + + + This value is not a valid HTML5 color. + Il valore non è un colore HTML5 valido. + + + Please enter a valid birthdate. + Per favore, inserisci una data di compleanno valida. + + + The selected choice is invalid. + La scelta selezionata non è valida. + + + The collection is invalid. + La collezione non è valida. + + + Please select a valid color. + Per favore, seleziona un colore valido. + + + Please select a valid country. + Per favore, seleziona un paese valido. + + + Please select a valid currency. + Per favore, seleziona una valuta valida. + + + Please choose a valid date interval. + Per favore, scegli a valid date interval. + + + Please enter a valid date and time. + Per favore, inserisci a valid date and time. + + + Please enter a valid date. + Per favore, inserisci a valid date. + + + Please select a valid file. + Per favore, seleziona un file valido. + + + The hidden field is invalid. + Il campo nascosto non è valido. + + + Please enter an integer. + Per favore, inserisci un numero intero. + + + Please select a valid language. + Per favore, seleziona una lingua valida. + + + Please select a valid locale. + Per favore, seleziona una lingua valida. + + + Please enter a valid money amount. + Per favore, inserisci un importo valido. + + + Please enter a number. + Per favore, inserisci un numero. + + + The password is invalid. + La password non è valida. + + + Please enter a percentage value. + Per favore, inserisci un valore percentuale. + + + The values do not match. + I valori non corrispondono. + + + Please enter a valid time. + Per favore, inserisci un orario valido. + + + Please select a valid timezone. + Per favore, seleziona un fuso orario valido. + + + Please enter a valid URL. + Per favore, inserisci un URL valido. + + + Please enter a valid search term. + Per favore, inserisci un termine di ricerca valido. + + + Please provide a valid phone number. + Per favore, indica un numero di telefono valido. + + + The checkbox has an invalid value. + La casella di selezione non ha un valore valido. + + + Please enter a valid email address. + Per favore, indica un indirizzo email valido. + + + Please select a valid option. + Per favore, seleziona un'opzione valida. + + + Please select a valid range. + Per favore, seleziona un intervallo valido. + + + Please enter a valid week. + Per favore, inserisci una settimana valida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.ja.xlf b/vendor/symfony/form/Resources/translations/validators.ja.xlf new file mode 100644 index 0000000..ea2226c --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.ja.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + フィールドグループに追加のフィールドを含んではなりません。 + + + The uploaded file was too large. Please try to upload a smaller file. + アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください。 + + + The CSRF token is invalid. Please try to resubmit the form. + CSRFトークンが無効です、再送信してください。 + + + This value is not a valid HTML5 color. + 有効なHTML5の色ではありません。 + + + Please enter a valid birthdate. + 有効な生年月日を入力してください。 + + + The selected choice is invalid. + 選択した値は無効です。 + + + The collection is invalid. + コレクションは無効です。 + + + Please select a valid color. + 有効な色を選択してください。 + + + Please select a valid country. + 有効な国を選択してください。 + + + Please select a valid currency. + 有効な通貨を選択してください。 + + + Please choose a valid date interval. + 有効な日付間隔を選択してください。 + + + Please enter a valid date and time. + 有効な日時を入力してください。 + + + Please enter a valid date. + 有効な日付を入力してください。 + + + Please select a valid file. + 有効なファイルを選択してください。 + + + The hidden field is invalid. + 隠しフィールドが無効です。 + + + Please enter an integer. + 整数で入力してください。 + + + Please select a valid language. + 有効な言語を選択してください。 + + + Please select a valid locale. + 有効なロケールを選択してください。 + + + Please enter a valid money amount. + 有効な金額を入力してください。 + + + Please enter a number. + 数値で入力してください。 + + + The password is invalid. + パスワードが無効です。 + + + Please enter a percentage value. + パーセント値で入力してください。 + + + The values do not match. + 値が一致しません。 + + + Please enter a valid time. + 有効な時間を入力してください。 + + + Please select a valid timezone. + 有効なタイムゾーンを選択してください。 + + + Please enter a valid URL. + 有効なURLを入力してください。 + + + Please enter a valid search term. + 有効な検索語を入力してください。 + + + Please provide a valid phone number. + 有効な電話番号を入力してください。 + + + The checkbox has an invalid value. + チェックボックスの値が無効です。 + + + Please enter a valid email address. + 有効なメールアドレスを入力してください。 + + + Please select a valid option. + 有効な値を選択してください。 + + + Please select a valid range. + 有効な範囲を選択してください。 + + + Please enter a valid week. + 有効な週を入力してください。 + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.lb.xlf b/vendor/symfony/form/Resources/translations/validators.lb.xlf new file mode 100644 index 0000000..e989264 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.lb.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Dës Feldergrupp sollt keng zousätzlech Felder enthalen. + + + The uploaded file was too large. Please try to upload a smaller file. + De geschécktene Fichier ass ze grouss. Versicht wann ech gelift ee méi klenge Fichier eropzelueden. + + + The CSRF token is invalid. Please try to resubmit the form. + Den CSRF-Token ass ongëlteg. Versicht wann ech gelift de Formulaire nach eng Kéier ze schécken. + + + This value is not a valid HTML5 color. + Dëse Wäert ass keng gëlteg HTML5-Faarf. + + + Please enter a valid birthdate. + W.e.g. e gëltege Gebuertsdatum aginn. + + + The selected choice is invalid. + Den ausgewielte Choix ass ongëlteg. + + + The collection is invalid. + D'Kollektioun ass ongëlteg. + + + Please select a valid color. + W.e.g. eng gëlteg Faarf auswielen. + + + Please select a valid country. + W.e.g. e gëltegt Land auswielen. + + + Please select a valid currency. + W.e.g. eng gëlteg Wärung auswielen. + + + Please choose a valid date interval. + W.e.g. e gëltegen Datumsinterval aginn. + + + Please enter a valid date and time. + W.e.g. eng gëlteg Datum an Zäit aginn. + + + Please enter a valid date. + W.e.g. eng gëltegen Datum aginn. + + + Please select a valid file. + W.e.g. e gëltege Fichier auswielen. + + + The hidden field is invalid. + Dat verstoppte Feld ass ongëlteg. + + + Please enter an integer. + W.e.g. eng ganz Zuel aginn. + + + Please select a valid language. + W.e.g. e gëltegt Sprooch auswielen. + + + Please select a valid locale. + W.e.g. e gëltegt Regionalschema auswielen. + + + Please enter a valid money amount. + W.e.g. eng gëlteg Geldzomm aginn. + + + Please enter a number. + W.e.g. eng Zuel aginn. + + + The password is invalid. + D'Passwuert ass ongëlteg. + + + Please enter a percentage value. + W.e.g. e Prozentwäert aginn. + + + The values do not match. + D'Wäerter stëmmen net iwwereneen. + + + Please enter a valid time. + W.e.g. eng gëlteg Zäit aginn. + + + Please select a valid timezone. + W.e.g. eng gëlteg Zäitzon auswielen. + + + Please enter a valid URL. + W.e.g. eng gëlteg URL aginn. + + + Please enter a valid search term. + W.e.g. e gëltege Sichbegrëff aginn. + + + Please provide a valid phone number. + W.e.g. eng gëlteg Telefonsnummer uginn. + + + The checkbox has an invalid value. + D'Ukräizfeld huet en ongëltege Wäert. + + + Please enter a valid email address. + W.e.g. eng gëlteg E-Mail-Adress aginn. + + + Please select a valid option. + W.e.g. eng gëlteg Optioun auswielen. + + + Please select a valid range. + W.e.g. eng gëlteg Spannbreet auswielen. + + + Please enter a valid week. + W.e.g. eng gëlteg Woch aginn. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.lt.xlf b/vendor/symfony/form/Resources/translations/validators.lt.xlf new file mode 100644 index 0000000..5613c42 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.lt.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Forma negali turėti papildomų laukų. + + + The uploaded file was too large. Please try to upload a smaller file. + Įkelta byla yra per didelė. bandykite įkelti mažesnę. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF kodas nepriimtinas. Bandykite siųsti formos užklausą dar kartą. + + + This value is not a valid HTML5 color. + Ši reikšmė nėra HTML5 spalva. + + + Please enter a valid birthdate. + Prašome įvesti tinkamą gimimo datą. + + + The selected choice is invalid. + Pasirinktas pasirinkimas yra neteisingas. + + + The collection is invalid. + Neteisingas sąrašas. + + + Please select a valid color. + Prašome pasirinkti tinkamą spalvą. + + + Please select a valid country. + Prašome pasirinkti tinkamą šalį. + + + Please select a valid currency. + Prašome pasirinkti tinkamą valiutą. + + + Please choose a valid date interval. + Prašome pasirinkti tinkamą datos intervalą. + + + Please enter a valid date and time. + Prašome įvesti tinkamą datą ir laiką. + + + Please enter a valid date. + Prašome įvesti tinkamą datą. + + + Please select a valid file. + Prašome pasirinkti tinkamą bylą. + + + The hidden field is invalid. + Klaidingas paslėptasis laukas. + + + Please enter an integer. + Prašome įvesti sveiką skaičių. + + + Please select a valid language. + Prašome pasirinkti tinkamą kalbą. + + + Please select a valid locale. + Prašome pasirinkti tinkamą lokalę. + + + Please enter a valid money amount. + Prašome įvesti tinkamą pinigų sumą. + + + Please enter a number. + Prašome įvesti numerį. + + + The password is invalid. + Klaidingas slaptažodis. + + + Please enter a percentage value. + Prašome įvesti procentinę reikšmę. + + + The values do not match. + Reikšmės nesutampa. + + + Please enter a valid time. + Prašome įvesti tinkamą laiką. + + + Please select a valid timezone. + Prašome pasirinkti tinkamą laiko zoną. + + + Please enter a valid URL. + Prašome įvesti tinkamą URL. + + + Please enter a valid search term. + Prašome įvesti tinkamą paieškos terminą. + + + Please provide a valid phone number. + Prašome pateikti tinkamą telefono numerį. + + + The checkbox has an invalid value. + Klaidinga žymimajo langelio reikšmė. + + + Please enter a valid email address. + Prašome įvesti tinkamą el. pašto adresą. + + + Please select a valid option. + Prašome pasirinkti tinkamą parinktį. + + + Please select a valid range. + Prašome pasirinkti tinkamą diapozoną. + + + Please enter a valid week. + Prašome įvesti tinkamą savaitę. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.lv.xlf b/vendor/symfony/form/Resources/translations/validators.lv.xlf new file mode 100644 index 0000000..e7c90c7 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.lv.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Šajā veidlapā nevajadzētu būt papildus ievades laukiem. + + + The uploaded file was too large. Please try to upload a smaller file. + Augšupielādētā faila izmērs bija par lielu. Lūdzu mēģiniet augšupielādēt mazāka izmēra failu. + + + The CSRF token is invalid. Please try to resubmit the form. + Dotais CSRF talons nav derīgs. Lūdzu mēģiniet vēlreiz iesniegt veidlapu. + + + This value is not a valid HTML5 color. + Šī vertība nav derīga HTML5 krāsa. + + + Please enter a valid birthdate. + Lūdzu, ievadiet derīgu dzimšanas datumu. + + + The selected choice is invalid. + Iezīmētā izvēle nav derīga. + + + The collection is invalid. + Kolekcija nav derīga. + + + Please select a valid color. + Lūdzu, izvēlieties derīgu krāsu. + + + Please select a valid country. + Lūdzu, izvēlieties derīgu valsti. + + + Please select a valid currency. + Lūdzu, izvēlieties derīgu valūtu. + + + Please choose a valid date interval. + Lūdzu, izvēlieties derīgu datumu intervālu. + + + Please enter a valid date and time. + Lūdzu, ievadiet derīgu datumu un laiku. + + + Please enter a valid date. + Lūdzu, ievadiet derīgu datumu. + + + Please select a valid file. + Lūdzu, izvēlieties derīgu failu. + + + The hidden field is invalid. + Slēptā lauka vērtība ir nederīga. + + + Please enter an integer. + Lūdzu, ievadiet veselu skaitli. + + + Please select a valid language. + Lūdzu, izvēlieties derīgu valodu. + + + Please select a valid locale. + Lūdzu, izvēlieties derīgu lokalizāciju. + + + Please enter a valid money amount. + Lūdzu, ievadiet derīgu naudas lielumu. + + + Please enter a number. + Lūdzu, ievadiet skaitli. + + + The password is invalid. + Parole ir nederīga. + + + Please enter a percentage value. + Lūdzu, ievadiet procentuālo lielumu. + + + The values do not match. + Vērtības nesakrīt. + + + Please enter a valid time. + Lūdzu, ievadiet derīgu laiku. + + + Please select a valid timezone. + Lūdzu, izvēlieties derīgu laika zonu. + + + Please enter a valid URL. + Lūdzu, ievadiet derīgu URL. + + + Please enter a valid search term. + Lūdzu, ievadiet derīgu meklēšanas nosacījumu. + + + Please provide a valid phone number. + Lūdzu, ievadiet derīgu tālruņa numuru. + + + The checkbox has an invalid value. + Izvēles rūtiņai ir nederīga vērtība. + + + Please enter a valid email address. + Lūdzu, ievadiet derīgu e-pasta adresi. + + + Please select a valid option. + Lūdzu, izvēlieties derīgu opciju. + + + Please select a valid range. + Lūdzu, izvēlieties derīgu diapazonu. + + + Please enter a valid week. + Lūdzu, ievadiet derīgu nedeļu. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.mn.xlf b/vendor/symfony/form/Resources/translations/validators.mn.xlf new file mode 100644 index 0000000..620112d --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.mn.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Форм нэмэлт талбар багтаах боломжгүй. + + + The uploaded file was too large. Please try to upload a smaller file. + Upload хийсэн файл хэтэрхий том байна. Бага хэмжээтэй файл оруулна уу. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF token буруу байна. Формоо дахин илгээнэ үү. + + + This value is not a valid HTML5 color. + Энэ утга зөв HTML5 өнгө биш байна. + + + Please enter a valid birthdate. + Зөв төрсөн он сар оруулна уу. + + + The selected choice is invalid. + Сонгосон утга буруу байна. + + + The collection is invalid. + Цуглуулга буруу байна. + + + Please select a valid color. + Үнэн зөв өнгө сонгоно уу. + + + Please select a valid country. + Үнэн зөв улс сонгоно уу. + + + Please select a valid currency. + Үнэн зөв мөнгөн тэмдэгт сонгоно уу. + + + Please choose a valid date interval. + Үнэн зөв цагын зай сонгоно уу. + + + Please enter a valid date and time. + Үнэн зөв он цаг оруулна уу. + + + Please enter a valid date. + Үнэн зөв он цаг өдөр оруулна уу. + + + Please select a valid file. + Үнэн зөв файл сонгоно уу. + + + The hidden field is invalid. + Нууц талбарын утга буруу байна. + + + Please enter an integer. + Бүхэл тоо оруулна уу. + + + Please select a valid language. + Үнэн зөв хэл сонгоно уу. + + + Please select a valid locale. + Үнэн зөв бүс сонгоно уу. + + + Please enter a valid money amount. + Үнэн зөв мөнгөний хэмжээ сонгоно уу. + + + Please enter a number. + Тоо оруулна уу. + + + The password is invalid. + Нууц үг буруу байна. + + + Please enter a percentage value. + Хувь утга оруулна уу. + + + The values do not match. + Утга хоорондоо таарахгүй байна. + + + Please enter a valid time. + Үнэн зөв цаг оруулна уу. + + + Please select a valid timezone. + Үнэн зөв цагын бүс оруулна уу. + + + Please enter a valid URL. + Үнэн зөв URL оруулна уу. + + + Please enter a valid search term. + Үнэн зөв хайх утга оруулна уу. + + + Please provide a valid phone number. + Үнэн зөв утасны дугаар оруулна уу. + + + The checkbox has an invalid value. + Сонгох хайрцаг буруу утгатай байна. + + + Please enter a valid email address. + Үнэн зөв и-мэйл хаяг оруулна уу. + + + Please select a valid option. + Үнэн зөв сонголт сонгоно уу. + + + Please select a valid range. + Үнэн зөв хязгаарын утга сонгоно уу. + + + Please enter a valid week. + Үнэн зөв долоо хоног сонгоно уу. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.my.xlf b/vendor/symfony/form/Resources/translations/validators.my.xlf new file mode 100644 index 0000000..b0180c5 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.my.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + ဤ ဖောင်သည် field အပိုများ မပါ၀င်သင့်ပါ။ + + + The uploaded file was too large. Please try to upload a smaller file. + Upload တင်သောဖိုင်သည်အလွန်ကြီးလွန်းသည်။ ကျေးဇူးပြု၍ သေးငယ်သည့်ဖိုင်ကိုတင်ရန်ကြိုးစားပါ။ + + + The CSRF token is invalid. Please try to resubmit the form. + သင့်လျှော်သော် CSRF တိုကင် မဟုတ်ပါ။ ကျေးဇူးပြု၍ဖောင်ကိုပြန်တင်ပါ။ + + + This value is not a valid HTML5 color. + ဤတန်ဖိုးသည် သင့်လျှော်သော် HTML5 အရောင်မဟုတ်ပါ။ + + + Please enter a valid birthdate. + ကျေးဇူးပြု၍ မှန်ကန်သောမွေးနေ့ကိုထည့်ပါ။ + + + The selected choice is invalid. + သင့် ရွေးချယ်မှုသည်မမှန်ကန်ပါ။ + + + The collection is invalid. + ဤ collection သည်သင့်လျှော်သော် collection မဟုတ်ပါ။ + + + Please select a valid color. + ကျေးဇူးပြု၍ မှန်ကန်သောအရောင်ကိုရွေးပါ။ + + + Please select a valid country. + ကျေးဇူးပြု၍ မှန်ကန်သောနိုင်ငံကိုရွေးပါ။ + + + Please select a valid currency. + ကျေးဇူးပြု၍ မှန်ကန်သောငွေကြေးကိုရွေးပါ။ + + + Please choose a valid date interval. + ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲကိုရွေးပါ။ + + + Please enter a valid date and time. + ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲနှင့်အချိန် ကိုထည့်ပါ။ + + + Please enter a valid date. + ကျေးဇူးပြု၍ မှန်ကန်သောနေ ရက်စွဲကိုထည့်ပါ။ + + + Please select a valid file. + ကျေးဇူးပြု၍ မှန်ကန်သောနေ ဖိုင်ကိုရွေးချယ်ပါ။ + + + The hidden field is invalid. + မသင့် လျှော်သော် hidden field ဖြစ်နေသည်။ + + + Please enter an integer. + ကျေးဇူးပြု၍ Integer တန်ဖိုးသာထည့်ပါ။ + + + Please select a valid language. + ကျေးဇူးပြု၍ မှန်ကန်သော ဘာသာစကားကိုရွေးချယ်ပါ။ + + + Please select a valid locale. + ကျေးဇူးပြု၍ မှန်ကန်သော locale ကိုရွေးချယ်ပါ။ + + + Please enter a valid money amount. + ကျေးဇူးပြု၍ မှန်ကန်သော ပိုက်ဆံပမာဏ ကိုထည့်ပါ။ + + + Please enter a number. + ကျေးဇူးပြု၍ မှန်ကန်သော နံပါတ် ကိုရွေးချယ်ပါ။ + + + The password is invalid. + မှန်ကန်သောစကား၀ှက်မဟုတ်ပါ။ + + + Please enter a percentage value. + ကျေးဇူးပြု၍ ရာခိုင်နှုန်းတန်ဖိုးထည့်ပါ။ + + + The values do not match. + တန်ဖိုးများကိုက်ညီမှုမရှိပါ။ + + + Please enter a valid time. + ကျေးဇူးပြု၍ မှန်ကန်သောအချိန်ကိုထည့်ပါ။ + + + Please select a valid timezone. + ကျေးဇူးပြု၍ မှန်ကန်သောအချိန်ဇုန်ကိုရွေးပါ။ + + + Please enter a valid URL. + ကျေးဇူးပြု၍ သင့်လျှော်သော် URL ကိုရွေးပါ။ + + + Please enter a valid search term. + ကျေးဇူးပြု၍ သင့် လျှော်သော်ရှာဖွေမှု term များထည့်ပါ။ + + + Please provide a valid phone number. + ကျေးဇူးပြု၍ သင့် လျှော်သော်ရှာဖွေမှု ဖုန်းနံပါတ်ထည့်ပါ။ + + + The checkbox has an invalid value. + Checkbox တန်ဖိုးသည် မှန်ကန်မှုမရှိပါ။ + + + Please enter a valid email address. + ကျေးဇူးပြု၍ မှန်ကန်သော် email လိပ်စာထည့်ပါ။ + + + Please select a valid option. + ကျေးဇူးပြု၍ မှန်ကန်သော် ရွေးချယ်မှု ကိုရွေးပါ။ + + + Please select a valid range. + ကျေးဇူးပြု၍ မှန်ကန်သော အပိုင်းအခြား ကိုရွေးပါ။ + + + Please enter a valid week. + ကျေးဇူးပြု၍ မှန်ကန်သောရက်သတ္တပတ်ကိုထည့်ပါ။ + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.nb.xlf b/vendor/symfony/form/Resources/translations/validators.nb.xlf new file mode 100644 index 0000000..1d83850 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.nb.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Feltgruppen må ikke inneholde ekstra felter. + + + The uploaded file was too large. Please try to upload a smaller file. + Den opplastede filen var for stor. Vennligst last opp en mindre fil. + + + The CSRF token is invalid. + CSRF nøkkelen er ugyldig. + + + This value is not a valid HTML5 color. + Denne verdien er ikke en gyldig HTML5-farge. + + + Please enter a valid birthdate. + Vennligst oppgi gyldig fødselsdato. + + + The selected choice is invalid. + Det valgte valget er ugyldig. + + + The collection is invalid. + Samlingen er ugyldig. + + + Please select a valid color. + Velg en gyldig farge. + + + Please select a valid country. + Vennligst velg et gyldig land. + + + Please select a valid currency. + Vennligst velg en gyldig valuta. + + + Please choose a valid date interval. + Vennligst velg et gyldig datointervall. + + + Please enter a valid date and time. + Vennligst angi en gyldig dato og tid. + + + Please enter a valid date. + Vennligst oppgi en gyldig dato. + + + Please select a valid file. + Vennligst velg en gyldig fil. + + + The hidden field is invalid. + Det skjulte feltet er ugyldig. + + + Please enter an integer. + Vennligst skriv inn et heltall. + + + Please select a valid language. + Vennligst velg et gyldig språk. + + + Please select a valid locale. + Vennligst velg et gyldig sted. + + + Please enter a valid money amount. + Vennligst angi et gyldig pengebeløp. + + + Please enter a number. + Vennligst skriv inn et nummer. + + + The password is invalid. + Passordet er ugyldig. + + + Please enter a percentage value. + Vennligst angi en prosentverdi. + + + The values do not match. + Verdiene stemmer ikke overens. + + + Please enter a valid time. + Vennligst angi et gyldig tidspunkt. + + + Please select a valid timezone. + Vennligst velg en gyldig tidssone. + + + Please enter a valid URL. + Vennligst skriv inn en gyldig URL. + + + Please enter a valid search term. + Vennligst angi et gyldig søketerm. + + + Please provide a valid phone number. + Vennligst oppgi et gyldig telefonnummer. + + + The checkbox has an invalid value. + Avkrysningsboksen har en ugyldig verdi. + + + Please enter a valid email address. + Vennligst skriv inn en gyldig e-post adresse. + + + Please select a valid option. + Vennligst velg et gyldig alternativ. + + + Please select a valid range. + Vennligst velg et gyldig område. + + + Please enter a valid week. + Vennligst skriv inn en gyldig uke. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.nl.xlf b/vendor/symfony/form/Resources/translations/validators.nl.xlf new file mode 100644 index 0000000..7aa56eb --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.nl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Dit formulier mag geen extra velden bevatten. + + + The uploaded file was too large. Please try to upload a smaller file. + Het geüploade bestand is te groot. Probeer een kleiner bestand te uploaden. + + + The CSRF token is invalid. Please try to resubmit the form. + De CSRF-token is ongeldig. Probeer het formulier opnieuw te versturen. + + + This value is not a valid HTML5 color. + Dit is geen geldige HTML5 kleur. + + + Please enter a valid birthdate. + Vul een geldige geboortedatum in. + + + The selected choice is invalid. + Deze keuze is ongeldig. + + + The collection is invalid. + Deze collectie is ongeldig. + + + Please select a valid color. + Kies een geldige kleur. + + + Please select a valid country. + Kies een geldige landnaam. + + + Please select a valid currency. + Kies een geldige valuta. + + + Please choose a valid date interval. + Kies een geldig tijdinterval. + + + Please enter a valid date and time. + Vul een geldige datum en tijd in. + + + Please enter a valid date. + Vul een geldige datum in. + + + Please select a valid file. + Kies een geldig bestand. + + + The hidden field is invalid. + Het verborgen veld is incorrect. + + + Please enter an integer. + Vul een geldig getal in. + + + Please select a valid language. + Kies een geldige taal. + + + Please select a valid locale. + Kies een geldige locale. + + + Please enter a valid money amount. + Vul een geldig bedrag in. + + + Please enter a number. + Vul een geldig getal in. + + + The password is invalid. + Het wachtwoord is incorrect. + + + Please enter a percentage value. + Vul een geldig percentage in. + + + The values do not match. + De waardes komen niet overeen. + + + Please enter a valid time. + Vul een geldige tijd in. + + + Please select a valid timezone. + Vul een geldige tijdzone in. + + + Please enter a valid URL. + Vul een geldige URL in. + + + Please enter a valid search term. + Vul een geldige zoekterm in. + + + Please provide a valid phone number. + Vul een geldig telefoonnummer in. + + + The checkbox has an invalid value. + De checkbox heeft een incorrecte waarde. + + + Please enter a valid email address. + Vul een geldig e-mailadres in. + + + Please select a valid option. + Kies een geldige optie. + + + Please select a valid range. + Kies een geldig bereik. + + + Please enter a valid week. + Vul een geldige week in. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.nn.xlf b/vendor/symfony/form/Resources/translations/validators.nn.xlf new file mode 100644 index 0000000..9fac1bf --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.nn.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Feltgruppa kan ikkje innehalde ekstra felt. + + + The uploaded file was too large. Please try to upload a smaller file. + Fila du lasta opp var for stor. Last opp ei mindre fil. + + + The CSRF token is invalid. + CSRF-nøkkelen er ikkje gyldig. + + + This value is not a valid HTML5 color. + Verdien er ikkje ein gyldig HTML5-farge. + + + Please enter a valid birthdate. + Gje opp ein gyldig fødselsdato. + + + The selected choice is invalid. + Valget du gjorde er ikkje gyldig. + + + The collection is invalid. + Samlinga er ikkje gyldig. + + + Please select a valid color. + Gje opp ein gyldig farge. + + + Please select a valid country. + Gje opp eit gyldig land. + + + Please select a valid currency. + Gje opp ein gyldig valuta. + + + Please choose a valid date interval. + Gje opp eit gyldig datointervall. + + + Please enter a valid date and time. + Gje opp ein gyldig dato og tid. + + + Please enter a valid date. + Gje opp ein gyldig dato. + + + Please select a valid file. + Velg ei gyldig fil. + + + The hidden field is invalid. + Det skjulte feltet er ikkje gyldig. + + + Please enter an integer. + Gje opp eit heiltal. + + + Please select a valid language. + Gje opp eit gyldig språk. + + + Please select a valid locale. + Gje opp eit gyldig locale. + + + Please enter a valid money amount. + Gje opp ein gyldig sum pengar. + + + Please enter a number. + Gje opp eit nummer. + + + The password is invalid. + Passordet er ikkje gyldig. + + + Please enter a percentage value. + Gje opp ein prosentverdi. + + + The values do not match. + Verdiane er ikkje eins. + + + Please enter a valid time. + Gje opp ei gyldig tid. + + + Please select a valid timezone. + Gje opp ei gyldig tidssone. + + + Please enter a valid URL. + Gje opp ein gyldig URL. + + + Please enter a valid search term. + Gje opp gyldige søkjeord. + + + Please provide a valid phone number. + Gje opp eit gyldig telefonnummer. + + + The checkbox has an invalid value. + Sjekkboksen har ein ugyldig verdi. + + + Please enter a valid email address. + Gje opp ei gyldig e-postadresse. + + + Please select a valid option. + Velg eit gyldig vilkår. + + + Please select a valid range. + Velg eit gyldig spenn. + + + Please enter a valid week. + Gje opp ei gyldig veke. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.no.xlf b/vendor/symfony/form/Resources/translations/validators.no.xlf new file mode 100644 index 0000000..1d83850 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.no.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Feltgruppen må ikke inneholde ekstra felter. + + + The uploaded file was too large. Please try to upload a smaller file. + Den opplastede filen var for stor. Vennligst last opp en mindre fil. + + + The CSRF token is invalid. + CSRF nøkkelen er ugyldig. + + + This value is not a valid HTML5 color. + Denne verdien er ikke en gyldig HTML5-farge. + + + Please enter a valid birthdate. + Vennligst oppgi gyldig fødselsdato. + + + The selected choice is invalid. + Det valgte valget er ugyldig. + + + The collection is invalid. + Samlingen er ugyldig. + + + Please select a valid color. + Velg en gyldig farge. + + + Please select a valid country. + Vennligst velg et gyldig land. + + + Please select a valid currency. + Vennligst velg en gyldig valuta. + + + Please choose a valid date interval. + Vennligst velg et gyldig datointervall. + + + Please enter a valid date and time. + Vennligst angi en gyldig dato og tid. + + + Please enter a valid date. + Vennligst oppgi en gyldig dato. + + + Please select a valid file. + Vennligst velg en gyldig fil. + + + The hidden field is invalid. + Det skjulte feltet er ugyldig. + + + Please enter an integer. + Vennligst skriv inn et heltall. + + + Please select a valid language. + Vennligst velg et gyldig språk. + + + Please select a valid locale. + Vennligst velg et gyldig sted. + + + Please enter a valid money amount. + Vennligst angi et gyldig pengebeløp. + + + Please enter a number. + Vennligst skriv inn et nummer. + + + The password is invalid. + Passordet er ugyldig. + + + Please enter a percentage value. + Vennligst angi en prosentverdi. + + + The values do not match. + Verdiene stemmer ikke overens. + + + Please enter a valid time. + Vennligst angi et gyldig tidspunkt. + + + Please select a valid timezone. + Vennligst velg en gyldig tidssone. + + + Please enter a valid URL. + Vennligst skriv inn en gyldig URL. + + + Please enter a valid search term. + Vennligst angi et gyldig søketerm. + + + Please provide a valid phone number. + Vennligst oppgi et gyldig telefonnummer. + + + The checkbox has an invalid value. + Avkrysningsboksen har en ugyldig verdi. + + + Please enter a valid email address. + Vennligst skriv inn en gyldig e-post adresse. + + + Please select a valid option. + Vennligst velg et gyldig alternativ. + + + Please select a valid range. + Vennligst velg et gyldig område. + + + Please enter a valid week. + Vennligst skriv inn en gyldig uke. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.pl.xlf b/vendor/symfony/form/Resources/translations/validators.pl.xlf new file mode 100644 index 0000000..d553f2a --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.pl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ten formularz nie powinien zawierać dodatkowych pól. + + + The uploaded file was too large. Please try to upload a smaller file. + Wgrany plik był za duży. Proszę spróbować wgrać mniejszy plik. + + + The CSRF token is invalid. Please try to resubmit the form. + Token CSRF jest nieprawidłowy. Proszę spróbować wysłać formularz ponownie. + + + This value is not a valid HTML5 color. + Ta wartość nie jest prawidłowym kolorem HTML5. + + + Please enter a valid birthdate. + Proszę wprowadzić prawidłową datę urodzenia. + + + The selected choice is invalid. + Wybrana wartość jest nieprawidłowa. + + + The collection is invalid. + Zbiór jest nieprawidłowy. + + + Please select a valid color. + Proszę wybrać prawidłowy kolor. + + + Please select a valid country. + Proszę wybrać prawidłowy kraj. + + + Please select a valid currency. + Proszę wybrać prawidłową walutę. + + + Please choose a valid date interval. + Proszę wybrać prawidłowy przedział czasowy. + + + Please enter a valid date and time. + Proszę wprowadzić prawidłową datę i czas. + + + Please enter a valid date. + Proszę wprowadzić prawidłową datę. + + + Please select a valid file. + Proszę wybrać prawidłowy plik. + + + The hidden field is invalid. + Ukryte pole jest nieprawidłowe. + + + Please enter an integer. + Proszę wprowadzić liczbę całkowitą. + + + Please select a valid language. + Proszę wybrać prawidłowy język. + + + Please select a valid locale. + Proszę wybrać prawidłową lokalizację. + + + Please enter a valid money amount. + Proszę wybrać prawidłową ilość pieniędzy. + + + Please enter a number. + Proszę wprowadzić liczbę. + + + The password is invalid. + Hasło jest nieprawidłowe. + + + Please enter a percentage value. + Proszę wprowadzić wartość procentową. + + + The values do not match. + Wartości się nie zgadzają. + + + Please enter a valid time. + Proszę wprowadzić prawidłowy czas. + + + Please select a valid timezone. + Proszę wybrać prawidłową strefę czasową. + + + Please enter a valid URL. + Proszę wprowadzić prawidłowy adres URL. + + + Please enter a valid search term. + Proszę wprowadzić prawidłowy termin wyszukiwania. + + + Please provide a valid phone number. + Proszę wprowadzić prawidłowy numer telefonu. + + + The checkbox has an invalid value. + Pole wyboru posiada nieprawidłową wartość. + + + Please enter a valid email address. + Proszę wprowadzić prawidłowy adres email. + + + Please select a valid option. + Proszę wybrać prawidłową opcję. + + + Please select a valid range. + Proszę wybrać prawidłowy zakres. + + + Please enter a valid week. + Proszę wybrać prawidłowy tydzień. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.pt.xlf b/vendor/symfony/form/Resources/translations/validators.pt.xlf new file mode 100644 index 0000000..6ce1c32 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.pt.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Este formulário não deveria possuir mais campos. + + + The uploaded file was too large. Please try to upload a smaller file. + O ficheiro enviado é muito grande. Por favor, tente enviar um ficheiro menor. + + + The CSRF token is invalid. Please try to resubmit the form. + O token CSRF está inválido. Por favor, tente enviar o formulário novamente. + + + This value is not a valid HTML5 color. + Este valor não é uma cor HTML5 válida. + + + Please enter a valid birthdate. + Por favor, informe uma data de nascimento válida. + + + The selected choice is invalid. + A escolha seleccionada é inválida. + + + The collection is invalid. + A coleção é inválida. + + + Please select a valid color. + Por favor, selecione uma cor válida. + + + Please select a valid country. + Por favor, selecione um país válido. + + + Please select a valid currency. + Por favor, selecione uma moeda válida. + + + Please choose a valid date interval. + Por favor, escolha um intervalo de datas válido. + + + Please enter a valid date and time. + Por favor, informe uma data e horário válidos. + + + Please enter a valid date. + Por favor, informe uma data válida. + + + Please select a valid file. + Por favor, selecione um ficheiro válido. + + + The hidden field is invalid. + O campo oculto é inválido. + + + Please enter an integer. + Por favor, informe um inteiro. + + + Please select a valid language. + Por favor selecione um idioma válido. + + + Please select a valid locale. + Por favor, selecione um locale válido. + + + Please enter a valid money amount. + Por favor, informe um valor monetário válido. + + + Please enter a number. + Por favor, informe um número. + + + The password is invalid. + A palavra-passe é inválida. + + + Please enter a percentage value. + Por favor, informe um valor percentual. + + + The values do not match. + Os valores não correspondem. + + + Please enter a valid time. + Por favor, informe uma hora válida. + + + Please select a valid timezone. + Por favor, selecione um fuso horário válido. + + + Please enter a valid URL. + Por favor, informe uma URL válida. + + + Please enter a valid search term. + Por favor, informe um termo de busca válido. + + + Please provide a valid phone number. + Por favor, infome um número de telefone válido. + + + The checkbox has an invalid value. + O checkbox possui um valor inválido. + + + Please enter a valid email address. + Por favor, informe um endereço de email válido. + + + Please select a valid option. + Por favor, selecione uma opção válida. + + + Please select a valid range. + Por favor, selecione um intervalo válido. + + + Please enter a valid week. + Por favor, selecione uma semana válida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.pt_BR.xlf b/vendor/symfony/form/Resources/translations/validators.pt_BR.xlf new file mode 100644 index 0000000..37717fe --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.pt_BR.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Este formulário não deve conter campos adicionais. + + + The uploaded file was too large. Please try to upload a smaller file. + O arquivo enviado é muito grande. Por favor, tente enviar um arquivo menor. + + + The CSRF token is invalid. Please try to resubmit the form. + O token CSRF é inválido. Por favor, tente reenviar o formulário. + + + This value is not a valid HTML5 color. + Este valor não é uma cor HTML5 válida. + + + Please enter a valid birthdate. + Por favor, informe uma data de nascimento válida. + + + The selected choice is invalid. + A escolha selecionada é inválida. + + + The collection is invalid. + A coleção é inválida. + + + Please select a valid color. + Por favor, selecione uma cor válida. + + + Please select a valid country. + Por favor, selecione um país válido. + + + Please select a valid currency. + Por favor, selecione uma moeda válida. + + + Please choose a valid date interval. + Por favor, escolha um intervalo de datas válido. + + + Please enter a valid date and time. + Por favor, informe uma data e horário válidos. + + + Please enter a valid date. + Por favor, informe uma data válida. + + + Please select a valid file. + Por favor, selecione um arquivo válido. + + + The hidden field is invalid. + O campo oculto é inválido. + + + Please enter an integer. + Por favor, informe um número inteiro. + + + Please select a valid language. + Por favor, selecione um idioma válido. + + + Please select a valid locale. + Por favor, selecione uma configuração de local válida. + + + Please enter a valid money amount. + Por favor, informe um valor monetário válido. + + + Please enter a number. + Por favor, informe um número. + + + The password is invalid. + A senha é inválida. + + + Please enter a percentage value. + Por favor, informe um valor percentual. + + + The values do not match. + Os valores não conferem. + + + Please enter a valid time. + Por favor, informe um horário válido. + + + Please select a valid timezone. + Por favor, selecione um fuso horário válido. + + + Please enter a valid URL. + Por favor, informe uma URL válida. + + + Please enter a valid search term. + Por favor, informe um termo de busca válido. + + + Please provide a valid phone number. + Por favor, informe um telefone válido. + + + The checkbox has an invalid value. + A caixa de seleção possui um valor inválido. + + + Please enter a valid email address. + Por favor, informe um endereço de e-mail válido. + + + Please select a valid option. + Por favor, selecione uma opção válida. + + + Please select a valid range. + Por favor, selecione um intervalo válido. + + + Please enter a valid week. + Por favor, informe uma semana válida. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.ro.xlf b/vendor/symfony/form/Resources/translations/validators.ro.xlf new file mode 100644 index 0000000..a7dc62b --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.ro.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Acest formular nu ar trebui să conțină câmpuri suplimentare. + + + The uploaded file was too large. Please try to upload a smaller file. + Fișierul încărcat a fost prea mare. Vă rugăm sa încărcați un fișier mai mic. + + + The CSRF token is invalid. Please try to resubmit the form. + Token-ul CSRF este invalid. Vă rugăm să retrimiteți formularul. + + + This value is not a valid HTML5 color. + Această valoare nu este un cod de culoare HTML5 valid. + + + Please enter a valid birthdate. + Vă rugăm să introduceți o dată de naștere validă. + + + The selected choice is invalid. + Valoarea selectată este invalidă. + + + The collection is invalid. + Colecția nu este validă. + + + Please select a valid color. + Vă rugăm să selectați o culoare validă. + + + Please select a valid country. + Vă rugăm să selectați o țară validă. + + + Please select a valid currency. + Vă rugăm să selectați o monedă validă. + + + Please choose a valid date interval. + Vă rugăm să selectați un interval de zile valid. + + + Please enter a valid date and time. + Vă rugăm să introduceți o dată și o oră validă. + + + Please enter a valid date. + Vă rugăm să introduceți o dată validă. + + + Please select a valid file. + Vă rugăm să selectați un fișier valid. + + + The hidden field is invalid. + Câmpul ascuns este invalid. + + + Please enter an integer. + Vă rugăm să introduceți un număr întreg. + + + Please select a valid language. + Vă rugăm să selectați o limbă validă. + + + Please select a valid locale. + Vă rugăm să selectați o setare locală validă. + + + Please enter a valid money amount. + Vă rugăm să introduceți o valoare monetară corectă. + + + Please enter a number. + Vă rugăm să introduceți un număr. + + + The password is invalid. + Parola nu este validă. + + + Please enter a percentage value. + Vă rugăm să introduceți o valoare procentuală. + + + The values do not match. + Valorile nu coincid. + + + Please enter a valid time. + Vă rugăm să introduceți o oră validă. + + + Please select a valid timezone. + Vă rugăm să selectați un fus orar valid. + + + Please enter a valid URL. + Vă rugăm să introduceți un URL valid. + + + Please enter a valid search term. + Vă rugăm să introduceți un termen de căutare valid. + + + Please provide a valid phone number. + Vă rugăm să introduceți un număr de telefon valid. + + + The checkbox has an invalid value. + Bifa nu are o valoare validă. + + + Please enter a valid email address. + Vă rugăm să introduceți o adresă de email validă. + + + Please select a valid option. + Vă rugăm să selectați o opțiune validă. + + + Please select a valid range. + Vă rugăm să selectați un interval valid. + + + Please enter a valid week. + Vă rugăm să introduceți o săptămână validă. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.ru.xlf b/vendor/symfony/form/Resources/translations/validators.ru.xlf new file mode 100644 index 0000000..b11b7ce --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.ru.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Эта форма не должна содержать дополнительных полей. + + + The uploaded file was too large. Please try to upload a smaller file. + Загруженный файл слишком большой. Пожалуйста, попробуйте загрузить файл меньшего размера. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF значение недопустимо. Пожалуйста, попробуйте повторить отправку формы. + + + This value is not a valid HTML5 color. + Значение не является допустимым HTML5 цветом. + + + Please enter a valid birthdate. + Пожалуйста, введите действительную дату рождения. + + + The selected choice is invalid. + Выбранный вариант недопустим. + + + The collection is invalid. + Коллекция недопустима. + + + Please select a valid color. + Пожалуйста, выберите допустимый цвет. + + + Please select a valid country. + Пожалуйста, выберите действительную страну. + + + Please select a valid currency. + Пожалуйста, выберите действительную валюту. + + + Please choose a valid date interval. + Пожалуйста, выберите действительный период. + + + Please enter a valid date and time. + Пожалуйста, введите действительные дату и время. + + + Please enter a valid date. + Пожалуйста, введите действительную дату. + + + Please select a valid file. + Пожалуйста, выберите допустимый файл. + + + The hidden field is invalid. + Значение скрытого поля недопустимо. + + + Please enter an integer. + Пожалуйста, введите целое число. + + + Please select a valid language. + Пожалуйста, выберите допустимый язык. + + + Please select a valid locale. + Пожалуйста, выберите допустимую локаль. + + + Please enter a valid money amount. + Пожалуйста, введите допустимое количество денег. + + + Please enter a number. + Пожалуйста, введите номер. + + + The password is invalid. + Пароль недействителен. + + + Please enter a percentage value. + Пожалуйста, введите процентное значение. + + + The values do not match. + Значения не совпадают. + + + Please enter a valid time. + Пожалуйста, введите действительное время. + + + Please select a valid timezone. + Пожалуйста, выберите действительный часовой пояс. + + + Please enter a valid URL. + Пожалуйста, введите действительный URL. + + + Please enter a valid search term. + Пожалуйста, введите действительный поисковый запрос. + + + Please provide a valid phone number. + Пожалуйста, введите действительный номер телефона. + + + The checkbox has an invalid value. + Флажок имеет недопустимое значение. + + + Please enter a valid email address. + Пожалуйста, введите допустимый email адрес. + + + Please select a valid option. + Пожалуйста, выберите допустимый вариант. + + + Please select a valid range. + Пожалуйста, выберите допустимый диапазон. + + + Please enter a valid week. + Пожалуйста, введите действительную неделю. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sk.xlf b/vendor/symfony/form/Resources/translations/validators.sk.xlf new file mode 100644 index 0000000..06b2bbd --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sk.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Polia by nemali obsahovať ďalšie prvky. + + + The uploaded file was too large. Please try to upload a smaller file. + Odoslaný súbor je príliš veľký. Prosím odošlite súbor s menšou veľkosťou. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF token je neplatný. Prosím skúste znovu odoslať formulár. + + + This value is not a valid HTML5 color. + Táto hodnota nie je platná HTML5 farba. + + + Please enter a valid birthdate. + Prosím zadajte platný dátum narodenia. + + + The selected choice is invalid. + Vybraná možnosť je neplatná. + + + The collection is invalid. + Kolekcia je neplatná. + + + Please select a valid color. + Prosím vyberte platnú farbu. + + + Please select a valid country. + Prosím vyberte platnú krajinu. + + + Please select a valid currency. + Prosím vyberte platnú menu. + + + Please choose a valid date interval. + Prosím vyberte platný rozsah dát. + + + Please enter a valid date and time. + Prosím zadajte platný dátum a čas. + + + Please enter a valid date. + Prosím zadajte platný dátum. + + + Please select a valid file. + Prosím vyberte platný súbor. + + + The hidden field is invalid. + Skryté pole je neplatné. + + + Please enter an integer. + Prosím zadajte celé číslo. + + + Please select a valid language. + Prosím vyberte platný jazyk. + + + Please select a valid locale. + Prosím vyberte platné miestne nastavenia. + + + Please enter a valid money amount. + Prosím zadajte platnú čiastku. + + + Please enter a number. + Prosím zadajte číslo. + + + The password is invalid. + Heslo je neprávne. + + + Please enter a percentage value. + Prosím zadajte percentuálnu hodnotu. + + + The values do not match. + Hodnoty nie sú zhodné. + + + Please enter a valid time. + Prosím zadajte platný čas. + + + Please select a valid timezone. + Prosím vyberte platné časové pásmo. + + + Please enter a valid URL. + Prosím zadajte platnú URL. + + + Please enter a valid search term. + Prosím zadajte platný vyhľadávací výraz. + + + Please provide a valid phone number. + Prosím zadajte platné telefónne číslo. + + + The checkbox has an invalid value. + Zaškrtávacie políčko má neplatnú hodnotu. + + + Please enter a valid email address. + Prosím zadajte platnú emailovú adresu. + + + Please select a valid option. + Prosím vyberte platnú možnosť. + + + Please select a valid range. + Prosím vyberte platný rozsah. + + + Please enter a valid week. + Prosím zadajte platný týždeň. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sl.xlf b/vendor/symfony/form/Resources/translations/validators.sl.xlf new file mode 100644 index 0000000..7e6a3fb --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ta obrazec ne sme vsebovati dodatnih polj. + + + The uploaded file was too large. Please try to upload a smaller file. + Naložena datoteka je prevelika. Prosimo, poizkusite naložiti manjšo. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF vrednost je napačna. Prosimo, ponovno pošljite obrazec. + + + This value is not a valid HTML5 color. + Ta vrednost ni veljavna barva HTML5. + + + Please enter a valid birthdate. + Prosimo, vnesite veljaven rojstni datum. + + + The selected choice is invalid. + Izbira ni veljavna. + + + The collection is invalid. + Zbirka ni veljavna. + + + Please select a valid color. + Prosimo, izberite veljavno barvo. + + + Please select a valid country. + Prosimo, izberite veljavno državo. + + + Please select a valid currency. + Prosimo, izberite veljavno valuto. + + + Please choose a valid date interval. + Prosimo, izberite veljaven datumski interval. + + + Please enter a valid date and time. + Prosimo, vnesite veljaven datum in čas. + + + Please enter a valid date. + Prosimo, izberite veljaven datum. + + + Please select a valid file. + Prosimo, izberite veljavno datoteko. + + + The hidden field is invalid. + Skrito polje ni veljavno. + + + Please enter an integer. + Prosimo, vnesite celo število. + + + Please select a valid language. + Prosimo, izberite veljaven jezik. + + + Please select a valid locale. + Prosimo, izberite veljavne področne nastavitve. + + + Please enter a valid money amount. + Prosimo, vnesite veljaven denarni znesek. + + + Please enter a number. + Prosimo, vnesite številko. + + + The password is invalid. + Geslo ni veljavno. + + + Please enter a percentage value. + Prosimo, vnesite odstotno vrednost. + + + The values do not match. + Vrednosti se ne ujemajo. + + + Please enter a valid time. + Prosimo, vnesite veljaven čas. + + + Please select a valid timezone. + Prosimo, izberite veljaven časovni pas. + + + Please enter a valid URL. + Prosimo, vnesite veljaven URL. + + + Please enter a valid search term. + Prosimo, vnesite veljaven iskalni izraz. + + + Please provide a valid phone number. + Prosimo, podajte veljavno telefonsko številko. + + + The checkbox has an invalid value. + Potrditveno polje vsebuje neveljavno vrednost. + + + Please enter a valid email address. + Prosimo, vnesite veljaven e-poštni naslov. + + + Please select a valid option. + Prosimo, izberite veljavno možnost. + + + Please select a valid range. + Prosimo, izberite veljaven obseg. + + + Please enter a valid week. + Prosimo, vnesite veljaven teden. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sq.xlf b/vendor/symfony/form/Resources/translations/validators.sq.xlf new file mode 100644 index 0000000..3224f6e --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sq.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Kjo formë nuk duhet të përmbajë fusha shtesë. + + + The uploaded file was too large. Please try to upload a smaller file. + Skedari i ngarkuar ishte shumë i madh. Ju lutemi provoni të ngarkoni një skedar më të vogël. + + + The CSRF token is invalid. Please try to resubmit the form. + Vlera CSRF është e pavlefshme. Ju lutemi provoni të ridërgoni formën. + + + This value is not a valid HTML5 color. + Kjo vlerë nuk është një ngjyrë e vlefshme HTML5. + + + Please enter a valid birthdate. + Ju lutemi shkruani një datëlindje të vlefshme. + + + The selected choice is invalid. + Opsioni i zgjedhur është i pavlefshëm. + + + The collection is invalid. + Koleksioni është i pavlefshëm. + + + Please select a valid color. + Ju lutemi zgjidhni një ngjyrë të vlefshme. + + + Please select a valid country. + Ju lutemi zgjidhni një shtet të vlefshëm. + + + Please select a valid currency. + Ju lutemi zgjidhni një monedhë të vlefshme. + + + Please choose a valid date interval. + Ju lutemi zgjidhni një interval të vlefshëm të datës. + + + Please enter a valid date and time. + Ju lutemi shkruani një datë dhe orë të vlefshme. + + + Please enter a valid date. + Ju lutemi shkruani një datë të vlefshme. + + + Please select a valid file. + Ju lutemi zgjidhni një skedar të vlefshëm. + + + The hidden field is invalid. + Fusha e fshehur është e pavlefshme. + + + Please enter an integer. + Ju lutemi shkruani një numër të plotë. + + + Please select a valid language. + Please select a valid language. + + + Please select a valid locale. + Ju lutemi zgjidhni një lokale të vlefshme. + + + Please enter a valid money amount. + Ju lutemi shkruani një shumë të vlefshme parash. + + + Please enter a number. + Ju lutemi shkruani një numër. + + + The password is invalid. + Fjalëkalimi është i pavlefshëm. + + + Please enter a percentage value. + Ju lutemi shkruani një vlerë përqindjeje. + + + The values do not match. + Vlerat nuk përputhen. + + + Please enter a valid time. + Ju lutemi shkruani një kohë të vlefshme. + + + Please select a valid timezone. + Ju lutemi zgjidhni një zonë kohore të vlefshme. + + + Please enter a valid URL. + Ju lutemi shkruani një URL të vlefshme. + + + Please enter a valid search term. + Ju lutemi shkruani një term të vlefshëm kërkimi. + + + Please provide a valid phone number. + Ju lutemi jepni një numër telefoni të vlefshëm. + + + The checkbox has an invalid value. + Kutia e zgjedhjes ka një vlerë të pavlefshme. + + + Please enter a valid email address. + Ju lutemi shkruani një adresë të vlefshme emaili. + + + Please select a valid option. + Ju lutemi zgjidhni një opsion të vlefshëm. + + + Please select a valid range. + Ju lutemi zgjidhni një diapazon të vlefshëm. + + + Please enter a valid week. + Ju lutemi shkruani një javë të vlefshme. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sr_Cyrl.xlf b/vendor/symfony/form/Resources/translations/validators.sr_Cyrl.xlf new file mode 100644 index 0000000..a5610e0 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sr_Cyrl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Овај формулар не треба да садржи додатна поља. + + + The uploaded file was too large. Please try to upload a smaller file. + Отпремљена датотека је била превелика. Молим покушајте отпремање мање датотеке. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF вредност није исправна. Покушајте поново. + + + This value is not a valid HTML5 color. + Ова вредност није исправна HTML5 боја. + + + Please enter a valid birthdate. + Молим упишите исправан датум рођења. + + + The selected choice is invalid. + Одабрани избор није исправан. + + + The collection is invalid. + Ова колекција није исправна. + + + Please select a valid color. + Молим изаберите исправну боју. + + + Please select a valid country. + Молим изаберите исправну државу. + + + Please select a valid currency. + Молим изаберите исправну валуту. + + + Please choose a valid date interval. + Молим изаберите исправан датумски интервал. + + + Please enter a valid date and time. + Молим упишите исправан датум и време. + + + Please enter a valid date. + Молим упишите исправан датум. + + + Please select a valid file. + Молим изаберите исправну датотеку. + + + The hidden field is invalid. + Скривено поље није исправно. + + + Please enter an integer. + Молим упишите цео број (integer). + + + Please select a valid language. + Молим изаберите исправан језик. + + + Please select a valid locale. + Молим изаберите исправну локализацију. + + + Please enter a valid money amount. + Молим упишите исправну количину новца. + + + Please enter a number. + Молим упишите број. + + + The password is invalid. + Ова лозинка није исправна. + + + Please enter a percentage value. + Молим упишите процентуалну вредност. + + + The values do not match. + Дате вредности се не поклапају. + + + Please enter a valid time. + Молим упишите исправно време. + + + Please select a valid timezone. + Молим изаберите исправну временску зону. + + + Please enter a valid URL. + Молим упишите исправан URL. + + + Please enter a valid search term. + Молим упишите исправан термин за претрагу. + + + Please provide a valid phone number. + Молим наведите исправан број телефона. + + + The checkbox has an invalid value. + Поље за потврду садржи неисправну вредност. + + + Please enter a valid email address. + Молим упишите исправну email адресу. + + + Please select a valid option. + Молим изаберите исправну опцију. + + + Please select a valid range. + Молим изаберите исправан опсег. + + + Please enter a valid week. + Молим упишите исправну седмицу. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/form/Resources/translations/validators.sr_Latn.xlf new file mode 100644 index 0000000..02fb5aa --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sr_Latn.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ovaj formular ne treba da sadrži dodatna polja. + + + The uploaded file was too large. Please try to upload a smaller file. + Otpremljena datoteka je bila prevelika. Molim pokušajte otpremanje manje datoteke. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF vrednost nije ispravna. Pokušajte ponovo. + + + This value is not a valid HTML5 color. + Ova vrednost nije ispravna HTML5 boja. + + + Please enter a valid birthdate. + Molim upišite ispravan datum rođenja. + + + The selected choice is invalid. + Odabrani izbor nije ispravan. + + + The collection is invalid. + Ova kolekcija nije ispravna. + + + Please select a valid color. + Molim izaberite ispravnu boju. + + + Please select a valid country. + Molim izaberite ispravnu državu. + + + Please select a valid currency. + Molim izaberite ispravnu valutu. + + + Please choose a valid date interval. + Molim izaberite ispravan datumski interval. + + + Please enter a valid date and time. + Molim upišite ispravan datum i vreme. + + + Please enter a valid date. + Molim upišite ispravan datum. + + + Please select a valid file. + Molim izaberite ispravnu datoteku. + + + The hidden field is invalid. + Skriveno polje nije ispravno. + + + Please enter an integer. + Molim upišite ceo broj (integer). + + + Please select a valid language. + Molim izaberite ispravan jezik. + + + Please select a valid locale. + Molim izaberite ispravnu lokalizaciju. + + + Please enter a valid money amount. + Molim upišite ispravnu količinu novca. + + + Please enter a number. + Molim upišite broj. + + + The password is invalid. + Ova lozinka nije ispravna. + + + Please enter a percentage value. + Molim upišite procentualnu vrednost. + + + The values do not match. + Date vrednosti se ne poklapaju. + + + Please enter a valid time. + Molim upišite ispravno vreme. + + + Please select a valid timezone. + Molim izaberite ispravnu vremensku zonu. + + + Please enter a valid URL. + Molim upišite ispravan URL. + + + Please enter a valid search term. + Molim upišite ispravan termin za pretragu. + + + Please provide a valid phone number. + Molim navedite ispravan broj telefona. + + + The checkbox has an invalid value. + Polje za potvrdu sadrži neispravnu vrednost. + + + Please enter a valid email address. + Molim upišite ispravnu email adresu. + + + Please select a valid option. + Molim izaberite ispravnu opciju. + + + Please select a valid range. + Molim izaberite ispravan opseg. + + + Please enter a valid week. + Molim upišite ispravnu sedmicu. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.sv.xlf b/vendor/symfony/form/Resources/translations/validators.sv.xlf new file mode 100644 index 0000000..43e9256 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.sv.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Formuläret kan inte innehålla extra fält. + + + The uploaded file was too large. Please try to upload a smaller file. + Den uppladdade filen var för stor. Försök ladda upp en mindre fil. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF-elementet är inte giltigt. Försök att skicka formuläret igen. + + + This value is not a valid HTML5 color. + Värdet är inte en giltig HTML5-färg. + + + Please enter a valid birthdate. + Ange ett giltigt födelsedatum. + + + The selected choice is invalid. + Det valda alternativet är ogiltigt. + + + The collection is invalid. + Den här samlingen är ogiltig. + + + Please select a valid color. + Välj en giltig färg. + + + Please select a valid country. + Välj ett land. + + + Please select a valid currency. + Välj en valuta. + + + Please choose a valid date interval. + Välj ett giltigt datumintervall. + + + Please enter a valid date and time. + Ange ett giltigt datum och tid. + + + Please enter a valid date. + Ange ett giltigt datum. + + + Please select a valid file. + Välj en fil. + + + The hidden field is invalid. + Det dolda fältet är ogiltigt. + + + Please enter an integer. + Ange ett heltal. + + + Please select a valid language. + Välj språk. + + + Please select a valid locale. + Välj plats. + + + Please enter a valid money amount. + Ange en giltig summa pengar. + + + Please enter a number. + Ange en siffra. + + + The password is invalid. + Lösenordet är ogiltigt. + + + Please enter a percentage value. + Ange ett procentuellt värde. + + + The values do not match. + De angivna värdena stämmer inte överens. + + + Please enter a valid time. + Ange en giltig tid. + + + Please select a valid timezone. + Välj en tidszon. + + + Please enter a valid URL. + Ange en giltig URL. + + + Please enter a valid search term. + Ange ett giltigt sökbegrepp. + + + Please provide a valid phone number. + Ange ett giltigt telefonnummer. + + + The checkbox has an invalid value. + Kryssrutan har ett ogiltigt värde. + + + Please enter a valid email address. + Ange en giltig e-postadress. + + + Please select a valid option. + Välj ett alternativ. + + + Please select a valid range. + Välj ett intervall. + + + Please enter a valid week. + Ange en giltig vecka. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.th.xlf b/vendor/symfony/form/Resources/translations/validators.th.xlf new file mode 100644 index 0000000..060dc9e --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.th.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + ฟอร์มนี้ไม่ควรมี extra fields + + + The uploaded file was too large. Please try to upload a smaller file. + ไฟล์ที่อัพโหลดมีขนาดใหญ่เกินไป กรุณาลองอัพโหลดใหม่อีกครั้งด้วยไฟล์ที่มีขนาดเล็กลง + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF token ไม่ถูกต้อง กรุณาลองส่งแบบฟอร์มใหม่ + + + This value is not a valid HTML5 color. + ค่านี้ไม่ใช่ค่าที่ถูกต้องของค่าสี HTML5 + + + Please enter a valid birthdate. + กรุณากรอกวันเดือนปีเกิดที่ถูกต้อง + + + The selected choice is invalid. + ตัวเลือกที่เลิอกไม่ถูกต้อง + + + The collection is invalid. + คอเล็กชั่นไม่ถูกต้อง + + + Please select a valid color. + กรุณาเลือกค่าสีที่ถูกต้อง + + + Please select a valid country. + กรุณาเลือกประเทศที่ถูกต้อง + + + Please select a valid currency. + กรุุณาเลิอกค่าสกุลเงินที่ถูกต้อง + + + Please choose a valid date interval. + กรุณณากรอกช่วงวันที่ที่ถูกต้อง + + + Please enter a valid date and time. + กรุณณากรอกค่าเวลาและวันที่ที่ถูกต้อง + + + Please enter a valid date. + กรุณณากรอกค่าวันที่ที่ถูกต้อง + + + Please select a valid file. + กรุณาเลือกไฟล์ที่ถูกต้อง + + + The hidden field is invalid. + ค่า Hidden field ไม่ถูกต้อง + + + Please enter an integer. + กรุณากรอกตัวเลขจำนวนเต็ม + + + Please select a valid language. + กรุณาเลือกภาษาที่ถูกต้อง + + + Please select a valid locale. + กรุณาเลือกท้องถิ่นที่ถูกต้อง + + + Please enter a valid money amount. + กรุณากรอกจำนวนเงินที่ถูกต้อง + + + Please enter a number. + กรุณากรอกตัวเลข + + + The password is invalid. + รหัสผ่านไม่ถูกต้อง + + + Please enter a percentage value. + กรุณากรอกค่าเปอร์เซ็นต์ + + + The values do not match. + ค่าทั้งสองไม่ตรงกัน + + + Please enter a valid time. + กรุณากรอกค่าเวลาที่ถูกต้อง + + + Please select a valid timezone. + กรุณาเลือกค่าเขตเวลาที่ถูกต้อง + + + Please enter a valid URL. + กรุณากรอก URL ที่ถูกต้อง + + + Please enter a valid search term. + กรุณากรอกคำค้นหาที่ถูกต้อง + + + Please provide a valid phone number. + กรุณากรอกเบอร์โทรศัพท์ที่ถูกต้อง + + + The checkbox has an invalid value. + Checkbox มีค่าที่ไม่ถูกต้อง + + + Please enter a valid email address. + กรุณากรอกที่อยู่อีเมล์ที่ถูกต้อง + + + Please select a valid option. + กรุณาเลือกตัวเลือกที่ถูกต้อง + + + Please select a valid range. + กรุณาเลือกค่าช่วงที่ถูกต้อง + + + Please enter a valid week. + กรุณากรอกค่าสัปดาห์ที่ถูกต้อง + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.tl.xlf b/vendor/symfony/form/Resources/translations/validators.tl.xlf new file mode 100644 index 0000000..272e331 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.tl.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ang pormang itong ay hindi dapat magkarron ng dagdag na mga patlang. + + + The uploaded file was too large. Please try to upload a smaller file. + Ang ini-upload na file ay masyadong malaki. Pakiulit muling mag-upload ng mas maliit na file. + + + The CSRF token is invalid. Please try to resubmit the form. + Hindi balido ang CSRF token. Maagpasa muli ng isang pang porma. + + + This value is not a valid HTML5 color. + Ang halagang ito ay hindi wastong HTML5 color. + + + Please enter a valid birthdate. + Pakilagay ang tamang petsa ng kapanganakan. + + + The selected choice is invalid. + Ang pinagpiliang sagot ay hindi tama. + + + The collection is invalid. + Hindi balido ang koleksyon. + + + Please select a valid color. + Pakipiliin ang nararapat na kulay. + + + Please select a valid country. + Pakipiliin ang nararapat na bansa. + + + Please select a valid currency. + Pakipiliin ang tamang pananalapi. + + + Please choose a valid date interval. + Piliin ang wastong agwat ng petsa. + + + Please enter a valid date and time. + Piliin ang wastong petsa at oras. + + + Please enter a valid date. + Ilagay ang wastong petsa. + + + Please select a valid file. + Piliin ang balidong file. + + + The hidden field is invalid. + Hindi balido ang field na nakatago. + + + Please enter an integer. + Pakilagay ang integer. + + + Please select a valid language. + Piliin ang nararapat na lengguwahe. + + + Please select a valid locale. + Pakipili ang nararapat na locale. + + + Please enter a valid money amount. + Pakilagay ang tamang halaga ng pera. + + + Please enter a number. + Ilagay ang numero. + + + The password is invalid. + Hindi balido ang password. + + + Please enter a percentage value. + Pakilagay ang tamang porsyento ng halaga. + + + The values do not match. + Hindi tugma ang mga halaga. + + + Please enter a valid time. + Pakilagay ang tamang oras. + + + Please select a valid timezone. + Pakilagay ang tamang sona ng oras. + + + Please enter a valid URL. + Pakilagay ang balidong URL. + + + Please enter a valid search term. + Pakilagay ang balidong katagang sinasaliksik. + + + Please provide a valid phone number. + Pakilagay ang balidong numero ng telepono. + + + The checkbox has an invalid value. + Ang checkbox ay mayroon hindi balidong halaga. + + + Please enter a valid email address. + Pakilagay ang balidong email address. + + + Please select a valid option. + Pakipiliin ang balidong pagpipilian. + + + Please select a valid range. + Pakipilian ang balidong layo. + + + Please enter a valid week. + Pakilagay ang balidong linggo. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.tr.xlf b/vendor/symfony/form/Resources/translations/validators.tr.xlf new file mode 100644 index 0000000..d1ddc1d --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.tr.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Form ekstra alanlar içeremez. + + + The uploaded file was too large. Please try to upload a smaller file. + Yüklenen dosya boyutu çok yüksek. Lütfen daha küçük bir dosya yüklemeyi deneyin. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF fişi geçersiz. Formu tekrar göndermeyi deneyin. + + + This value is not a valid HTML5 color. + Bu değer, geçerli bir HTML5 rengi değil. + + + Please enter a valid birthdate. + Lütfen geçerli bir doğum tarihi girin. + + + The selected choice is invalid. + Seçilen seçim geçersiz. + + + The collection is invalid. + Koleksiyon geçersiz. + + + Please select a valid color. + Lütfen geçerli bir renk seçin. + + + Please select a valid country. + Lütfen geçerli bir ülke seçin. + + + Please select a valid currency. + Lütfen geçerli bir para birimi seçin. + + + Please choose a valid date interval. + Lütfen geçerli bir tarih aralığı seçin. + + + Please enter a valid date and time. + Lütfen geçerli bir tarih ve saat girin. + + + Please enter a valid date. + Lütfen geçerli bir tarih giriniz. + + + Please select a valid file. + Lütfen geçerli bir dosya seçin. + + + The hidden field is invalid. + Gizli alan geçersiz. + + + Please enter an integer. + Lütfen bir tam sayı girin. + + + Please select a valid language. + Lütfen geçerli bir dil seçin. + + + Please select a valid locale. + Lütfen geçerli bir yerel ayar seçin. + + + Please enter a valid money amount. + Lütfen geçerli bir para tutarı girin. + + + Please enter a number. + Lütfen bir numara giriniz. + + + The password is invalid. + Şifre geçersiz. + + + Please enter a percentage value. + Lütfen bir yüzde değeri girin. + + + The values do not match. + Değerler eşleşmiyor. + + + Please enter a valid time. + Lütfen geçerli bir zaman girin. + + + Please select a valid timezone. + Lütfen geçerli bir saat dilimi seçin. + + + Please enter a valid URL. + Lütfen geçerli bir giriniz URL. + + + Please enter a valid search term. + Lütfen geçerli bir arama terimi girin. + + + Please provide a valid phone number. + lütfen geçerli bir telefon numarası sağlayın. + + + The checkbox has an invalid value. + Onay kutusunda geçersiz bir değer var. + + + Please enter a valid email address. + Lütfen geçerli bir e-posta adresi girin. + + + Please select a valid option. + Lütfen geçerli bir seçenek seçin. + + + Please select a valid range. + Lütfen geçerli bir aralık seçin. + + + Please enter a valid week. + Lütfen geçerli bir hafta girin. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.uk.xlf b/vendor/symfony/form/Resources/translations/validators.uk.xlf new file mode 100644 index 0000000..ca707bc --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.uk.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ця форма не повинна містити додаткових полів. + + + The uploaded file was too large. Please try to upload a smaller file. + Завантажений файл занадто великий. Будь ласка, спробуйте завантажити файл меншого розміру. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF значення недопустиме. Будь ласка, спробуйте відправити форму знову. + + + This value is not a valid HTML5 color. + Це значення не є допустимим кольором HTML5. + + + Please enter a valid birthdate. + Будь ласка, введіть дійсну дату народження. + + + The selected choice is invalid. + Обраний варіант недійсний. + + + The collection is invalid. + Колекція недійсна. + + + Please select a valid color. + Будь ласка, оберіть дійсний колір. + + + Please select a valid country. + Будь ласка, оберіть дійсну країну. + + + Please select a valid currency. + Будь ласка, оберіть дійсну валюту. + + + Please choose a valid date interval. + Будь ласка, оберіть дійсний інтервал дати. + + + Please enter a valid date and time. + Будь ласка, введіть дійсну дату та час. + + + Please enter a valid date. + Будь ласка, введіть дійсну дату. + + + Please select a valid file. + Будь ласка, оберіть дійсний файл. + + + The hidden field is invalid. + Приховане поле недійсне. + + + Please enter an integer. + Будь ласка, введіть ціле число. + + + Please select a valid language. + Будь ласка, оберіть дійсну мову. + + + Please select a valid locale. + Будь ласка, оберіть дійсну локаль. + + + Please enter a valid money amount. + Будь ласка, введіть дійсну суму грошей. + + + Please enter a number. + Будь ласка, введіть число. + + + The password is invalid. + Пароль недійсний. + + + Please enter a percentage value. + Будь ласка, введіть процентне значення. + + + The values do not match. + Значення не збігаються. + + + Please enter a valid time. + Будь ласка, введіть дійсний час. + + + Please select a valid timezone. + Будь ласка, оберіть дійсний часовий пояс. + + + Please enter a valid URL. + Будь ласка, введіть дійсну URL-адресу. + + + Please enter a valid search term. + Будь ласка, введіть дійсний пошуковий термін. + + + Please provide a valid phone number. + Будь ласка, введіть дійсний номер телефону. + + + The checkbox has an invalid value. + Прапорець має недійсне значення. + + + Please enter a valid email address. + Будь ласка, введіть дійсну адресу електронної пошти. + + + Please select a valid option. + Будь ласка, оберіть дійсний варіант. + + + Please select a valid range. + Будь ласка, оберіть дійсний діапазон. + + + Please enter a valid week. + Будь ласка, введіть дійсний тиждень. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.uz.xlf b/vendor/symfony/form/Resources/translations/validators.uz.xlf new file mode 100644 index 0000000..58591d6 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.uz.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Ushbu fo'rmada qo'shimcha maydonlar bo'lmasligi kerak. + + + The uploaded file was too large. Please try to upload a smaller file. + Yuklab olingan fayl juda katta. Iltimos, kichikroq faylni yuklashga harakat qiling. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF qiymati yaroqsiz. Fo'rmani qayta yuborishga harakat qiling. + + + This value is not a valid HTML5 color. + Qiymat noto'g'ri, HTML5 rangi emas. + + + Please enter a valid birthdate. + Iltimos, tug'ilgan kuningizni to'g'ri kiriting. + + + The selected choice is invalid. + Tanlangan parametr noto'g'ri. + + + The collection is invalid. + Kolleksiya noto'g'ri + + + Please select a valid color. + Iltimos, to'g'ri rang tanlang. + + + Please select a valid country. + Iltimos, to'g'ri mamlakatni tanlang. + + + Please select a valid currency. + Iltimos, to'g'ri valyutani tanlang. + + + Please choose a valid date interval. + Iltimos, to'g'ri sana oralig'ini tanlang. + + + Please enter a valid date and time. + Iltimos, to'g'ri sana va vaqtni kiriting. + + + Please enter a valid date. + Iltimos, to'g'ri sanani kiriting. + + + Please select a valid file. + Iltimos, to'g'ri faylni tanlang. + + + The hidden field is invalid. + Yashirin maydon qiymati yaroqsiz. + + + Please enter an integer. + Iltimos, butun son kiriting. + + + Please select a valid language. + Iltimos, to'g'ri tilni tanlang. + + + Please select a valid locale. + Iltimos, to'g'ri localni tanlang. + + + Please enter a valid money amount. + Iltimos, tegishli miqdordagi pulni kiriting. + + + Please enter a number. + Iltimos, raqam kiriting. + + + The password is invalid. + Parol noto'g'ri. + + + Please enter a percentage value. + Iltimos, foyizli qiymat kiriting. + + + The values do not match. + Qiymatlar mos kelmaydi. + + + Please enter a valid time. + Iltimos, to'g'ri vaqtni tanlang. + + + Please select a valid timezone. + Iltimos, to'g'ri vaqt zonasini tanlang. + + + Please enter a valid URL. + Iltimos, to'g'ri URL kiriting. + + + Please enter a valid search term. + Iltimos, to'g'ri qidiruv so'zini kiriting. + + + Please provide a valid phone number. + Iltimos, to'g'ri telefon raqamini kiriting. + + + The checkbox has an invalid value. + Belgilash katagida yaroqsiz qiymat mavjud. + + + Please enter a valid email address. + Iltimos, to'g'ri email kiriting. + + + Please select a valid option. + Iltimos, yaroqli variantni tanlang. + + + Please select a valid range. + Iltimos, yaroqli oraliqni tanlang. + + + Please enter a valid week. + Iltimos, haqiqiy haftani kiriting. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.vi.xlf b/vendor/symfony/form/Resources/translations/validators.vi.xlf new file mode 100644 index 0000000..6a8f2bd --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.vi.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + Mẫu này không nên chứa trường mở rộng. + + + The uploaded file was too large. Please try to upload a smaller file. + Tập tin tải lên quá lớn. Vui lòng thử lại với tập tin nhỏ hơn. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF token không hợp lệ. Vui lòng thử lại. + + + This value is not a valid HTML5 color. + Giá trị này không phải là màu HTML5 hợp lệ. + + + Please enter a valid birthdate. + Vui lòng nhập ngày sinh hợp lệ. + + + The selected choice is invalid. + Lựa chọn không hợp lệ. + + + The collection is invalid. + Danh sách không hợp lệ. + + + Please select a valid color. + Vui lòng chọn một màu hợp lệ. + + + Please select a valid country. + Vui lòng chọn đất nước hợp lệ. + + + Please select a valid currency. + Vui lòng chọn tiền tệ hợp lệ. + + + Please choose a valid date interval. + Vui lòng chọn một khoảng thời gian hợp lệ. + + + Please enter a valid date and time. + Vui lòng nhập ngày và thời gian hợp lệ. + + + Please enter a valid date. + Vui lòng nhập ngày hợp lệ. + + + Please select a valid file. + Vui lòng chọn tệp hợp lệ. + + + The hidden field is invalid. + Phạm vi ẩn không hợp lệ. + + + Please enter an integer. + Vui lòng nhập một số nguyên. + + + Please select a valid language. + Vui lòng chọn ngôn ngữ hợp lệ. + + + Please select a valid locale. + Vui lòng chọn miền hợp lệ. + + + Please enter a valid money amount. + Vui lòng nhập một khoảng tiền hợp lệ. + + + Please enter a number. + Vui lòng nhập một con số. + + + The password is invalid. + Mật khẩu không hợp lệ. + + + Please enter a percentage value. + Vui lòng nhập một giá trị phần trăm. + + + The values do not match. + Các giá trị không phù hợp. + + + Please enter a valid time. + Vui lòng nhập thời gian hợp lệ. + + + Please select a valid timezone. + Vui lòng chọn múi giờ hợp lệ. + + + Please enter a valid URL. + Vui lòng nhập một URL hợp lệ. + + + Please enter a valid search term. + Vui lòng nhập chuỗi tìm kiếm hợp lệ. + + + Please provide a valid phone number. + Vui lòng cung cấp số điện thoại hợp lệ. + + + The checkbox has an invalid value. + Hộp kiểm có một giá trị không hợp lệ. + + + Please enter a valid email address. + Vui lòng nhập địa chỉ email hợp lệ. + + + Please select a valid option. + Vui lòng chọn một phương án hợp lệ. + + + Please select a valid range. + Vui lòng nhập một phạm vi hợp lệ. + + + Please enter a valid week. + Vui lòng nhập một tuần hợp lệ. + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.zh_CN.xlf b/vendor/symfony/form/Resources/translations/validators.zh_CN.xlf new file mode 100644 index 0000000..3106db2 --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.zh_CN.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + 该表单中不可有额外字段. + + + The uploaded file was too large. Please try to upload a smaller file. + 上传文件太大, 请重新尝试上传一个较小的文件. + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF 验证符无效, 请重新提交. + + + This value is not a valid HTML5 color. + 该数值不是个有效的 HTML5 颜色。 + + + Please enter a valid birthdate. + 请输入有效的生日日期。 + + + The selected choice is invalid. + 所选的选项无效。 + + + The collection is invalid. + 集合无效。 + + + Please select a valid color. + 请选择有效的颜色。 + + + Please select a valid country. + 请选择有效的国家。 + + + Please select a valid currency. + 请选择有效的货币。 + + + Please choose a valid date interval. + 请选择有效的日期间隔。 + + + Please enter a valid date and time. + 请输入有效的日期与时间。 + + + Please enter a valid date. + 请输入有效的日期。 + + + Please select a valid file. + 请选择有效的文件。 + + + The hidden field is invalid. + 隐藏字段无效。 + + + Please enter an integer. + 请输入整数。 + + + Please select a valid language. + 请选择有效的语言。 + + + Please select a valid locale. + 请选择有效的语言环境。 + + + Please enter a valid money amount. + 请输入正确的金额。 + + + Please enter a number. + 请输入数字。 + + + The password is invalid. + 密码无效。 + + + Please enter a percentage value. + 请输入百分比值。 + + + The values do not match. + 数值不匹配。 + + + Please enter a valid time. + 请输入有效的时间。 + + + Please select a valid timezone. + 请选择有效的时区。 + + + Please enter a valid URL. + 请输入有效的网址。 + + + Please enter a valid search term. + 请输入有效的搜索词。 + + + Please provide a valid phone number. + 请提供有效的手机号码。 + + + The checkbox has an invalid value. + 无效的选框值。 + + + Please enter a valid email address. + 请输入有效的电子邮件地址。 + + + Please select a valid option. + 请选择有效的选项。 + + + Please select a valid range. + 请选择有效的范围。 + + + Please enter a valid week. + 请输入有效的星期。 + + + + diff --git a/vendor/symfony/form/Resources/translations/validators.zh_TW.xlf b/vendor/symfony/form/Resources/translations/validators.zh_TW.xlf new file mode 100644 index 0000000..858b9db --- /dev/null +++ b/vendor/symfony/form/Resources/translations/validators.zh_TW.xlf @@ -0,0 +1,139 @@ + + + + + + This form should not contain extra fields. + 該表單中不可有額外字段。 + + + The uploaded file was too large. Please try to upload a smaller file. + 上傳文件太大, 請重新嘗試上傳一個較小的文件。 + + + The CSRF token is invalid. Please try to resubmit the form. + CSRF 驗證符無效, 請重新提交。 + + + This value is not a valid HTML5 color. + 該數值不是個有效的 HTML5 顏色。 + + + Please enter a valid birthdate. + 請輸入有效的生日日期。 + + + The selected choice is invalid. + 所選的選項無效。 + + + The collection is invalid. + 集合無效。 + + + Please select a valid color. + 請選擇有效的顏色。 + + + Please select a valid country. + 請選擇有效的國家。 + + + Please select a valid currency. + 請選擇有效的貨幣。 + + + Please choose a valid date interval. + 請選擇有效的日期間隔。 + + + Please enter a valid date and time. + 請輸入有效的日期與時間。 + + + Please enter a valid date. + 請輸入有效的日期。 + + + Please select a valid file. + 請選擇有效的文件。 + + + The hidden field is invalid. + 隱藏字段無效。 + + + Please enter an integer. + 請輸入整數。 + + + Please select a valid language. + 請選擇有效的語言。 + + + Please select a valid locale. + 請選擇有效的語言環境。 + + + Please enter a valid money amount. + 請輸入正確的金額。 + + + Please enter a number. + 請輸入數字。 + + + The password is invalid. + 密碼無效。 + + + Please enter a percentage value. + 請輸入百分比值。 + + + The values do not match. + 數值不匹配。 + + + Please enter a valid time. + 請輸入有效的時間。 + + + Please select a valid timezone. + 請選擇有效的時區。 + + + Please enter a valid URL. + 請輸入有效的網址。 + + + Please enter a valid search term. + 請輸入有效的搜索詞。 + + + Please provide a valid phone number. + 請提供有效的手機號碼。 + + + The checkbox has an invalid value. + 無效的選框值。 + + + Please enter a valid email address. + 請輸入有效的電子郵件地址。 + + + Please select a valid option. + 請選擇有效的選項。 + + + Please select a valid range. + 請選擇有效的範圍。 + + + Please enter a valid week. + 請輸入有效的星期。 + + + + diff --git a/vendor/symfony/form/ReversedTransformer.php b/vendor/symfony/form/ReversedTransformer.php new file mode 100644 index 0000000..8089e47 --- /dev/null +++ b/vendor/symfony/form/ReversedTransformer.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * Reverses a transformer. + * + * When the transform() method is called, the reversed transformer's + * reverseTransform() method is called and vice versa. + * + * @author Bernhard Schussek + */ +class ReversedTransformer implements DataTransformerInterface +{ + protected $reversedTransformer; + + public function __construct(DataTransformerInterface $reversedTransformer) + { + $this->reversedTransformer = $reversedTransformer; + } + + /** + * {@inheritdoc} + */ + public function transform($value) + { + return $this->reversedTransformer->reverseTransform($value); + } + + /** + * {@inheritdoc} + */ + public function reverseTransform($value) + { + return $this->reversedTransformer->transform($value); + } +} diff --git a/vendor/symfony/form/SubmitButton.php b/vendor/symfony/form/SubmitButton.php new file mode 100644 index 0000000..520f223 --- /dev/null +++ b/vendor/symfony/form/SubmitButton.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A button that submits the form. + * + * @author Bernhard Schussek + */ +class SubmitButton extends Button implements ClickableInterface +{ + private $clicked = false; + + /** + * {@inheritdoc} + */ + public function isClicked() + { + return $this->clicked; + } + + /** + * Submits data to the button. + * + * @param array|string|null $submittedData The data + * @param bool $clearMissing Not used + * + * @return $this + * + * @throws Exception\AlreadySubmittedException if the form has already been submitted + */ + public function submit($submittedData, bool $clearMissing = true) + { + if ($this->getConfig()->getDisabled()) { + $this->clicked = false; + + return $this; + } + + parent::submit($submittedData, $clearMissing); + + $this->clicked = null !== $submittedData; + + return $this; + } +} diff --git a/vendor/symfony/form/SubmitButtonBuilder.php b/vendor/symfony/form/SubmitButtonBuilder.php new file mode 100644 index 0000000..3045e0d --- /dev/null +++ b/vendor/symfony/form/SubmitButtonBuilder.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A builder for {@link SubmitButton} instances. + * + * @author Bernhard Schussek + */ +class SubmitButtonBuilder extends ButtonBuilder +{ + /** + * Creates the button. + * + * @return SubmitButton + */ + public function getForm() + { + return new SubmitButton($this->getFormConfig()); + } +} diff --git a/vendor/symfony/form/SubmitButtonTypeInterface.php b/vendor/symfony/form/SubmitButtonTypeInterface.php new file mode 100644 index 0000000..f7ac13f --- /dev/null +++ b/vendor/symfony/form/SubmitButtonTypeInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A type that should be converted into a {@link SubmitButton} instance. + * + * @author Bernhard Schussek + */ +interface SubmitButtonTypeInterface extends FormTypeInterface +{ +} diff --git a/vendor/symfony/form/Test/FormBuilderInterface.php b/vendor/symfony/form/Test/FormBuilderInterface.php new file mode 100644 index 0000000..185a8a1 --- /dev/null +++ b/vendor/symfony/form/Test/FormBuilderInterface.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use Symfony\Component\Form\FormBuilderInterface as BaseFormBuilderInterface; + +interface FormBuilderInterface extends \Iterator, BaseFormBuilderInterface +{ +} diff --git a/vendor/symfony/form/Test/FormIntegrationTestCase.php b/vendor/symfony/form/Test/FormIntegrationTestCase.php new file mode 100644 index 0000000..4feb8df --- /dev/null +++ b/vendor/symfony/form/Test/FormIntegrationTestCase.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\Forms; + +/** + * @author Bernhard Schussek + */ +abstract class FormIntegrationTestCase extends TestCase +{ + /** + * @var FormFactoryInterface + */ + protected $factory; + + protected function setUp(): void + { + $this->factory = Forms::createFormFactoryBuilder() + ->addExtensions($this->getExtensions()) + ->addTypeExtensions($this->getTypeExtensions()) + ->addTypes($this->getTypes()) + ->addTypeGuessers($this->getTypeGuessers()) + ->getFormFactory(); + } + + protected function getExtensions() + { + return []; + } + + protected function getTypeExtensions() + { + return []; + } + + protected function getTypes() + { + return []; + } + + protected function getTypeGuessers() + { + return []; + } +} diff --git a/vendor/symfony/form/Test/FormInterface.php b/vendor/symfony/form/Test/FormInterface.php new file mode 100644 index 0000000..4af4603 --- /dev/null +++ b/vendor/symfony/form/Test/FormInterface.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use Symfony\Component\Form\FormInterface as BaseFormInterface; + +interface FormInterface extends \Iterator, BaseFormInterface +{ +} diff --git a/vendor/symfony/form/Test/FormPerformanceTestCase.php b/vendor/symfony/form/Test/FormPerformanceTestCase.php new file mode 100644 index 0000000..732f9ec --- /dev/null +++ b/vendor/symfony/form/Test/FormPerformanceTestCase.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use Symfony\Component\Form\Tests\VersionAwareTest; + +/** + * Base class for performance tests. + * + * Copied from Doctrine 2's OrmPerformanceTestCase. + * + * @author robo + * @author Bernhard Schussek + */ +abstract class FormPerformanceTestCase extends FormIntegrationTestCase +{ + use VersionAwareTest; + + /** + * @var int + */ + protected $maxRunningTime = 0; + + /** + * {@inheritdoc} + */ + protected function runTest() + { + $s = microtime(true); + parent::runTest(); + $time = microtime(true) - $s; + + if (0 != $this->maxRunningTime && $time > $this->maxRunningTime) { + $this->fail(sprintf('expected running time: <= %s but was: %s', $this->maxRunningTime, $time)); + } + } + + /** + * @throws \InvalidArgumentException + */ + public function setMaxRunningTime(int $maxRunningTime) + { + if ($maxRunningTime < 0) { + throw new \InvalidArgumentException(); + } + + $this->maxRunningTime = $maxRunningTime; + } + + /** + * @return int + */ + public function getMaxRunningTime() + { + return $this->maxRunningTime; + } +} diff --git a/vendor/symfony/form/Test/Traits/ValidatorExtensionTrait.php b/vendor/symfony/form/Test/Traits/ValidatorExtensionTrait.php new file mode 100644 index 0000000..b4b35fa --- /dev/null +++ b/vendor/symfony/form/Test/Traits/ValidatorExtensionTrait.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test\Traits; + +use Symfony\Component\Form\Extension\Validator\ValidatorExtension; +use Symfony\Component\Form\Test\TypeTestCase; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +trait ValidatorExtensionTrait +{ + /** + * @var ValidatorInterface|null + */ + protected $validator; + + protected function getValidatorExtension(): ValidatorExtension + { + if (!interface_exists(ValidatorInterface::class)) { + throw new \Exception('In order to use the "ValidatorExtensionTrait", the symfony/validator component must be installed.'); + } + + if (!$this instanceof TypeTestCase) { + throw new \Exception(sprintf('The trait "ValidatorExtensionTrait" can only be added to a class that extends "%s".', TypeTestCase::class)); + } + + $this->validator = $this->createMock(ValidatorInterface::class); + $metadata = $this->getMockBuilder(ClassMetadata::class)->setConstructorArgs([''])->setMethods(['addPropertyConstraint'])->getMock(); + $this->validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata)); + $this->validator->expects($this->any())->method('validate')->will($this->returnValue(new ConstraintViolationList())); + + return new ValidatorExtension($this->validator, false); + } +} diff --git a/vendor/symfony/form/Test/TypeTestCase.php b/vendor/symfony/form/Test/TypeTestCase.php new file mode 100644 index 0000000..a925c55 --- /dev/null +++ b/vendor/symfony/form/Test/TypeTestCase.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait; + +abstract class TypeTestCase extends FormIntegrationTestCase +{ + /** + * @var FormBuilder + */ + protected $builder; + + /** + * @var EventDispatcherInterface + */ + protected $dispatcher; + + protected function setUp(): void + { + parent::setUp(); + + $this->dispatcher = $this->createMock(EventDispatcherInterface::class); + $this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory); + } + + protected function tearDown(): void + { + if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) { + $this->validator = null; + } + } + + protected function getExtensions() + { + $extensions = []; + + if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) { + $extensions[] = $this->getValidatorExtension(); + } + + return $extensions; + } + + public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) + { + self::assertEquals($expected->format('c'), $actual->format('c')); + } + + public static function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual) + { + self::assertEquals($expected->format('%RP%yY%mM%dDT%hH%iM%sS'), $actual->format('%RP%yY%mM%dDT%hH%iM%sS')); + } +} diff --git a/vendor/symfony/form/Util/FormUtil.php b/vendor/symfony/form/Util/FormUtil.php new file mode 100644 index 0000000..fed96de --- /dev/null +++ b/vendor/symfony/form/Util/FormUtil.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * @author Bernhard Schussek + */ +class FormUtil +{ + /** + * This class should not be instantiated. + */ + private function __construct() + { + } + + /** + * Returns whether the given data is empty. + * + * This logic is reused multiple times throughout the processing of + * a form and needs to be consistent. PHP keyword `empty` cannot + * be used as it also considers 0 and "0" to be empty. + * + * @param mixed $data + * + * @return bool + */ + public static function isEmpty($data) + { + // Should not do a check for [] === $data!!! + // This method is used in occurrences where arrays are + // not considered to be empty, ever. + return null === $data || '' === $data; + } +} diff --git a/vendor/symfony/form/Util/InheritDataAwareIterator.php b/vendor/symfony/form/Util/InheritDataAwareIterator.php new file mode 100644 index 0000000..7cba17d --- /dev/null +++ b/vendor/symfony/form/Util/InheritDataAwareIterator.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * Iterator that traverses an array of forms. + * + * Contrary to \ArrayIterator, this iterator recognizes changes in the original + * array during iteration. + * + * You can wrap the iterator into a {@link \RecursiveIteratorIterator} in order to + * enter any child form that inherits its parent's data and iterate the children + * of that form as well. + * + * @author Bernhard Schussek + */ +class InheritDataAwareIterator extends \IteratorIterator implements \RecursiveIterator +{ + /** + * {@inheritdoc} + * + * @return static + */ + #[\ReturnTypeWillChange] + public function getChildren() + { + return new static($this->current()); + } + + /** + * @return bool + */ + #[\ReturnTypeWillChange] + public function hasChildren() + { + return (bool) $this->current()->getConfig()->getInheritData(); + } +} diff --git a/vendor/symfony/form/Util/OptionsResolverWrapper.php b/vendor/symfony/form/Util/OptionsResolverWrapper.php new file mode 100644 index 0000000..078f93d --- /dev/null +++ b/vendor/symfony/form/Util/OptionsResolverWrapper.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Yonel Ceruto + * + * @internal + */ +class OptionsResolverWrapper extends OptionsResolver +{ + private $undefined = []; + + /** + * @return $this + */ + public function setNormalizer(string $option, \Closure $normalizer): self + { + try { + parent::setNormalizer($option, $normalizer); + } catch (UndefinedOptionsException $e) { + $this->undefined[$option] = true; + } + + return $this; + } + + /** + * @return $this + */ + public function setAllowedValues(string $option, $allowedValues): self + { + try { + parent::setAllowedValues($option, $allowedValues); + } catch (UndefinedOptionsException $e) { + $this->undefined[$option] = true; + } + + return $this; + } + + /** + * @return $this + */ + public function addAllowedValues(string $option, $allowedValues): self + { + try { + parent::addAllowedValues($option, $allowedValues); + } catch (UndefinedOptionsException $e) { + $this->undefined[$option] = true; + } + + return $this; + } + + /** + * @param string|array $allowedTypes + * + * @return $this + */ + public function setAllowedTypes(string $option, $allowedTypes): self + { + try { + parent::setAllowedTypes($option, $allowedTypes); + } catch (UndefinedOptionsException $e) { + $this->undefined[$option] = true; + } + + return $this; + } + + /** + * @param string|array $allowedTypes + * + * @return $this + */ + public function addAllowedTypes(string $option, $allowedTypes): self + { + try { + parent::addAllowedTypes($option, $allowedTypes); + } catch (UndefinedOptionsException $e) { + $this->undefined[$option] = true; + } + + return $this; + } + + public function resolve(array $options = []): array + { + throw new AccessException('Resolve options is not supported.'); + } + + public function getUndefinedOptions(): array + { + return array_keys($this->undefined); + } +} diff --git a/vendor/symfony/form/Util/OrderedHashMap.php b/vendor/symfony/form/Util/OrderedHashMap.php new file mode 100644 index 0000000..7d84cbe --- /dev/null +++ b/vendor/symfony/form/Util/OrderedHashMap.php @@ -0,0 +1,192 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * A hash map which keeps track of deletions and additions. + * + * Like in associative arrays, elements can be mapped to integer or string keys. + * Unlike associative arrays, the map keeps track of the order in which keys + * were added and removed. This order is reflected during iteration. + * + * The map supports concurrent modification during iteration. That means that + * you can insert and remove elements from within a foreach loop and the + * iterator will reflect those changes accordingly. + * + * While elements that are added during the loop are recognized by the iterator, + * changed elements are not. Otherwise the loop could be infinite if each loop + * changes the current element: + * + * $map = new OrderedHashMap(); + * $map[1] = 1; + * $map[2] = 2; + * $map[3] = 3; + * + * foreach ($map as $index => $value) { + * echo "$index: $value\n" + * if (1 === $index) { + * $map[1] = 4; + * $map[] = 5; + * } + * } + * + * print_r(iterator_to_array($map)); + * + * // => 1: 1 + * // 2: 2 + * // 3: 3 + * // 4: 5 + * // Array + * // ( + * // [1] => 4 + * // [2] => 2 + * // [3] => 3 + * // [4] => 5 + * // ) + * + * The map also supports multiple parallel iterators. That means that you can + * nest foreach loops without affecting each other's iteration: + * + * foreach ($map as $index => $value) { + * foreach ($map as $index2 => $value2) { + * // ... + * } + * } + * + * @author Bernhard Schussek + * + * @template TKey of array-key + * @template TValue + * + * @implements \ArrayAccess + * @implements \IteratorAggregate + */ +class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * The elements of the map, indexed by their keys. + * + * @var array + */ + private $elements = []; + + /** + * The keys of the map in the order in which they were inserted or changed. + * + * @var list + */ + private $orderedKeys = []; + + /** + * References to the cursors of all open iterators. + * + * @var array + */ + private $managedCursors = []; + + /** + * Creates a new map. + * + * @param array $elements The elements to insert initially + */ + public function __construct(array $elements = []) + { + $this->elements = $elements; + $this->orderedKeys = array_keys($elements); + } + + /** + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($key) + { + return isset($this->elements[$key]); + } + + /** + * {@inheritdoc} + * + * @return TValue + */ + #[\ReturnTypeWillChange] + public function offsetGet($key) + { + if (!isset($this->elements[$key])) { + throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $key)); + } + + return $this->elements[$key]; + } + + /** + * {@inheritdoc} + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($key, $value) + { + if (null === $key || !isset($this->elements[$key])) { + if (null === $key) { + $key = [] === $this->orderedKeys + // If the array is empty, use 0 as key + ? 0 + // Imitate PHP behavior of generating a key that equals + // the highest existing integer key + 1 + : 1 + (int) max($this->orderedKeys); + } + + $this->orderedKeys[] = (string) $key; + } + + $this->elements[$key] = $value; + } + + /** + * {@inheritdoc} + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($key) + { + if (false !== ($position = array_search((string) $key, $this->orderedKeys))) { + array_splice($this->orderedKeys, $position, 1); + unset($this->elements[$key]); + + foreach ($this->managedCursors as $i => $cursor) { + if ($cursor >= $position) { + --$this->managedCursors[$i]; + } + } + } + } + + /** + * @return \Traversable + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new OrderedHashMapIterator($this->elements, $this->orderedKeys, $this->managedCursors); + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->elements); + } +} diff --git a/vendor/symfony/form/Util/OrderedHashMapIterator.php b/vendor/symfony/form/Util/OrderedHashMapIterator.php new file mode 100644 index 0000000..e91e333 --- /dev/null +++ b/vendor/symfony/form/Util/OrderedHashMapIterator.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * Iterator for {@link OrderedHashMap} objects. + * + * @author Bernhard Schussek + * + * @internal + * + * @template-covariant TKey of array-key + * @template-covariant TValue + * + * @implements \Iterator + */ +class OrderedHashMapIterator implements \Iterator +{ + /** + * @var array + */ + private $elements; + + /** + * @var list + */ + private $orderedKeys; + + /** + * @var int + */ + private $cursor = 0; + + /** + * @var int + */ + private $cursorId; + + /** + * @var array + */ + private $managedCursors; + + /** + * @var TKey|null + */ + private $key; + + /** + * @var TValue|null + */ + private $current; + + /** + * @param array $elements The elements of the map, indexed by their + * keys + * @param list $orderedKeys The keys of the map in the order in which + * they should be iterated + * @param array $managedCursors An array from which to reference the + * iterator's cursor as long as it is alive. + * This array is managed by the corresponding + * {@link OrderedHashMap} instance to support + * recognizing the deletion of elements. + */ + public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors) + { + $this->elements = &$elements; + $this->orderedKeys = &$orderedKeys; + $this->managedCursors = &$managedCursors; + $this->cursorId = \count($managedCursors); + + $this->managedCursors[$this->cursorId] = &$this->cursor; + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + /** + * Removes the iterator's cursors from the managed cursors of the + * corresponding {@link OrderedHashMap} instance. + */ + public function __destruct() + { + // Use array_splice() instead of unset() to prevent holes in the + // array indices, which would break the initialization of $cursorId + array_splice($this->managedCursors, $this->cursorId, 1); + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function current() + { + return $this->current; + } + + /** + * {@inheritdoc} + */ + public function next(): void + { + ++$this->cursor; + + if (isset($this->orderedKeys[$this->cursor])) { + $this->key = $this->orderedKeys[$this->cursor]; + $this->current = $this->elements[$this->key]; + } else { + $this->key = null; + $this->current = null; + } + } + + /** + * {@inheritdoc} + * + * @return mixed + */ + #[\ReturnTypeWillChange] + public function key() + { + if (null === $this->key) { + return null; + } + + $array = [$this->key => null]; + + return key($array); + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return null !== $this->key; + } + + /** + * {@inheritdoc} + */ + public function rewind(): void + { + $this->cursor = 0; + + if (isset($this->orderedKeys[0])) { + $this->key = $this->orderedKeys[0]; + $this->current = $this->elements[$this->key]; + } else { + $this->key = null; + $this->current = null; + } + } +} diff --git a/vendor/symfony/form/Util/ServerParams.php b/vendor/symfony/form/Util/ServerParams.php new file mode 100644 index 0000000..a88c526 --- /dev/null +++ b/vendor/symfony/form/Util/ServerParams.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +use Symfony\Component\HttpFoundation\RequestStack; + +/** + * @author Bernhard Schussek + */ +class ServerParams +{ + private $requestStack; + + public function __construct(RequestStack $requestStack = null) + { + $this->requestStack = $requestStack; + } + + /** + * Returns true if the POST max size has been exceeded in the request. + * + * @return bool + */ + public function hasPostMaxSizeBeenExceeded() + { + $contentLength = $this->getContentLength(); + $maxContentLength = $this->getPostMaxSize(); + + return $maxContentLength && $contentLength > $maxContentLength; + } + + /** + * Returns maximum post size in bytes. + * + * @return int|float|null + */ + public function getPostMaxSize() + { + $iniMax = strtolower($this->getNormalizedIniPostMaxSize()); + + if ('' === $iniMax) { + return null; + } + + $max = ltrim($iniMax, '+'); + if (str_starts_with($max, '0x')) { + $max = \intval($max, 16); + } elseif (str_starts_with($max, '0')) { + $max = \intval($max, 8); + } else { + $max = (int) $max; + } + + switch (substr($iniMax, -1)) { + case 't': $max *= 1024; + // no break + case 'g': $max *= 1024; + // no break + case 'm': $max *= 1024; + // no break + case 'k': $max *= 1024; + } + + return $max; + } + + /** + * Returns the normalized "post_max_size" ini setting. + * + * @return string + */ + public function getNormalizedIniPostMaxSize() + { + return strtoupper(trim(ini_get('post_max_size'))); + } + + /** + * Returns the content length of the request. + * + * @return mixed + */ + public function getContentLength() + { + if (null !== $this->requestStack && null !== $request = $this->requestStack->getCurrentRequest()) { + return $request->server->get('CONTENT_LENGTH'); + } + + return isset($_SERVER['CONTENT_LENGTH']) + ? (int) $_SERVER['CONTENT_LENGTH'] + : null; + } +} diff --git a/vendor/symfony/form/Util/StringUtil.php b/vendor/symfony/form/Util/StringUtil.php new file mode 100644 index 0000000..db60f95 --- /dev/null +++ b/vendor/symfony/form/Util/StringUtil.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Util; + +/** + * @author Issei Murasawa + * @author Bernhard Schussek + */ +class StringUtil +{ + /** + * This class should not be instantiated. + */ + private function __construct() + { + } + + /** + * Returns the trimmed data. + * + * @return string + */ + public static function trim(string $string) + { + if (null !== $result = @preg_replace('/^[\pZ\p{Cc}\p{Cf}]+|[\pZ\p{Cc}\p{Cf}]+$/u', '', $string)) { + return $result; + } + + return trim($string); + } + + /** + * Converts a fully-qualified class name to a block prefix. + * + * @param string $fqcn The fully-qualified class name + * + * @return string|null + */ + public static function fqcnToBlockPrefix(string $fqcn) + { + // Non-greedy ("+?") to match "type" suffix, if present + if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) { + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1])); + } + + return null; + } +} diff --git a/vendor/symfony/form/composer.json b/vendor/symfony/form/composer.json new file mode 100644 index 0000000..ff9e6b9 --- /dev/null +++ b/vendor/symfony/form/composer.json @@ -0,0 +1,70 @@ +{ + "name": "symfony/form", + "type": "library", + "description": "Allows to easily create, process and reuse HTML forms", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/options-resolver": "^5.1|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.23", + "symfony/property-access": "^5.0.8|^6.0", + "symfony/service-contracts": "^1.1|^2|^3" + }, + "require-dev": { + "doctrine/collections": "~1.0", + "symfony/validator": "^4.4.17|^5.1.9|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<4.4", + "symfony/doctrine-bridge": "<4.4", + "symfony/error-handler": "<4.4.5", + "symfony/framework-bundle": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<4.4", + "symfony/translation-contracts": "<1.1.7", + "symfony/twig-bridge": "<4.4" + }, + "suggest": { + "symfony/validator": "For form validation.", + "symfony/security-csrf": "For protecting forms against CSRF attacks.", + "symfony/twig-bridge": "For templating with Twig." + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Form\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/http-client-contracts/.gitignore b/vendor/symfony/http-client-contracts/.gitignore new file mode 100644 index 0000000..c49a5d8 --- /dev/null +++ b/vendor/symfony/http-client-contracts/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/http-client-contracts/CHANGELOG.md b/vendor/symfony/http-client-contracts/CHANGELOG.md new file mode 100644 index 0000000..7932e26 --- /dev/null +++ b/vendor/symfony/http-client-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/http-client-contracts/ChunkInterface.php b/vendor/symfony/http-client-contracts/ChunkInterface.php new file mode 100644 index 0000000..0800cb3 --- /dev/null +++ b/vendor/symfony/http-client-contracts/ChunkInterface.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient; + +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * The interface of chunks returned by ResponseStreamInterface::current(). + * + * When the chunk is first, last or timeout, the content MUST be empty. + * When an unchecked timeout or a network error occurs, a TransportExceptionInterface + * MUST be thrown by the destructor unless one was already thrown by another method. + * + * @author Nicolas Grekas + */ +interface ChunkInterface +{ + /** + * Tells when the idle timeout has been reached. + * + * @throws TransportExceptionInterface on a network error + */ + public function isTimeout(): bool; + + /** + * Tells when headers just arrived. + * + * @throws TransportExceptionInterface on a network error or when the idle timeout is reached + */ + public function isFirst(): bool; + + /** + * Tells when the body just completed. + * + * @throws TransportExceptionInterface on a network error or when the idle timeout is reached + */ + public function isLast(): bool; + + /** + * Returns a [status code, headers] tuple when a 1xx status code was just received. + * + * @throws TransportExceptionInterface on a network error or when the idle timeout is reached + */ + public function getInformationalStatus(): ?array; + + /** + * Returns the content of the response chunk. + * + * @throws TransportExceptionInterface on a network error or when the idle timeout is reached + */ + public function getContent(): string; + + /** + * Returns the offset of the chunk in the response body. + */ + public function getOffset(): int; + + /** + * In case of error, returns the message that describes it. + */ + public function getError(): ?string; +} diff --git a/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php new file mode 100644 index 0000000..22d2b45 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/ClientExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When a 4xx response is returned. + * + * @author Nicolas Grekas + */ +interface ClientExceptionInterface extends HttpExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php new file mode 100644 index 0000000..971a7a2 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/DecodingExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When a content-type cannot be decoded to the expected representation. + * + * @author Nicolas Grekas + */ +interface DecodingExceptionInterface extends ExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php new file mode 100644 index 0000000..e553b47 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * The base interface for all exceptions in the contract. + * + * @author Nicolas Grekas + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php new file mode 100644 index 0000000..17865ed --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/HttpExceptionInterface.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * Base interface for HTTP-related exceptions. + * + * @author Anton Chernikov + */ +interface HttpExceptionInterface extends ExceptionInterface +{ + public function getResponse(): ResponseInterface; +} diff --git a/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php new file mode 100644 index 0000000..edd9b8a --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/RedirectionExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When a 3xx response is returned and the "max_redirects" option has been reached. + * + * @author Nicolas Grekas + */ +interface RedirectionExceptionInterface extends HttpExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php new file mode 100644 index 0000000..9bfe135 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/ServerExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When a 5xx response is returned. + * + * @author Nicolas Grekas + */ +interface ServerExceptionInterface extends HttpExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php new file mode 100644 index 0000000..08acf9f --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/TimeoutExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When an idle timeout occurs. + * + * @author Nicolas Grekas + */ +interface TimeoutExceptionInterface extends TransportExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php b/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php new file mode 100644 index 0000000..0c8d131 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Exception/TransportExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Exception; + +/** + * When any error happens at the transport level. + * + * @author Nicolas Grekas + */ +interface TransportExceptionInterface extends ExceptionInterface +{ +} diff --git a/vendor/symfony/http-client-contracts/HttpClientInterface.php b/vendor/symfony/http-client-contracts/HttpClientInterface.php new file mode 100644 index 0000000..158c1a7 --- /dev/null +++ b/vendor/symfony/http-client-contracts/HttpClientInterface.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient; + +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\Test\HttpClientTestCase; + +/** + * Provides flexible methods for requesting HTTP resources synchronously or asynchronously. + * + * @see HttpClientTestCase for a reference test suite + * + * @method static withOptions(array $options) Returns a new instance of the client with new default options + * + * @author Nicolas Grekas + */ +interface HttpClientInterface +{ + public const OPTIONS_DEFAULTS = [ + 'auth_basic' => null, // array|string - an array containing the username as first value, and optionally the + // password as the second one; or string like username:password - enabling HTTP Basic + // authentication (RFC 7617) + 'auth_bearer' => null, // string - a token enabling HTTP Bearer authorization (RFC 6750) + 'query' => [], // string[] - associative array of query string values to merge with the request's URL + 'headers' => [], // iterable|string[]|string[][] - headers names provided as keys or as part of values + 'body' => '', // array|string|resource|\Traversable|\Closure - the callback SHOULD yield a string + // smaller than the amount requested as argument; the empty string signals EOF; if + // an array is passed, it is meant as a form payload of field names and values + 'json' => null, // mixed - if set, implementations MUST set the "body" option to the JSON-encoded + // value and set the "content-type" header to a JSON-compatible value if it is not + // explicitly defined in the headers option - typically "application/json" + 'user_data' => null, // mixed - any extra data to attach to the request (scalar, callable, object...) that + // MUST be available via $response->getInfo('user_data') - not used internally + 'max_redirects' => 20, // int - the maximum number of redirects to follow; a value lower than or equal to 0 + // means redirects should not be followed; "Authorization" and "Cookie" headers MUST + // NOT follow except for the initial host name + 'http_version' => null, // string - defaults to the best supported version, typically 1.1 or 2.0 + 'base_uri' => null, // string - the URI to resolve relative URLs, following rules in RFC 3986, section 2 + 'buffer' => true, // bool|resource|\Closure - whether the content of the response should be buffered or not, + // or a stream resource where the response body should be written, + // or a closure telling if/where the response should be buffered based on its headers + 'on_progress' => null, // callable(int $dlNow, int $dlSize, array $info) - throwing any exceptions MUST abort + // the request; it MUST be called on DNS resolution, on arrival of headers and on + // completion; it SHOULD be called on upload/download of data and at least 1/s + 'resolve' => [], // string[] - a map of host to IP address that SHOULD replace DNS resolution + 'proxy' => null, // string - by default, the proxy-related env vars handled by curl SHOULD be honored + 'no_proxy' => null, // string - a comma separated list of hosts that do not require a proxy to be reached + 'timeout' => null, // float - the idle timeout - defaults to ini_get('default_socket_timeout') + 'max_duration' => 0, // float - the maximum execution time for the request+response as a whole; + // a value lower than or equal to 0 means it is unlimited + 'bindto' => '0', // string - the interface or the local socket to bind to + 'verify_peer' => true, // see https://php.net/context.ssl for the following options + 'verify_host' => true, + 'cafile' => null, + 'capath' => null, + 'local_cert' => null, + 'local_pk' => null, + 'passphrase' => null, + 'ciphers' => null, + 'peer_fingerprint' => null, + 'capture_peer_cert_chain' => false, + 'extra' => [], // array - additional options that can be ignored if unsupported, unlike regular options + ]; + + /** + * Requests an HTTP resource. + * + * Responses MUST be lazy, but their status code MUST be + * checked even if none of their public methods are called. + * + * Implementations are not required to support all options described above; they can also + * support more custom options; but in any case, they MUST throw a TransportExceptionInterface + * when an unsupported option is passed. + * + * @throws TransportExceptionInterface When an unsupported option is passed + */ + public function request(string $method, string $url, array $options = []): ResponseInterface; + + /** + * Yields responses chunk by chunk as they complete. + * + * @param ResponseInterface|iterable $responses One or more responses created by the current HTTP client + * @param float|null $timeout The idle timeout before yielding timeout chunks + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface; +} diff --git a/vendor/symfony/http-client-contracts/LICENSE b/vendor/symfony/http-client-contracts/LICENSE new file mode 100644 index 0000000..74cdc2d --- /dev/null +++ b/vendor/symfony/http-client-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018-2022 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/http-client-contracts/README.md b/vendor/symfony/http-client-contracts/README.md new file mode 100644 index 0000000..03b3a69 --- /dev/null +++ b/vendor/symfony/http-client-contracts/README.md @@ -0,0 +1,9 @@ +Symfony HttpClient Contracts +============================ + +A set of abstractions extracted out of the Symfony components. + +Can be used to build on semantics that the Symfony components proved useful - and +that already have battle tested implementations. + +See https://github.com/symfony/contracts/blob/main/README.md for more information. diff --git a/vendor/symfony/http-client-contracts/ResponseInterface.php b/vendor/symfony/http-client-contracts/ResponseInterface.php new file mode 100644 index 0000000..df71488 --- /dev/null +++ b/vendor/symfony/http-client-contracts/ResponseInterface.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient; + +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * A (lazily retrieved) HTTP response. + * + * @author Nicolas Grekas + */ +interface ResponseInterface +{ + /** + * Gets the HTTP status code of the response. + * + * @throws TransportExceptionInterface when a network error occurs + */ + public function getStatusCode(): int; + + /** + * Gets the HTTP headers of the response. + * + * @param bool $throw Whether an exception should be thrown on 3/4/5xx status codes + * + * @return string[][] The headers of the response keyed by header names in lowercase + * + * @throws TransportExceptionInterface When a network error occurs + * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached + * @throws ClientExceptionInterface On a 4xx when $throw is true + * @throws ServerExceptionInterface On a 5xx when $throw is true + */ + public function getHeaders(bool $throw = true): array; + + /** + * Gets the response body as a string. + * + * @param bool $throw Whether an exception should be thrown on 3/4/5xx status codes + * + * @throws TransportExceptionInterface When a network error occurs + * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached + * @throws ClientExceptionInterface On a 4xx when $throw is true + * @throws ServerExceptionInterface On a 5xx when $throw is true + */ + public function getContent(bool $throw = true): string; + + /** + * Gets the response body decoded as array, typically from a JSON payload. + * + * @param bool $throw Whether an exception should be thrown on 3/4/5xx status codes + * + * @throws DecodingExceptionInterface When the body cannot be decoded to an array + * @throws TransportExceptionInterface When a network error occurs + * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached + * @throws ClientExceptionInterface On a 4xx when $throw is true + * @throws ServerExceptionInterface On a 5xx when $throw is true + */ + public function toArray(bool $throw = true): array; + + /** + * Closes the response stream and all related buffers. + * + * No further chunk will be yielded after this method has been called. + */ + public function cancel(): void; + + /** + * Returns info coming from the transport layer. + * + * This method SHOULD NOT throw any ExceptionInterface and SHOULD be non-blocking. + * The returned info is "live": it can be empty and can change from one call to + * another, as the request/response progresses. + * + * The following info MUST be returned: + * - canceled (bool) - true if the response was canceled using ResponseInterface::cancel(), false otherwise + * - error (string|null) - the error message when the transfer was aborted, null otherwise + * - http_code (int) - the last response code or 0 when it is not known yet + * - http_method (string) - the HTTP verb of the last request + * - redirect_count (int) - the number of redirects followed while executing the request + * - redirect_url (string|null) - the resolved location of redirect responses, null otherwise + * - response_headers (array) - an array modelled after the special $http_response_header variable + * - start_time (float) - the time when the request was sent or 0.0 when it's pending + * - url (string) - the last effective URL of the request + * - user_data (mixed) - the value of the "user_data" request option, null if not set + * + * When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain" + * attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources. + * + * Other info SHOULD be named after curl_getinfo()'s associative return value. + * + * @return mixed An array of all available info, or one of them when $type is + * provided, or null when an unsupported type is requested + */ + public function getInfo(string $type = null); +} diff --git a/vendor/symfony/http-client-contracts/ResponseStreamInterface.php b/vendor/symfony/http-client-contracts/ResponseStreamInterface.php new file mode 100644 index 0000000..fa3e5db --- /dev/null +++ b/vendor/symfony/http-client-contracts/ResponseStreamInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient; + +/** + * Yields response chunks, returned by HttpClientInterface::stream(). + * + * @author Nicolas Grekas + * + * @extends \Iterator + */ +interface ResponseStreamInterface extends \Iterator +{ + public function key(): ResponseInterface; + + public function current(): ChunkInterface; +} diff --git a/vendor/symfony/http-client-contracts/Test/Fixtures/web/index.php b/vendor/symfony/http-client-contracts/Test/Fixtures/web/index.php new file mode 100644 index 0000000..30a7049 --- /dev/null +++ b/vendor/symfony/http-client-contracts/Test/Fixtures/web/index.php @@ -0,0 +1,192 @@ + $v) { + switch ($k) { + default: + if (0 !== strpos($k, 'HTTP_')) { + continue 2; + } + // no break + case 'SERVER_NAME': + case 'SERVER_PROTOCOL': + case 'REQUEST_URI': + case 'REQUEST_METHOD': + case 'PHP_AUTH_USER': + case 'PHP_AUTH_PW': + $vars[$k] = $v; + } +} + +$json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE); + +switch ($vars['REQUEST_URI']) { + default: + exit; + + case '/head': + header('Content-Length: '.strlen($json), true); + break; + + case '/': + case '/?a=a&b=b': + case 'http://127.0.0.1:8057/': + case 'http://localhost:8057/': + ob_start('ob_gzhandler'); + break; + + case '/103': + header('HTTP/1.1 103 Early Hints'); + header('Link: ; rel=preload; as=style', false); + header('Link: ; rel=preload; as=script', false); + flush(); + usleep(1000); + echo "HTTP/1.1 200 OK\r\n"; + echo "Date: Fri, 26 May 2017 10:02:11 GMT\r\n"; + echo "Content-Length: 13\r\n"; + echo "\r\n"; + echo 'Here the body'; + exit; + + case '/404': + header('Content-Type: application/json', true, 404); + break; + + case '/404-gzipped': + header('Content-Type: text/plain', true, 404); + ob_start('ob_gzhandler'); + @ob_flush(); + flush(); + usleep(300000); + echo 'some text'; + exit; + + case '/301': + if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) { + header('Location: http://127.0.0.1:8057/302', true, 301); + } + break; + + case '/301/bad-tld': + header('Location: http://foo.example.', true, 301); + break; + + case '/301/invalid': + header('Location: //?foo=bar', true, 301); + break; + + case '/302': + if (!isset($vars['HTTP_AUTHORIZATION'])) { + header('Location: http://localhost:8057/', true, 302); + } + break; + + case '/302/relative': + header('Location: ..', true, 302); + break; + + case '/304': + header('Content-Length: 10', true, 304); + echo '12345'; + + return; + + case '/307': + header('Location: http://localhost:8057/post', true, 307); + break; + + case '/length-broken': + header('Content-Length: 1000'); + break; + + case '/post': + $output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE); + header('Content-Type: application/json', true); + header('Content-Length: '.strlen($output)); + echo $output; + exit; + + case '/timeout-header': + usleep(300000); + break; + + case '/timeout-body': + echo '<1>'; + @ob_flush(); + flush(); + usleep(500000); + echo '<2>'; + exit; + + case '/timeout-long': + ignore_user_abort(false); + sleep(1); + while (true) { + echo '<1>'; + @ob_flush(); + flush(); + usleep(500); + } + exit; + + case '/chunked': + header('Transfer-Encoding: chunked'); + echo "8\r\nSymfony \r\n5\r\nis aw\r\n6\r\nesome!\r\n0\r\n\r\n"; + exit; + + case '/chunked-broken': + header('Transfer-Encoding: chunked'); + echo "8\r\nSymfony \r\n5\r\nis aw\r\n6\r\ne"; + exit; + + case '/gzip-broken': + header('Content-Encoding: gzip'); + echo str_repeat('-', 1000); + exit; + + case '/max-duration': + ignore_user_abort(false); + while (true) { + echo '<1>'; + @ob_flush(); + flush(); + usleep(500); + } + exit; + + case '/json': + header('Content-Type: application/json'); + echo json_encode([ + 'documents' => [ + ['id' => '/json/1'], + ['id' => '/json/2'], + ['id' => '/json/3'], + ], + ]); + exit; + + case '/json/1': + case '/json/2': + case '/json/3': + header('Content-Type: application/json'); + echo json_encode([ + 'title' => $vars['REQUEST_URI'], + ]); + + exit; +} + +header('Content-Type: application/json', true); + +echo $json; diff --git a/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php b/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php new file mode 100644 index 0000000..efb57bc --- /dev/null +++ b/vendor/symfony/http-client-contracts/Test/HttpClientTestCase.php @@ -0,0 +1,1132 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Test; + +use PHPUnit\Framework\TestCase; +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TimeoutExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * A reference test suite for HttpClientInterface implementations. + */ +abstract class HttpClientTestCase extends TestCase +{ + public static function setUpBeforeClass(): void + { + TestHttpServer::start(); + } + + abstract protected function getHttpClient(string $testCase): HttpClientInterface; + + public function testGetRequest() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057', [ + 'headers' => ['Foo' => 'baR'], + 'user_data' => $data = new \stdClass(), + ]); + + $this->assertSame([], $response->getInfo('response_headers')); + $this->assertSame($data, $response->getInfo()['user_data']); + $this->assertSame(200, $response->getStatusCode()); + + $info = $response->getInfo(); + $this->assertNull($info['error']); + $this->assertSame(0, $info['redirect_count']); + $this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]); + $this->assertSame('Host: localhost:8057', $info['response_headers'][1]); + $this->assertSame('http://localhost:8057/', $info['url']); + + $headers = $response->getHeaders(); + + $this->assertSame('localhost:8057', $headers['host'][0]); + $this->assertSame(['application/json'], $headers['content-type']); + + $body = json_decode($response->getContent(), true); + $this->assertSame($body, $response->toArray()); + + $this->assertSame('HTTP/1.1', $body['SERVER_PROTOCOL']); + $this->assertSame('/', $body['REQUEST_URI']); + $this->assertSame('GET', $body['REQUEST_METHOD']); + $this->assertSame('localhost:8057', $body['HTTP_HOST']); + $this->assertSame('baR', $body['HTTP_FOO']); + + $response = $client->request('GET', 'http://localhost:8057/length-broken'); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testHeadRequest() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('HEAD', 'http://localhost:8057/head', [ + 'headers' => ['Foo' => 'baR'], + 'user_data' => $data = new \stdClass(), + 'buffer' => false, + ]); + + $this->assertSame([], $response->getInfo('response_headers')); + $this->assertSame(200, $response->getStatusCode()); + + $info = $response->getInfo(); + $this->assertSame('HTTP/1.1 200 OK', $info['response_headers'][0]); + $this->assertSame('Host: localhost:8057', $info['response_headers'][1]); + + $headers = $response->getHeaders(); + + $this->assertSame('localhost:8057', $headers['host'][0]); + $this->assertSame(['application/json'], $headers['content-type']); + $this->assertTrue(0 < $headers['content-length'][0]); + + $this->assertSame('', $response->getContent()); + } + + public function testNonBufferedGetRequest() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057', [ + 'buffer' => false, + 'headers' => ['Foo' => 'baR'], + ]); + + $body = $response->toArray(); + $this->assertSame('baR', $body['HTTP_FOO']); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testBufferSink() + { + $sink = fopen('php://temp', 'w+'); + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057', [ + 'buffer' => $sink, + 'headers' => ['Foo' => 'baR'], + ]); + + $body = $response->toArray(); + $this->assertSame('baR', $body['HTTP_FOO']); + + rewind($sink); + $sink = stream_get_contents($sink); + $this->assertSame($sink, $response->getContent()); + } + + public function testConditionalBuffering() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057'); + $firstContent = $response->getContent(); + $secondContent = $response->getContent(); + + $this->assertSame($firstContent, $secondContent); + + $response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () { return false; }]); + $response->getContent(); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testReentrantBufferCallback() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () use (&$response) { + $response->cancel(); + + return true; + }]); + + $this->assertSame(200, $response->getStatusCode()); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testThrowingBufferCallback() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('GET', 'http://localhost:8057', ['buffer' => function () { + throw new \Exception('Boo.'); + }]); + + $this->assertSame(200, $response->getStatusCode()); + + $this->expectException(TransportExceptionInterface::class); + $this->expectExceptionMessage('Boo'); + $response->getContent(); + } + + public function testUnsupportedOption() + { + $client = $this->getHttpClient(__FUNCTION__); + + $this->expectException(\InvalidArgumentException::class); + $client->request('GET', 'http://localhost:8057', [ + 'capture_peer_cert' => 1.0, + ]); + } + + public function testHttpVersion() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057', [ + 'http_version' => 1.0, + ]); + + $this->assertSame(200, $response->getStatusCode()); + $this->assertSame('HTTP/1.0 200 OK', $response->getInfo('response_headers')[0]); + + $body = $response->toArray(); + + $this->assertSame('HTTP/1.0', $body['SERVER_PROTOCOL']); + $this->assertSame('GET', $body['REQUEST_METHOD']); + $this->assertSame('/', $body['REQUEST_URI']); + } + + public function testChunkedEncoding() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/chunked'); + + $this->assertSame(['chunked'], $response->getHeaders()['transfer-encoding']); + $this->assertSame('Symfony is awesome!', $response->getContent()); + + $response = $client->request('GET', 'http://localhost:8057/chunked-broken'); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testClientError() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/404'); + + $client->stream($response)->valid(); + + $this->assertSame(404, $response->getInfo('http_code')); + + try { + $response->getHeaders(); + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (ClientExceptionInterface $e) { + } + + try { + $response->getContent(); + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (ClientExceptionInterface $e) { + } + + $this->assertSame(404, $response->getStatusCode()); + $this->assertSame(['application/json'], $response->getHeaders(false)['content-type']); + $this->assertNotEmpty($response->getContent(false)); + + $response = $client->request('GET', 'http://localhost:8057/404'); + + try { + foreach ($client->stream($response) as $chunk) { + $this->assertTrue($chunk->isFirst()); + } + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (ClientExceptionInterface $e) { + } + } + + public function testIgnoreErrors() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/404'); + + $this->assertSame(404, $response->getStatusCode()); + } + + public function testDnsError() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/301/bad-tld'); + + try { + $response->getStatusCode(); + $this->fail(TransportExceptionInterface::class.' expected'); + } catch (TransportExceptionInterface $e) { + $this->addToAssertionCount(1); + } + + try { + $response->getStatusCode(); + $this->fail(TransportExceptionInterface::class.' still expected'); + } catch (TransportExceptionInterface $e) { + $this->addToAssertionCount(1); + } + + $response = $client->request('GET', 'http://localhost:8057/301/bad-tld'); + + try { + foreach ($client->stream($response) as $r => $chunk) { + } + $this->fail(TransportExceptionInterface::class.' expected'); + } catch (TransportExceptionInterface $e) { + $this->addToAssertionCount(1); + } + + $this->assertSame($response, $r); + $this->assertNotNull($chunk->getError()); + + $this->expectException(TransportExceptionInterface::class); + foreach ($client->stream($response) as $chunk) { + } + } + + public function testInlineAuth() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://foo:bar%3Dbar@localhost:8057'); + + $body = $response->toArray(); + + $this->assertSame('foo', $body['PHP_AUTH_USER']); + $this->assertSame('bar=bar', $body['PHP_AUTH_PW']); + } + + public function testBadRequestBody() + { + $client = $this->getHttpClient(__FUNCTION__); + + $this->expectException(TransportExceptionInterface::class); + + $response = $client->request('POST', 'http://localhost:8057/', [ + 'body' => function () { yield []; }, + ]); + + $response->getStatusCode(); + } + + public function test304() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/304', [ + 'headers' => ['If-Match' => '"abc"'], + 'buffer' => false, + ]); + + $this->assertSame(304, $response->getStatusCode()); + $this->assertSame('', $response->getContent(false)); + } + + public function testRedirects() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('POST', 'http://localhost:8057/301', [ + 'auth_basic' => 'foo:bar', + 'body' => function () { + yield 'foo=bar'; + }, + ]); + + $body = $response->toArray(); + $this->assertSame('GET', $body['REQUEST_METHOD']); + $this->assertSame('Basic Zm9vOmJhcg==', $body['HTTP_AUTHORIZATION']); + $this->assertSame('http://localhost:8057/', $response->getInfo('url')); + + $this->assertSame(2, $response->getInfo('redirect_count')); + $this->assertNull($response->getInfo('redirect_url')); + + $expected = [ + 'HTTP/1.1 301 Moved Permanently', + 'Location: http://127.0.0.1:8057/302', + 'Content-Type: application/json', + 'HTTP/1.1 302 Found', + 'Location: http://localhost:8057/', + 'Content-Type: application/json', + 'HTTP/1.1 200 OK', + 'Content-Type: application/json', + ]; + + $filteredHeaders = array_values(array_filter($response->getInfo('response_headers'), function ($h) { + return \in_array(substr($h, 0, 4), ['HTTP', 'Loca', 'Cont'], true) && 'Content-Encoding: gzip' !== $h; + })); + + $this->assertSame($expected, $filteredHeaders); + } + + public function testInvalidRedirect() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/301/invalid'); + + $this->assertSame(301, $response->getStatusCode()); + $this->assertSame(['//?foo=bar'], $response->getHeaders(false)['location']); + $this->assertSame(0, $response->getInfo('redirect_count')); + $this->assertNull($response->getInfo('redirect_url')); + + $this->expectException(RedirectionExceptionInterface::class); + $response->getHeaders(); + } + + public function testRelativeRedirects() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/302/relative'); + + $body = $response->toArray(); + + $this->assertSame('/', $body['REQUEST_URI']); + $this->assertNull($response->getInfo('redirect_url')); + + $response = $client->request('GET', 'http://localhost:8057/302/relative', [ + 'max_redirects' => 0, + ]); + + $this->assertSame(302, $response->getStatusCode()); + $this->assertSame('http://localhost:8057/', $response->getInfo('redirect_url')); + } + + public function testRedirect307() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('POST', 'http://localhost:8057/307', [ + 'body' => function () { + yield 'foo=bar'; + }, + 'max_redirects' => 0, + ]); + + $this->assertSame(307, $response->getStatusCode()); + + $response = $client->request('POST', 'http://localhost:8057/307', [ + 'body' => 'foo=bar', + ]); + + $body = $response->toArray(); + + $this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $body); + } + + public function testMaxRedirects() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/301', [ + 'max_redirects' => 1, + 'auth_basic' => 'foo:bar', + ]); + + try { + $response->getHeaders(); + $this->fail(RedirectionExceptionInterface::class.' expected'); + } catch (RedirectionExceptionInterface $e) { + } + + $this->assertSame(302, $response->getStatusCode()); + $this->assertSame(1, $response->getInfo('redirect_count')); + $this->assertSame('http://localhost:8057/', $response->getInfo('redirect_url')); + + $expected = [ + 'HTTP/1.1 301 Moved Permanently', + 'Location: http://127.0.0.1:8057/302', + 'Content-Type: application/json', + 'HTTP/1.1 302 Found', + 'Location: http://localhost:8057/', + 'Content-Type: application/json', + ]; + + $filteredHeaders = array_values(array_filter($response->getInfo('response_headers'), function ($h) { + return \in_array(substr($h, 0, 4), ['HTTP', 'Loca', 'Cont'], true); + })); + + $this->assertSame($expected, $filteredHeaders); + } + + public function testStream() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('GET', 'http://localhost:8057'); + $chunks = $client->stream($response); + $result = []; + + foreach ($chunks as $r => $chunk) { + if ($chunk->isTimeout()) { + $result[] = 't'; + } elseif ($chunk->isLast()) { + $result[] = 'l'; + } elseif ($chunk->isFirst()) { + $result[] = 'f'; + } + } + + $this->assertSame($response, $r); + $this->assertSame(['f', 'l'], $result); + + $chunk = null; + $i = 0; + + foreach ($client->stream($response) as $chunk) { + ++$i; + } + + $this->assertSame(1, $i); + $this->assertTrue($chunk->isLast()); + } + + public function testAddToStream() + { + $client = $this->getHttpClient(__FUNCTION__); + + $r1 = $client->request('GET', 'http://localhost:8057'); + + $completed = []; + + $pool = [$r1]; + + while ($pool) { + $chunks = $client->stream($pool); + $pool = []; + + foreach ($chunks as $r => $chunk) { + if (!$chunk->isLast()) { + continue; + } + + if ($r1 === $r) { + $r2 = $client->request('GET', 'http://localhost:8057'); + $pool[] = $r2; + } + + $completed[] = $r; + } + } + + $this->assertSame([$r1, $r2], $completed); + } + + public function testCompleteTypeError() + { + $client = $this->getHttpClient(__FUNCTION__); + + $this->expectException(\TypeError::class); + $client->stream(123); + } + + public function testOnProgress() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'headers' => ['Content-Length' => 14], + 'body' => 'foo=0123456789', + 'on_progress' => function (...$state) use (&$steps) { $steps[] = $state; }, + ]); + + $body = $response->toArray(); + + $this->assertSame(['foo' => '0123456789', 'REQUEST_METHOD' => 'POST'], $body); + $this->assertSame([0, 0], \array_slice($steps[0], 0, 2)); + $lastStep = \array_slice($steps, -1)[0]; + $this->assertSame([57, 57], \array_slice($lastStep, 0, 2)); + $this->assertSame('http://localhost:8057/post', $steps[0][2]['url']); + } + + public function testPostJson() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'json' => ['foo' => 'bar'], + ]); + + $body = $response->toArray(); + + $this->assertStringContainsString('json', $body['content-type']); + unset($body['content-type']); + $this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $body); + } + + public function testPostArray() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'body' => ['foo' => 'bar'], + ]); + + $this->assertSame(['foo' => 'bar', 'REQUEST_METHOD' => 'POST'], $response->toArray()); + } + + public function testPostResource() + { + $client = $this->getHttpClient(__FUNCTION__); + + $h = fopen('php://temp', 'w+'); + fwrite($h, 'foo=0123456789'); + rewind($h); + + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'body' => $h, + ]); + + $body = $response->toArray(); + + $this->assertSame(['foo' => '0123456789', 'REQUEST_METHOD' => 'POST'], $body); + } + + public function testPostCallback() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('POST', 'http://localhost:8057/post', [ + 'body' => function () { + yield 'foo'; + yield ''; + yield '='; + yield '0123456789'; + }, + ]); + + $this->assertSame(['foo' => '0123456789', 'REQUEST_METHOD' => 'POST'], $response->toArray()); + } + + public function testCancel() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-header'); + + $response->cancel(); + $this->expectException(TransportExceptionInterface::class); + $response->getHeaders(); + } + + public function testInfoOnCanceledResponse() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('GET', 'http://localhost:8057/timeout-header'); + + $this->assertFalse($response->getInfo('canceled')); + $response->cancel(); + $this->assertTrue($response->getInfo('canceled')); + } + + public function testCancelInStream() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/404'); + + foreach ($client->stream($response) as $chunk) { + $response->cancel(); + } + + $this->expectException(TransportExceptionInterface::class); + + foreach ($client->stream($response) as $chunk) { + } + } + + public function testOnProgressCancel() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body', [ + 'on_progress' => function ($dlNow) { + if (0 < $dlNow) { + throw new \Exception('Aborting the request.'); + } + }, + ]); + + try { + foreach ($client->stream([$response]) as $chunk) { + } + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (TransportExceptionInterface $e) { + $this->assertSame('Aborting the request.', $e->getPrevious()->getMessage()); + } + + $this->assertNotNull($response->getInfo('error')); + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testOnProgressError() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body', [ + 'on_progress' => function ($dlNow) { + if (0 < $dlNow) { + throw new \Error('BUG.'); + } + }, + ]); + + try { + foreach ($client->stream([$response]) as $chunk) { + } + $this->fail('Error expected'); + } catch (\Error $e) { + $this->assertSame('BUG.', $e->getMessage()); + } + + $this->assertNotNull($response->getInfo('error')); + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testResolve() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://symfony.com:8057/', [ + 'resolve' => ['symfony.com' => '127.0.0.1'], + ]); + + $this->assertSame(200, $response->getStatusCode()); + $this->assertSame(200, $client->request('GET', 'http://symfony.com:8057/')->getStatusCode()); + + $response = null; + $this->expectException(TransportExceptionInterface::class); + $client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]); + } + + public function testIdnResolve() + { + $client = $this->getHttpClient(__FUNCTION__); + + $response = $client->request('GET', 'http://0-------------------------------------------------------------0.com:8057/', [ + 'resolve' => ['0-------------------------------------------------------------0.com' => '127.0.0.1'], + ]); + + $this->assertSame(200, $response->getStatusCode()); + + $response = $client->request('GET', 'http://Bücher.example:8057/', [ + 'resolve' => ['xn--bcher-kva.example' => '127.0.0.1'], + ]); + + $this->assertSame(200, $response->getStatusCode()); + } + + public function testNotATimeout() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-header', [ + 'timeout' => 0.9, + ]); + sleep(1); + $this->assertSame(200, $response->getStatusCode()); + } + + public function testTimeoutOnAccess() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-header', [ + 'timeout' => 0.1, + ]); + + $this->expectException(TransportExceptionInterface::class); + $response->getHeaders(); + } + + public function testTimeoutIsNotAFatalError() + { + usleep(300000); // wait for the previous test to release the server + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body', [ + 'timeout' => 0.25, + ]); + + try { + $response->getContent(); + $this->fail(TimeoutExceptionInterface::class.' expected'); + } catch (TimeoutExceptionInterface $e) { + } + + for ($i = 0; $i < 10; ++$i) { + try { + $this->assertSame('<1><2>', $response->getContent()); + break; + } catch (TimeoutExceptionInterface $e) { + } + } + + if (10 === $i) { + throw $e; + } + } + + public function testTimeoutOnStream() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body'); + + $this->assertSame(200, $response->getStatusCode()); + $chunks = $client->stream([$response], 0.2); + + $result = []; + + foreach ($chunks as $r => $chunk) { + if ($chunk->isTimeout()) { + $result[] = 't'; + } else { + $result[] = $chunk->getContent(); + } + } + + $this->assertSame(['<1>', 't'], $result); + + $chunks = $client->stream([$response]); + + foreach ($chunks as $r => $chunk) { + $this->assertSame('<2>', $chunk->getContent()); + $this->assertSame('<1><2>', $r->getContent()); + + return; + } + + $this->fail('The response should have completed'); + } + + public function testUncheckedTimeoutThrows() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/timeout-body'); + $chunks = $client->stream([$response], 0.1); + + $this->expectException(TransportExceptionInterface::class); + + foreach ($chunks as $r => $chunk) { + } + } + + public function testTimeoutWithActiveConcurrentStream() + { + $p1 = TestHttpServer::start(8067); + $p2 = TestHttpServer::start(8077); + + $client = $this->getHttpClient(__FUNCTION__); + $streamingResponse = $client->request('GET', 'http://localhost:8067/max-duration'); + $blockingResponse = $client->request('GET', 'http://localhost:8077/timeout-body', [ + 'timeout' => 0.25, + ]); + + $this->assertSame(200, $streamingResponse->getStatusCode()); + $this->assertSame(200, $blockingResponse->getStatusCode()); + + $this->expectException(TransportExceptionInterface::class); + + try { + $blockingResponse->getContent(); + } finally { + $p1->stop(); + $p2->stop(); + } + } + + public function testTimeoutOnInitialize() + { + $p1 = TestHttpServer::start(8067); + $p2 = TestHttpServer::start(8077); + + $client = $this->getHttpClient(__FUNCTION__); + $start = microtime(true); + $responses = []; + + $responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]); + + try { + foreach ($responses as $response) { + try { + $response->getContent(); + $this->fail(TransportExceptionInterface::class.' expected'); + } catch (TransportExceptionInterface $e) { + } + } + $responses = []; + + $duration = microtime(true) - $start; + + $this->assertLessThan(1.0, $duration); + } finally { + $p1->stop(); + $p2->stop(); + } + } + + public function testTimeoutOnDestruct() + { + $p1 = TestHttpServer::start(8067); + $p2 = TestHttpServer::start(8077); + + $client = $this->getHttpClient(__FUNCTION__); + $start = microtime(true); + $responses = []; + + $responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8067/timeout-header', ['timeout' => 0.25]); + $responses[] = $client->request('GET', 'http://localhost:8077/timeout-header', ['timeout' => 0.25]); + + try { + while ($response = array_shift($responses)) { + try { + unset($response); + $this->fail(TransportExceptionInterface::class.' expected'); + } catch (TransportExceptionInterface $e) { + } + } + + $duration = microtime(true) - $start; + + $this->assertLessThan(1.0, $duration); + } finally { + $p1->stop(); + $p2->stop(); + } + } + + public function testDestruct() + { + $client = $this->getHttpClient(__FUNCTION__); + + $start = microtime(true); + $client->request('GET', 'http://localhost:8057/timeout-long'); + $client = null; + $duration = microtime(true) - $start; + + $this->assertGreaterThan(1, $duration); + $this->assertLessThan(4, $duration); + } + + public function testGetContentAfterDestruct() + { + $client = $this->getHttpClient(__FUNCTION__); + + try { + $client->request('GET', 'http://localhost:8057/404'); + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (ClientExceptionInterface $e) { + $this->assertSame('GET', $e->getResponse()->toArray(false)['REQUEST_METHOD']); + } + } + + public function testGetEncodedContentAfterDestruct() + { + $client = $this->getHttpClient(__FUNCTION__); + + try { + $client->request('GET', 'http://localhost:8057/404-gzipped'); + $this->fail(ClientExceptionInterface::class.' expected'); + } catch (ClientExceptionInterface $e) { + $this->assertSame('some text', $e->getResponse()->getContent(false)); + } + } + + public function testProxy() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/', [ + 'proxy' => 'http://localhost:8057', + ]); + + $body = $response->toArray(); + $this->assertSame('localhost:8057', $body['HTTP_HOST']); + $this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']); + + $response = $client->request('GET', 'http://localhost:8057/', [ + 'proxy' => 'http://foo:b%3Dar@localhost:8057', + ]); + + $body = $response->toArray(); + $this->assertSame('Basic Zm9vOmI9YXI=', $body['HTTP_PROXY_AUTHORIZATION']); + + $_SERVER['http_proxy'] = 'http://localhost:8057'; + try { + $response = $client->request('GET', 'http://localhost:8057/'); + $body = $response->toArray(); + $this->assertSame('localhost:8057', $body['HTTP_HOST']); + $this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']); + } finally { + unset($_SERVER['http_proxy']); + } + } + + public function testNoProxy() + { + putenv('no_proxy='.$_SERVER['no_proxy'] = 'example.com, localhost'); + + try { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/', [ + 'proxy' => 'http://localhost:8057', + ]); + + $body = $response->toArray(); + + $this->assertSame('HTTP/1.1', $body['SERVER_PROTOCOL']); + $this->assertSame('/', $body['REQUEST_URI']); + $this->assertSame('GET', $body['REQUEST_METHOD']); + } finally { + putenv('no_proxy'); + unset($_SERVER['no_proxy']); + } + } + + /** + * @requires extension zlib + */ + public function testAutoEncodingRequest() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057'); + + $this->assertSame(200, $response->getStatusCode()); + + $headers = $response->getHeaders(); + + $this->assertSame(['Accept-Encoding'], $headers['vary']); + $this->assertStringContainsString('gzip', $headers['content-encoding'][0]); + + $body = $response->toArray(); + + $this->assertStringContainsString('gzip', $body['HTTP_ACCEPT_ENCODING']); + } + + public function testBaseUri() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', '../404', [ + 'base_uri' => 'http://localhost:8057/abc/', + ]); + + $this->assertSame(404, $response->getStatusCode()); + $this->assertSame(['application/json'], $response->getHeaders(false)['content-type']); + } + + public function testQuery() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/?a=a', [ + 'query' => ['b' => 'b'], + ]); + + $body = $response->toArray(); + $this->assertSame('GET', $body['REQUEST_METHOD']); + $this->assertSame('/?a=a&b=b', $body['REQUEST_URI']); + } + + public function testInformationalResponse() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/103'); + + $this->assertSame('Here the body', $response->getContent()); + $this->assertSame(200, $response->getStatusCode()); + } + + public function testInformationalResponseStream() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/103'); + + $chunks = []; + foreach ($client->stream($response) as $chunk) { + $chunks[] = $chunk; + } + + $this->assertSame(103, $chunks[0]->getInformationalStatus()[0]); + $this->assertSame(['; rel=preload; as=style', '; rel=preload; as=script'], $chunks[0]->getInformationalStatus()[1]['link']); + $this->assertTrue($chunks[1]->isFirst()); + $this->assertSame('Here the body', $chunks[2]->getContent()); + $this->assertTrue($chunks[3]->isLast()); + $this->assertNull($chunks[3]->getInformationalStatus()); + + $this->assertSame(['date', 'content-length'], array_keys($response->getHeaders())); + $this->assertContains('Link: ; rel=preload; as=style', $response->getInfo('response_headers')); + } + + /** + * @requires extension zlib + */ + public function testUserlandEncodingRequest() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057', [ + 'headers' => ['Accept-Encoding' => 'gzip'], + ]); + + $headers = $response->getHeaders(); + + $this->assertSame(['Accept-Encoding'], $headers['vary']); + $this->assertStringContainsString('gzip', $headers['content-encoding'][0]); + + $body = $response->getContent(); + $this->assertSame("\x1F", $body[0]); + + $body = json_decode(gzdecode($body), true); + $this->assertSame('gzip', $body['HTTP_ACCEPT_ENCODING']); + } + + /** + * @requires extension zlib + */ + public function testGzipBroken() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/gzip-broken'); + + $this->expectException(TransportExceptionInterface::class); + $response->getContent(); + } + + public function testMaxDuration() + { + $client = $this->getHttpClient(__FUNCTION__); + $response = $client->request('GET', 'http://localhost:8057/max-duration', [ + 'max_duration' => 0.1, + ]); + + $start = microtime(true); + + try { + $response->getContent(); + } catch (TransportExceptionInterface $e) { + $this->addToAssertionCount(1); + } + + $duration = microtime(true) - $start; + + $this->assertLessThan(10, $duration); + } + + public function testWithOptions() + { + $client = $this->getHttpClient(__FUNCTION__); + if (!method_exists($client, 'withOptions')) { + $this->markTestSkipped(sprintf('Not implementing "%s::withOptions()" is deprecated.', get_debug_type($client))); + } + + $client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']); + + $this->assertNotSame($client, $client2); + $this->assertSame(\get_class($client), \get_class($client2)); + + $response = $client2->request('GET', '/'); + $this->assertSame(200, $response->getStatusCode()); + } +} diff --git a/vendor/symfony/http-client-contracts/Test/TestHttpServer.php b/vendor/symfony/http-client-contracts/Test/TestHttpServer.php new file mode 100644 index 0000000..55a744a --- /dev/null +++ b/vendor/symfony/http-client-contracts/Test/TestHttpServer.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\HttpClient\Test; + +use Symfony\Component\Process\PhpExecutableFinder; +use Symfony\Component\Process\Process; + +class TestHttpServer +{ + private static $process = []; + + /** + * @return Process + */ + public static function start(int $port = 8057) + { + if (isset(self::$process[$port])) { + self::$process[$port]->stop(); + } else { + register_shutdown_function(static function () use ($port) { + self::$process[$port]->stop(); + }); + } + + $finder = new PhpExecutableFinder(); + $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port])); + $process->setWorkingDirectory(__DIR__.'/Fixtures/web'); + $process->start(); + self::$process[$port] = $process; + + do { + usleep(50000); + } while (!@fopen('http://127.0.0.1:'.$port, 'r')); + + return $process; + } +} diff --git a/vendor/symfony/http-client-contracts/composer.json b/vendor/symfony/http-client-contracts/composer.json new file mode 100644 index 0000000..b76cab8 --- /dev/null +++ b/vendor/symfony/http-client-contracts/composer.json @@ -0,0 +1,37 @@ +{ + "name": "symfony/http-client-contracts", + "type": "library", + "description": "Generic abstractions related to HTTP clients", + "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/http-client-implementation": "" + }, + "autoload": { + "psr-4": { "Symfony\\Contracts\\HttpClient\\": "" } + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/vendor/symfony/http-client/AmpHttpClient.php b/vendor/symfony/http-client/AmpHttpClient.php new file mode 100644 index 0000000..96a5e0a --- /dev/null +++ b/vendor/symfony/http-client/AmpHttpClient.php @@ -0,0 +1,176 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Amp\CancelledException; +use Amp\Http\Client\DelegateHttpClient; +use Amp\Http\Client\InterceptedHttpClient; +use Amp\Http\Client\PooledHttpClient; +use Amp\Http\Client\Request; +use Amp\Http\Tunnel\Http1TunnelConnector; +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerAwareTrait; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\AmpClientState; +use Symfony\Component\HttpClient\Response\AmpResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +if (!interface_exists(DelegateHttpClient::class)) { + throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client".'); +} + +/** + * A portable implementation of the HttpClientInterface contracts based on Amp's HTTP client. + * + * @author Nicolas Grekas + */ +final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface +{ + use HttpClientTrait; + use LoggerAwareTrait; + + private $defaultOptions = self::OPTIONS_DEFAULTS; + private static $emptyDefaults = self::OPTIONS_DEFAULTS; + + /** @var AmpClientState */ + private $multi; + + /** + * @param array $defaultOptions Default requests' options + * @param callable $clientConfigurator A callable that builds a {@see DelegateHttpClient} from a {@see PooledHttpClient}; + * passing null builds an {@see InterceptedHttpClient} with 2 retries on failures + * @param int $maxHostConnections The maximum number of connections to a single host + * @param int $maxPendingPushes The maximum number of pushed responses to accept in the queue + * + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + */ + public function __construct(array $defaultOptions = [], callable $clientConfigurator = null, int $maxHostConnections = 6, int $maxPendingPushes = 50) + { + $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + + if ($defaultOptions) { + [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); + } + + $this->multi = new AmpClientState($clientConfigurator, $maxHostConnections, $maxPendingPushes, $this->logger); + } + + /** + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + * + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + [$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions); + + $options['proxy'] = self::getProxy($options['proxy'], $url, $options['no_proxy']); + + if (null !== $options['proxy'] && !class_exists(Http1TunnelConnector::class)) { + throw new \LogicException('You cannot use the "proxy" option as the "amphp/http-tunnel" package is not installed. Try running "composer require amphp/http-tunnel".'); + } + + if ($options['bindto']) { + if (0 === strpos($options['bindto'], 'if!')) { + throw new TransportException(__CLASS__.' cannot bind to network interfaces, use e.g. CurlHttpClient instead.'); + } + if (0 === strpos($options['bindto'], 'host!')) { + $options['bindto'] = substr($options['bindto'], 5); + } + } + + if (('' !== $options['body'] || 'POST' === $method || isset($options['normalized_headers']['content-length'])) && !isset($options['normalized_headers']['content-type'])) { + $options['headers'][] = 'Content-Type: application/x-www-form-urlencoded'; + } + + if (!isset($options['normalized_headers']['user-agent'])) { + $options['headers'][] = 'User-Agent: Symfony HttpClient/Amp'; + } + + if (0 < $options['max_duration']) { + $options['timeout'] = min($options['max_duration'], $options['timeout']); + } + + if ($options['resolve']) { + $this->multi->dnsCache = $options['resolve'] + $this->multi->dnsCache; + } + + if ($options['peer_fingerprint'] && !isset($options['peer_fingerprint']['pin-sha256'])) { + throw new TransportException(__CLASS__.' supports only "pin-sha256" fingerprints.'); + } + + $request = new Request(implode('', $url), $method); + + if ($options['http_version']) { + switch ((float) $options['http_version']) { + case 1.0: $request->setProtocolVersions(['1.0']); break; + case 1.1: $request->setProtocolVersions(['1.1', '1.0']); break; + default: $request->setProtocolVersions(['2', '1.1', '1.0']); break; + } + } + + foreach ($options['headers'] as $v) { + $h = explode(': ', $v, 2); + $request->addHeader($h[0], $h[1]); + } + + $request->setTcpConnectTimeout(1000 * $options['timeout']); + $request->setTlsHandshakeTimeout(1000 * $options['timeout']); + $request->setTransferTimeout(1000 * $options['max_duration']); + if (method_exists($request, 'setInactivityTimeout')) { + $request->setInactivityTimeout(0); + } + + if ('' !== $request->getUri()->getUserInfo() && !$request->hasHeader('authorization')) { + $auth = explode(':', $request->getUri()->getUserInfo(), 2); + $auth = array_map('rawurldecode', $auth) + [1 => '']; + $request->setHeader('Authorization', 'Basic '.base64_encode(implode(':', $auth))); + } + + return new AmpResponse($this->multi, $request, $options, $this->logger); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof AmpResponse) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of AmpResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + return new ResponseStream(AmpResponse::stream($responses, $timeout)); + } + + public function reset() + { + $this->multi->dnsCache = []; + + foreach ($this->multi->pushedResponses as $authority => $pushedResponses) { + foreach ($pushedResponses as [$pushedUrl, $pushDeferred]) { + $pushDeferred->fail(new CancelledException()); + + if ($this->logger) { + $this->logger->debug(sprintf('Unused pushed response: "%s"', $pushedUrl)); + } + } + } + + $this->multi->pushedResponses = []; + } +} diff --git a/vendor/symfony/http-client/AsyncDecoratorTrait.php b/vendor/symfony/http-client/AsyncDecoratorTrait.php new file mode 100644 index 0000000..aff402d --- /dev/null +++ b/vendor/symfony/http-client/AsyncDecoratorTrait.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Component\HttpClient\Response\AsyncResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; + +/** + * Eases with processing responses while streaming them. + * + * @author Nicolas Grekas + */ +trait AsyncDecoratorTrait +{ + use DecoratorTrait; + + /** + * {@inheritdoc} + * + * @return AsyncResponse + */ + abstract public function request(string $method, string $url, array $options = []): ResponseInterface; + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof AsyncResponse) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of AsyncResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + return new ResponseStream(AsyncResponse::stream($responses, $timeout, static::class)); + } +} diff --git a/vendor/symfony/http-client/CHANGELOG.md b/vendor/symfony/http-client/CHANGELOG.md new file mode 100644 index 0000000..7c2fc22 --- /dev/null +++ b/vendor/symfony/http-client/CHANGELOG.md @@ -0,0 +1,54 @@ +CHANGELOG +========= + +5.4 +--- + + * Add `MockHttpClient::setResponseFactory()` method to be able to set response factory after client creating + +5.3 +--- + + * Implement `HttpClientInterface::withOptions()` from `symfony/contracts` v2.4 + * Add `DecoratorTrait` to ease writing simple decorators + +5.2.0 +----- + + * added `AsyncDecoratorTrait` to ease processing responses without breaking async + * added support for pausing responses with a new `pause_handler` callable exposed as an info item + * added `StreamableInterface` to ease turning responses into PHP streams + * added `MockResponse::getRequestMethod()` and `getRequestUrl()` to allow inspecting which request has been sent + * added `EventSourceHttpClient` a Server-Sent events stream implementing the [EventSource specification](https://www.w3.org/TR/eventsource/#eventsource) + * added option "extra.curl" to allow setting additional curl options in `CurlHttpClient` + * added `RetryableHttpClient` to automatically retry failed HTTP requests. + * added `extra.trace_content` option to `TraceableHttpClient` to prevent it from keeping the content in memory + +5.1.0 +----- + + * added `NoPrivateNetworkHttpClient` decorator + * added `AmpHttpClient`, a portable HTTP/2 implementation based on Amp + * added `LoggerAwareInterface` to `ScopingHttpClient` and `TraceableHttpClient` + * made `HttpClient::create()` return an `AmpHttpClient` when `amphp/http-client` is found but curl is not or too old + +4.4.0 +----- + + * added `canceled` to `ResponseInterface::getInfo()` + * added `HttpClient::createForBaseUri()` + * added `HttplugClient` with support for sync and async requests + * added `max_duration` option + * added support for NTLM authentication + * added `StreamWrapper` to cast any `ResponseInterface` instances to PHP streams. + * added `$response->toStream()` to cast responses to regular PHP streams + * made `Psr18Client` implement relevant PSR-17 factories and have streaming responses + * added `TraceableHttpClient`, `HttpClientDataCollector` and `HttpClientPass` to integrate with the web profiler + * allow enabling buffering conditionally with a Closure + * allow option "buffer" to be a stream resource + * allow arbitrary values for the "json" option + +4.3.0 +----- + + * added the component diff --git a/vendor/symfony/http-client/CachingHttpClient.php b/vendor/symfony/http-client/CachingHttpClient.php new file mode 100644 index 0000000..e1d7023 --- /dev/null +++ b/vendor/symfony/http-client/CachingHttpClient.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Component\HttpClient\Response\MockResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpCache\HttpCache; +use Symfony\Component\HttpKernel\HttpCache\StoreInterface; +use Symfony\Component\HttpKernel\HttpClientKernel; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Adds caching on top of an HTTP client. + * + * The implementation buffers responses in memory and doesn't stream directly from the network. + * You can disable/enable this layer by setting option "no_cache" under "extra" to true/false. + * By default, caching is enabled unless the "buffer" option is set to false. + * + * @author Nicolas Grekas + */ +class CachingHttpClient implements HttpClientInterface, ResetInterface +{ + use HttpClientTrait; + + private $client; + private $cache; + private $defaultOptions = self::OPTIONS_DEFAULTS; + + public function __construct(HttpClientInterface $client, StoreInterface $store, array $defaultOptions = []) + { + if (!class_exists(HttpClientKernel::class)) { + throw new \LogicException(sprintf('Using "%s" requires that the HttpKernel component version 4.3 or higher is installed, try running "composer require symfony/http-kernel:^5.4".', __CLASS__)); + } + + $this->client = $client; + $kernel = new HttpClientKernel($client); + $this->cache = new HttpCache($kernel, $store, null, $defaultOptions); + + unset($defaultOptions['debug']); + unset($defaultOptions['default_ttl']); + unset($defaultOptions['private_headers']); + unset($defaultOptions['allow_reload']); + unset($defaultOptions['allow_revalidate']); + unset($defaultOptions['stale_while_revalidate']); + unset($defaultOptions['stale_if_error']); + unset($defaultOptions['trace_level']); + unset($defaultOptions['trace_header']); + + if ($defaultOptions) { + [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); + } + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + [$url, $options] = $this->prepareRequest($method, $url, $options, $this->defaultOptions, true); + $url = implode('', $url); + + if (!empty($options['body']) || !empty($options['extra']['no_cache']) || !\in_array($method, ['GET', 'HEAD', 'OPTIONS'])) { + return $this->client->request($method, $url, $options); + } + + $request = Request::create($url, $method); + $request->attributes->set('http_client_options', $options); + + foreach ($options['normalized_headers'] as $name => $values) { + if ('cookie' !== $name) { + foreach ($values as $value) { + $request->headers->set($name, substr($value, 2 + \strlen($name)), false); + } + + continue; + } + + foreach ($values as $cookies) { + foreach (explode('; ', substr($cookies, \strlen('Cookie: '))) as $cookie) { + if ('' !== $cookie) { + $cookie = explode('=', $cookie, 2); + $request->cookies->set($cookie[0], $cookie[1] ?? ''); + } + } + } + } + + $response = $this->cache->handle($request); + $response = new MockResponse($response->getContent(), [ + 'http_code' => $response->getStatusCode(), + 'response_headers' => $response->headers->allPreserveCase(), + ]); + + return MockResponse::fromRequest($method, $url, $options, $response); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof ResponseInterface) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of ResponseInterface objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + $mockResponses = []; + $clientResponses = []; + + foreach ($responses as $response) { + if ($response instanceof MockResponse) { + $mockResponses[] = $response; + } else { + $clientResponses[] = $response; + } + } + + if (!$mockResponses) { + return $this->client->stream($clientResponses, $timeout); + } + + if (!$clientResponses) { + return new ResponseStream(MockResponse::stream($mockResponses, $timeout)); + } + + return new ResponseStream((function () use ($mockResponses, $clientResponses, $timeout) { + yield from MockResponse::stream($mockResponses, $timeout); + yield $this->client->stream($clientResponses, $timeout); + })()); + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } +} diff --git a/vendor/symfony/http-client/Chunk/DataChunk.php b/vendor/symfony/http-client/Chunk/DataChunk.php new file mode 100644 index 0000000..37ca848 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/DataChunk.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +use Symfony\Contracts\HttpClient\ChunkInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class DataChunk implements ChunkInterface +{ + private $offset = 0; + private $content = ''; + + public function __construct(int $offset = 0, string $content = '') + { + $this->offset = $offset; + $this->content = $content; + } + + /** + * {@inheritdoc} + */ + public function isTimeout(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isFirst(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function isLast(): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getInformationalStatus(): ?array + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getContent(): string + { + return $this->content; + } + + /** + * {@inheritdoc} + */ + public function getOffset(): int + { + return $this->offset; + } + + /** + * {@inheritdoc} + */ + public function getError(): ?string + { + return null; + } +} diff --git a/vendor/symfony/http-client/Chunk/ErrorChunk.php b/vendor/symfony/http-client/Chunk/ErrorChunk.php new file mode 100644 index 0000000..a19f433 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/ErrorChunk.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +use Symfony\Component\HttpClient\Exception\TimeoutException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Contracts\HttpClient\ChunkInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class ErrorChunk implements ChunkInterface +{ + private $didThrow = false; + private $offset; + private $errorMessage; + private $error; + + /** + * @param \Throwable|string $error + */ + public function __construct(int $offset, $error) + { + $this->offset = $offset; + + if (\is_string($error)) { + $this->errorMessage = $error; + } else { + $this->error = $error; + $this->errorMessage = $error->getMessage(); + } + } + + /** + * {@inheritdoc} + */ + public function isTimeout(): bool + { + $this->didThrow = true; + + if (null !== $this->error) { + throw new TransportException($this->errorMessage, 0, $this->error); + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function isFirst(): bool + { + $this->didThrow = true; + throw null !== $this->error ? new TransportException($this->errorMessage, 0, $this->error) : new TimeoutException($this->errorMessage); + } + + /** + * {@inheritdoc} + */ + public function isLast(): bool + { + $this->didThrow = true; + throw null !== $this->error ? new TransportException($this->errorMessage, 0, $this->error) : new TimeoutException($this->errorMessage); + } + + /** + * {@inheritdoc} + */ + public function getInformationalStatus(): ?array + { + $this->didThrow = true; + throw null !== $this->error ? new TransportException($this->errorMessage, 0, $this->error) : new TimeoutException($this->errorMessage); + } + + /** + * {@inheritdoc} + */ + public function getContent(): string + { + $this->didThrow = true; + throw null !== $this->error ? new TransportException($this->errorMessage, 0, $this->error) : new TimeoutException($this->errorMessage); + } + + /** + * {@inheritdoc} + */ + public function getOffset(): int + { + return $this->offset; + } + + /** + * {@inheritdoc} + */ + public function getError(): ?string + { + return $this->errorMessage; + } + + /** + * @return bool Whether the wrapped error has been thrown or not + */ + public function didThrow(bool $didThrow = null): bool + { + if (null !== $didThrow && $this->didThrow !== $didThrow) { + return !$this->didThrow = $didThrow; + } + + return $this->didThrow; + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + public function __destruct() + { + if (!$this->didThrow) { + $this->didThrow = true; + throw null !== $this->error ? new TransportException($this->errorMessage, 0, $this->error) : new TimeoutException($this->errorMessage); + } + } +} diff --git a/vendor/symfony/http-client/Chunk/FirstChunk.php b/vendor/symfony/http-client/Chunk/FirstChunk.php new file mode 100644 index 0000000..d891ca8 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/FirstChunk.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class FirstChunk extends DataChunk +{ + /** + * {@inheritdoc} + */ + public function isFirst(): bool + { + return true; + } +} diff --git a/vendor/symfony/http-client/Chunk/InformationalChunk.php b/vendor/symfony/http-client/Chunk/InformationalChunk.php new file mode 100644 index 0000000..c4452f1 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/InformationalChunk.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class InformationalChunk extends DataChunk +{ + private $status; + + public function __construct(int $statusCode, array $headers) + { + $this->status = [$statusCode, $headers]; + } + + /** + * {@inheritdoc} + */ + public function getInformationalStatus(): ?array + { + return $this->status; + } +} diff --git a/vendor/symfony/http-client/Chunk/LastChunk.php b/vendor/symfony/http-client/Chunk/LastChunk.php new file mode 100644 index 0000000..84095d3 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/LastChunk.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class LastChunk extends DataChunk +{ + /** + * {@inheritdoc} + */ + public function isLast(): bool + { + return true; + } +} diff --git a/vendor/symfony/http-client/Chunk/ServerSentEvent.php b/vendor/symfony/http-client/Chunk/ServerSentEvent.php new file mode 100644 index 0000000..f7ff4b9 --- /dev/null +++ b/vendor/symfony/http-client/Chunk/ServerSentEvent.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Chunk; + +use Symfony\Contracts\HttpClient\ChunkInterface; + +/** + * @author Antoine Bluchet + * @author Nicolas Grekas + */ +final class ServerSentEvent extends DataChunk implements ChunkInterface +{ + private $data = ''; + private $id = ''; + private $type = 'message'; + private $retry = 0; + + public function __construct(string $content) + { + parent::__construct(-1, $content); + + // remove BOM + if (0 === strpos($content, "\xEF\xBB\xBF")) { + $content = substr($content, 3); + } + + foreach (preg_split("/(?:\r\n|[\r\n])/", $content) as $line) { + if (0 === $i = strpos($line, ':')) { + continue; + } + + $i = false === $i ? \strlen($line) : $i; + $field = substr($line, 0, $i); + $i += 1 + (' ' === ($line[1 + $i] ?? '')); + + switch ($field) { + case 'id': $this->id = substr($line, $i); break; + case 'event': $this->type = substr($line, $i); break; + case 'data': $this->data .= ('' === $this->data ? '' : "\n").substr($line, $i); break; + case 'retry': + $retry = substr($line, $i); + + if ('' !== $retry && \strlen($retry) === strspn($retry, '0123456789')) { + $this->retry = $retry / 1000.0; + } + break; + } + } + } + + public function getId(): string + { + return $this->id; + } + + public function getType(): string + { + return $this->type; + } + + public function getData(): string + { + return $this->data; + } + + public function getRetry(): float + { + return $this->retry; + } +} diff --git a/vendor/symfony/http-client/CurlHttpClient.php b/vendor/symfony/http-client/CurlHttpClient.php new file mode 100644 index 0000000..d50f324 --- /dev/null +++ b/vendor/symfony/http-client/CurlHttpClient.php @@ -0,0 +1,551 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\CurlClientState; +use Symfony\Component\HttpClient\Internal\PushedResponse; +use Symfony\Component\HttpClient\Response\CurlResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * A performant implementation of the HttpClientInterface contracts based on the curl extension. + * + * This provides fully concurrent HTTP requests, with transparent + * HTTP/2 push when a curl version that supports it is installed. + * + * @author Nicolas Grekas + */ +final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface +{ + use HttpClientTrait; + + private $defaultOptions = self::OPTIONS_DEFAULTS + [ + 'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the + // password as the second one; or string like username:password - enabling NTLM auth + 'extra' => [ + 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* + ], + ]; + private static $emptyDefaults = self::OPTIONS_DEFAULTS + ['auth_ntlm' => null]; + + /** + * @var LoggerInterface|null + */ + private $logger; + + /** + * An internal object to share state between the client and its responses. + * + * @var CurlClientState + */ + private $multi; + + /** + * @param array $defaultOptions Default request's options + * @param int $maxHostConnections The maximum number of connections to a single host + * @param int $maxPendingPushes The maximum number of pushed responses to accept in the queue + * + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + */ + public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50) + { + if (!\extension_loaded('curl')) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.'); + } + + $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + + if ($defaultOptions) { + [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); + } + + $this->multi = new CurlClientState($maxHostConnections, $maxPendingPushes); + } + + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $this->multi->logger = $logger; + } + + /** + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + * + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + [$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions); + $scheme = $url['scheme']; + $authority = $url['authority']; + $host = parse_url($authority, \PHP_URL_HOST); + $proxy = $options['proxy'] + ?? ('https:' === $url['scheme'] ? $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? null : null) + // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities + ?? $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null; + $url = implode('', $url); + + if (!isset($options['normalized_headers']['user-agent'])) { + $options['headers'][] = 'User-Agent: Symfony HttpClient/Curl'; + } + + $curlopts = [ + \CURLOPT_URL => $url, + \CURLOPT_TCP_NODELAY => true, + \CURLOPT_PROTOCOLS => \CURLPROTO_HTTP | \CURLPROTO_HTTPS, + \CURLOPT_REDIR_PROTOCOLS => \CURLPROTO_HTTP | \CURLPROTO_HTTPS, + \CURLOPT_FOLLOWLOCATION => true, + \CURLOPT_MAXREDIRS => 0 < $options['max_redirects'] ? $options['max_redirects'] : 0, + \CURLOPT_COOKIEFILE => '', // Keep track of cookies during redirects + \CURLOPT_TIMEOUT => 0, + \CURLOPT_PROXY => $proxy, + \CURLOPT_NOPROXY => $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '', + \CURLOPT_SSL_VERIFYPEER => $options['verify_peer'], + \CURLOPT_SSL_VERIFYHOST => $options['verify_host'] ? 2 : 0, + \CURLOPT_CAINFO => $options['cafile'], + \CURLOPT_CAPATH => $options['capath'], + \CURLOPT_SSL_CIPHER_LIST => $options['ciphers'], + \CURLOPT_SSLCERT => $options['local_cert'], + \CURLOPT_SSLKEY => $options['local_pk'], + \CURLOPT_KEYPASSWD => $options['passphrase'], + \CURLOPT_CERTINFO => $options['capture_peer_cert_chain'], + ]; + + if (1.0 === (float) $options['http_version']) { + $curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; + } elseif (1.1 === (float) $options['http_version']) { + $curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + } elseif (\defined('CURL_VERSION_HTTP2') && (\CURL_VERSION_HTTP2 & CurlClientState::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) { + $curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; + } + + if (isset($options['auth_ntlm'])) { + $curlopts[\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM; + $curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + + if (\is_array($options['auth_ntlm'])) { + $count = \count($options['auth_ntlm']); + if ($count <= 0 || $count > 2) { + throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must contain 1 or 2 elements, %d given.', $count)); + } + + $options['auth_ntlm'] = implode(':', $options['auth_ntlm']); + } + + if (!\is_string($options['auth_ntlm'])) { + throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be a string or an array, "%s" given.', get_debug_type($options['auth_ntlm']))); + } + + $curlopts[\CURLOPT_USERPWD] = $options['auth_ntlm']; + } + + if (!\ZEND_THREAD_SAFE) { + $curlopts[\CURLOPT_DNS_USE_GLOBAL_CACHE] = false; + } + + if (\defined('CURLOPT_HEADEROPT') && \defined('CURLHEADER_SEPARATE')) { + $curlopts[\CURLOPT_HEADEROPT] = \CURLHEADER_SEPARATE; + } + + // curl's resolve feature varies by host:port but ours varies by host only, let's handle this with our own DNS map + if (isset($this->multi->dnsCache->hostnames[$host])) { + $options['resolve'] += [$host => $this->multi->dnsCache->hostnames[$host]]; + } + + if ($options['resolve'] || $this->multi->dnsCache->evictions) { + // First reset any old DNS cache entries then add the new ones + $resolve = $this->multi->dnsCache->evictions; + $this->multi->dnsCache->evictions = []; + $port = parse_url($authority, \PHP_URL_PORT) ?: ('http:' === $scheme ? 80 : 443); + + if ($resolve && 0x072A00 > CurlClientState::$curlVersion['version_number']) { + // DNS cache removals require curl 7.42 or higher + $this->multi->reset(); + } + + foreach ($options['resolve'] as $host => $ip) { + $resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip"; + $this->multi->dnsCache->hostnames[$host] = $ip; + $this->multi->dnsCache->removals["-$host:$port"] = "-$host:$port"; + } + + $curlopts[\CURLOPT_RESOLVE] = $resolve; + } + + if ('POST' === $method) { + // Use CURLOPT_POST to have browser-like POST-to-GET redirects for 301, 302 and 303 + $curlopts[\CURLOPT_POST] = true; + } elseif ('HEAD' === $method) { + $curlopts[\CURLOPT_NOBODY] = true; + } else { + $curlopts[\CURLOPT_CUSTOMREQUEST] = $method; + } + + if ('\\' !== \DIRECTORY_SEPARATOR && $options['timeout'] < 1) { + $curlopts[\CURLOPT_NOSIGNAL] = true; + } + + if (\extension_loaded('zlib') && !isset($options['normalized_headers']['accept-encoding'])) { + $options['headers'][] = 'Accept-Encoding: gzip'; // Expose only one encoding, some servers mess up when more are provided + } + + foreach ($options['headers'] as $header) { + if (':' === $header[-2] && \strlen($header) - 2 === strpos($header, ': ')) { + // curl requires a special syntax to send empty headers + $curlopts[\CURLOPT_HTTPHEADER][] = substr_replace($header, ';', -2); + } else { + $curlopts[\CURLOPT_HTTPHEADER][] = $header; + } + } + + // Prevent curl from sending its default Accept and Expect headers + foreach (['accept', 'expect'] as $header) { + if (!isset($options['normalized_headers'][$header][0])) { + $curlopts[\CURLOPT_HTTPHEADER][] = $header.':'; + } + } + + if (!\is_string($body = $options['body'])) { + if (\is_resource($body)) { + $curlopts[\CURLOPT_INFILE] = $body; + } else { + $eof = false; + $buffer = ''; + $curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body, &$buffer, &$eof) { + return self::readRequestBody($length, $body, $buffer, $eof); + }; + } + + if (isset($options['normalized_headers']['content-length'][0])) { + $curlopts[\CURLOPT_INFILESIZE] = substr($options['normalized_headers']['content-length'][0], \strlen('Content-Length: ')); + } elseif (!isset($options['normalized_headers']['transfer-encoding'])) { + $curlopts[\CURLOPT_HTTPHEADER][] = 'Transfer-Encoding: chunked'; // Enable chunked request bodies + } + + if ('POST' !== $method) { + $curlopts[\CURLOPT_UPLOAD] = true; + + if (!isset($options['normalized_headers']['content-type'])) { + $curlopts[\CURLOPT_HTTPHEADER][] = 'Content-Type: application/x-www-form-urlencoded'; + } + } + } elseif ('' !== $body || 'POST' === $method) { + $curlopts[\CURLOPT_POSTFIELDS] = $body; + } + + if ($options['peer_fingerprint']) { + if (!isset($options['peer_fingerprint']['pin-sha256'])) { + throw new TransportException(__CLASS__.' supports only "pin-sha256" fingerprints.'); + } + + $curlopts[\CURLOPT_PINNEDPUBLICKEY] = 'sha256//'.implode(';sha256//', $options['peer_fingerprint']['pin-sha256']); + } + + if ($options['bindto']) { + if (file_exists($options['bindto'])) { + $curlopts[\CURLOPT_UNIX_SOCKET_PATH] = $options['bindto']; + } elseif (!str_starts_with($options['bindto'], 'if!') && preg_match('/^(.*):(\d+)$/', $options['bindto'], $matches)) { + $curlopts[\CURLOPT_INTERFACE] = $matches[1]; + $curlopts[\CURLOPT_LOCALPORT] = $matches[2]; + } else { + $curlopts[\CURLOPT_INTERFACE] = $options['bindto']; + } + } + + if (0 < $options['max_duration']) { + $curlopts[\CURLOPT_TIMEOUT_MS] = 1000 * $options['max_duration']; + } + + if (!empty($options['extra']['curl']) && \is_array($options['extra']['curl'])) { + $this->validateExtraCurlOptions($options['extra']['curl']); + $curlopts += $options['extra']['curl']; + } + + if ($pushedResponse = $this->multi->pushedResponses[$url] ?? null) { + unset($this->multi->pushedResponses[$url]); + + if (self::acceptPushForRequest($method, $options, $pushedResponse)) { + $this->logger && $this->logger->debug(sprintf('Accepting pushed response: "%s %s"', $method, $url)); + + // Reinitialize the pushed response with request's options + $ch = $pushedResponse->handle; + $pushedResponse = $pushedResponse->response; + $pushedResponse->__construct($this->multi, $url, $options, $this->logger); + } else { + $this->logger && $this->logger->debug(sprintf('Rejecting pushed response: "%s"', $url)); + $pushedResponse = null; + } + } + + if (!$pushedResponse) { + $ch = curl_init(); + $this->logger && $this->logger->info(sprintf('Request: "%s %s"', $method, $url)); + $curlopts += [\CURLOPT_SHARE => $this->multi->share]; + } + + foreach ($curlopts as $opt => $value) { + if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) { + $constantName = $this->findConstantName($opt); + throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt)); + } + } + + return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host), CurlClientState::$curlVersion['version_number']); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof CurlResponse) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of CurlResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + if (\is_resource($this->multi->handle) || $this->multi->handle instanceof \CurlMultiHandle) { + $active = 0; + while (\CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active)) { + } + } + + return new ResponseStream(CurlResponse::stream($responses, $timeout)); + } + + public function reset() + { + $this->multi->reset(); + } + + /** + * Accepts pushed responses only if their headers related to authentication match the request. + */ + private static function acceptPushForRequest(string $method, array $options, PushedResponse $pushedResponse): bool + { + if ('' !== $options['body'] || $method !== $pushedResponse->requestHeaders[':method'][0]) { + return false; + } + + foreach (['proxy', 'no_proxy', 'bindto', 'local_cert', 'local_pk'] as $k) { + if ($options[$k] !== $pushedResponse->parentOptions[$k]) { + return false; + } + } + + foreach (['authorization', 'cookie', 'range', 'proxy-authorization'] as $k) { + $normalizedHeaders = $options['normalized_headers'][$k] ?? []; + foreach ($normalizedHeaders as $i => $v) { + $normalizedHeaders[$i] = substr($v, \strlen($k) + 2); + } + + if (($pushedResponse->requestHeaders[$k] ?? []) !== $normalizedHeaders) { + return false; + } + } + + return true; + } + + /** + * Wraps the request's body callback to allow it to return strings longer than curl requested. + */ + private static function readRequestBody(int $length, \Closure $body, string &$buffer, bool &$eof): string + { + if (!$eof && \strlen($buffer) < $length) { + if (!\is_string($data = $body($length))) { + throw new TransportException(sprintf('The return value of the "body" option callback must be a string, "%s" returned.', get_debug_type($data))); + } + + $buffer .= $data; + $eof = '' === $data; + } + + $data = substr($buffer, 0, $length); + $buffer = substr($buffer, $length); + + return $data; + } + + /** + * Resolves relative URLs on redirects and deals with authentication headers. + * + * Work around CVE-2018-1000007: Authorization and Cookie headers should not follow redirects - fixed in Curl 7.64 + */ + private static function createRedirectResolver(array $options, string $host): \Closure + { + $redirectHeaders = []; + if (0 < $options['max_redirects']) { + $redirectHeaders['host'] = $host; + $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = array_filter($options['headers'], static function ($h) { + return 0 !== stripos($h, 'Host:'); + }); + + if (isset($options['normalized_headers']['authorization'][0]) || isset($options['normalized_headers']['cookie'][0])) { + $redirectHeaders['no_auth'] = array_filter($options['headers'], static function ($h) { + return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:'); + }); + } + } + + return static function ($ch, string $location, bool $noContent) use (&$redirectHeaders) { + try { + $location = self::parseUrl($location); + } catch (InvalidArgumentException $e) { + return null; + } + + if ($noContent && $redirectHeaders) { + $filterContentHeaders = static function ($h) { + return 0 !== stripos($h, 'Content-Length:') && 0 !== stripos($h, 'Content-Type:') && 0 !== stripos($h, 'Transfer-Encoding:'); + }; + $redirectHeaders['no_auth'] = array_filter($redirectHeaders['no_auth'], $filterContentHeaders); + $redirectHeaders['with_auth'] = array_filter($redirectHeaders['with_auth'], $filterContentHeaders); + } + + if ($redirectHeaders && $host = parse_url('http:'.$location['authority'], \PHP_URL_HOST)) { + $requestHeaders = $redirectHeaders['host'] === $host ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth']; + curl_setopt($ch, \CURLOPT_HTTPHEADER, $requestHeaders); + } elseif ($noContent && $redirectHeaders) { + curl_setopt($ch, \CURLOPT_HTTPHEADER, $redirectHeaders['with_auth']); + } + + $url = self::parseUrl(curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)); + $url = self::resolveUrl($location, $url); + + curl_setopt($ch, \CURLOPT_PROXY, $options['proxy'] + ?? ('https:' === $url['scheme'] ? $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? null : null) + // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities + ?? $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null + ); + + return implode('', $url); + }; + } + + private function findConstantName(int $opt): ?string + { + $constants = array_filter(get_defined_constants(), static function ($v, $k) use ($opt) { + return $v === $opt && 'C' === $k[0] && (str_starts_with($k, 'CURLOPT_') || str_starts_with($k, 'CURLINFO_')); + }, \ARRAY_FILTER_USE_BOTH); + + return key($constants); + } + + /** + * Prevents overriding options that are set internally throughout the request. + */ + private function validateExtraCurlOptions(array $options): void + { + $curloptsToConfig = [ + //options used in CurlHttpClient + \CURLOPT_HTTPAUTH => 'auth_ntlm', + \CURLOPT_USERPWD => 'auth_ntlm', + \CURLOPT_RESOLVE => 'resolve', + \CURLOPT_NOSIGNAL => 'timeout', + \CURLOPT_HTTPHEADER => 'headers', + \CURLOPT_INFILE => 'body', + \CURLOPT_READFUNCTION => 'body', + \CURLOPT_INFILESIZE => 'body', + \CURLOPT_POSTFIELDS => 'body', + \CURLOPT_UPLOAD => 'body', + \CURLOPT_INTERFACE => 'bindto', + \CURLOPT_TIMEOUT_MS => 'max_duration', + \CURLOPT_TIMEOUT => 'max_duration', + \CURLOPT_MAXREDIRS => 'max_redirects', + \CURLOPT_PROXY => 'proxy', + \CURLOPT_NOPROXY => 'no_proxy', + \CURLOPT_SSL_VERIFYPEER => 'verify_peer', + \CURLOPT_SSL_VERIFYHOST => 'verify_host', + \CURLOPT_CAINFO => 'cafile', + \CURLOPT_CAPATH => 'capath', + \CURLOPT_SSL_CIPHER_LIST => 'ciphers', + \CURLOPT_SSLCERT => 'local_cert', + \CURLOPT_SSLKEY => 'local_pk', + \CURLOPT_KEYPASSWD => 'passphrase', + \CURLOPT_CERTINFO => 'capture_peer_cert_chain', + \CURLOPT_USERAGENT => 'normalized_headers', + \CURLOPT_REFERER => 'headers', + //options used in CurlResponse + \CURLOPT_NOPROGRESS => 'on_progress', + \CURLOPT_PROGRESSFUNCTION => 'on_progress', + ]; + + if (\defined('CURLOPT_UNIX_SOCKET_PATH')) { + $curloptsToConfig[\CURLOPT_UNIX_SOCKET_PATH] = 'bindto'; + } + + if (\defined('CURLOPT_PINNEDPUBLICKEY')) { + $curloptsToConfig[\CURLOPT_PINNEDPUBLICKEY] = 'peer_fingerprint'; + } + + $curloptsToCheck = [ + \CURLOPT_PRIVATE, + \CURLOPT_HEADERFUNCTION, + \CURLOPT_WRITEFUNCTION, + \CURLOPT_VERBOSE, + \CURLOPT_STDERR, + \CURLOPT_RETURNTRANSFER, + \CURLOPT_URL, + \CURLOPT_FOLLOWLOCATION, + \CURLOPT_HEADER, + \CURLOPT_CONNECTTIMEOUT, + \CURLOPT_CONNECTTIMEOUT_MS, + \CURLOPT_HTTP_VERSION, + \CURLOPT_PORT, + \CURLOPT_DNS_USE_GLOBAL_CACHE, + \CURLOPT_PROTOCOLS, + \CURLOPT_REDIR_PROTOCOLS, + \CURLOPT_COOKIEFILE, + \CURLINFO_REDIRECT_COUNT, + ]; + + if (\defined('CURLOPT_HTTP09_ALLOWED')) { + $curloptsToCheck[] = \CURLOPT_HTTP09_ALLOWED; + } + + if (\defined('CURLOPT_HEADEROPT')) { + $curloptsToCheck[] = \CURLOPT_HEADEROPT; + } + + $methodOpts = [ + \CURLOPT_POST, + \CURLOPT_PUT, + \CURLOPT_CUSTOMREQUEST, + \CURLOPT_HTTPGET, + \CURLOPT_NOBODY, + ]; + + foreach ($options as $opt => $optValue) { + if (isset($curloptsToConfig[$opt])) { + $constName = $this->findConstantName($opt) ?? $opt; + throw new InvalidArgumentException(sprintf('Cannot set "%s" with "extra.curl", use option "%s" instead.', $constName, $curloptsToConfig[$opt])); + } + + if (\in_array($opt, $methodOpts)) { + throw new InvalidArgumentException('The HTTP method cannot be overridden using "extra.curl".'); + } + + if (\in_array($opt, $curloptsToCheck)) { + $constName = $this->findConstantName($opt) ?? $opt; + throw new InvalidArgumentException(sprintf('Cannot set "%s" with "extra.curl".', $constName)); + } + } + } +} diff --git a/vendor/symfony/http-client/DataCollector/HttpClientDataCollector.php b/vendor/symfony/http-client/DataCollector/HttpClientDataCollector.php new file mode 100644 index 0000000..db8bbbd --- /dev/null +++ b/vendor/symfony/http-client/DataCollector/HttpClientDataCollector.php @@ -0,0 +1,170 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\DataCollector; + +use Symfony\Component\HttpClient\TraceableHttpClient; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; +use Symfony\Component\VarDumper\Caster\ImgStub; + +/** + * @author Jérémy Romey + */ +final class HttpClientDataCollector extends DataCollector implements LateDataCollectorInterface +{ + /** + * @var TraceableHttpClient[] + */ + private $clients = []; + + public function registerClient(string $name, TraceableHttpClient $client) + { + $this->clients[$name] = $client; + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + $this->reset(); + + foreach ($this->clients as $name => $client) { + [$errorCount, $traces] = $this->collectOnClient($client); + + $this->data['clients'][$name] = [ + 'traces' => $traces, + 'error_count' => $errorCount, + ]; + + $this->data['request_count'] += \count($traces); + $this->data['error_count'] += $errorCount; + } + } + + public function lateCollect() + { + foreach ($this->clients as $client) { + $client->reset(); + } + } + + public function getClients(): array + { + return $this->data['clients'] ?? []; + } + + public function getRequestCount(): int + { + return $this->data['request_count'] ?? 0; + } + + public function getErrorCount(): int + { + return $this->data['error_count'] ?? 0; + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return 'http_client'; + } + + public function reset() + { + $this->data = [ + 'clients' => [], + 'request_count' => 0, + 'error_count' => 0, + ]; + } + + private function collectOnClient(TraceableHttpClient $client): array + { + $traces = $client->getTracedRequests(); + $errorCount = 0; + $baseInfo = [ + 'response_headers' => 1, + 'retry_count' => 1, + 'redirect_count' => 1, + 'redirect_url' => 1, + 'user_data' => 1, + 'error' => 1, + 'url' => 1, + ]; + + foreach ($traces as $i => $trace) { + if (400 <= ($trace['info']['http_code'] ?? 0)) { + ++$errorCount; + } + + $info = $trace['info']; + $traces[$i]['http_code'] = $info['http_code'] ?? 0; + + unset($info['filetime'], $info['http_code'], $info['ssl_verify_result'], $info['content_type']); + + if (($info['http_method'] ?? null) === $trace['method']) { + unset($info['http_method']); + } + + if (($info['url'] ?? null) === $trace['url']) { + unset($info['url']); + } + + foreach ($info as $k => $v) { + if (!$v || (is_numeric($v) && 0 > $v)) { + unset($info[$k]); + } + } + + if (\is_string($content = $trace['content'])) { + $contentType = 'application/octet-stream'; + + foreach ($info['response_headers'] ?? [] as $h) { + if (0 === stripos($h, 'content-type: ')) { + $contentType = substr($h, \strlen('content-type: ')); + break; + } + } + + if (0 === strpos($contentType, 'image/') && class_exists(ImgStub::class)) { + $content = new ImgStub($content, $contentType, ''); + } else { + $content = [$content]; + } + + $content = ['response_content' => $content]; + } elseif (\is_array($content)) { + $content = ['response_json' => $content]; + } else { + $content = []; + } + + if (isset($info['retry_count'])) { + $content['retries'] = $info['previous_info']; + unset($info['previous_info']); + } + + $debugInfo = array_diff_key($info, $baseInfo); + $info = ['info' => $debugInfo] + array_diff_key($info, $debugInfo) + $content; + unset($traces[$i]['info']); // break PHP reference used by TraceableHttpClient + $traces[$i]['info'] = $this->cloneVar($info); + $traces[$i]['options'] = $this->cloneVar($trace['options']); + } + + return [$errorCount, $traces]; + } +} diff --git a/vendor/symfony/http-client/DecoratorTrait.php b/vendor/symfony/http-client/DecoratorTrait.php new file mode 100644 index 0000000..790fc32 --- /dev/null +++ b/vendor/symfony/http-client/DecoratorTrait.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Eases with writing decorators. + * + * @author Nicolas Grekas + */ +trait DecoratorTrait +{ + private $client; + + public function __construct(HttpClientInterface $client = null) + { + $this->client = $client ?? HttpClient::create(); + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + return $this->client->request($method, $url, $options); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + return $this->client->stream($responses, $timeout); + } + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->client = $this->client->withOptions($options); + + return $clone; + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } +} diff --git a/vendor/symfony/http-client/DependencyInjection/HttpClientPass.php b/vendor/symfony/http-client/DependencyInjection/HttpClientPass.php new file mode 100644 index 0000000..73f8865 --- /dev/null +++ b/vendor/symfony/http-client/DependencyInjection/HttpClientPass.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\HttpClient\TraceableHttpClient; + +final class HttpClientPass implements CompilerPassInterface +{ + private $clientTag; + + public function __construct(string $clientTag = 'http_client.client') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/http-client', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->clientTag = $clientTag; + } + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('data_collector.http_client')) { + return; + } + + foreach ($container->findTaggedServiceIds($this->clientTag) as $id => $tags) { + $container->register('.debug.'.$id, TraceableHttpClient::class) + ->setArguments([new Reference('.debug.'.$id.'.inner'), new Reference('debug.stopwatch', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]) + ->addTag('kernel.reset', ['method' => 'reset']) + ->setDecoratedService($id); + $container->getDefinition('data_collector.http_client') + ->addMethodCall('registerClient', [$id, new Reference('.debug.'.$id)]); + } + } +} diff --git a/vendor/symfony/http-client/EventSourceHttpClient.php b/vendor/symfony/http-client/EventSourceHttpClient.php new file mode 100644 index 0000000..60e4e82 --- /dev/null +++ b/vendor/symfony/http-client/EventSourceHttpClient.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Component\HttpClient\Chunk\ServerSentEvent; +use Symfony\Component\HttpClient\Exception\EventSourceException; +use Symfony\Component\HttpClient\Response\AsyncContext; +use Symfony\Component\HttpClient\Response\AsyncResponse; +use Symfony\Contracts\HttpClient\ChunkInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * @author Antoine Bluchet + * @author Nicolas Grekas + */ +final class EventSourceHttpClient implements HttpClientInterface, ResetInterface +{ + use AsyncDecoratorTrait, HttpClientTrait { + AsyncDecoratorTrait::withOptions insteadof HttpClientTrait; + } + + private $reconnectionTime; + + public function __construct(HttpClientInterface $client = null, float $reconnectionTime = 10.0) + { + $this->client = $client ?? HttpClient::create(); + $this->reconnectionTime = $reconnectionTime; + } + + public function connect(string $url, array $options = []): ResponseInterface + { + return $this->request('GET', $url, self::mergeDefaultOptions($options, [ + 'buffer' => false, + 'headers' => [ + 'Accept' => 'text/event-stream', + 'Cache-Control' => 'no-cache', + ], + ], true)); + } + + public function request(string $method, string $url, array $options = []): ResponseInterface + { + $state = new class() { + public $buffer = null; + public $lastEventId = null; + public $reconnectionTime; + public $lastError = null; + }; + $state->reconnectionTime = $this->reconnectionTime; + + if ($accept = self::normalizeHeaders($options['headers'] ?? [])['accept'] ?? []) { + $state->buffer = \in_array($accept, [['Accept: text/event-stream'], ['accept: text/event-stream']], true) ? '' : null; + + if (null !== $state->buffer) { + $options['extra']['trace_content'] = false; + } + } + + return new AsyncResponse($this->client, $method, $url, $options, static function (ChunkInterface $chunk, AsyncContext $context) use ($state, $method, $url, $options) { + if (null !== $state->buffer) { + $context->setInfo('reconnection_time', $state->reconnectionTime); + $isTimeout = false; + } + $lastError = $state->lastError; + $state->lastError = null; + + try { + $isTimeout = $chunk->isTimeout(); + + if (null !== $chunk->getInformationalStatus() || $context->getInfo('canceled')) { + yield $chunk; + + return; + } + } catch (TransportExceptionInterface $e) { + $state->lastError = $lastError ?? microtime(true); + + if (null === $state->buffer || ($isTimeout && microtime(true) - $state->lastError < $state->reconnectionTime)) { + yield $chunk; + } else { + $options['headers']['Last-Event-ID'] = $state->lastEventId; + $state->buffer = ''; + $state->lastError = microtime(true); + $context->getResponse()->cancel(); + $context->replaceRequest($method, $url, $options); + if ($isTimeout) { + yield $chunk; + } else { + $context->pause($state->reconnectionTime); + } + } + + return; + } + + if ($chunk->isFirst()) { + if (preg_match('/^text\/event-stream(;|$)/i', $context->getHeaders()['content-type'][0] ?? '')) { + $state->buffer = ''; + } elseif (null !== $lastError || (null !== $state->buffer && 200 === $context->getStatusCode())) { + throw new EventSourceException(sprintf('Response content-type is "%s" while "text/event-stream" was expected for "%s".', $context->getHeaders()['content-type'][0] ?? '', $context->getInfo('url'))); + } else { + $context->passthru(); + } + + if (null === $lastError) { + yield $chunk; + } + + return; + } + + $rx = '/((?:\r\n|[\r\n]){2,})/'; + $content = $state->buffer.$chunk->getContent(); + + if ($chunk->isLast()) { + $rx = substr_replace($rx, '|$', -2, 0); + } + $events = preg_split($rx, $content, -1, \PREG_SPLIT_DELIM_CAPTURE); + $state->buffer = array_pop($events); + + for ($i = 0; isset($events[$i]); $i += 2) { + $event = new ServerSentEvent($events[$i].$events[1 + $i]); + + if ('' !== $event->getId()) { + $context->setInfo('last_event_id', $state->lastEventId = $event->getId()); + } + + if ($event->getRetry()) { + $context->setInfo('reconnection_time', $state->reconnectionTime = $event->getRetry()); + } + + yield $event; + } + + if (preg_match('/^(?::[^\r\n]*+(?:\r\n|[\r\n]))+$/m', $state->buffer)) { + $content = $state->buffer; + $state->buffer = ''; + + yield $context->createChunk($content); + } + + if ($chunk->isLast()) { + yield $chunk; + } + }); + } +} diff --git a/vendor/symfony/http-client/Exception/ClientException.php b/vendor/symfony/http-client/Exception/ClientException.php new file mode 100644 index 0000000..4264534 --- /dev/null +++ b/vendor/symfony/http-client/Exception/ClientException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; + +/** + * Represents a 4xx response. + * + * @author Nicolas Grekas + */ +final class ClientException extends \RuntimeException implements ClientExceptionInterface +{ + use HttpExceptionTrait; +} diff --git a/vendor/symfony/http-client/Exception/EventSourceException.php b/vendor/symfony/http-client/Exception/EventSourceException.php new file mode 100644 index 0000000..30ab795 --- /dev/null +++ b/vendor/symfony/http-client/Exception/EventSourceException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; + +/** + * @author Nicolas Grekas + */ +final class EventSourceException extends \RuntimeException implements DecodingExceptionInterface +{ +} diff --git a/vendor/symfony/http-client/Exception/HttpExceptionTrait.php b/vendor/symfony/http-client/Exception/HttpExceptionTrait.php new file mode 100644 index 0000000..7ab2752 --- /dev/null +++ b/vendor/symfony/http-client/Exception/HttpExceptionTrait.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +trait HttpExceptionTrait +{ + private $response; + + public function __construct(ResponseInterface $response) + { + $this->response = $response; + $code = $response->getInfo('http_code'); + $url = $response->getInfo('url'); + $message = sprintf('HTTP %d returned for "%s".', $code, $url); + + $httpCodeFound = false; + $isJson = false; + foreach (array_reverse($response->getInfo('response_headers')) as $h) { + if (str_starts_with($h, 'HTTP/')) { + if ($httpCodeFound) { + break; + } + + $message = sprintf('%s returned for "%s".', $h, $url); + $httpCodeFound = true; + } + + if (0 === stripos($h, 'content-type:')) { + if (preg_match('/\bjson\b/i', $h)) { + $isJson = true; + } + + if ($httpCodeFound) { + break; + } + } + } + + // Try to guess a better error message using common API error formats + // The MIME type isn't explicitly checked because some formats inherit from others + // Ex: JSON:API follows RFC 7807 semantics, Hydra can be used in any JSON-LD-compatible format + if ($isJson && $body = json_decode($response->getContent(false), true)) { + if (isset($body['hydra:title']) || isset($body['hydra:description'])) { + // see http://www.hydra-cg.com/spec/latest/core/#description-of-http-status-codes-and-errors + $separator = isset($body['hydra:title'], $body['hydra:description']) ? "\n\n" : ''; + $message = ($body['hydra:title'] ?? '').$separator.($body['hydra:description'] ?? ''); + } elseif ((isset($body['title']) || isset($body['detail'])) + && (is_scalar($body['title'] ?? '') && is_scalar($body['detail'] ?? ''))) { + // see RFC 7807 and https://jsonapi.org/format/#error-objects + $separator = isset($body['title'], $body['detail']) ? "\n\n" : ''; + $message = ($body['title'] ?? '').$separator.($body['detail'] ?? ''); + } + } + + parent::__construct($message, $code); + } + + public function getResponse(): ResponseInterface + { + return $this->response; + } +} diff --git a/vendor/symfony/http-client/Exception/InvalidArgumentException.php b/vendor/symfony/http-client/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..6c2fae7 --- /dev/null +++ b/vendor/symfony/http-client/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * @author Nicolas Grekas + */ +final class InvalidArgumentException extends \InvalidArgumentException implements TransportExceptionInterface +{ +} diff --git a/vendor/symfony/http-client/Exception/JsonException.php b/vendor/symfony/http-client/Exception/JsonException.php new file mode 100644 index 0000000..54502e6 --- /dev/null +++ b/vendor/symfony/http-client/Exception/JsonException.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; + +/** + * Thrown by responses' toArray() method when their content cannot be JSON-decoded. + * + * @author Nicolas Grekas + */ +final class JsonException extends \JsonException implements DecodingExceptionInterface +{ +} diff --git a/vendor/symfony/http-client/Exception/RedirectionException.php b/vendor/symfony/http-client/Exception/RedirectionException.php new file mode 100644 index 0000000..5b93670 --- /dev/null +++ b/vendor/symfony/http-client/Exception/RedirectionException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; + +/** + * Represents a 3xx response. + * + * @author Nicolas Grekas + */ +final class RedirectionException extends \RuntimeException implements RedirectionExceptionInterface +{ + use HttpExceptionTrait; +} diff --git a/vendor/symfony/http-client/Exception/ServerException.php b/vendor/symfony/http-client/Exception/ServerException.php new file mode 100644 index 0000000..c6f8273 --- /dev/null +++ b/vendor/symfony/http-client/Exception/ServerException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; + +/** + * Represents a 5xx response. + * + * @author Nicolas Grekas + */ +final class ServerException extends \RuntimeException implements ServerExceptionInterface +{ + use HttpExceptionTrait; +} diff --git a/vendor/symfony/http-client/Exception/TimeoutException.php b/vendor/symfony/http-client/Exception/TimeoutException.php new file mode 100644 index 0000000..a9155cc --- /dev/null +++ b/vendor/symfony/http-client/Exception/TimeoutException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\TimeoutExceptionInterface; + +/** + * @author Nicolas Grekas + */ +final class TimeoutException extends TransportException implements TimeoutExceptionInterface +{ +} diff --git a/vendor/symfony/http-client/Exception/TransportException.php b/vendor/symfony/http-client/Exception/TransportException.php new file mode 100644 index 0000000..a3a80c6 --- /dev/null +++ b/vendor/symfony/http-client/Exception/TransportException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Exception; + +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * @author Nicolas Grekas + */ +class TransportException extends \RuntimeException implements TransportExceptionInterface +{ +} diff --git a/vendor/symfony/http-client/HttpClient.php b/vendor/symfony/http-client/HttpClient.php new file mode 100644 index 0000000..ff00a29 --- /dev/null +++ b/vendor/symfony/http-client/HttpClient.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Amp\Http\Client\Connection\ConnectionLimitingPool; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * A factory to instantiate the best possible HTTP client for the runtime. + * + * @author Nicolas Grekas + */ +final class HttpClient +{ + /** + * @param array $defaultOptions Default request's options + * @param int $maxHostConnections The maximum number of connections to a single host + * @param int $maxPendingPushes The maximum number of pushed responses to accept in the queue + * + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + */ + public static function create(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface + { + if ($amp = class_exists(ConnectionLimitingPool::class)) { + if (!\extension_loaded('curl')) { + return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes); + } + + // Skip curl when HTTP/2 push is unsupported or buggy, see https://bugs.php.net/77535 + if (\PHP_VERSION_ID < 70217 || (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304) || !\defined('CURLMOPT_PUSHFUNCTION')) { + return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes); + } + + static $curlVersion = null; + $curlVersion = $curlVersion ?? curl_version(); + + // HTTP/2 push crashes before curl 7.61 + if (0x073D00 > $curlVersion['version_number'] || !(\CURL_VERSION_HTTP2 & $curlVersion['features'])) { + return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes); + } + } + + if (\extension_loaded('curl')) { + if ('\\' !== \DIRECTORY_SEPARATOR || isset($defaultOptions['cafile']) || isset($defaultOptions['capath']) || ini_get('curl.cainfo') || ini_get('openssl.cafile') || ini_get('openssl.capath')) { + return new CurlHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes); + } + + @trigger_error('Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient', \E_USER_WARNING); + } + + if ($amp) { + return new AmpHttpClient($defaultOptions, null, $maxHostConnections, $maxPendingPushes); + } + + @trigger_error((\extension_loaded('curl') ? 'Upgrade' : 'Install').' the curl extension or run "composer require amphp/http-client" to perform async HTTP operations, including full HTTP/2 support', \E_USER_NOTICE); + + return new NativeHttpClient($defaultOptions, $maxHostConnections); + } + + /** + * Creates a client that adds options (e.g. authentication headers) only when the request URL matches the provided base URI. + */ + public static function createForBaseUri(string $baseUri, array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50): HttpClientInterface + { + $client = self::create([], $maxHostConnections, $maxPendingPushes); + + return ScopingHttpClient::forBaseUri($client, $baseUri, $defaultOptions); + } +} diff --git a/vendor/symfony/http-client/HttpClientTrait.php b/vendor/symfony/http-client/HttpClientTrait.php new file mode 100644 index 0000000..6c2375a --- /dev/null +++ b/vendor/symfony/http-client/HttpClientTrait.php @@ -0,0 +1,684 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; + +/** + * Provides the common logic from writing HttpClientInterface implementations. + * + * All private methods are static to prevent implementers from creating memory leaks via circular references. + * + * @author Nicolas Grekas + */ +trait HttpClientTrait +{ + private static $CHUNK_SIZE = 16372; + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->defaultOptions = self::mergeDefaultOptions($options, $this->defaultOptions); + + return $clone; + } + + /** + * Validates and normalizes method, URL and options, and merges them with defaults. + * + * @throws InvalidArgumentException When a not-supported option is found + */ + private static function prepareRequest(?string $method, ?string $url, array $options, array $defaultOptions = [], bool $allowExtraOptions = false): array + { + if (null !== $method) { + if (\strlen($method) !== strspn($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')) { + throw new InvalidArgumentException(sprintf('Invalid HTTP method "%s", only uppercase letters are accepted.', $method)); + } + if (!$method) { + throw new InvalidArgumentException('The HTTP method cannot be empty.'); + } + } + + $options = self::mergeDefaultOptions($options, $defaultOptions, $allowExtraOptions); + + $buffer = $options['buffer'] ?? true; + + if ($buffer instanceof \Closure) { + $options['buffer'] = static function (array $headers) use ($buffer) { + if (!\is_bool($buffer = $buffer($headers))) { + if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) { + throw new \LogicException(sprintf('The closure passed as option "buffer" must return bool or stream resource, got "%s".', get_debug_type($buffer))); + } + + if (false === strpbrk($bufferInfo['mode'], 'acew+')) { + throw new \LogicException(sprintf('The stream returned by the closure passed as option "buffer" must be writeable, got mode "%s".', $bufferInfo['mode'])); + } + } + + return $buffer; + }; + } elseif (!\is_bool($buffer)) { + if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) { + throw new InvalidArgumentException(sprintf('Option "buffer" must be bool, stream resource or Closure, "%s" given.', get_debug_type($buffer))); + } + + if (false === strpbrk($bufferInfo['mode'], 'acew+')) { + throw new InvalidArgumentException(sprintf('The stream in option "buffer" must be writeable, mode "%s" given.', $bufferInfo['mode'])); + } + } + + if (isset($options['json'])) { + if (isset($options['body']) && '' !== $options['body']) { + throw new InvalidArgumentException('Define either the "json" or the "body" option, setting both is not supported.'); + } + $options['body'] = self::jsonEncode($options['json']); + unset($options['json']); + + if (!isset($options['normalized_headers']['content-type'])) { + $options['normalized_headers']['content-type'] = ['Content-Type: application/json']; + } + } + + if (!isset($options['normalized_headers']['accept'])) { + $options['normalized_headers']['accept'] = ['Accept: */*']; + } + + if (isset($options['body'])) { + $options['body'] = self::normalizeBody($options['body']); + + if (\is_string($options['body']) + && (string) \strlen($options['body']) !== substr($h = $options['normalized_headers']['content-length'][0] ?? '', 16) + && ('' !== $h || '' !== $options['body']) + ) { + if ('chunked' === substr($options['normalized_headers']['transfer-encoding'][0] ?? '', \strlen('Transfer-Encoding: '))) { + unset($options['normalized_headers']['transfer-encoding']); + $options['body'] = self::dechunk($options['body']); + } + + $options['normalized_headers']['content-length'] = [substr_replace($h ?: 'Content-Length: ', \strlen($options['body']), 16)]; + } + } + + if (isset($options['peer_fingerprint'])) { + $options['peer_fingerprint'] = self::normalizePeerFingerprint($options['peer_fingerprint']); + } + + // Validate on_progress + if (!\is_callable($onProgress = $options['on_progress'] ?? 'var_dump')) { + throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', get_debug_type($onProgress))); + } + + if (\is_array($options['auth_basic'] ?? null)) { + $count = \count($options['auth_basic']); + if ($count <= 0 || $count > 2) { + throw new InvalidArgumentException(sprintf('Option "auth_basic" must contain 1 or 2 elements, "%s" given.', $count)); + } + + $options['auth_basic'] = implode(':', $options['auth_basic']); + } + + if (!\is_string($options['auth_basic'] ?? '')) { + throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, "%s" given.', get_debug_type($options['auth_basic']))); + } + + if (isset($options['auth_bearer'])) { + if (!\is_string($options['auth_bearer'])) { + throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string, "%s" given.', get_debug_type($options['auth_bearer']))); + } + if (preg_match('{[^\x21-\x7E]}', $options['auth_bearer'])) { + throw new InvalidArgumentException('Invalid character found in option "auth_bearer": '.json_encode($options['auth_bearer']).'.'); + } + } + + if (isset($options['auth_basic'], $options['auth_bearer'])) { + throw new InvalidArgumentException('Define either the "auth_basic" or the "auth_bearer" option, setting both is not supported.'); + } + + if (null !== $url) { + // Merge auth with headers + if (($options['auth_basic'] ?? false) && !($options['normalized_headers']['authorization'] ?? false)) { + $options['normalized_headers']['authorization'] = ['Authorization: Basic '.base64_encode($options['auth_basic'])]; + } + // Merge bearer with headers + if (($options['auth_bearer'] ?? false) && !($options['normalized_headers']['authorization'] ?? false)) { + $options['normalized_headers']['authorization'] = ['Authorization: Bearer '.$options['auth_bearer']]; + } + + unset($options['auth_basic'], $options['auth_bearer']); + + // Parse base URI + if (\is_string($options['base_uri'])) { + $options['base_uri'] = self::parseUrl($options['base_uri']); + } + + // Validate and resolve URL + $url = self::parseUrl($url, $options['query']); + $url = self::resolveUrl($url, $options['base_uri'], $defaultOptions['query'] ?? []); + } + + // Finalize normalization of options + $options['http_version'] = (string) ($options['http_version'] ?? '') ?: null; + if (0 > $options['timeout'] = (float) ($options['timeout'] ?? ini_get('default_socket_timeout'))) { + $options['timeout'] = 172800.0; // 2 days + } + + $options['max_duration'] = isset($options['max_duration']) ? (float) $options['max_duration'] : 0; + $options['headers'] = array_merge(...array_values($options['normalized_headers'])); + + return [$url, $options]; + } + + /** + * @throws InvalidArgumentException When an invalid option is found + */ + private static function mergeDefaultOptions(array $options, array $defaultOptions, bool $allowExtraOptions = false): array + { + $options['normalized_headers'] = self::normalizeHeaders($options['headers'] ?? []); + + if ($defaultOptions['headers'] ?? false) { + $options['normalized_headers'] += self::normalizeHeaders($defaultOptions['headers']); + } + + $options['headers'] = array_merge(...array_values($options['normalized_headers']) ?: [[]]); + + if ($resolve = $options['resolve'] ?? false) { + $options['resolve'] = []; + foreach ($resolve as $k => $v) { + $options['resolve'][substr(self::parseUrl('http://'.$k)['authority'], 2)] = (string) $v; + } + } + + // Option "query" is never inherited from defaults + $options['query'] = $options['query'] ?? []; + + $options += $defaultOptions; + + foreach (self::$emptyDefaults ?? [] as $k => $v) { + if (!isset($options[$k])) { + $options[$k] = $v; + } + } + + if (isset($defaultOptions['extra'])) { + $options['extra'] += $defaultOptions['extra']; + } + + if ($resolve = $defaultOptions['resolve'] ?? false) { + foreach ($resolve as $k => $v) { + $options['resolve'] += [substr(self::parseUrl('http://'.$k)['authority'], 2) => (string) $v]; + } + } + + if ($allowExtraOptions || !$defaultOptions) { + return $options; + } + + // Look for unsupported options + foreach ($options as $name => $v) { + if (\array_key_exists($name, $defaultOptions) || 'normalized_headers' === $name) { + continue; + } + + if ('auth_ntlm' === $name) { + if (!\extension_loaded('curl')) { + $msg = 'try installing the "curl" extension to use "%s" instead.'; + } else { + $msg = 'try using "%s" instead.'; + } + + throw new InvalidArgumentException(sprintf('Option "auth_ntlm" is not supported by "%s", '.$msg, __CLASS__, CurlHttpClient::class)); + } + + $alternatives = []; + + foreach ($defaultOptions as $k => $v) { + if (levenshtein($name, $k) <= \strlen($name) / 3 || str_contains($k, $name)) { + $alternatives[] = $k; + } + } + + throw new InvalidArgumentException(sprintf('Unsupported option "%s" passed to "%s", did you mean "%s"?', $name, __CLASS__, implode('", "', $alternatives ?: array_keys($defaultOptions)))); + } + + return $options; + } + + /** + * @return string[][] + * + * @throws InvalidArgumentException When an invalid header is found + */ + private static function normalizeHeaders(array $headers): array + { + $normalizedHeaders = []; + + foreach ($headers as $name => $values) { + if (\is_object($values) && method_exists($values, '__toString')) { + $values = (string) $values; + } + + if (\is_int($name)) { + if (!\is_string($values)) { + throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, "%s" given.', $name, get_debug_type($values))); + } + [$name, $values] = explode(':', $values, 2); + $values = [ltrim($values)]; + } elseif (!is_iterable($values)) { + if (\is_object($values)) { + throw new InvalidArgumentException(sprintf('Invalid value for header "%s": expected string, "%s" given.', $name, get_debug_type($values))); + } + + $values = (array) $values; + } + + $lcName = strtolower($name); + $normalizedHeaders[$lcName] = []; + + foreach ($values as $value) { + $normalizedHeaders[$lcName][] = $value = $name.': '.$value; + + if (\strlen($value) !== strcspn($value, "\r\n\0")) { + throw new InvalidArgumentException(sprintf('Invalid header: CR/LF/NUL found in "%s".', $value)); + } + } + } + + return $normalizedHeaders; + } + + /** + * @param array|string|resource|\Traversable|\Closure $body + * + * @return string|resource|\Closure + * + * @throws InvalidArgumentException When an invalid body is passed + */ + private static function normalizeBody($body) + { + if (\is_array($body)) { + array_walk_recursive($body, $caster = static function (&$v) use (&$caster) { + if (\is_object($v)) { + if ($vars = get_object_vars($v)) { + array_walk_recursive($vars, $caster); + $v = $vars; + } elseif (method_exists($v, '__toString')) { + $v = (string) $v; + } + } + }); + + return http_build_query($body, '', '&'); + } + + if (\is_string($body)) { + return $body; + } + + $generatorToCallable = static function (\Generator $body): \Closure { + return static function () use ($body) { + while ($body->valid()) { + $chunk = $body->current(); + $body->next(); + + if ('' !== $chunk) { + return $chunk; + } + } + + return ''; + }; + }; + + if ($body instanceof \Generator) { + return $generatorToCallable($body); + } + + if ($body instanceof \Traversable) { + return $generatorToCallable((static function ($body) { yield from $body; })($body)); + } + + if ($body instanceof \Closure) { + $r = new \ReflectionFunction($body); + $body = $r->getClosure(); + + if ($r->isGenerator()) { + $body = $body(self::$CHUNK_SIZE); + + return $generatorToCallable($body); + } + + return $body; + } + + if (!\is_array(@stream_get_meta_data($body))) { + throw new InvalidArgumentException(sprintf('Option "body" must be string, stream resource, iterable or callable, "%s" given.', get_debug_type($body))); + } + + return $body; + } + + private static function dechunk(string $body): string + { + $h = fopen('php://temp', 'w+'); + stream_filter_append($h, 'dechunk', \STREAM_FILTER_WRITE); + fwrite($h, $body); + $body = stream_get_contents($h, -1, 0); + rewind($h); + ftruncate($h, 0); + + if (fwrite($h, '-') && '' !== stream_get_contents($h, -1, 0)) { + throw new TransportException('Request body has broken chunked encoding.'); + } + + return $body; + } + + /** + * @param string|string[] $fingerprint + * + * @throws InvalidArgumentException When an invalid fingerprint is passed + */ + private static function normalizePeerFingerprint($fingerprint): array + { + if (\is_string($fingerprint)) { + switch (\strlen($fingerprint = str_replace(':', '', $fingerprint))) { + case 32: $fingerprint = ['md5' => $fingerprint]; break; + case 40: $fingerprint = ['sha1' => $fingerprint]; break; + case 44: $fingerprint = ['pin-sha256' => [$fingerprint]]; break; + case 64: $fingerprint = ['sha256' => $fingerprint]; break; + default: throw new InvalidArgumentException(sprintf('Cannot auto-detect fingerprint algorithm for "%s".', $fingerprint)); + } + } elseif (\is_array($fingerprint)) { + foreach ($fingerprint as $algo => $hash) { + $fingerprint[$algo] = 'pin-sha256' === $algo ? (array) $hash : str_replace(':', '', $hash); + } + } else { + throw new InvalidArgumentException(sprintf('Option "peer_fingerprint" must be string or array, "%s" given.', get_debug_type($fingerprint))); + } + + return $fingerprint; + } + + /** + * @param mixed $value + * + * @throws InvalidArgumentException When the value cannot be json-encoded + */ + private static function jsonEncode($value, int $flags = null, int $maxDepth = 512): string + { + $flags = $flags ?? (\JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION); + + try { + $value = json_encode($value, $flags | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0), $maxDepth); + } catch (\JsonException $e) { + throw new InvalidArgumentException('Invalid value for "json" option: '.$e->getMessage()); + } + + if (\PHP_VERSION_ID < 70300 && \JSON_ERROR_NONE !== json_last_error() && (false === $value || !($flags & \JSON_PARTIAL_OUTPUT_ON_ERROR))) { + throw new InvalidArgumentException('Invalid value for "json" option: '.json_last_error_msg()); + } + + return $value; + } + + /** + * Resolves a URL against a base URI. + * + * @see https://tools.ietf.org/html/rfc3986#section-5.2.2 + * + * @throws InvalidArgumentException When an invalid URL is passed + */ + private static function resolveUrl(array $url, ?array $base, array $queryDefaults = []): array + { + if (null !== $base && '' === ($base['scheme'] ?? '').($base['authority'] ?? '')) { + throw new InvalidArgumentException(sprintf('Invalid "base_uri" option: host or scheme is missing in "%s".', implode('', $base))); + } + + if (null === $url['scheme'] && (null === $base || null === $base['scheme'])) { + throw new InvalidArgumentException(sprintf('Invalid URL: scheme is missing in "%s". Did you forget to add "http(s)://"?', implode('', $base ?? $url))); + } + + if (null === $base && '' === $url['scheme'].$url['authority']) { + throw new InvalidArgumentException(sprintf('Invalid URL: no "base_uri" option was provided and host or scheme is missing in "%s".', implode('', $url))); + } + + if (null !== $url['scheme']) { + $url['path'] = self::removeDotSegments($url['path'] ?? ''); + } else { + if (null !== $url['authority']) { + $url['path'] = self::removeDotSegments($url['path'] ?? ''); + } else { + if (null === $url['path']) { + $url['path'] = $base['path']; + $url['query'] = $url['query'] ?? $base['query']; + } else { + if ('/' !== $url['path'][0]) { + if (null === $base['path']) { + $url['path'] = '/'.$url['path']; + } else { + $segments = explode('/', $base['path']); + array_splice($segments, -1, 1, [$url['path']]); + $url['path'] = implode('/', $segments); + } + } + + $url['path'] = self::removeDotSegments($url['path']); + } + + $url['authority'] = $base['authority']; + + if ($queryDefaults) { + $url['query'] = '?'.self::mergeQueryString(substr($url['query'] ?? '', 1), $queryDefaults, false); + } + } + + $url['scheme'] = $base['scheme']; + } + + if ('' === ($url['path'] ?? '')) { + $url['path'] = '/'; + } + + if ('?' === ($url['query'] ?? '')) { + $url['query'] = null; + } + + return $url; + } + + /** + * Parses a URL and fixes its encoding if needed. + * + * @throws InvalidArgumentException When an invalid URL is passed + */ + private static function parseUrl(string $url, array $query = [], array $allowedSchemes = ['http' => 80, 'https' => 443]): array + { + if (false === $parts = parse_url($url)) { + throw new InvalidArgumentException(sprintf('Malformed URL "%s".', $url)); + } + + if ($query) { + $parts['query'] = self::mergeQueryString($parts['query'] ?? null, $query, true); + } + + $port = $parts['port'] ?? 0; + + if (null !== $scheme = $parts['scheme'] ?? null) { + if (!isset($allowedSchemes[$scheme = strtolower($scheme)])) { + throw new InvalidArgumentException(sprintf('Unsupported scheme in "%s".', $url)); + } + + $port = $allowedSchemes[$scheme] === $port ? 0 : $port; + $scheme .= ':'; + } + + if (null !== $host = $parts['host'] ?? null) { + if (!\defined('INTL_IDNA_VARIANT_UTS46') && preg_match('/[\x80-\xFF]/', $host)) { + throw new InvalidArgumentException(sprintf('Unsupported IDN "%s", try enabling the "intl" PHP extension or running "composer require symfony/polyfill-intl-idn".', $host)); + } + + $host = \defined('INTL_IDNA_VARIANT_UTS46') ? idn_to_ascii($host, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46) ?: strtolower($host) : strtolower($host); + $host .= $port ? ':'.$port : ''; + } + + foreach (['user', 'pass', 'path', 'query', 'fragment'] as $part) { + if (!isset($parts[$part])) { + continue; + } + + if (str_contains($parts[$part], '%')) { + // https://tools.ietf.org/html/rfc3986#section-2.3 + $parts[$part] = preg_replace_callback('/%(?:2[DE]|3[0-9]|[46][1-9A-F]|5F|[57][0-9A]|7E)++/i', function ($m) { return rawurldecode($m[0]); }, $parts[$part]); + } + + // https://tools.ietf.org/html/rfc3986#section-3.3 + $parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()*+,;=:@%]++#", function ($m) { return rawurlencode($m[0]); }, $parts[$part]); + } + + return [ + 'scheme' => $scheme, + 'authority' => null !== $host ? '//'.(isset($parts['user']) ? $parts['user'].(isset($parts['pass']) ? ':'.$parts['pass'] : '').'@' : '').$host : null, + 'path' => isset($parts['path'][0]) ? $parts['path'] : null, + 'query' => isset($parts['query']) ? '?'.$parts['query'] : null, + 'fragment' => isset($parts['fragment']) ? '#'.$parts['fragment'] : null, + ]; + } + + /** + * Removes dot-segments from a path. + * + * @see https://tools.ietf.org/html/rfc3986#section-5.2.4 + */ + private static function removeDotSegments(string $path) + { + $result = ''; + + while (!\in_array($path, ['', '.', '..'], true)) { + if ('.' === $path[0] && (str_starts_with($path, $p = '../') || str_starts_with($path, $p = './'))) { + $path = substr($path, \strlen($p)); + } elseif ('/.' === $path || str_starts_with($path, '/./')) { + $path = substr_replace($path, '/', 0, 3); + } elseif ('/..' === $path || str_starts_with($path, '/../')) { + $i = strrpos($result, '/'); + $result = $i ? substr($result, 0, $i) : ''; + $path = substr_replace($path, '/', 0, 4); + } else { + $i = strpos($path, '/', 1) ?: \strlen($path); + $result .= substr($path, 0, $i); + $path = substr($path, $i); + } + } + + return $result; + } + + /** + * Merges and encodes a query array with a query string. + * + * @throws InvalidArgumentException When an invalid query-string value is passed + */ + private static function mergeQueryString(?string $queryString, array $queryArray, bool $replace): ?string + { + if (!$queryArray) { + return $queryString; + } + + $query = []; + + if (null !== $queryString) { + foreach (explode('&', $queryString) as $v) { + if ('' !== $v) { + $k = urldecode(explode('=', $v, 2)[0]); + $query[$k] = (isset($query[$k]) ? $query[$k].'&' : '').$v; + } + } + } + + if ($replace) { + foreach ($queryArray as $k => $v) { + if (null === $v) { + unset($query[$k]); + } + } + } + + $queryString = http_build_query($queryArray, '', '&', \PHP_QUERY_RFC3986); + $queryArray = []; + + if ($queryString) { + foreach (explode('&', $queryString) as $v) { + $queryArray[rawurldecode(explode('=', $v, 2)[0])] = $v; + } + } + + return implode('&', $replace ? array_replace($query, $queryArray) : ($query + $queryArray)); + } + + /** + * Loads proxy configuration from the same environment variables as curl when no proxy is explicitly set. + */ + private static function getProxy(?string $proxy, array $url, ?string $noProxy): ?array + { + if (null === $proxy) { + // Ignore HTTP_PROXY except on the CLI to work around httpoxy set of vulnerabilities + $proxy = $_SERVER['http_proxy'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? $_SERVER['HTTP_PROXY'] ?? null : null) ?? $_SERVER['all_proxy'] ?? $_SERVER['ALL_PROXY'] ?? null; + + if ('https:' === $url['scheme']) { + $proxy = $_SERVER['https_proxy'] ?? $_SERVER['HTTPS_PROXY'] ?? $proxy; + } + } + + if (null === $proxy) { + return null; + } + + $proxy = (parse_url($proxy) ?: []) + ['scheme' => 'http']; + + if (!isset($proxy['host'])) { + throw new TransportException('Invalid HTTP proxy: host is missing.'); + } + + if ('http' === $proxy['scheme']) { + $proxyUrl = 'tcp://'.$proxy['host'].':'.($proxy['port'] ?? '80'); + } elseif ('https' === $proxy['scheme']) { + $proxyUrl = 'ssl://'.$proxy['host'].':'.($proxy['port'] ?? '443'); + } else { + throw new TransportException(sprintf('Unsupported proxy scheme "%s": "http" or "https" expected.', $proxy['scheme'])); + } + + $noProxy = $noProxy ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? ''; + $noProxy = $noProxy ? preg_split('/[\s,]+/', $noProxy) : []; + + return [ + 'url' => $proxyUrl, + 'auth' => isset($proxy['user']) ? 'Basic '.base64_encode(rawurldecode($proxy['user']).':'.rawurldecode($proxy['pass'] ?? '')) : null, + 'no_proxy' => $noProxy, + ]; + } + + private static function shouldBuffer(array $headers): bool + { + if (null === $contentType = $headers['content-type'][0] ?? null) { + return false; + } + + if (false !== $i = strpos($contentType, ';')) { + $contentType = substr($contentType, 0, $i); + } + + return $contentType && preg_match('#^(?:text/|application/(?:.+\+)?(?:json|xml)$)#i', $contentType); + } +} diff --git a/vendor/symfony/http-client/HttpOptions.php b/vendor/symfony/http-client/HttpOptions.php new file mode 100644 index 0000000..1638189 --- /dev/null +++ b/vendor/symfony/http-client/HttpOptions.php @@ -0,0 +1,321 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * A helper providing autocompletion for available options. + * + * @see HttpClientInterface for a description of each options. + * + * @author Nicolas Grekas + */ +class HttpOptions +{ + private $options = []; + + public function toArray(): array + { + return $this->options; + } + + /** + * @return $this + */ + public function setAuthBasic(string $user, string $password = '') + { + $this->options['auth_basic'] = $user; + + if ('' !== $password) { + $this->options['auth_basic'] .= ':'.$password; + } + + return $this; + } + + /** + * @return $this + */ + public function setAuthBearer(string $token) + { + $this->options['auth_bearer'] = $token; + + return $this; + } + + /** + * @return $this + */ + public function setQuery(array $query) + { + $this->options['query'] = $query; + + return $this; + } + + /** + * @return $this + */ + public function setHeaders(iterable $headers) + { + $this->options['headers'] = $headers; + + return $this; + } + + /** + * @param array|string|resource|\Traversable|\Closure $body + * + * @return $this + */ + public function setBody($body) + { + $this->options['body'] = $body; + + return $this; + } + + /** + * @param mixed $json + * + * @return $this + */ + public function setJson($json) + { + $this->options['json'] = $json; + + return $this; + } + + /** + * @return $this + */ + public function setUserData($data) + { + $this->options['user_data'] = $data; + + return $this; + } + + /** + * @return $this + */ + public function setMaxRedirects(int $max) + { + $this->options['max_redirects'] = $max; + + return $this; + } + + /** + * @return $this + */ + public function setHttpVersion(string $version) + { + $this->options['http_version'] = $version; + + return $this; + } + + /** + * @return $this + */ + public function setBaseUri(string $uri) + { + $this->options['base_uri'] = $uri; + + return $this; + } + + /** + * @return $this + */ + public function buffer(bool $buffer) + { + $this->options['buffer'] = $buffer; + + return $this; + } + + /** + * @return $this + */ + public function setOnProgress(callable $callback) + { + $this->options['on_progress'] = $callback; + + return $this; + } + + /** + * @return $this + */ + public function resolve(array $hostIps) + { + $this->options['resolve'] = $hostIps; + + return $this; + } + + /** + * @return $this + */ + public function setProxy(string $proxy) + { + $this->options['proxy'] = $proxy; + + return $this; + } + + /** + * @return $this + */ + public function setNoProxy(string $noProxy) + { + $this->options['no_proxy'] = $noProxy; + + return $this; + } + + /** + * @return $this + */ + public function setTimeout(float $timeout) + { + $this->options['timeout'] = $timeout; + + return $this; + } + + /** + * @return $this + */ + public function bindTo(string $bindto) + { + $this->options['bindto'] = $bindto; + + return $this; + } + + /** + * @return $this + */ + public function verifyPeer(bool $verify) + { + $this->options['verify_peer'] = $verify; + + return $this; + } + + /** + * @return $this + */ + public function verifyHost(bool $verify) + { + $this->options['verify_host'] = $verify; + + return $this; + } + + /** + * @return $this + */ + public function setCaFile(string $cafile) + { + $this->options['cafile'] = $cafile; + + return $this; + } + + /** + * @return $this + */ + public function setCaPath(string $capath) + { + $this->options['capath'] = $capath; + + return $this; + } + + /** + * @return $this + */ + public function setLocalCert(string $cert) + { + $this->options['local_cert'] = $cert; + + return $this; + } + + /** + * @return $this + */ + public function setLocalPk(string $pk) + { + $this->options['local_pk'] = $pk; + + return $this; + } + + /** + * @return $this + */ + public function setPassphrase(string $passphrase) + { + $this->options['passphrase'] = $passphrase; + + return $this; + } + + /** + * @return $this + */ + public function setCiphers(string $ciphers) + { + $this->options['ciphers'] = $ciphers; + + return $this; + } + + /** + * @param string|array $fingerprint + * + * @return $this + */ + public function setPeerFingerprint($fingerprint) + { + $this->options['peer_fingerprint'] = $fingerprint; + + return $this; + } + + /** + * @return $this + */ + public function capturePeerCertChain(bool $capture) + { + $this->options['capture_peer_cert_chain'] = $capture; + + return $this; + } + + /** + * @return $this + */ + public function setExtra(string $name, $value) + { + $this->options['extra'][$name] = $value; + + return $this; + } +} diff --git a/vendor/symfony/http-client/HttplugClient.php b/vendor/symfony/http-client/HttplugClient.php new file mode 100644 index 0000000..ec3b01d --- /dev/null +++ b/vendor/symfony/http-client/HttplugClient.php @@ -0,0 +1,271 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use GuzzleHttp\Promise\Promise as GuzzlePromise; +use GuzzleHttp\Promise\RejectedPromise; +use GuzzleHttp\Promise\Utils; +use Http\Client\Exception\NetworkException; +use Http\Client\Exception\RequestException; +use Http\Client\HttpAsyncClient; +use Http\Client\HttpClient as HttplugInterface; +use Http\Discovery\Exception\NotFoundException; +use Http\Discovery\Psr17FactoryDiscovery; +use Http\Message\RequestFactory; +use Http\Message\StreamFactory; +use Http\Message\UriFactory; +use Http\Promise\Promise; +use Nyholm\Psr7\Factory\Psr17Factory; +use Nyholm\Psr7\Request; +use Nyholm\Psr7\Uri; +use Psr\Http\Message\RequestFactoryInterface; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\StreamInterface; +use Psr\Http\Message\UriFactoryInterface; +use Psr\Http\Message\UriInterface; +use Symfony\Component\HttpClient\Internal\HttplugWaitLoop; +use Symfony\Component\HttpClient\Response\HttplugPromise; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\Service\ResetInterface; + +if (!interface_exists(HttplugInterface::class)) { + throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/httplug" package is not installed. Try running "composer require php-http/httplug".'); +} + +if (!interface_exists(RequestFactory::class)) { + throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/message-factory" package is not installed. Try running "composer require nyholm/psr7".'); +} + +/** + * An adapter to turn a Symfony HttpClientInterface into an Httplug client. + * + * Run "composer require nyholm/psr7" to install an efficient implementation of response + * and stream factories with flex-provided autowiring aliases. + * + * @author Nicolas Grekas + */ +final class HttplugClient implements HttplugInterface, HttpAsyncClient, RequestFactory, StreamFactory, UriFactory, ResetInterface +{ + private $client; + private $responseFactory; + private $streamFactory; + + /** + * @var \SplObjectStorage|null + */ + private $promisePool; + + private $waitLoop; + + public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null) + { + $this->client = $client ?? HttpClient::create(); + $this->responseFactory = $responseFactory; + $this->streamFactory = $streamFactory ?? ($responseFactory instanceof StreamFactoryInterface ? $responseFactory : null); + $this->promisePool = class_exists(Utils::class) ? new \SplObjectStorage() : null; + + if (null === $this->responseFactory || null === $this->streamFactory) { + if (!class_exists(Psr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\HttplugClient" as no PSR-17 factories have been provided. Try running "composer require nyholm/psr7".'); + } + + try { + $psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : null; + $this->responseFactory = $this->responseFactory ?? $psr17Factory ?? Psr17FactoryDiscovery::findResponseFactory(); + $this->streamFactory = $this->streamFactory ?? $psr17Factory ?? Psr17FactoryDiscovery::findStreamFactory(); + } catch (NotFoundException $e) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\HttplugClient" as no PSR-17 factories have been found. Try running "composer require nyholm/psr7".', 0, $e); + } + } + + $this->waitLoop = new HttplugWaitLoop($this->client, $this->promisePool, $this->responseFactory, $this->streamFactory); + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): Psr7ResponseInterface + { + try { + return $this->waitLoop->createPsr7Response($this->sendPsr7Request($request)); + } catch (TransportExceptionInterface $e) { + throw new NetworkException($e->getMessage(), $request, $e); + } + } + + /** + * {@inheritdoc} + * + * @return HttplugPromise + */ + public function sendAsyncRequest(RequestInterface $request): Promise + { + if (!$promisePool = $this->promisePool) { + throw new \LogicException(sprintf('You cannot use "%s()" as the "guzzlehttp/promises" package is not installed. Try running "composer require guzzlehttp/promises".', __METHOD__)); + } + + try { + $response = $this->sendPsr7Request($request, true); + } catch (NetworkException $e) { + return new HttplugPromise(new RejectedPromise($e)); + } + + $waitLoop = $this->waitLoop; + + $promise = new GuzzlePromise(static function () use ($response, $waitLoop) { + $waitLoop->wait($response); + }, static function () use ($response, $promisePool) { + $response->cancel(); + unset($promisePool[$response]); + }); + + $promisePool[$response] = [$request, $promise]; + + return new HttplugPromise($promise); + } + + /** + * Resolves pending promises that complete before the timeouts are reached. + * + * When $maxDuration is null and $idleTimeout is reached, promises are rejected. + * + * @return int The number of remaining pending promises + */ + public function wait(float $maxDuration = null, float $idleTimeout = null): int + { + return $this->waitLoop->wait(null, $maxDuration, $idleTimeout); + } + + /** + * {@inheritdoc} + */ + public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface + { + if ($this->responseFactory instanceof RequestFactoryInterface) { + $request = $this->responseFactory->createRequest($method, $uri); + } elseif (class_exists(Request::class)) { + $request = new Request($method, $uri); + } elseif (class_exists(Psr17FactoryDiscovery::class)) { + $request = Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $uri); + } else { + throw new \LogicException(sprintf('You cannot use "%s()" as the "nyholm/psr7" package is not installed. Try running "composer require nyholm/psr7".', __METHOD__)); + } + + $request = $request + ->withProtocolVersion($protocolVersion) + ->withBody($this->createStream($body)) + ; + + foreach ($headers as $name => $value) { + $request = $request->withAddedHeader($name, $value); + } + + return $request; + } + + /** + * {@inheritdoc} + */ + public function createStream($body = null): StreamInterface + { + if ($body instanceof StreamInterface) { + return $body; + } + + if (\is_string($body ?? '')) { + $stream = $this->streamFactory->createStream($body ?? ''); + } elseif (\is_resource($body)) { + $stream = $this->streamFactory->createStreamFromResource($body); + } else { + throw new \InvalidArgumentException(sprintf('"%s()" expects string, resource or StreamInterface, "%s" given.', __METHOD__, get_debug_type($body))); + } + + if ($stream->isSeekable()) { + $stream->seek(0); + } + + return $stream; + } + + /** + * {@inheritdoc} + */ + public function createUri($uri): UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + + if ($this->responseFactory instanceof UriFactoryInterface) { + return $this->responseFactory->createUri($uri); + } + + if (class_exists(Uri::class)) { + return new Uri($uri); + } + + if (class_exists(Psr17FactoryDiscovery::class)) { + return Psr17FactoryDiscovery::findUrlFactory()->createUri($uri); + } + + throw new \LogicException(sprintf('You cannot use "%s()" as the "nyholm/psr7" package is not installed. Try running "composer require nyholm/psr7".', __METHOD__)); + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + public function __destruct() + { + $this->wait(); + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } + + private function sendPsr7Request(RequestInterface $request, bool $buffer = null): ResponseInterface + { + try { + $body = $request->getBody(); + + if ($body->isSeekable()) { + $body->seek(0); + } + + return $this->client->request($request->getMethod(), (string) $request->getUri(), [ + 'headers' => $request->getHeaders(), + 'body' => $body->getContents(), + 'http_version' => '1.0' === $request->getProtocolVersion() ? '1.0' : null, + 'buffer' => $buffer, + ]); + } catch (\InvalidArgumentException $e) { + throw new RequestException($e->getMessage(), $request, $e); + } catch (TransportExceptionInterface $e) { + throw new NetworkException($e->getMessage(), $request, $e); + } + } +} diff --git a/vendor/symfony/http-client/Internal/AmpBody.php b/vendor/symfony/http-client/Internal/AmpBody.php new file mode 100644 index 0000000..b99742b --- /dev/null +++ b/vendor/symfony/http-client/Internal/AmpBody.php @@ -0,0 +1,142 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Amp\ByteStream\InputStream; +use Amp\ByteStream\ResourceInputStream; +use Amp\Http\Client\RequestBody; +use Amp\Promise; +use Amp\Success; +use Symfony\Component\HttpClient\Exception\TransportException; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class AmpBody implements RequestBody, InputStream +{ + private $body; + private $info; + private $onProgress; + private $offset = 0; + private $length = -1; + private $uploaded; + + public function __construct($body, &$info, \Closure $onProgress) + { + $this->body = $body; + $this->info = &$info; + $this->onProgress = $onProgress; + + if (\is_resource($body)) { + $this->offset = ftell($body); + $this->length = fstat($body)['size']; + $this->body = new ResourceInputStream($body); + } elseif (\is_string($body)) { + $this->length = \strlen($body); + } + } + + public function createBodyStream(): InputStream + { + if (null !== $this->uploaded) { + $this->uploaded = null; + + if (\is_string($this->body)) { + $this->offset = 0; + } elseif ($this->body instanceof ResourceInputStream) { + fseek($this->body->getResource(), $this->offset); + } + } + + return $this; + } + + public function getHeaders(): Promise + { + return new Success([]); + } + + public function getBodyLength(): Promise + { + return new Success($this->length - $this->offset); + } + + public function read(): Promise + { + $this->info['size_upload'] += $this->uploaded; + $this->uploaded = 0; + ($this->onProgress)(); + + $chunk = $this->doRead(); + $chunk->onResolve(function ($e, $data) { + if (null !== $data) { + $this->uploaded = \strlen($data); + } else { + $this->info['upload_content_length'] = $this->info['size_upload']; + } + }); + + return $chunk; + } + + public static function rewind(RequestBody $body): RequestBody + { + if (!$body instanceof self) { + return $body; + } + + $body->uploaded = null; + + if ($body->body instanceof ResourceInputStream) { + fseek($body->body->getResource(), $body->offset); + + return new $body($body->body, $body->info, $body->onProgress); + } + + if (\is_string($body->body)) { + $body->offset = 0; + } + + return $body; + } + + private function doRead(): Promise + { + if ($this->body instanceof ResourceInputStream) { + return $this->body->read(); + } + + if (null === $this->offset || !$this->length) { + return new Success(); + } + + if (\is_string($this->body)) { + $this->offset = null; + + return new Success($this->body); + } + + if ('' === $data = ($this->body)(16372)) { + $this->offset = null; + + return new Success(); + } + + if (!\is_string($data)) { + throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', get_debug_type($data))); + } + + return new Success($data); + } +} diff --git a/vendor/symfony/http-client/Internal/AmpClientState.php b/vendor/symfony/http-client/Internal/AmpClientState.php new file mode 100644 index 0000000..3061f08 --- /dev/null +++ b/vendor/symfony/http-client/Internal/AmpClientState.php @@ -0,0 +1,217 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Amp\CancellationToken; +use Amp\Deferred; +use Amp\Http\Client\Connection\ConnectionLimitingPool; +use Amp\Http\Client\Connection\DefaultConnectionFactory; +use Amp\Http\Client\InterceptedHttpClient; +use Amp\Http\Client\Interceptor\RetryRequests; +use Amp\Http\Client\PooledHttpClient; +use Amp\Http\Client\Request; +use Amp\Http\Client\Response; +use Amp\Http\Tunnel\Http1TunnelConnector; +use Amp\Http\Tunnel\Https1TunnelConnector; +use Amp\Promise; +use Amp\Socket\Certificate; +use Amp\Socket\ClientTlsContext; +use Amp\Socket\ConnectContext; +use Amp\Socket\Connector; +use Amp\Socket\DnsConnector; +use Amp\Socket\SocketAddress; +use Amp\Success; +use Psr\Log\LoggerInterface; + +/** + * Internal representation of the Amp client's state. + * + * @author Nicolas Grekas + * + * @internal + */ +final class AmpClientState extends ClientState +{ + public $dnsCache = []; + public $responseCount = 0; + public $pushedResponses = []; + + private $clients = []; + private $clientConfigurator; + private $maxHostConnections; + private $maxPendingPushes; + private $logger; + + public function __construct(?callable $clientConfigurator, int $maxHostConnections, int $maxPendingPushes, ?LoggerInterface &$logger) + { + $this->clientConfigurator = $clientConfigurator ?? static function (PooledHttpClient $client) { + return new InterceptedHttpClient($client, new RetryRequests(2)); + }; + $this->maxHostConnections = $maxHostConnections; + $this->maxPendingPushes = $maxPendingPushes; + $this->logger = &$logger; + } + + /** + * @return Promise + */ + public function request(array $options, Request $request, CancellationToken $cancellation, array &$info, \Closure $onProgress, &$handle): Promise + { + if ($options['proxy']) { + if ($request->hasHeader('proxy-authorization')) { + $options['proxy']['auth'] = $request->getHeader('proxy-authorization'); + } + + // Matching "no_proxy" should follow the behavior of curl + $host = $request->getUri()->getHost(); + foreach ($options['proxy']['no_proxy'] as $rule) { + $dotRule = '.'.ltrim($rule, '.'); + + if ('*' === $rule || $host === $rule || substr($host, -\strlen($dotRule)) === $dotRule) { + $options['proxy'] = null; + break; + } + } + } + + $request = clone $request; + + if ($request->hasHeader('proxy-authorization')) { + $request->removeHeader('proxy-authorization'); + } + + if ($options['capture_peer_cert_chain']) { + $info['peer_certificate_chain'] = []; + } + + $request->addEventListener(new AmpListener($info, $options['peer_fingerprint']['pin-sha256'] ?? [], $onProgress, $handle)); + $request->setPushHandler(function ($request, $response) use ($options): Promise { + return $this->handlePush($request, $response, $options); + }); + + ($request->hasHeader('content-length') ? new Success((int) $request->getHeader('content-length')) : $request->getBody()->getBodyLength()) + ->onResolve(static function ($e, $bodySize) use (&$info) { + if (null !== $bodySize && 0 <= $bodySize) { + $info['upload_content_length'] = ((1 + $info['upload_content_length']) ?? 1) - 1 + $bodySize; + } + }); + + [$client, $connector] = $this->getClient($options); + $response = $client->request($request, $cancellation); + $response->onResolve(static function ($e) use ($connector, &$handle) { + if (null === $e) { + $handle = $connector->handle; + } + }); + + return $response; + } + + private function getClient(array $options): array + { + $options = [ + 'bindto' => $options['bindto'] ?: '0', + 'verify_peer' => $options['verify_peer'], + 'capath' => $options['capath'], + 'cafile' => $options['cafile'], + 'local_cert' => $options['local_cert'], + 'local_pk' => $options['local_pk'], + 'ciphers' => $options['ciphers'], + 'capture_peer_cert_chain' => $options['capture_peer_cert_chain'] || $options['peer_fingerprint'], + 'proxy' => $options['proxy'], + ]; + + $key = md5(serialize($options)); + + if (isset($this->clients[$key])) { + return $this->clients[$key]; + } + + $context = new ClientTlsContext(''); + $options['verify_peer'] || $context = $context->withoutPeerVerification(); + $options['cafile'] && $context = $context->withCaFile($options['cafile']); + $options['capath'] && $context = $context->withCaPath($options['capath']); + $options['local_cert'] && $context = $context->withCertificate(new Certificate($options['local_cert'], $options['local_pk'])); + $options['ciphers'] && $context = $context->withCiphers($options['ciphers']); + $options['capture_peer_cert_chain'] && $context = $context->withPeerCapturing(); + + $connector = $handleConnector = new class() implements Connector { + public $connector; + public $uri; + public $handle; + + public function connect(string $uri, ConnectContext $context = null, CancellationToken $token = null): Promise + { + $result = $this->connector->connect($this->uri ?? $uri, $context, $token); + $result->onResolve(function ($e, $socket) { + $this->handle = null !== $socket ? $socket->getResource() : false; + }); + + return $result; + } + }; + $connector->connector = new DnsConnector(new AmpResolver($this->dnsCache)); + + $context = (new ConnectContext()) + ->withTcpNoDelay() + ->withTlsContext($context); + + if ($options['bindto']) { + if (file_exists($options['bindto'])) { + $connector->uri = 'unix://'.$options['bindto']; + } else { + $context = $context->withBindTo($options['bindto']); + } + } + + if ($options['proxy']) { + $proxyUrl = parse_url($options['proxy']['url']); + $proxySocket = new SocketAddress($proxyUrl['host'], $proxyUrl['port']); + $proxyHeaders = $options['proxy']['auth'] ? ['Proxy-Authorization' => $options['proxy']['auth']] : []; + + if ('ssl' === $proxyUrl['scheme']) { + $connector = new Https1TunnelConnector($proxySocket, $context->getTlsContext(), $proxyHeaders, $connector); + } else { + $connector = new Http1TunnelConnector($proxySocket, $proxyHeaders, $connector); + } + } + + $maxHostConnections = 0 < $this->maxHostConnections ? $this->maxHostConnections : \PHP_INT_MAX; + $pool = new DefaultConnectionFactory($connector, $context); + $pool = ConnectionLimitingPool::byAuthority($maxHostConnections, $pool); + + return $this->clients[$key] = [($this->clientConfigurator)(new PooledHttpClient($pool)), $handleConnector]; + } + + private function handlePush(Request $request, Promise $response, array $options): Promise + { + $deferred = new Deferred(); + $authority = $request->getUri()->getAuthority(); + + if ($this->maxPendingPushes <= \count($this->pushedResponses[$authority] ?? [])) { + $fifoUrl = key($this->pushedResponses[$authority]); + unset($this->pushedResponses[$authority][$fifoUrl]); + $this->logger && $this->logger->debug(sprintf('Evicting oldest pushed response: "%s"', $fifoUrl)); + } + + $url = (string) $request->getUri(); + $this->logger && $this->logger->debug(sprintf('Queueing pushed response: "%s"', $url)); + $this->pushedResponses[$authority][] = [$url, $deferred, $request, $response, [ + 'proxy' => $options['proxy'], + 'bindto' => $options['bindto'], + 'local_cert' => $options['local_cert'], + 'local_pk' => $options['local_pk'], + ]]; + + return $deferred->promise(); + } +} diff --git a/vendor/symfony/http-client/Internal/AmpListener.php b/vendor/symfony/http-client/Internal/AmpListener.php new file mode 100644 index 0000000..cb3235b --- /dev/null +++ b/vendor/symfony/http-client/Internal/AmpListener.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Amp\Http\Client\Connection\Stream; +use Amp\Http\Client\EventListener; +use Amp\Http\Client\Request; +use Amp\Promise; +use Amp\Success; +use Symfony\Component\HttpClient\Exception\TransportException; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class AmpListener implements EventListener +{ + private $info; + private $pinSha256; + private $onProgress; + private $handle; + + public function __construct(array &$info, array $pinSha256, \Closure $onProgress, &$handle) + { + $info += [ + 'connect_time' => 0.0, + 'pretransfer_time' => 0.0, + 'starttransfer_time' => 0.0, + 'total_time' => 0.0, + 'namelookup_time' => 0.0, + 'primary_ip' => '', + 'primary_port' => 0, + ]; + + $this->info = &$info; + $this->pinSha256 = $pinSha256; + $this->onProgress = $onProgress; + $this->handle = &$handle; + } + + public function startRequest(Request $request): Promise + { + $this->info['start_time'] = $this->info['start_time'] ?? microtime(true); + ($this->onProgress)(); + + return new Success(); + } + + public function startDnsResolution(Request $request): Promise + { + ($this->onProgress)(); + + return new Success(); + } + + public function startConnectionCreation(Request $request): Promise + { + ($this->onProgress)(); + + return new Success(); + } + + public function startTlsNegotiation(Request $request): Promise + { + ($this->onProgress)(); + + return new Success(); + } + + public function startSendingRequest(Request $request, Stream $stream): Promise + { + $host = $stream->getRemoteAddress()->getHost(); + + if (false !== strpos($host, ':')) { + $host = '['.$host.']'; + } + + $this->info['primary_ip'] = $host; + $this->info['primary_port'] = $stream->getRemoteAddress()->getPort(); + $this->info['pretransfer_time'] = microtime(true) - $this->info['start_time']; + $this->info['debug'] .= sprintf("* Connected to %s (%s) port %d\n", $request->getUri()->getHost(), $host, $this->info['primary_port']); + + if ((isset($this->info['peer_certificate_chain']) || $this->pinSha256) && null !== $tlsInfo = $stream->getTlsInfo()) { + foreach ($tlsInfo->getPeerCertificates() as $cert) { + $this->info['peer_certificate_chain'][] = openssl_x509_read($cert->toPem()); + } + + if ($this->pinSha256) { + $pin = openssl_pkey_get_public($this->info['peer_certificate_chain'][0]); + $pin = openssl_pkey_get_details($pin)['key']; + $pin = \array_slice(explode("\n", $pin), 1, -2); + $pin = base64_decode(implode('', $pin)); + $pin = base64_encode(hash('sha256', $pin, true)); + + if (!\in_array($pin, $this->pinSha256, true)) { + throw new TransportException(sprintf('SSL public key does not match pinned public key for "%s".', $this->info['url'])); + } + } + } + ($this->onProgress)(); + + $uri = $request->getUri(); + $requestUri = $uri->getPath() ?: '/'; + + if ('' !== $query = $uri->getQuery()) { + $requestUri .= '?'.$query; + } + + if ('CONNECT' === $method = $request->getMethod()) { + $requestUri = $uri->getHost().': '.($uri->getPort() ?? ('https' === $uri->getScheme() ? 443 : 80)); + } + + $this->info['debug'] .= sprintf("> %s %s HTTP/%s \r\n", $method, $requestUri, $request->getProtocolVersions()[0]); + + foreach ($request->getRawHeaders() as [$name, $value]) { + $this->info['debug'] .= $name.': '.$value."\r\n"; + } + $this->info['debug'] .= "\r\n"; + + return new Success(); + } + + public function completeSendingRequest(Request $request, Stream $stream): Promise + { + ($this->onProgress)(); + + return new Success(); + } + + public function startReceivingResponse(Request $request, Stream $stream): Promise + { + $this->info['starttransfer_time'] = microtime(true) - $this->info['start_time']; + ($this->onProgress)(); + + return new Success(); + } + + public function completeReceivingResponse(Request $request, Stream $stream): Promise + { + $this->handle = null; + ($this->onProgress)(); + + return new Success(); + } + + public function completeDnsResolution(Request $request): Promise + { + $this->info['namelookup_time'] = microtime(true) - $this->info['start_time']; + ($this->onProgress)(); + + return new Success(); + } + + public function completeConnectionCreation(Request $request): Promise + { + $this->info['connect_time'] = microtime(true) - $this->info['start_time']; + ($this->onProgress)(); + + return new Success(); + } + + public function completeTlsNegotiation(Request $request): Promise + { + ($this->onProgress)(); + + return new Success(); + } + + public function abort(Request $request, \Throwable $cause): Promise + { + return new Success(); + } +} diff --git a/vendor/symfony/http-client/Internal/AmpResolver.php b/vendor/symfony/http-client/Internal/AmpResolver.php new file mode 100644 index 0000000..d31476a --- /dev/null +++ b/vendor/symfony/http-client/Internal/AmpResolver.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Amp\Dns; +use Amp\Dns\Record; +use Amp\Promise; +use Amp\Success; + +/** + * Handles local overrides for the DNS resolver. + * + * @author Nicolas Grekas + * + * @internal + */ +class AmpResolver implements Dns\Resolver +{ + private $dnsMap; + + public function __construct(array &$dnsMap) + { + $this->dnsMap = &$dnsMap; + } + + public function resolve(string $name, int $typeRestriction = null): Promise + { + if (!isset($this->dnsMap[$name]) || !\in_array($typeRestriction, [Record::A, null], true)) { + return Dns\resolver()->resolve($name, $typeRestriction); + } + + return new Success([new Record($this->dnsMap[$name], Record::A, null)]); + } + + public function query(string $name, int $type): Promise + { + if (!isset($this->dnsMap[$name]) || Record::A !== $type) { + return Dns\resolver()->query($name, $type); + } + + return new Success([new Record($this->dnsMap[$name], Record::A, null)]); + } +} diff --git a/vendor/symfony/http-client/Internal/Canary.php b/vendor/symfony/http-client/Internal/Canary.php new file mode 100644 index 0000000..3d14b5f --- /dev/null +++ b/vendor/symfony/http-client/Internal/Canary.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class Canary +{ + private $canceller; + + public function __construct(\Closure $canceller) + { + $this->canceller = $canceller; + } + + public function cancel() + { + if (($canceller = $this->canceller) instanceof \Closure) { + $this->canceller = null; + $canceller(); + } + } + + public function __destruct() + { + $this->cancel(); + } +} diff --git a/vendor/symfony/http-client/Internal/ClientState.php b/vendor/symfony/http-client/Internal/ClientState.php new file mode 100644 index 0000000..52fe3c8 --- /dev/null +++ b/vendor/symfony/http-client/Internal/ClientState.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +/** + * Internal representation of the client state. + * + * @author Alexander M. Turek + * + * @internal + */ +class ClientState +{ + public $handlesActivity = []; + public $openHandles = []; + public $lastTimeout; +} diff --git a/vendor/symfony/http-client/Internal/CurlClientState.php b/vendor/symfony/http-client/Internal/CurlClientState.php new file mode 100644 index 0000000..958a00a --- /dev/null +++ b/vendor/symfony/http-client/Internal/CurlClientState.php @@ -0,0 +1,148 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Response\CurlResponse; + +/** + * Internal representation of the cURL client's state. + * + * @author Alexander M. Turek + * + * @internal + */ +final class CurlClientState extends ClientState +{ + /** @var \CurlMultiHandle|resource|null */ + public $handle; + /** @var \CurlShareHandle|resource|null */ + public $share; + /** @var PushedResponse[] */ + public $pushedResponses = []; + /** @var DnsCache */ + public $dnsCache; + /** @var float[] */ + public $pauseExpiries = []; + public $execCounter = \PHP_INT_MIN; + /** @var LoggerInterface|null */ + public $logger; + + public static $curlVersion; + + public function __construct(int $maxHostConnections, int $maxPendingPushes) + { + self::$curlVersion = self::$curlVersion ?? curl_version(); + + $this->handle = curl_multi_init(); + $this->dnsCache = new DnsCache(); + $this->reset(); + + // Don't enable HTTP/1.1 pipelining: it forces responses to be sent in order + if (\defined('CURLPIPE_MULTIPLEX')) { + curl_multi_setopt($this->handle, \CURLMOPT_PIPELINING, \CURLPIPE_MULTIPLEX); + } + if (\defined('CURLMOPT_MAX_HOST_CONNECTIONS')) { + $maxHostConnections = curl_multi_setopt($this->handle, \CURLMOPT_MAX_HOST_CONNECTIONS, 0 < $maxHostConnections ? $maxHostConnections : \PHP_INT_MAX) ? 0 : $maxHostConnections; + } + if (\defined('CURLMOPT_MAXCONNECTS') && 0 < $maxHostConnections) { + curl_multi_setopt($this->handle, \CURLMOPT_MAXCONNECTS, $maxHostConnections); + } + + // Skip configuring HTTP/2 push when it's unsupported or buggy, see https://bugs.php.net/77535 + if (0 >= $maxPendingPushes || \PHP_VERSION_ID < 70217 || (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304)) { + return; + } + + // HTTP/2 push crashes before curl 7.61 + if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > self::$curlVersion['version_number'] || !(\CURL_VERSION_HTTP2 & self::$curlVersion['features'])) { + return; + } + + // Clone to prevent a circular reference + $multi = clone $this; + $multi->handle = null; + $multi->share = null; + $multi->pushedResponses = &$this->pushedResponses; + $multi->logger = &$this->logger; + $multi->handlesActivity = &$this->handlesActivity; + $multi->openHandles = &$this->openHandles; + + curl_multi_setopt($this->handle, \CURLMOPT_PUSHFUNCTION, static function ($parent, $pushed, array $requestHeaders) use ($multi, $maxPendingPushes) { + return $multi->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes); + }); + } + + public function reset() + { + foreach ($this->pushedResponses as $url => $response) { + $this->logger && $this->logger->debug(sprintf('Unused pushed response: "%s"', $url)); + curl_multi_remove_handle($this->handle, $response->handle); + curl_close($response->handle); + } + + $this->pushedResponses = []; + $this->dnsCache->evictions = $this->dnsCache->evictions ?: $this->dnsCache->removals; + $this->dnsCache->removals = $this->dnsCache->hostnames = []; + + $this->share = curl_share_init(); + + curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS); + curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION); + + if (\defined('CURL_LOCK_DATA_CONNECT')) { + curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT); + } + } + + private function handlePush($parent, $pushed, array $requestHeaders, int $maxPendingPushes): int + { + $headers = []; + $origin = curl_getinfo($parent, \CURLINFO_EFFECTIVE_URL); + + foreach ($requestHeaders as $h) { + if (false !== $i = strpos($h, ':', 1)) { + $headers[substr($h, 0, $i)][] = substr($h, 1 + $i); + } + } + + if (!isset($headers[':method']) || !isset($headers[':scheme']) || !isset($headers[':authority']) || !isset($headers[':path'])) { + $this->logger && $this->logger->debug(sprintf('Rejecting pushed response from "%s": pushed headers are invalid', $origin)); + + return \CURL_PUSH_DENY; + } + + $url = $headers[':scheme'][0].'://'.$headers[':authority'][0]; + + // curl before 7.65 doesn't validate the pushed ":authority" header, + // but this is a MUST in the HTTP/2 RFC; let's restrict pushes to the original host, + // ignoring domains mentioned as alt-name in the certificate for now (same as curl). + if (!str_starts_with($origin, $url.'/')) { + $this->logger && $this->logger->debug(sprintf('Rejecting pushed response from "%s": server is not authoritative for "%s"', $origin, $url)); + + return \CURL_PUSH_DENY; + } + + if ($maxPendingPushes <= \count($this->pushedResponses)) { + $fifoUrl = key($this->pushedResponses); + unset($this->pushedResponses[$fifoUrl]); + $this->logger && $this->logger->debug(sprintf('Evicting oldest pushed response: "%s"', $fifoUrl)); + } + + $url .= $headers[':path'][0]; + $this->logger && $this->logger->debug(sprintf('Queueing pushed response: "%s"', $url)); + + $this->pushedResponses[$url] = new PushedResponse(new CurlResponse($this, $pushed), $headers, $this->openHandles[(int) $parent][1] ?? [], $pushed); + + return \CURL_PUSH_OK; + } +} diff --git a/vendor/symfony/http-client/Internal/DnsCache.php b/vendor/symfony/http-client/Internal/DnsCache.php new file mode 100644 index 0000000..bd23f77 --- /dev/null +++ b/vendor/symfony/http-client/Internal/DnsCache.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +/** + * Cache for resolved DNS queries. + * + * @author Alexander M. Turek + * + * @internal + */ +final class DnsCache +{ + /** + * Resolved hostnames (hostname => IP address). + * + * @var string[] + */ + public $hostnames = []; + + /** + * @var string[] + */ + public $removals = []; + + /** + * @var string[] + */ + public $evictions = []; +} diff --git a/vendor/symfony/http-client/Internal/HttplugWaitLoop.php b/vendor/symfony/http-client/Internal/HttplugWaitLoop.php new file mode 100644 index 0000000..9f5658f --- /dev/null +++ b/vendor/symfony/http-client/Internal/HttplugWaitLoop.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Http\Client\Exception\NetworkException; +use Http\Promise\Promise; +use Psr\Http\Message\RequestInterface as Psr7RequestInterface; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Symfony\Component\HttpClient\Response\StreamableInterface; +use Symfony\Component\HttpClient\Response\StreamWrapper; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class HttplugWaitLoop +{ + private $client; + private $promisePool; + private $responseFactory; + private $streamFactory; + + /** + * @param \SplObjectStorage|null $promisePool + */ + public function __construct(HttpClientInterface $client, ?\SplObjectStorage $promisePool, ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory) + { + $this->client = $client; + $this->promisePool = $promisePool; + $this->responseFactory = $responseFactory; + $this->streamFactory = $streamFactory; + } + + public function wait(?ResponseInterface $pendingResponse, float $maxDuration = null, float $idleTimeout = null): int + { + if (!$this->promisePool) { + return 0; + } + + $guzzleQueue = \GuzzleHttp\Promise\Utils::queue(); + + if (0.0 === $remainingDuration = $maxDuration) { + $idleTimeout = 0.0; + } elseif (null !== $maxDuration) { + $startTime = microtime(true); + $idleTimeout = max(0.0, min($maxDuration / 5, $idleTimeout ?? $maxDuration)); + } + + do { + foreach ($this->client->stream($this->promisePool, $idleTimeout) as $response => $chunk) { + try { + if (null !== $maxDuration && $chunk->isTimeout()) { + goto check_duration; + } + + if ($chunk->isFirst()) { + // Deactivate throwing on 3/4/5xx + $response->getStatusCode(); + } + + if (!$chunk->isLast()) { + goto check_duration; + } + + if ([, $promise] = $this->promisePool[$response] ?? null) { + unset($this->promisePool[$response]); + $promise->resolve($this->createPsr7Response($response, true)); + } + } catch (\Exception $e) { + if ([$request, $promise] = $this->promisePool[$response] ?? null) { + unset($this->promisePool[$response]); + + if ($e instanceof TransportExceptionInterface) { + $e = new NetworkException($e->getMessage(), $request, $e); + } + + $promise->reject($e); + } + } + + $guzzleQueue->run(); + + if ($pendingResponse === $response) { + return $this->promisePool->count(); + } + + check_duration: + if (null !== $maxDuration && $idleTimeout && $idleTimeout > $remainingDuration = max(0.0, $maxDuration - microtime(true) + $startTime)) { + $idleTimeout = $remainingDuration / 5; + break; + } + } + + if (!$count = $this->promisePool->count()) { + return 0; + } + } while (null === $maxDuration || 0 < $remainingDuration); + + return $count; + } + + public function createPsr7Response(ResponseInterface $response, bool $buffer = false): Psr7ResponseInterface + { + $psrResponse = $this->responseFactory->createResponse($response->getStatusCode()); + + foreach ($response->getHeaders(false) as $name => $values) { + foreach ($values as $value) { + $psrResponse = $psrResponse->withAddedHeader($name, $value); + } + } + + if ($response instanceof StreamableInterface) { + $body = $this->streamFactory->createStreamFromResource($response->toStream(false)); + } elseif (!$buffer) { + $body = $this->streamFactory->createStreamFromResource(StreamWrapper::createResource($response, $this->client)); + } else { + $body = $this->streamFactory->createStream($response->getContent(false)); + } + + if ($body->isSeekable()) { + $body->seek(0); + } + + return $psrResponse->withBody($body); + } +} diff --git a/vendor/symfony/http-client/Internal/NativeClientState.php b/vendor/symfony/http-client/Internal/NativeClientState.php new file mode 100644 index 0000000..20b2727 --- /dev/null +++ b/vendor/symfony/http-client/Internal/NativeClientState.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +/** + * Internal representation of the native client's state. + * + * @author Alexander M. Turek + * + * @internal + */ +final class NativeClientState extends ClientState +{ + /** @var int */ + public $id; + /** @var int */ + public $maxHostConnections = \PHP_INT_MAX; + /** @var int */ + public $responseCount = 0; + /** @var string[] */ + public $dnsCache = []; + /** @var bool */ + public $sleep = false; + /** @var int[] */ + public $hosts = []; + + public function __construct() + { + $this->id = random_int(\PHP_INT_MIN, \PHP_INT_MAX); + } + + public function reset() + { + $this->responseCount = 0; + $this->dnsCache = []; + $this->hosts = []; + } +} diff --git a/vendor/symfony/http-client/Internal/PushedResponse.php b/vendor/symfony/http-client/Internal/PushedResponse.php new file mode 100644 index 0000000..08fca60 --- /dev/null +++ b/vendor/symfony/http-client/Internal/PushedResponse.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Internal; + +use Symfony\Component\HttpClient\Response\CurlResponse; + +/** + * A pushed response with its request headers. + * + * @author Alexander M. Turek + * + * @internal + */ +final class PushedResponse +{ + public $response; + + /** @var string[] */ + public $requestHeaders; + + public $parentOptions = []; + + public $handle; + + public function __construct(CurlResponse $response, array $requestHeaders, array $parentOptions, $handle) + { + $this->response = $response; + $this->requestHeaders = $requestHeaders; + $this->parentOptions = $parentOptions; + $this->handle = $handle; + } +} diff --git a/vendor/symfony/http-client/LICENSE b/vendor/symfony/http-client/LICENSE new file mode 100644 index 0000000..74cdc2d --- /dev/null +++ b/vendor/symfony/http-client/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018-2022 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/http-client/MockHttpClient.php b/vendor/symfony/http-client/MockHttpClient.php new file mode 100644 index 0000000..fecba0e --- /dev/null +++ b/vendor/symfony/http-client/MockHttpClient.php @@ -0,0 +1,124 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Response\MockResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * A test-friendly HttpClient that doesn't make actual HTTP requests. + * + * @author Nicolas Grekas + */ +class MockHttpClient implements HttpClientInterface, ResetInterface +{ + use HttpClientTrait; + + private $responseFactory; + private $requestsCount = 0; + private $defaultOptions = []; + + /** + * @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory + */ + public function __construct($responseFactory = null, ?string $baseUri = 'https://example.com') + { + $this->setResponseFactory($responseFactory); + $this->defaultOptions['base_uri'] = $baseUri; + } + + /** + * @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory + */ + public function setResponseFactory($responseFactory): void + { + if ($responseFactory instanceof ResponseInterface) { + $responseFactory = [$responseFactory]; + } + + if (!$responseFactory instanceof \Iterator && null !== $responseFactory && !\is_callable($responseFactory)) { + $responseFactory = (static function () use ($responseFactory) { + yield from $responseFactory; + })(); + } + + $this->responseFactory = $responseFactory; + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + [$url, $options] = $this->prepareRequest($method, $url, $options, $this->defaultOptions, true); + $url = implode('', $url); + + if (null === $this->responseFactory) { + $response = new MockResponse(); + } elseif (\is_callable($this->responseFactory)) { + $response = ($this->responseFactory)($method, $url, $options); + } elseif (!$this->responseFactory->valid()) { + throw new TransportException('The response factory iterator passed to MockHttpClient is empty.'); + } else { + $responseFactory = $this->responseFactory->current(); + $response = \is_callable($responseFactory) ? $responseFactory($method, $url, $options) : $responseFactory; + $this->responseFactory->next(); + } + ++$this->requestsCount; + + if (!$response instanceof ResponseInterface) { + throw new TransportException(sprintf('The response factory passed to MockHttpClient must return/yield an instance of ResponseInterface, "%s" given.', \is_object($response) ? \get_class($response) : \gettype($response))); + } + + return MockResponse::fromRequest($method, $url, $options, $response); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof ResponseInterface) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of MockResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + return new ResponseStream(MockResponse::stream($responses, $timeout)); + } + + public function getRequestsCount(): int + { + return $this->requestsCount; + } + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->defaultOptions = self::mergeDefaultOptions($options, $this->defaultOptions, true); + + return $clone; + } + + public function reset() + { + $this->requestsCount = 0; + } +} diff --git a/vendor/symfony/http-client/NativeHttpClient.php b/vendor/symfony/http-client/NativeHttpClient.php new file mode 100644 index 0000000..63fcc1c --- /dev/null +++ b/vendor/symfony/http-client/NativeHttpClient.php @@ -0,0 +1,468 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerAwareTrait; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\NativeClientState; +use Symfony\Component\HttpClient\Response\NativeResponse; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * A portable implementation of the HttpClientInterface contracts based on PHP stream wrappers. + * + * PHP stream wrappers are able to fetch response bodies concurrently, + * but each request is opened synchronously. + * + * @author Nicolas Grekas + */ +final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface +{ + use HttpClientTrait; + use LoggerAwareTrait; + + private $defaultOptions = self::OPTIONS_DEFAULTS; + private static $emptyDefaults = self::OPTIONS_DEFAULTS; + + /** @var NativeClientState */ + private $multi; + + /** + * @param array $defaultOptions Default request's options + * @param int $maxHostConnections The maximum number of connections to open + * + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + */ + public function __construct(array $defaultOptions = [], int $maxHostConnections = 6) + { + $this->defaultOptions['buffer'] = $this->defaultOptions['buffer'] ?? \Closure::fromCallable([__CLASS__, 'shouldBuffer']); + + if ($defaultOptions) { + [, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions); + } + + $this->multi = new NativeClientState(); + $this->multi->maxHostConnections = 0 < $maxHostConnections ? $maxHostConnections : \PHP_INT_MAX; + } + + /** + * @see HttpClientInterface::OPTIONS_DEFAULTS for available options + * + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + [$url, $options] = self::prepareRequest($method, $url, $options, $this->defaultOptions); + + if ($options['bindto']) { + if (file_exists($options['bindto'])) { + throw new TransportException(__CLASS__.' cannot bind to local Unix sockets, use e.g. CurlHttpClient instead.'); + } + if (str_starts_with($options['bindto'], 'if!')) { + throw new TransportException(__CLASS__.' cannot bind to network interfaces, use e.g. CurlHttpClient instead.'); + } + if (str_starts_with($options['bindto'], 'host!')) { + $options['bindto'] = substr($options['bindto'], 5); + } + } + + $hasContentLength = isset($options['normalized_headers']['content-length']); + $hasBody = '' !== $options['body'] || 'POST' === $method || $hasContentLength; + + $options['body'] = self::getBodyAsString($options['body']); + + if ('chunked' === substr($options['normalized_headers']['transfer-encoding'][0] ?? '', \strlen('Transfer-Encoding: '))) { + unset($options['normalized_headers']['transfer-encoding']); + $options['headers'] = array_merge(...array_values($options['normalized_headers'])); + $options['body'] = self::dechunk($options['body']); + } + if ('' === $options['body'] && $hasBody && !$hasContentLength) { + $options['headers'][] = 'Content-Length: 0'; + } + if ($hasBody && !isset($options['normalized_headers']['content-type'])) { + $options['headers'][] = 'Content-Type: application/x-www-form-urlencoded'; + } + + if (\extension_loaded('zlib') && !isset($options['normalized_headers']['accept-encoding'])) { + // gzip is the most widely available algo, no need to deal with deflate + $options['headers'][] = 'Accept-Encoding: gzip'; + } + + if ($options['peer_fingerprint']) { + if (isset($options['peer_fingerprint']['pin-sha256']) && 1 === \count($options['peer_fingerprint'])) { + throw new TransportException(__CLASS__.' cannot verify "pin-sha256" fingerprints, please provide a "sha256" one.'); + } + + unset($options['peer_fingerprint']['pin-sha256']); + } + + $info = [ + 'response_headers' => [], + 'url' => $url, + 'error' => null, + 'canceled' => false, + 'http_method' => $method, + 'http_code' => 0, + 'redirect_count' => 0, + 'start_time' => 0.0, + 'connect_time' => 0.0, + 'redirect_time' => 0.0, + 'pretransfer_time' => 0.0, + 'starttransfer_time' => 0.0, + 'total_time' => 0.0, + 'namelookup_time' => 0.0, + 'size_upload' => 0, + 'size_download' => 0, + 'size_body' => \strlen($options['body']), + 'primary_ip' => '', + 'primary_port' => 'http:' === $url['scheme'] ? 80 : 443, + 'debug' => \extension_loaded('curl') ? '' : "* Enable the curl extension for better performance\n", + ]; + + if ($onProgress = $options['on_progress']) { + // Memoize the last progress to ease calling the callback periodically when no network transfer happens + $lastProgress = [0, 0]; + $maxDuration = 0 < $options['max_duration'] ? $options['max_duration'] : \INF; + $onProgress = static function (...$progress) use ($onProgress, &$lastProgress, &$info, $maxDuration) { + if ($info['total_time'] >= $maxDuration) { + throw new TransportException(sprintf('Max duration was reached for "%s".', implode('', $info['url']))); + } + + $progressInfo = $info; + $progressInfo['url'] = implode('', $info['url']); + unset($progressInfo['size_body']); + + if ($progress && -1 === $progress[0]) { + // Response completed + $lastProgress[0] = max($lastProgress); + } else { + $lastProgress = $progress ?: $lastProgress; + } + + $onProgress($lastProgress[0], $lastProgress[1], $progressInfo); + }; + } elseif (0 < $options['max_duration']) { + $maxDuration = $options['max_duration']; + $onProgress = static function () use (&$info, $maxDuration): void { + if ($info['total_time'] >= $maxDuration) { + throw new TransportException(sprintf('Max duration was reached for "%s".', implode('', $info['url']))); + } + }; + } + + // Always register a notification callback to compute live stats about the response + $notification = static function (int $code, int $severity, ?string $msg, int $msgCode, int $dlNow, int $dlSize) use ($onProgress, &$info) { + $info['total_time'] = microtime(true) - $info['start_time']; + + if (\STREAM_NOTIFY_PROGRESS === $code) { + $info['starttransfer_time'] = $info['starttransfer_time'] ?: $info['total_time']; + $info['size_upload'] += $dlNow ? 0 : $info['size_body']; + $info['size_download'] = $dlNow; + } elseif (\STREAM_NOTIFY_CONNECT === $code) { + $info['connect_time'] = $info['total_time']; + $info['debug'] .= $info['request_header']; + unset($info['request_header']); + } else { + return; + } + + if ($onProgress) { + $onProgress($dlNow, $dlSize); + } + }; + + if ($options['resolve']) { + $this->multi->dnsCache = $options['resolve'] + $this->multi->dnsCache; + } + + $this->logger && $this->logger->info(sprintf('Request: "%s %s"', $method, implode('', $url))); + + if (!isset($options['normalized_headers']['user-agent'])) { + $options['headers'][] = 'User-Agent: Symfony HttpClient/Native'; + } + + if (0 < $options['max_duration']) { + $options['timeout'] = min($options['max_duration'], $options['timeout']); + } + + $bindto = $options['bindto']; + if (!$bindto && (70322 === \PHP_VERSION_ID || 70410 === \PHP_VERSION_ID)) { + $bindto = '0:0'; + } + + $context = [ + 'http' => [ + 'protocol_version' => min($options['http_version'] ?: '1.1', '1.1'), + 'method' => $method, + 'content' => $options['body'], + 'ignore_errors' => true, + 'curl_verify_ssl_peer' => $options['verify_peer'], + 'curl_verify_ssl_host' => $options['verify_host'], + 'auto_decode' => false, // Disable dechunk filter, it's incompatible with stream_select() + 'timeout' => $options['timeout'], + 'follow_location' => false, // We follow redirects ourselves - the native logic is too limited + ], + 'ssl' => array_filter([ + 'verify_peer' => $options['verify_peer'], + 'verify_peer_name' => $options['verify_host'], + 'cafile' => $options['cafile'], + 'capath' => $options['capath'], + 'local_cert' => $options['local_cert'], + 'local_pk' => $options['local_pk'], + 'passphrase' => $options['passphrase'], + 'ciphers' => $options['ciphers'], + 'peer_fingerprint' => $options['peer_fingerprint'], + 'capture_peer_cert_chain' => $options['capture_peer_cert_chain'], + 'allow_self_signed' => (bool) $options['peer_fingerprint'], + 'SNI_enabled' => true, + 'disable_compression' => true, + ], static function ($v) { return null !== $v; }), + 'socket' => [ + 'bindto' => $bindto, + 'tcp_nodelay' => true, + ], + ]; + + $context = stream_context_create($context, ['notification' => $notification]); + + $resolver = static function ($multi) use ($context, $options, $url, &$info, $onProgress) { + [$host, $port] = self::parseHostPort($url, $info); + + if (!isset($options['normalized_headers']['host'])) { + $options['headers'][] = 'Host: '.$host.$port; + } + + $proxy = self::getProxy($options['proxy'], $url, $options['no_proxy']); + + if (!self::configureHeadersAndProxy($context, $host, $options['headers'], $proxy, 'https:' === $url['scheme'])) { + $ip = self::dnsResolve($host, $multi, $info, $onProgress); + $url['authority'] = substr_replace($url['authority'], $ip, -\strlen($host) - \strlen($port), \strlen($host)); + } + + return [self::createRedirectResolver($options, $host, $proxy, $info, $onProgress), implode('', $url)]; + }; + + return new NativeResponse($this->multi, $context, implode('', $url), $options, $info, $resolver, $onProgress, $this->logger); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof NativeResponse) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of NativeResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + return new ResponseStream(NativeResponse::stream($responses, $timeout)); + } + + public function reset() + { + $this->multi->reset(); + } + + private static function getBodyAsString($body): string + { + if (\is_resource($body)) { + return stream_get_contents($body); + } + + if (!$body instanceof \Closure) { + return $body; + } + + $result = ''; + + while ('' !== $data = $body(self::$CHUNK_SIZE)) { + if (!\is_string($data)) { + throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', get_debug_type($data))); + } + + $result .= $data; + } + + return $result; + } + + /** + * Extracts the host and the port from the URL. + */ + private static function parseHostPort(array $url, array &$info): array + { + if ($port = parse_url($url['authority'], \PHP_URL_PORT) ?: '') { + $info['primary_port'] = $port; + $port = ':'.$port; + } else { + $info['primary_port'] = 'http:' === $url['scheme'] ? 80 : 443; + } + + return [parse_url($url['authority'], \PHP_URL_HOST), $port]; + } + + /** + * Resolves the IP of the host using the local DNS cache if possible. + */ + private static function dnsResolve($host, NativeClientState $multi, array &$info, ?\Closure $onProgress): string + { + if (null === $ip = $multi->dnsCache[$host] ?? null) { + $info['debug'] .= "* Hostname was NOT found in DNS cache\n"; + $now = microtime(true); + + if (!$ip = gethostbynamel($host)) { + throw new TransportException(sprintf('Could not resolve host "%s".', $host)); + } + + $info['namelookup_time'] = microtime(true) - ($info['start_time'] ?: $now); + $multi->dnsCache[$host] = $ip = $ip[0]; + $info['debug'] .= "* Added {$host}:0:{$ip} to DNS cache\n"; + } else { + $info['debug'] .= "* Hostname was found in DNS cache\n"; + } + + $info['primary_ip'] = $ip; + + if ($onProgress) { + // Notify DNS resolution + $onProgress(); + } + + return $ip; + } + + /** + * Handles redirects - the native logic is too buggy to be used. + */ + private static function createRedirectResolver(array $options, string $host, ?array $proxy, array &$info, ?\Closure $onProgress): \Closure + { + $redirectHeaders = []; + if (0 < $maxRedirects = $options['max_redirects']) { + $redirectHeaders = ['host' => $host]; + $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = array_filter($options['headers'], static function ($h) { + return 0 !== stripos($h, 'Host:'); + }); + + if (isset($options['normalized_headers']['authorization']) || isset($options['normalized_headers']['cookie'])) { + $redirectHeaders['no_auth'] = array_filter($redirectHeaders['no_auth'], static function ($h) { + return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:'); + }); + } + } + + return static function (NativeClientState $multi, ?string $location, $context) use (&$redirectHeaders, $proxy, &$info, $maxRedirects, $onProgress): ?string { + if (null === $location || $info['http_code'] < 300 || 400 <= $info['http_code']) { + $info['redirect_url'] = null; + + return null; + } + + try { + $url = self::parseUrl($location); + } catch (InvalidArgumentException $e) { + $info['redirect_url'] = null; + + return null; + } + + $url = self::resolveUrl($url, $info['url']); + $info['redirect_url'] = implode('', $url); + + if ($info['redirect_count'] >= $maxRedirects) { + return null; + } + + $info['url'] = $url; + ++$info['redirect_count']; + $info['redirect_time'] = microtime(true) - $info['start_time']; + + // Do like curl and browsers: turn POST to GET on 301, 302 and 303 + if (\in_array($info['http_code'], [301, 302, 303], true)) { + $options = stream_context_get_options($context)['http']; + + if ('POST' === $options['method'] || 303 === $info['http_code']) { + $info['http_method'] = $options['method'] = 'HEAD' === $options['method'] ? 'HEAD' : 'GET'; + $options['content'] = ''; + $filterContentHeaders = static function ($h) { + return 0 !== stripos($h, 'Content-Length:') && 0 !== stripos($h, 'Content-Type:') && 0 !== stripos($h, 'Transfer-Encoding:'); + }; + $options['header'] = array_filter($options['header'], $filterContentHeaders); + $redirectHeaders['no_auth'] = array_filter($redirectHeaders['no_auth'], $filterContentHeaders); + $redirectHeaders['with_auth'] = array_filter($redirectHeaders['with_auth'], $filterContentHeaders); + + stream_context_set_option($context, ['http' => $options]); + } + } + + [$host, $port] = self::parseHostPort($url, $info); + + if (false !== (parse_url($location, \PHP_URL_HOST) ?? false)) { + // Authorization and Cookie headers MUST NOT follow except for the initial host name + $requestHeaders = $redirectHeaders['host'] === $host ? $redirectHeaders['with_auth'] : $redirectHeaders['no_auth']; + $requestHeaders[] = 'Host: '.$host.$port; + $dnsResolve = !self::configureHeadersAndProxy($context, $host, $requestHeaders, $proxy, 'https:' === $url['scheme']); + } else { + $dnsResolve = isset(stream_context_get_options($context)['ssl']['peer_name']); + } + + if ($dnsResolve) { + $ip = self::dnsResolve($host, $multi, $info, $onProgress); + $url['authority'] = substr_replace($url['authority'], $ip, -\strlen($host) - \strlen($port), \strlen($host)); + } + + return implode('', $url); + }; + } + + private static function configureHeadersAndProxy($context, string $host, array $requestHeaders, ?array $proxy, bool $isSsl): bool + { + if (null === $proxy) { + stream_context_set_option($context, 'http', 'header', $requestHeaders); + stream_context_set_option($context, 'ssl', 'peer_name', $host); + + return false; + } + + // Matching "no_proxy" should follow the behavior of curl + + foreach ($proxy['no_proxy'] as $rule) { + $dotRule = '.'.ltrim($rule, '.'); + + if ('*' === $rule || $host === $rule || str_ends_with($host, $dotRule)) { + stream_context_set_option($context, 'http', 'proxy', null); + stream_context_set_option($context, 'http', 'request_fulluri', false); + stream_context_set_option($context, 'http', 'header', $requestHeaders); + stream_context_set_option($context, 'ssl', 'peer_name', $host); + + return false; + } + } + + if (null !== $proxy['auth']) { + $requestHeaders[] = 'Proxy-Authorization: '.$proxy['auth']; + } + + stream_context_set_option($context, 'http', 'proxy', $proxy['url']); + stream_context_set_option($context, 'http', 'request_fulluri', !$isSsl); + stream_context_set_option($context, 'http', 'header', $requestHeaders); + stream_context_set_option($context, 'ssl', 'peer_name', null); + + return true; + } +} diff --git a/vendor/symfony/http-client/NoPrivateNetworkHttpClient.php b/vendor/symfony/http-client/NoPrivateNetworkHttpClient.php new file mode 100644 index 0000000..911cce9 --- /dev/null +++ b/vendor/symfony/http-client/NoPrivateNetworkHttpClient.php @@ -0,0 +1,132 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpFoundation\IpUtils; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Decorator that blocks requests to private networks by default. + * + * @author Hallison Boaventura + */ +final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwareInterface, ResetInterface +{ + use HttpClientTrait; + + private const PRIVATE_SUBNETS = [ + '127.0.0.0/8', + '10.0.0.0/8', + '192.168.0.0/16', + '172.16.0.0/12', + '169.254.0.0/16', + '0.0.0.0/8', + '240.0.0.0/4', + '::1/128', + 'fc00::/7', + 'fe80::/10', + '::ffff:0:0/96', + '::/128', + ]; + + private $client; + private $subnets; + + /** + * @param string|array|null $subnets String or array of subnets using CIDR notation that will be used by IpUtils. + * If null is passed, the standard private subnets will be used. + */ + public function __construct(HttpClientInterface $client, $subnets = null) + { + if (!(\is_array($subnets) || \is_string($subnets) || null === $subnets)) { + throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be of the type array, string or null. "%s" given.', __METHOD__, get_debug_type($subnets))); + } + + if (!class_exists(IpUtils::class)) { + throw new \LogicException(sprintf('You cannot use "%s" if the HttpFoundation component is not installed. Try running "composer require symfony/http-foundation".', __CLASS__)); + } + + $this->client = $client; + $this->subnets = $subnets; + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + $onProgress = $options['on_progress'] ?? null; + if (null !== $onProgress && !\is_callable($onProgress)) { + throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', get_debug_type($onProgress))); + } + + $subnets = $this->subnets; + $lastPrimaryIp = ''; + + $options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use ($onProgress, $subnets, &$lastPrimaryIp): void { + if ($info['primary_ip'] !== $lastPrimaryIp) { + if ($info['primary_ip'] && IpUtils::checkIp($info['primary_ip'], $subnets ?? self::PRIVATE_SUBNETS)) { + throw new TransportException(sprintf('IP "%s" is blocked for "%s".', $info['primary_ip'], $info['url'])); + } + + $lastPrimaryIp = $info['primary_ip']; + } + + null !== $onProgress && $onProgress($dlNow, $dlSize, $info); + }; + + return $this->client->request($method, $url, $options); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + return $this->client->stream($responses, $timeout); + } + + /** + * {@inheritdoc} + */ + public function setLogger(LoggerInterface $logger): void + { + if ($this->client instanceof LoggerAwareInterface) { + $this->client->setLogger($logger); + } + } + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->client = $this->client->withOptions($options); + + return $clone; + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } +} diff --git a/vendor/symfony/http-client/Psr18Client.php b/vendor/symfony/http-client/Psr18Client.php new file mode 100644 index 0000000..dbd8864 --- /dev/null +++ b/vendor/symfony/http-client/Psr18Client.php @@ -0,0 +1,239 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Http\Discovery\Exception\NotFoundException; +use Http\Discovery\Psr17FactoryDiscovery; +use Nyholm\Psr7\Factory\Psr17Factory; +use Nyholm\Psr7\Request; +use Nyholm\Psr7\Uri; +use Psr\Http\Client\ClientInterface; +use Psr\Http\Client\NetworkExceptionInterface; +use Psr\Http\Client\RequestExceptionInterface; +use Psr\Http\Message\RequestFactoryInterface; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\StreamInterface; +use Psr\Http\Message\UriFactoryInterface; +use Psr\Http\Message\UriInterface; +use Symfony\Component\HttpClient\Response\StreamableInterface; +use Symfony\Component\HttpClient\Response\StreamWrapper; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\Service\ResetInterface; + +if (!interface_exists(RequestFactoryInterface::class)) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as the "psr/http-factory" package is not installed. Try running "composer require nyholm/psr7".'); +} + +if (!interface_exists(ClientInterface::class)) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as the "psr/http-client" package is not installed. Try running "composer require psr/http-client".'); +} + +/** + * An adapter to turn a Symfony HttpClientInterface into a PSR-18 ClientInterface. + * + * Run "composer require psr/http-client" to install the base ClientInterface. Run + * "composer require nyholm/psr7" to install an efficient implementation of response + * and stream factories with flex-provided autowiring aliases. + * + * @author Nicolas Grekas + */ +final class Psr18Client implements ClientInterface, RequestFactoryInterface, StreamFactoryInterface, UriFactoryInterface, ResetInterface +{ + private $client; + private $responseFactory; + private $streamFactory; + + public function __construct(HttpClientInterface $client = null, ResponseFactoryInterface $responseFactory = null, StreamFactoryInterface $streamFactory = null) + { + $this->client = $client ?? HttpClient::create(); + $this->responseFactory = $responseFactory; + $this->streamFactory = $streamFactory ?? ($responseFactory instanceof StreamFactoryInterface ? $responseFactory : null); + + if (null !== $this->responseFactory && null !== $this->streamFactory) { + return; + } + + if (!class_exists(Psr17Factory::class) && !class_exists(Psr17FactoryDiscovery::class)) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as no PSR-17 factories have been provided. Try running "composer require nyholm/psr7".'); + } + + try { + $psr17Factory = class_exists(Psr17Factory::class, false) ? new Psr17Factory() : null; + $this->responseFactory = $this->responseFactory ?? $psr17Factory ?? Psr17FactoryDiscovery::findResponseFactory(); + $this->streamFactory = $this->streamFactory ?? $psr17Factory ?? Psr17FactoryDiscovery::findStreamFactory(); + } catch (NotFoundException $e) { + throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\HttplugClient" as no PSR-17 factories have been found. Try running "composer require nyholm/psr7".', 0, $e); + } + } + + /** + * {@inheritdoc} + */ + public function sendRequest(RequestInterface $request): ResponseInterface + { + try { + $body = $request->getBody(); + + if ($body->isSeekable()) { + $body->seek(0); + } + + $response = $this->client->request($request->getMethod(), (string) $request->getUri(), [ + 'headers' => $request->getHeaders(), + 'body' => $body->getContents(), + 'http_version' => '1.0' === $request->getProtocolVersion() ? '1.0' : null, + ]); + + $psrResponse = $this->responseFactory->createResponse($response->getStatusCode()); + + foreach ($response->getHeaders(false) as $name => $values) { + foreach ($values as $value) { + $psrResponse = $psrResponse->withAddedHeader($name, $value); + } + } + + $body = $response instanceof StreamableInterface ? $response->toStream(false) : StreamWrapper::createResource($response, $this->client); + $body = $this->streamFactory->createStreamFromResource($body); + + if ($body->isSeekable()) { + $body->seek(0); + } + + return $psrResponse->withBody($body); + } catch (TransportExceptionInterface $e) { + if ($e instanceof \InvalidArgumentException) { + throw new Psr18RequestException($e, $request); + } + + throw new Psr18NetworkException($e, $request); + } + } + + /** + * {@inheritdoc} + */ + public function createRequest(string $method, $uri): RequestInterface + { + if ($this->responseFactory instanceof RequestFactoryInterface) { + return $this->responseFactory->createRequest($method, $uri); + } + + if (class_exists(Request::class)) { + return new Request($method, $uri); + } + + if (class_exists(Psr17FactoryDiscovery::class)) { + return Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $uri); + } + + throw new \LogicException(sprintf('You cannot use "%s()" as the "nyholm/psr7" package is not installed. Try running "composer require nyholm/psr7".', __METHOD__)); + } + + /** + * {@inheritdoc} + */ + public function createStream(string $content = ''): StreamInterface + { + $stream = $this->streamFactory->createStream($content); + + if ($stream->isSeekable()) { + $stream->seek(0); + } + + return $stream; + } + + /** + * {@inheritdoc} + */ + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + return $this->streamFactory->createStreamFromFile($filename, $mode); + } + + /** + * {@inheritdoc} + */ + public function createStreamFromResource($resource): StreamInterface + { + return $this->streamFactory->createStreamFromResource($resource); + } + + /** + * {@inheritdoc} + */ + public function createUri(string $uri = ''): UriInterface + { + if ($this->responseFactory instanceof UriFactoryInterface) { + return $this->responseFactory->createUri($uri); + } + + if (class_exists(Uri::class)) { + return new Uri($uri); + } + + if (class_exists(Psr17FactoryDiscovery::class)) { + return Psr17FactoryDiscovery::findUrlFactory()->createUri($uri); + } + + throw new \LogicException(sprintf('You cannot use "%s()" as the "nyholm/psr7" package is not installed. Try running "composer require nyholm/psr7".', __METHOD__)); + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } +} + +/** + * @internal + */ +class Psr18NetworkException extends \RuntimeException implements NetworkExceptionInterface +{ + private $request; + + public function __construct(TransportExceptionInterface $e, RequestInterface $request) + { + parent::__construct($e->getMessage(), 0, $e); + $this->request = $request; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } +} + +/** + * @internal + */ +class Psr18RequestException extends \InvalidArgumentException implements RequestExceptionInterface +{ + private $request; + + public function __construct(TransportExceptionInterface $e, RequestInterface $request) + { + parent::__construct($e->getMessage(), 0, $e); + $this->request = $request; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } +} diff --git a/vendor/symfony/http-client/README.md b/vendor/symfony/http-client/README.md new file mode 100644 index 0000000..0c55ccc --- /dev/null +++ b/vendor/symfony/http-client/README.md @@ -0,0 +1,27 @@ +HttpClient component +==================== + +The HttpClient component provides powerful methods to fetch HTTP resources synchronously or asynchronously. + +Sponsor +------- + +The Httpclient component for Symfony 5.4/6.0 is [backed][1] by [Klaxoon][2]. + +Klaxoon is a platform that empowers organizations to run effective and +productive workshops easily in a hybrid environment. Anytime, Anywhere. + +Help Symfony by [sponsoring][3] its development! + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/http_client.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://klaxoon.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/http-client/Response/AmpResponse.php b/vendor/symfony/http-client/Response/AmpResponse.php new file mode 100644 index 0000000..9015a06 --- /dev/null +++ b/vendor/symfony/http-client/Response/AmpResponse.php @@ -0,0 +1,460 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Amp\ByteStream\StreamException; +use Amp\CancellationTokenSource; +use Amp\Coroutine; +use Amp\Deferred; +use Amp\Http\Client\HttpException; +use Amp\Http\Client\Request; +use Amp\Http\Client\Response; +use Amp\Loop; +use Amp\Promise; +use Amp\Success; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Chunk\InformationalChunk; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\HttpClientTrait; +use Symfony\Component\HttpClient\Internal\AmpBody; +use Symfony\Component\HttpClient\Internal\AmpClientState; +use Symfony\Component\HttpClient\Internal\Canary; +use Symfony\Component\HttpClient\Internal\ClientState; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class AmpResponse implements ResponseInterface, StreamableInterface +{ + use CommonResponseTrait; + use TransportResponseTrait; + + private static $nextId = 'a'; + + private $multi; + private $options; + private $canceller; + private $onProgress; + + private static $delay; + + /** + * @internal + */ + public function __construct(AmpClientState $multi, Request $request, array $options, ?LoggerInterface $logger) + { + $this->multi = $multi; + $this->options = &$options; + $this->logger = $logger; + $this->timeout = $options['timeout']; + $this->shouldBuffer = $options['buffer']; + + if ($this->inflate = \extension_loaded('zlib') && !$request->hasHeader('accept-encoding')) { + $request->setHeader('Accept-Encoding', 'gzip'); + } + + $this->initializer = static function (self $response) { + return null !== $response->options; + }; + + $info = &$this->info; + $headers = &$this->headers; + $canceller = $this->canceller = new CancellationTokenSource(); + $handle = &$this->handle; + + $info['url'] = (string) $request->getUri(); + $info['http_method'] = $request->getMethod(); + $info['start_time'] = null; + $info['redirect_url'] = null; + $info['redirect_time'] = 0.0; + $info['redirect_count'] = 0; + $info['size_upload'] = 0.0; + $info['size_download'] = 0.0; + $info['upload_content_length'] = -1.0; + $info['download_content_length'] = -1.0; + $info['user_data'] = $options['user_data']; + $info['debug'] = ''; + + $onProgress = $options['on_progress'] ?? static function () {}; + $onProgress = $this->onProgress = static function () use (&$info, $onProgress) { + $info['total_time'] = microtime(true) - $info['start_time']; + $onProgress((int) $info['size_download'], ((int) (1 + $info['download_content_length']) ?: 1) - 1, (array) $info); + }; + + $pauseDeferred = new Deferred(); + $pause = new Success(); + + $throttleWatcher = null; + + $this->id = $id = self::$nextId++; + Loop::defer(static function () use ($request, $multi, &$id, &$info, &$headers, $canceller, &$options, $onProgress, &$handle, $logger, &$pause) { + return new Coroutine(self::generateResponse($request, $multi, $id, $info, $headers, $canceller, $options, $onProgress, $handle, $logger, $pause)); + }); + + $info['pause_handler'] = static function (float $duration) use (&$throttleWatcher, &$pauseDeferred, &$pause) { + if (null !== $throttleWatcher) { + Loop::cancel($throttleWatcher); + } + + $pause = $pauseDeferred->promise(); + + if ($duration <= 0) { + $deferred = $pauseDeferred; + $pauseDeferred = new Deferred(); + $deferred->resolve(); + } else { + $throttleWatcher = Loop::delay(ceil(1000 * $duration), static function () use (&$pauseDeferred) { + $deferred = $pauseDeferred; + $pauseDeferred = new Deferred(); + $deferred->resolve(); + }); + } + }; + + $multi->lastTimeout = null; + $multi->openHandles[$id] = $id; + ++$multi->responseCount; + + $this->canary = new Canary(static function () use ($canceller, $multi, $id) { + $canceller->cancel(); + unset($multi->openHandles[$id], $multi->handlesActivity[$id]); + }); + } + + /** + * {@inheritdoc} + */ + public function getInfo(string $type = null) + { + return null !== $type ? $this->info[$type] ?? null : $this->info; + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + public function __destruct() + { + try { + $this->doDestruct(); + } finally { + // Clear the DNS cache when all requests completed + if (0 >= --$this->multi->responseCount) { + $this->multi->responseCount = 0; + $this->multi->dnsCache = []; + } + } + } + + /** + * {@inheritdoc} + */ + private static function schedule(self $response, array &$runningResponses): void + { + if (isset($runningResponses[0])) { + $runningResponses[0][1][$response->id] = $response; + } else { + $runningResponses[0] = [$response->multi, [$response->id => $response]]; + } + + if (!isset($response->multi->openHandles[$response->id])) { + $response->multi->handlesActivity[$response->id][] = null; + $response->multi->handlesActivity[$response->id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; + } + } + + /** + * {@inheritdoc} + * + * @param AmpClientState $multi + */ + private static function perform(ClientState $multi, array &$responses = null): void + { + if ($responses) { + foreach ($responses as $response) { + try { + if ($response->info['start_time']) { + $response->info['total_time'] = microtime(true) - $response->info['start_time']; + ($response->onProgress)(); + } + } catch (\Throwable $e) { + $multi->handlesActivity[$response->id][] = null; + $multi->handlesActivity[$response->id][] = $e; + } + } + } + } + + /** + * {@inheritdoc} + * + * @param AmpClientState $multi + */ + private static function select(ClientState $multi, float $timeout): int + { + $timeout += microtime(true); + self::$delay = Loop::defer(static function () use ($timeout) { + if (0 < $timeout -= microtime(true)) { + self::$delay = Loop::delay(ceil(1000 * $timeout), [Loop::class, 'stop']); + } else { + Loop::stop(); + } + }); + + Loop::run(); + + return null === self::$delay ? 1 : 0; + } + + private static function generateResponse(Request $request, AmpClientState $multi, string $id, array &$info, array &$headers, CancellationTokenSource $canceller, array &$options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause) + { + $request->setInformationalResponseHandler(static function (Response $response) use ($multi, $id, &$info, &$headers) { + self::addResponseHeaders($response, $info, $headers); + $multi->handlesActivity[$id][] = new InformationalChunk($response->getStatus(), $response->getHeaders()); + self::stopLoop(); + }); + + try { + /* @var Response $response */ + if (null === $response = yield from self::getPushedResponse($request, $multi, $info, $headers, $options, $logger)) { + $logger && $logger->info(sprintf('Request: "%s %s"', $info['http_method'], $info['url'])); + + $response = yield from self::followRedirects($request, $multi, $info, $headers, $canceller, $options, $onProgress, $handle, $logger, $pause); + } + + $options = null; + + $multi->handlesActivity[$id][] = new FirstChunk(); + + if ('HEAD' === $response->getRequest()->getMethod() || \in_array($info['http_code'], [204, 304], true)) { + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = null; + self::stopLoop(); + + return; + } + + if ($response->hasHeader('content-length')) { + $info['download_content_length'] = (float) $response->getHeader('content-length'); + } + + $body = $response->getBody(); + + while (true) { + self::stopLoop(); + + yield $pause; + + if (null === $data = yield $body->read()) { + break; + } + + $info['size_download'] += \strlen($data); + $multi->handlesActivity[$id][] = $data; + } + + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = null; + } catch (\Throwable $e) { + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = $e; + } finally { + $info['download_content_length'] = $info['size_download']; + } + + self::stopLoop(); + } + + private static function followRedirects(Request $originRequest, AmpClientState $multi, array &$info, array &$headers, CancellationTokenSource $canceller, array $options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause) + { + yield $pause; + + $originRequest->setBody(new AmpBody($options['body'], $info, $onProgress)); + $response = yield $multi->request($options, $originRequest, $canceller->getToken(), $info, $onProgress, $handle); + $previousUrl = null; + + while (true) { + self::addResponseHeaders($response, $info, $headers); + $status = $response->getStatus(); + + if (!\in_array($status, [301, 302, 303, 307, 308], true) || null === $location = $response->getHeader('location')) { + return $response; + } + + $urlResolver = new class() { + use HttpClientTrait { + parseUrl as public; + resolveUrl as public; + } + }; + + try { + $previousUrl = $previousUrl ?? $urlResolver::parseUrl($info['url']); + $location = $urlResolver::parseUrl($location); + $location = $urlResolver::resolveUrl($location, $previousUrl); + $info['redirect_url'] = implode('', $location); + } catch (InvalidArgumentException $e) { + return $response; + } + + if (0 >= $options['max_redirects'] || $info['redirect_count'] >= $options['max_redirects']) { + return $response; + } + + $logger && $logger->info(sprintf('Redirecting: "%s %s"', $status, $info['url'])); + + try { + // Discard body of redirects + while (null !== yield $response->getBody()->read()) { + } + } catch (HttpException|StreamException $e) { + // Ignore streaming errors on previous responses + } + + ++$info['redirect_count']; + $info['url'] = $info['redirect_url']; + $info['redirect_url'] = null; + $previousUrl = $location; + + $request = new Request($info['url'], $info['http_method']); + $request->setProtocolVersions($originRequest->getProtocolVersions()); + $request->setTcpConnectTimeout($originRequest->getTcpConnectTimeout()); + $request->setTlsHandshakeTimeout($originRequest->getTlsHandshakeTimeout()); + $request->setTransferTimeout($originRequest->getTransferTimeout()); + + if (\in_array($status, [301, 302, 303], true)) { + $originRequest->removeHeader('transfer-encoding'); + $originRequest->removeHeader('content-length'); + $originRequest->removeHeader('content-type'); + + // Do like curl and browsers: turn POST to GET on 301, 302 and 303 + if ('POST' === $response->getRequest()->getMethod() || 303 === $status) { + $info['http_method'] = 'HEAD' === $response->getRequest()->getMethod() ? 'HEAD' : 'GET'; + $request->setMethod($info['http_method']); + } + } else { + $request->setBody(AmpBody::rewind($response->getRequest()->getBody())); + } + + foreach ($originRequest->getRawHeaders() as [$name, $value]) { + $request->setHeader($name, $value); + } + + if ($request->getUri()->getAuthority() !== $originRequest->getUri()->getAuthority()) { + $request->removeHeader('authorization'); + $request->removeHeader('cookie'); + $request->removeHeader('host'); + } + + yield $pause; + + $response = yield $multi->request($options, $request, $canceller->getToken(), $info, $onProgress, $handle); + $info['redirect_time'] = microtime(true) - $info['start_time']; + } + } + + private static function addResponseHeaders(Response $response, array &$info, array &$headers): void + { + $info['http_code'] = $response->getStatus(); + + if ($headers) { + $info['debug'] .= "< \r\n"; + $headers = []; + } + + $h = sprintf('HTTP/%s %s %s', $response->getProtocolVersion(), $response->getStatus(), $response->getReason()); + $info['debug'] .= "< {$h}\r\n"; + $info['response_headers'][] = $h; + + foreach ($response->getRawHeaders() as [$name, $value]) { + $headers[strtolower($name)][] = $value; + $h = $name.': '.$value; + $info['debug'] .= "< {$h}\r\n"; + $info['response_headers'][] = $h; + } + + $info['debug'] .= "< \r\n"; + } + + /** + * Accepts pushed responses only if their headers related to authentication match the request. + */ + private static function getPushedResponse(Request $request, AmpClientState $multi, array &$info, array &$headers, array $options, ?LoggerInterface $logger) + { + if ('' !== $options['body']) { + return null; + } + + $authority = $request->getUri()->getAuthority(); + + foreach ($multi->pushedResponses[$authority] ?? [] as $i => [$pushedUrl, $pushDeferred, $pushedRequest, $pushedResponse, $parentOptions]) { + if ($info['url'] !== $pushedUrl || $info['http_method'] !== $pushedRequest->getMethod()) { + continue; + } + + foreach ($parentOptions as $k => $v) { + if ($options[$k] !== $v) { + continue 2; + } + } + + foreach (['authorization', 'cookie', 'range', 'proxy-authorization'] as $k) { + if ($pushedRequest->getHeaderArray($k) !== $request->getHeaderArray($k)) { + continue 2; + } + } + + $response = yield $pushedResponse; + + foreach ($response->getHeaderArray('vary') as $vary) { + foreach (preg_split('/\s*+,\s*+/', $vary) as $v) { + if ('*' === $v || ($pushedRequest->getHeaderArray($v) !== $request->getHeaderArray($v) && 'accept-encoding' !== strtolower($v))) { + $logger && $logger->debug(sprintf('Skipping pushed response: "%s"', $info['url'])); + continue 3; + } + } + } + + $pushDeferred->resolve(); + $logger && $logger->debug(sprintf('Accepting pushed response: "%s %s"', $info['http_method'], $info['url'])); + self::addResponseHeaders($response, $info, $headers); + unset($multi->pushedResponses[$authority][$i]); + + if (!$multi->pushedResponses[$authority]) { + unset($multi->pushedResponses[$authority]); + } + + return $response; + } + } + + private static function stopLoop(): void + { + if (null !== self::$delay) { + Loop::cancel(self::$delay); + self::$delay = null; + } + + Loop::defer([Loop::class, 'stop']); + } +} diff --git a/vendor/symfony/http-client/Response/AsyncContext.php b/vendor/symfony/http-client/Response/AsyncContext.php new file mode 100644 index 0000000..1af8dbe --- /dev/null +++ b/vendor/symfony/http-client/Response/AsyncContext.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Chunk\DataChunk; +use Symfony\Component\HttpClient\Chunk\LastChunk; +use Symfony\Contracts\HttpClient\ChunkInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * A DTO to work with AsyncResponse. + * + * @author Nicolas Grekas + */ +final class AsyncContext +{ + private $passthru; + private $client; + private $response; + private $info = []; + private $content; + private $offset; + + public function __construct(&$passthru, HttpClientInterface $client, ResponseInterface &$response, array &$info, $content, int $offset) + { + $this->passthru = &$passthru; + $this->client = $client; + $this->response = &$response; + $this->info = &$info; + $this->content = $content; + $this->offset = $offset; + } + + /** + * Returns the HTTP status without consuming the response. + */ + public function getStatusCode(): int + { + return $this->response->getInfo('http_code'); + } + + /** + * Returns the headers without consuming the response. + */ + public function getHeaders(): array + { + $headers = []; + + foreach ($this->response->getInfo('response_headers') as $h) { + if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? ([123456789]\d\d)(?: |$)#', $h, $m)) { + $headers = []; + } elseif (2 === \count($m = explode(':', $h, 2))) { + $headers[strtolower($m[0])][] = ltrim($m[1]); + } + } + + return $headers; + } + + /** + * @return resource|null The PHP stream resource where the content is buffered, if it is + */ + public function getContent() + { + return $this->content; + } + + /** + * Creates a new chunk of content. + */ + public function createChunk(string $data): ChunkInterface + { + return new DataChunk($this->offset, $data); + } + + /** + * Pauses the request for the given number of seconds. + */ + public function pause(float $duration): void + { + if (\is_callable($pause = $this->response->getInfo('pause_handler'))) { + $pause($duration); + } elseif (0 < $duration) { + usleep(1E6 * $duration); + } + } + + /** + * Cancels the request and returns the last chunk to yield. + */ + public function cancel(): ChunkInterface + { + $this->info['canceled'] = true; + $this->info['error'] = 'Response has been canceled.'; + $this->response->cancel(); + + return new LastChunk(); + } + + /** + * Returns the current info of the response. + */ + public function getInfo(string $type = null) + { + if (null !== $type) { + return $this->info[$type] ?? $this->response->getInfo($type); + } + + return $this->info + $this->response->getInfo(); + } + + /** + * Attaches an info to the response. + * + * @return $this + */ + public function setInfo(string $type, $value): self + { + if ('canceled' === $type && $value !== $this->info['canceled']) { + throw new \LogicException('You cannot set the "canceled" info directly.'); + } + + if (null === $value) { + unset($this->info[$type]); + } else { + $this->info[$type] = $value; + } + + return $this; + } + + /** + * Returns the currently processed response. + */ + public function getResponse(): ResponseInterface + { + return $this->response; + } + + /** + * Replaces the currently processed response by doing a new request. + */ + public function replaceRequest(string $method, string $url, array $options = []): ResponseInterface + { + $this->info['previous_info'][] = $this->response->getInfo(); + if (null !== $onProgress = $options['on_progress'] ?? null) { + $thisInfo = &$this->info; + $options['on_progress'] = static function (int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) { + $onProgress($dlNow, $dlSize, $thisInfo + $info); + }; + } + + return $this->response = $this->client->request($method, $url, ['buffer' => false] + $options); + } + + /** + * Replaces the currently processed response by another one. + */ + public function replaceResponse(ResponseInterface $response): ResponseInterface + { + $this->info['previous_info'][] = $this->response->getInfo(); + + return $this->response = $response; + } + + /** + * Replaces or removes the chunk filter iterator. + */ + public function passthru(callable $passthru = null): void + { + $this->passthru = $passthru; + } +} diff --git a/vendor/symfony/http-client/Response/AsyncResponse.php b/vendor/symfony/http-client/Response/AsyncResponse.php new file mode 100644 index 0000000..c164fad --- /dev/null +++ b/vendor/symfony/http-client/Response/AsyncResponse.php @@ -0,0 +1,475 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Chunk\ErrorChunk; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Chunk\LastChunk; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Contracts\HttpClient\ChunkInterface; +use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * Provides a single extension point to process a response's content stream. + * + * @author Nicolas Grekas + */ +final class AsyncResponse implements ResponseInterface, StreamableInterface +{ + use CommonResponseTrait; + + private const FIRST_CHUNK_YIELDED = 1; + private const LAST_CHUNK_YIELDED = 2; + + private $client; + private $response; + private $info = ['canceled' => false]; + private $passthru; + private $stream; + private $yieldedState; + + /** + * @param ?callable(ChunkInterface, AsyncContext): ?\Iterator $passthru + */ + public function __construct(HttpClientInterface $client, string $method, string $url, array $options, callable $passthru = null) + { + $this->client = $client; + $this->shouldBuffer = $options['buffer'] ?? true; + + if (null !== $onProgress = $options['on_progress'] ?? null) { + $thisInfo = &$this->info; + $options['on_progress'] = static function (int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) { + $onProgress($dlNow, $dlSize, $thisInfo + $info); + }; + } + $this->response = $client->request($method, $url, ['buffer' => false] + $options); + $this->passthru = $passthru; + $this->initializer = static function (self $response, float $timeout = null) { + if (null === $response->shouldBuffer) { + return false; + } + + while (true) { + foreach (self::stream([$response], $timeout) as $chunk) { + if ($chunk->isTimeout() && $response->passthru) { + foreach (self::passthru($response->client, $response, new ErrorChunk($response->offset, new TransportException($chunk->getError()))) as $chunk) { + if ($chunk->isFirst()) { + return false; + } + } + + continue 2; + } + + if ($chunk->isFirst()) { + return false; + } + } + + return false; + } + }; + if (\array_key_exists('user_data', $options)) { + $this->info['user_data'] = $options['user_data']; + } + } + + public function getStatusCode(): int + { + if ($this->initializer) { + self::initialize($this); + } + + return $this->response->getStatusCode(); + } + + public function getHeaders(bool $throw = true): array + { + if ($this->initializer) { + self::initialize($this); + } + + $headers = $this->response->getHeaders(false); + + if ($throw) { + $this->checkStatusCode(); + } + + return $headers; + } + + public function getInfo(string $type = null) + { + if (null !== $type) { + return $this->info[$type] ?? $this->response->getInfo($type); + } + + return $this->info + $this->response->getInfo(); + } + + /** + * {@inheritdoc} + */ + public function toStream(bool $throw = true) + { + if ($throw) { + // Ensure headers arrived + $this->getHeaders(true); + } + + $handle = function () { + $stream = $this->response instanceof StreamableInterface ? $this->response->toStream(false) : StreamWrapper::createResource($this->response); + + return stream_get_meta_data($stream)['wrapper_data']->stream_cast(\STREAM_CAST_FOR_SELECT); + }; + + $stream = StreamWrapper::createResource($this); + stream_get_meta_data($stream)['wrapper_data'] + ->bindHandles($handle, $this->content); + + return $stream; + } + + /** + * {@inheritdoc} + */ + public function cancel(): void + { + if ($this->info['canceled']) { + return; + } + + $this->info['canceled'] = true; + $this->info['error'] = 'Response has been canceled.'; + $this->close(); + $client = $this->client; + $this->client = null; + + if (!$this->passthru) { + return; + } + + try { + foreach (self::passthru($client, $this, new LastChunk()) as $chunk) { + // no-op + } + + $this->passthru = null; + } catch (ExceptionInterface $e) { + // ignore any errors when canceling + } + } + + public function __destruct() + { + $httpException = null; + + if ($this->initializer && null === $this->getInfo('error')) { + try { + self::initialize($this, -0.0); + $this->getHeaders(true); + } catch (HttpExceptionInterface $httpException) { + // no-op + } + } + + if ($this->passthru && null === $this->getInfo('error')) { + $this->info['canceled'] = true; + + try { + foreach (self::passthru($this->client, $this, new LastChunk()) as $chunk) { + // no-op + } + } catch (ExceptionInterface $e) { + // ignore any errors when destructing + } + } + + if (null !== $httpException) { + throw $httpException; + } + } + + /** + * @internal + */ + public static function stream(iterable $responses, float $timeout = null, string $class = null): \Generator + { + while ($responses) { + $wrappedResponses = []; + $asyncMap = new \SplObjectStorage(); + $client = null; + + foreach ($responses as $r) { + if (!$r instanceof self) { + throw new \TypeError(sprintf('"%s::stream()" expects parameter 1 to be an iterable of AsyncResponse objects, "%s" given.', $class ?? static::class, get_debug_type($r))); + } + + if (null !== $e = $r->info['error'] ?? null) { + yield $r => $chunk = new ErrorChunk($r->offset, new TransportException($e)); + $chunk->didThrow() ?: $chunk->getContent(); + continue; + } + + if (null === $client) { + $client = $r->client; + } elseif ($r->client !== $client) { + throw new TransportException('Cannot stream AsyncResponse objects with many clients.'); + } + + $asyncMap[$r->response] = $r; + $wrappedResponses[] = $r->response; + + if ($r->stream) { + yield from self::passthruStream($response = $r->response, $r, new FirstChunk(), $asyncMap); + + if (!isset($asyncMap[$response])) { + array_pop($wrappedResponses); + } + + if ($r->response !== $response && !isset($asyncMap[$r->response])) { + $asyncMap[$r->response] = $r; + $wrappedResponses[] = $r->response; + } + } + } + + if (!$client || !$wrappedResponses) { + return; + } + + foreach ($client->stream($wrappedResponses, $timeout) as $response => $chunk) { + $r = $asyncMap[$response]; + + if (null === $chunk->getError()) { + if ($chunk->isFirst()) { + // Ensure no exception is thrown on destruct for the wrapped response + $r->response->getStatusCode(); + } elseif (0 === $r->offset && null === $r->content && $chunk->isLast()) { + $r->content = fopen('php://memory', 'w+'); + } + } + + if (!$r->passthru) { + if (null !== $chunk->getError() || $chunk->isLast()) { + unset($asyncMap[$response]); + } elseif (null !== $r->content && '' !== ($content = $chunk->getContent()) && \strlen($content) !== fwrite($r->content, $content)) { + $chunk = new ErrorChunk($r->offset, new TransportException(sprintf('Failed writing %d bytes to the response buffer.', \strlen($content)))); + $r->info['error'] = $chunk->getError(); + $r->response->cancel(); + } + + yield $r => $chunk; + continue; + } + + if (null !== $chunk->getError()) { + // no-op + } elseif ($chunk->isFirst()) { + $r->yieldedState = self::FIRST_CHUNK_YIELDED; + } elseif (self::FIRST_CHUNK_YIELDED !== $r->yieldedState && null === $chunk->getInformationalStatus()) { + throw new \LogicException(sprintf('Instance of "%s" is already consumed and cannot be managed by "%s". A decorated client should not call any of the response\'s methods in its "request()" method.', get_debug_type($response), $class ?? static::class)); + } + + foreach (self::passthru($r->client, $r, $chunk, $asyncMap) as $chunk) { + yield $r => $chunk; + } + + if ($r->response !== $response && isset($asyncMap[$response])) { + break; + } + } + + if (null === $chunk->getError() && $chunk->isLast()) { + $r->yieldedState = self::LAST_CHUNK_YIELDED; + } + if (null === $chunk->getError() && self::LAST_CHUNK_YIELDED !== $r->yieldedState && $r->response === $response && null !== $r->client) { + throw new \LogicException('A chunk passthru must yield an "isLast()" chunk before ending a stream.'); + } + + $responses = []; + foreach ($asyncMap as $response) { + $r = $asyncMap[$response]; + + if (null !== $r->client) { + $responses[] = $asyncMap[$response]; + } + } + } + } + + /** + * @param \SplObjectStorage|null $asyncMap + */ + private static function passthru(HttpClientInterface $client, self $r, ChunkInterface $chunk, \SplObjectStorage $asyncMap = null): \Generator + { + $r->stream = null; + $response = $r->response; + $context = new AsyncContext($r->passthru, $client, $r->response, $r->info, $r->content, $r->offset); + if (null === $stream = ($r->passthru)($chunk, $context)) { + if ($r->response === $response && (null !== $chunk->getError() || $chunk->isLast())) { + throw new \LogicException('A chunk passthru cannot swallow the last chunk.'); + } + + return; + } + + if (!$stream instanceof \Iterator) { + throw new \LogicException(sprintf('A chunk passthru must return an "Iterator", "%s" returned.', get_debug_type($stream))); + } + $r->stream = $stream; + + yield from self::passthruStream($response, $r, null, $asyncMap); + } + + /** + * @param \SplObjectStorage|null $asyncMap + */ + private static function passthruStream(ResponseInterface $response, self $r, ?ChunkInterface $chunk, ?\SplObjectStorage $asyncMap): \Generator + { + while (true) { + try { + if (null !== $chunk && $r->stream) { + $r->stream->next(); + } + + if (!$r->stream || !$r->stream->valid() || !$r->stream) { + $r->stream = null; + break; + } + } catch (\Throwable $e) { + unset($asyncMap[$response]); + $r->stream = null; + $r->info['error'] = $e->getMessage(); + $r->response->cancel(); + + yield $r => $chunk = new ErrorChunk($r->offset, $e); + $chunk->didThrow() ?: $chunk->getContent(); + break; + } + + $chunk = $r->stream->current(); + + if (!$chunk instanceof ChunkInterface) { + throw new \LogicException(sprintf('A chunk passthru must yield instances of "%s", "%s" yielded.', ChunkInterface::class, get_debug_type($chunk))); + } + + if (null !== $chunk->getError()) { + // no-op + } elseif ($chunk->isFirst()) { + $e = $r->openBuffer(); + + yield $r => $chunk; + + if ($r->initializer && null === $r->getInfo('error')) { + // Ensure the HTTP status code is always checked + $r->getHeaders(true); + } + + if (null === $e) { + continue; + } + + $r->response->cancel(); + $chunk = new ErrorChunk($r->offset, $e); + } elseif ('' !== $content = $chunk->getContent()) { + if (null !== $r->shouldBuffer) { + throw new \LogicException('A chunk passthru must yield an "isFirst()" chunk before any content chunk.'); + } + + if (null !== $r->content && \strlen($content) !== fwrite($r->content, $content)) { + $chunk = new ErrorChunk($r->offset, new TransportException(sprintf('Failed writing %d bytes to the response buffer.', \strlen($content)))); + $r->info['error'] = $chunk->getError(); + $r->response->cancel(); + } + } + + if (null !== $chunk->getError() || $chunk->isLast()) { + $stream = $r->stream; + $r->stream = null; + unset($asyncMap[$response]); + } + + if (null === $chunk->getError()) { + $r->offset += \strlen($content); + + yield $r => $chunk; + + if (!$chunk->isLast()) { + continue; + } + + $stream->next(); + + if ($stream->valid()) { + throw new \LogicException('A chunk passthru cannot yield after an "isLast()" chunk.'); + } + + $r->passthru = null; + } else { + if ($chunk instanceof ErrorChunk) { + $chunk->didThrow(false); + } else { + try { + $chunk = new ErrorChunk($chunk->getOffset(), !$chunk->isTimeout() ?: $chunk->getError()); + } catch (TransportExceptionInterface $e) { + $chunk = new ErrorChunk($chunk->getOffset(), $e); + } + } + + yield $r => $chunk; + $chunk->didThrow() ?: $chunk->getContent(); + } + + break; + } + } + + private function openBuffer(): ?\Throwable + { + if (null === $shouldBuffer = $this->shouldBuffer) { + throw new \LogicException('A chunk passthru cannot yield more than one "isFirst()" chunk.'); + } + + $e = $this->shouldBuffer = null; + + if ($shouldBuffer instanceof \Closure) { + try { + $shouldBuffer = $shouldBuffer($this->getHeaders(false)); + + if (null !== $e = $this->response->getInfo('error')) { + throw new TransportException($e); + } + } catch (\Throwable $e) { + $this->info['error'] = $e->getMessage(); + $this->response->cancel(); + } + } + + if (true === $shouldBuffer) { + $this->content = fopen('php://temp', 'w+'); + } elseif (\is_resource($shouldBuffer)) { + $this->content = $shouldBuffer; + } + + return $e; + } + + private function close(): void + { + $this->response->cancel(); + } +} diff --git a/vendor/symfony/http-client/Response/CommonResponseTrait.php b/vendor/symfony/http-client/Response/CommonResponseTrait.php new file mode 100644 index 0000000..11a8d6c --- /dev/null +++ b/vendor/symfony/http-client/Response/CommonResponseTrait.php @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Exception\ClientException; +use Symfony\Component\HttpClient\Exception\JsonException; +use Symfony\Component\HttpClient\Exception\RedirectionException; +use Symfony\Component\HttpClient\Exception\ServerException; +use Symfony\Component\HttpClient\Exception\TransportException; + +/** + * Implements common logic for response classes. + * + * @author Nicolas Grekas + * + * @internal + */ +trait CommonResponseTrait +{ + /** + * @var callable|null A callback that tells whether we're waiting for response headers + */ + private $initializer; + private $shouldBuffer; + private $content; + private $offset = 0; + private $jsonData; + + /** + * {@inheritdoc} + */ + public function getContent(bool $throw = true): string + { + if ($this->initializer) { + self::initialize($this); + } + + if ($throw) { + $this->checkStatusCode(); + } + + if (null === $this->content) { + $content = null; + + foreach (self::stream([$this]) as $chunk) { + if (!$chunk->isLast()) { + $content .= $chunk->getContent(); + } + } + + if (null !== $content) { + return $content; + } + + if (null === $this->content) { + throw new TransportException('Cannot get the content of the response twice: buffering is disabled.'); + } + } else { + foreach (self::stream([$this]) as $chunk) { + // Chunks are buffered in $this->content already + } + } + + rewind($this->content); + + return stream_get_contents($this->content); + } + + /** + * {@inheritdoc} + */ + public function toArray(bool $throw = true): array + { + if ('' === $content = $this->getContent($throw)) { + throw new JsonException('Response body is empty.'); + } + + if (null !== $this->jsonData) { + return $this->jsonData; + } + + try { + $content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0)); + } catch (\JsonException $e) { + throw new JsonException($e->getMessage().sprintf(' for "%s".', $this->getInfo('url')), $e->getCode()); + } + + if (\PHP_VERSION_ID < 70300 && \JSON_ERROR_NONE !== json_last_error()) { + throw new JsonException(json_last_error_msg().sprintf(' for "%s".', $this->getInfo('url')), json_last_error()); + } + + if (!\is_array($content)) { + throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned for "%s".', get_debug_type($content), $this->getInfo('url'))); + } + + if (null !== $this->content) { + // Option "buffer" is true + return $this->jsonData = $content; + } + + return $content; + } + + /** + * {@inheritdoc} + */ + public function toStream(bool $throw = true) + { + if ($throw) { + // Ensure headers arrived + $this->getHeaders($throw); + } + + $stream = StreamWrapper::createResource($this); + stream_get_meta_data($stream)['wrapper_data'] + ->bindHandles($this->handle, $this->content); + + return $stream; + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + /** + * Closes the response and all its network handles. + */ + abstract protected function close(): void; + + private static function initialize(self $response): void + { + if (null !== $response->getInfo('error')) { + throw new TransportException($response->getInfo('error')); + } + + try { + if (($response->initializer)($response, -0.0)) { + foreach (self::stream([$response], -0.0) as $chunk) { + if ($chunk->isFirst()) { + break; + } + } + } + } catch (\Throwable $e) { + // Persist timeouts thrown during initialization + $response->info['error'] = $e->getMessage(); + $response->close(); + throw $e; + } + + $response->initializer = null; + } + + private function checkStatusCode() + { + $code = $this->getInfo('http_code'); + + if (500 <= $code) { + throw new ServerException($this); + } + + if (400 <= $code) { + throw new ClientException($this); + } + + if (300 <= $code) { + throw new RedirectionException($this); + } + } +} diff --git a/vendor/symfony/http-client/Response/CurlResponse.php b/vendor/symfony/http-client/Response/CurlResponse.php new file mode 100644 index 0000000..5739392 --- /dev/null +++ b/vendor/symfony/http-client/Response/CurlResponse.php @@ -0,0 +1,473 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Chunk\InformationalChunk; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\Canary; +use Symfony\Component\HttpClient\Internal\ClientState; +use Symfony\Component\HttpClient\Internal\CurlClientState; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class CurlResponse implements ResponseInterface, StreamableInterface +{ + use CommonResponseTrait { + getContent as private doGetContent; + } + use TransportResponseTrait; + + private static $performing = false; + private $multi; + private $debugBuffer; + + /** + * @param \CurlHandle|resource|string $ch + * + * @internal + */ + public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null) + { + $this->multi = $multi; + + if (\is_resource($ch) || $ch instanceof \CurlHandle) { + $this->handle = $ch; + $this->debugBuffer = fopen('php://temp', 'w+'); + if (0x074000 === $curlVersion) { + fwrite($this->debugBuffer, 'Due to a bug in curl 7.64.0, the debug log is disabled; use another version to work around the issue.'); + } else { + curl_setopt($ch, \CURLOPT_VERBOSE, true); + curl_setopt($ch, \CURLOPT_STDERR, $this->debugBuffer); + } + } else { + $this->info['url'] = $ch; + $ch = $this->handle; + } + + $this->id = $id = (int) $ch; + $this->logger = $logger; + $this->shouldBuffer = $options['buffer'] ?? true; + $this->timeout = $options['timeout'] ?? null; + $this->info['http_method'] = $method; + $this->info['user_data'] = $options['user_data'] ?? null; + $this->info['start_time'] = $this->info['start_time'] ?? microtime(true); + $info = &$this->info; + $headers = &$this->headers; + $debugBuffer = $this->debugBuffer; + + if (!$info['response_headers']) { + // Used to keep track of what we're waiting for + curl_setopt($ch, \CURLOPT_PRIVATE, \in_array($method, ['GET', 'HEAD', 'OPTIONS', 'TRACE'], true) && 1.0 < (float) ($options['http_version'] ?? 1.1) ? 'H2' : 'H0'); // H = headers + retry counter + } + + curl_setopt($ch, \CURLOPT_HEADERFUNCTION, static function ($ch, string $data) use (&$info, &$headers, $options, $multi, $id, &$location, $resolveRedirect, $logger): int { + if (0 !== substr_compare($data, "\r\n", -2)) { + return 0; + } + + $len = 0; + + foreach (explode("\r\n", substr($data, 0, -2)) as $data) { + $len += 2 + self::parseHeaderLine($ch, $data, $info, $headers, $options, $multi, $id, $location, $resolveRedirect, $logger); + } + + return $len; + }); + + if (null === $options) { + // Pushed response: buffer until requested + curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int { + $multi->handlesActivity[$id][] = $data; + curl_pause($ch, \CURLPAUSE_RECV); + + return \strlen($data); + }); + + return; + } + + $execCounter = $multi->execCounter; + $this->info['pause_handler'] = static function (float $duration) use ($ch, $multi, $execCounter) { + if (0 < $duration) { + if ($execCounter === $multi->execCounter) { + $multi->execCounter = !\is_float($execCounter) ? 1 + $execCounter : \PHP_INT_MIN; + curl_multi_remove_handle($multi->handle, $ch); + } + + $lastExpiry = end($multi->pauseExpiries); + $multi->pauseExpiries[(int) $ch] = $duration += microtime(true); + if (false !== $lastExpiry && $lastExpiry > $duration) { + asort($multi->pauseExpiries); + } + curl_pause($ch, \CURLPAUSE_ALL); + } else { + unset($multi->pauseExpiries[(int) $ch]); + curl_pause($ch, \CURLPAUSE_CONT); + curl_multi_add_handle($multi->handle, $ch); + } + }; + + $this->inflate = !isset($options['normalized_headers']['accept-encoding']); + curl_pause($ch, \CURLPAUSE_CONT); + + if ($onProgress = $options['on_progress']) { + $url = isset($info['url']) ? ['url' => $info['url']] : []; + curl_setopt($ch, \CURLOPT_NOPROGRESS, false); + curl_setopt($ch, \CURLOPT_PROGRESSFUNCTION, static function ($ch, $dlSize, $dlNow) use ($onProgress, &$info, $url, $multi, $debugBuffer) { + try { + rewind($debugBuffer); + $debug = ['debug' => stream_get_contents($debugBuffer)]; + $onProgress($dlNow, $dlSize, $url + curl_getinfo($ch) + $info + $debug); + } catch (\Throwable $e) { + $multi->handlesActivity[(int) $ch][] = null; + $multi->handlesActivity[(int) $ch][] = $e; + + return 1; // Abort the request + } + + return null; + }); + } + + curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int { + if ('H' === (curl_getinfo($ch, \CURLINFO_PRIVATE)[0] ?? null)) { + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = new TransportException(sprintf('Unsupported protocol for "%s"', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL))); + + return 0; + } + + curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int { + $multi->handlesActivity[$id][] = $data; + + return \strlen($data); + }); + + $multi->handlesActivity[$id][] = $data; + + return \strlen($data); + }); + + $this->initializer = static function (self $response) { + $waitFor = curl_getinfo($ch = $response->handle, \CURLINFO_PRIVATE); + + return 'H' === $waitFor[0]; + }; + + // Schedule the request in a non-blocking way + $multi->lastTimeout = null; + $multi->openHandles[$id] = [$ch, $options]; + curl_multi_add_handle($multi->handle, $ch); + + $this->canary = new Canary(static function () use ($ch, $multi, $id) { + unset($multi->pauseExpiries[$id], $multi->openHandles[$id], $multi->handlesActivity[$id]); + curl_setopt($ch, \CURLOPT_PRIVATE, '_0'); + + if (self::$performing) { + return; + } + + curl_multi_remove_handle($multi->handle, $ch); + curl_setopt_array($ch, [ + \CURLOPT_NOPROGRESS => true, + \CURLOPT_PROGRESSFUNCTION => null, + \CURLOPT_HEADERFUNCTION => null, + \CURLOPT_WRITEFUNCTION => null, + \CURLOPT_READFUNCTION => null, + \CURLOPT_INFILE => null, + ]); + + if (!$multi->openHandles) { + // Schedule DNS cache eviction for the next request + $multi->dnsCache->evictions = $multi->dnsCache->evictions ?: $multi->dnsCache->removals; + $multi->dnsCache->removals = $multi->dnsCache->hostnames = []; + } + }); + } + + /** + * {@inheritdoc} + */ + public function getInfo(string $type = null) + { + if (!$info = $this->finalInfo) { + $info = array_merge($this->info, curl_getinfo($this->handle)); + $info['url'] = $this->info['url'] ?? $info['url']; + $info['redirect_url'] = $this->info['redirect_url'] ?? null; + + // workaround curl not subtracting the time offset for pushed responses + if (isset($this->info['url']) && $info['start_time'] / 1000 < $info['total_time']) { + $info['total_time'] -= $info['starttransfer_time'] ?: $info['total_time']; + $info['starttransfer_time'] = 0.0; + } + + rewind($this->debugBuffer); + $info['debug'] = stream_get_contents($this->debugBuffer); + $waitFor = curl_getinfo($this->handle, \CURLINFO_PRIVATE); + + if ('H' !== $waitFor[0] && 'C' !== $waitFor[0]) { + curl_setopt($this->handle, \CURLOPT_VERBOSE, false); + rewind($this->debugBuffer); + ftruncate($this->debugBuffer, 0); + $this->finalInfo = $info; + } + } + + return null !== $type ? $info[$type] ?? null : $info; + } + + /** + * {@inheritdoc} + */ + public function getContent(bool $throw = true): string + { + $performing = self::$performing; + self::$performing = $performing || '_0' === curl_getinfo($this->handle, \CURLINFO_PRIVATE); + + try { + return $this->doGetContent($throw); + } finally { + self::$performing = $performing; + } + } + + public function __destruct() + { + try { + if (null === $this->timeout) { + return; // Unused pushed response + } + + $this->doDestruct(); + } finally { + if (\is_resource($this->handle) || $this->handle instanceof \CurlHandle) { + curl_setopt($this->handle, \CURLOPT_VERBOSE, false); + } + } + } + + /** + * {@inheritdoc} + */ + private static function schedule(self $response, array &$runningResponses): void + { + if (isset($runningResponses[$i = (int) $response->multi->handle])) { + $runningResponses[$i][1][$response->id] = $response; + } else { + $runningResponses[$i] = [$response->multi, [$response->id => $response]]; + } + + if ('_0' === curl_getinfo($ch = $response->handle, \CURLINFO_PRIVATE)) { + // Response already completed + $response->multi->handlesActivity[$response->id][] = null; + $response->multi->handlesActivity[$response->id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; + } + } + + /** + * {@inheritdoc} + * + * @param CurlClientState $multi + */ + private static function perform(ClientState $multi, array &$responses = null): void + { + if (self::$performing) { + if ($responses) { + $response = current($responses); + $multi->handlesActivity[(int) $response->handle][] = null; + $multi->handlesActivity[(int) $response->handle][] = new TransportException(sprintf('Userland callback cannot use the client nor the response while processing "%s".', curl_getinfo($response->handle, \CURLINFO_EFFECTIVE_URL))); + } + + return; + } + + try { + self::$performing = true; + ++$multi->execCounter; + $active = 0; + while (\CURLM_CALL_MULTI_PERFORM === ($err = curl_multi_exec($multi->handle, $active))) { + } + + if (\CURLM_OK !== $err) { + throw new TransportException(curl_multi_strerror($err)); + } + + while ($info = curl_multi_info_read($multi->handle)) { + if (\CURLMSG_DONE !== $info['msg']) { + continue; + } + $result = $info['result']; + $id = (int) $ch = $info['handle']; + $waitFor = @curl_getinfo($ch, \CURLINFO_PRIVATE) ?: '_0'; + + if (\in_array($result, [\CURLE_SEND_ERROR, \CURLE_RECV_ERROR, /*CURLE_HTTP2*/ 16, /*CURLE_HTTP2_STREAM*/ 92], true) && $waitFor[1] && 'C' !== $waitFor[0]) { + curl_multi_remove_handle($multi->handle, $ch); + $waitFor[1] = (string) ((int) $waitFor[1] - 1); // decrement the retry counter + curl_setopt($ch, \CURLOPT_PRIVATE, $waitFor); + curl_setopt($ch, \CURLOPT_FORBID_REUSE, true); + + if (0 === curl_multi_add_handle($multi->handle, $ch)) { + continue; + } + } + + if (\CURLE_RECV_ERROR === $result && 'H' === $waitFor[0] && 400 <= ($responses[(int) $ch]->info['http_code'] ?? 0)) { + $multi->handlesActivity[$id][] = new FirstChunk(); + } + + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = \in_array($result, [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || '_0' === $waitFor || curl_getinfo($ch, \CURLINFO_SIZE_DOWNLOAD) === curl_getinfo($ch, \CURLINFO_CONTENT_LENGTH_DOWNLOAD) ? null : new TransportException(ucfirst(curl_error($ch) ?: curl_strerror($result)).sprintf(' for "%s".', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL))); + } + } finally { + self::$performing = false; + } + } + + /** + * {@inheritdoc} + * + * @param CurlClientState $multi + */ + private static function select(ClientState $multi, float $timeout): int + { + if (\PHP_VERSION_ID < 70211) { + // workaround https://bugs.php.net/76480 + $timeout = min($timeout, 0.01); + } + + if ($multi->pauseExpiries) { + $now = microtime(true); + + foreach ($multi->pauseExpiries as $id => $pauseExpiry) { + if ($now < $pauseExpiry) { + $timeout = min($timeout, $pauseExpiry - $now); + break; + } + + unset($multi->pauseExpiries[$id]); + curl_pause($multi->openHandles[$id][0], \CURLPAUSE_CONT); + curl_multi_add_handle($multi->handle, $multi->openHandles[$id][0]); + } + } + + if (0 !== $selected = curl_multi_select($multi->handle, $timeout)) { + return $selected; + } + + if ($multi->pauseExpiries && 0 < $timeout -= microtime(true) - $now) { + usleep((int) (1E6 * $timeout)); + } + + return 0; + } + + /** + * Parses header lines as curl yields them to us. + */ + private static function parseHeaderLine($ch, string $data, array &$info, array &$headers, ?array $options, CurlClientState $multi, int $id, ?string &$location, ?callable $resolveRedirect, ?LoggerInterface $logger): int + { + $waitFor = @curl_getinfo($ch, \CURLINFO_PRIVATE) ?: '_0'; + + if ('H' !== $waitFor[0]) { + return \strlen($data); // Ignore HTTP trailers + } + + if ('' !== $data) { + // Regular header line: add it to the list + self::addResponseHeaders([$data], $info, $headers); + + if (!str_starts_with($data, 'HTTP/')) { + if (0 === stripos($data, 'Location:')) { + $location = trim(substr($data, 9)); + } + + return \strlen($data); + } + + if (\function_exists('openssl_x509_read') && $certinfo = curl_getinfo($ch, \CURLINFO_CERTINFO)) { + $info['peer_certificate_chain'] = array_map('openssl_x509_read', array_column($certinfo, 'Cert')); + } + + if (300 <= $info['http_code'] && $info['http_code'] < 400) { + if (curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT) === $options['max_redirects']) { + curl_setopt($ch, \CURLOPT_FOLLOWLOCATION, false); + } elseif (303 === $info['http_code'] || ('POST' === $info['http_method'] && \in_array($info['http_code'], [301, 302], true))) { + curl_setopt($ch, \CURLOPT_POSTFIELDS, ''); + } + } + + return \strlen($data); + } + + // End of headers: handle informational responses, redirects, etc. + + if (200 > $statusCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE)) { + $multi->handlesActivity[$id][] = new InformationalChunk($statusCode, $headers); + $location = null; + + return \strlen($data); + } + + $info['redirect_url'] = null; + + if (300 <= $statusCode && $statusCode < 400 && null !== $location) { + if ($noContent = 303 === $statusCode || ('POST' === $info['http_method'] && \in_array($statusCode, [301, 302], true))) { + $info['http_method'] = 'HEAD' === $info['http_method'] ? 'HEAD' : 'GET'; + curl_setopt($ch, \CURLOPT_CUSTOMREQUEST, $info['http_method']); + } + + if (null === $info['redirect_url'] = $resolveRedirect($ch, $location, $noContent)) { + $options['max_redirects'] = curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT); + curl_setopt($ch, \CURLOPT_FOLLOWLOCATION, false); + curl_setopt($ch, \CURLOPT_MAXREDIRS, $options['max_redirects']); + } else { + $url = parse_url($location ?? ':'); + + if (isset($url['host']) && null !== $ip = $multi->dnsCache->hostnames[$url['host'] = strtolower($url['host'])] ?? null) { + // Populate DNS cache for redirects if needed + $port = $url['port'] ?? ('http' === ($url['scheme'] ?? parse_url(curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL), \PHP_URL_SCHEME)) ? 80 : 443); + curl_setopt($ch, \CURLOPT_RESOLVE, ["{$url['host']}:$port:$ip"]); + $multi->dnsCache->removals["-{$url['host']}:$port"] = "-{$url['host']}:$port"; + } + } + } + + if (401 === $statusCode && isset($options['auth_ntlm']) && 0 === strncasecmp($headers['www-authenticate'][0] ?? '', 'NTLM ', 5)) { + // Continue with NTLM auth + } elseif ($statusCode < 300 || 400 <= $statusCode || null === $location || curl_getinfo($ch, \CURLINFO_REDIRECT_COUNT) === $options['max_redirects']) { + // Headers and redirects completed, time to get the response's content + $multi->handlesActivity[$id][] = new FirstChunk(); + + if ('HEAD' === $info['http_method'] || \in_array($statusCode, [204, 304], true)) { + $waitFor = '_0'; // no content expected + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = null; + } else { + $waitFor[0] = 'C'; // C = content + } + + curl_setopt($ch, \CURLOPT_PRIVATE, $waitFor); + } elseif (null !== $info['redirect_url'] && $logger) { + $logger->info(sprintf('Redirecting: "%s %s"', $info['http_code'], $info['redirect_url'])); + } + + $location = null; + + return \strlen($data); + } +} diff --git a/vendor/symfony/http-client/Response/HttplugPromise.php b/vendor/symfony/http-client/Response/HttplugPromise.php new file mode 100644 index 0000000..2efacca --- /dev/null +++ b/vendor/symfony/http-client/Response/HttplugPromise.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use GuzzleHttp\Promise\Create; +use GuzzleHttp\Promise\PromiseInterface as GuzzlePromiseInterface; +use Http\Promise\Promise as HttplugPromiseInterface; +use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface; + +/** + * @author Tobias Nyholm + * + * @internal + */ +final class HttplugPromise implements HttplugPromiseInterface +{ + private $promise; + + public function __construct(GuzzlePromiseInterface $promise) + { + $this->promise = $promise; + } + + public function then(callable $onFulfilled = null, callable $onRejected = null): self + { + return new self($this->promise->then( + $this->wrapThenCallback($onFulfilled), + $this->wrapThenCallback($onRejected) + )); + } + + public function cancel(): void + { + $this->promise->cancel(); + } + + /** + * {@inheritdoc} + */ + public function getState(): string + { + return $this->promise->getState(); + } + + /** + * {@inheritdoc} + * + * @return Psr7ResponseInterface|mixed + */ + public function wait($unwrap = true) + { + $result = $this->promise->wait($unwrap); + + while ($result instanceof HttplugPromiseInterface || $result instanceof GuzzlePromiseInterface) { + $result = $result->wait($unwrap); + } + + return $result; + } + + private function wrapThenCallback(?callable $callback): ?callable + { + if (null === $callback) { + return null; + } + + return static function ($value) use ($callback) { + return Create::promiseFor($callback($value)); + }; + } +} diff --git a/vendor/symfony/http-client/Response/MockResponse.php b/vendor/symfony/http-client/Response/MockResponse.php new file mode 100644 index 0000000..7177795 --- /dev/null +++ b/vendor/symfony/http-client/Response/MockResponse.php @@ -0,0 +1,337 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Chunk\ErrorChunk; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\ClientState; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * A test-friendly response. + * + * @author Nicolas Grekas + */ +class MockResponse implements ResponseInterface, StreamableInterface +{ + use CommonResponseTrait; + use TransportResponseTrait { + doDestruct as public __destruct; + } + + private $body; + private $requestOptions = []; + private $requestUrl; + private $requestMethod; + + private static $mainMulti; + private static $idSequence = 0; + + /** + * @param string|string[]|iterable $body The response body as a string or an iterable of strings, + * yielding an empty string simulates an idle timeout, + * throwing an exception yields an ErrorChunk + * + * @see ResponseInterface::getInfo() for possible info, e.g. "response_headers" + */ + public function __construct($body = '', array $info = []) + { + $this->body = is_iterable($body) ? $body : (string) $body; + $this->info = $info + ['http_code' => 200] + $this->info; + + if (!isset($info['response_headers'])) { + return; + } + + $responseHeaders = []; + + foreach ($info['response_headers'] as $k => $v) { + foreach ((array) $v as $v) { + $responseHeaders[] = (\is_string($k) ? $k.': ' : '').$v; + } + } + + $this->info['response_headers'] = []; + self::addResponseHeaders($responseHeaders, $this->info, $this->headers); + } + + /** + * Returns the options used when doing the request. + */ + public function getRequestOptions(): array + { + return $this->requestOptions; + } + + /** + * Returns the URL used when doing the request. + */ + public function getRequestUrl(): string + { + return $this->requestUrl; + } + + /** + * Returns the method used when doing the request. + */ + public function getRequestMethod(): string + { + return $this->requestMethod; + } + + /** + * {@inheritdoc} + */ + public function getInfo(string $type = null) + { + return null !== $type ? $this->info[$type] ?? null : $this->info; + } + + /** + * {@inheritdoc} + */ + public function cancel(): void + { + $this->info['canceled'] = true; + $this->info['error'] = 'Response has been canceled.'; + try { + $this->body = null; + } catch (TransportException $e) { + // ignore errors when canceling + } + } + + /** + * {@inheritdoc} + */ + protected function close(): void + { + $this->inflate = null; + $this->body = []; + } + + /** + * @internal + */ + public static function fromRequest(string $method, string $url, array $options, ResponseInterface $mock): self + { + $response = new self([]); + $response->requestOptions = $options; + $response->id = ++self::$idSequence; + $response->shouldBuffer = $options['buffer'] ?? true; + $response->initializer = static function (self $response) { + return \is_array($response->body[0] ?? null); + }; + + $response->info['redirect_count'] = 0; + $response->info['redirect_url'] = null; + $response->info['start_time'] = microtime(true); + $response->info['http_method'] = $method; + $response->info['http_code'] = 0; + $response->info['user_data'] = $options['user_data'] ?? null; + $response->info['url'] = $url; + + if ($mock instanceof self) { + $mock->requestOptions = $response->requestOptions; + $mock->requestMethod = $method; + $mock->requestUrl = $url; + } + + self::writeRequest($response, $options, $mock); + $response->body[] = [$options, $mock]; + + return $response; + } + + /** + * {@inheritdoc} + */ + protected static function schedule(self $response, array &$runningResponses): void + { + if (!$response->id) { + throw new InvalidArgumentException('MockResponse instances must be issued by MockHttpClient before processing.'); + } + + $multi = self::$mainMulti ?? self::$mainMulti = new ClientState(); + + if (!isset($runningResponses[0])) { + $runningResponses[0] = [$multi, []]; + } + + $runningResponses[0][1][$response->id] = $response; + } + + /** + * {@inheritdoc} + */ + protected static function perform(ClientState $multi, array &$responses): void + { + foreach ($responses as $response) { + $id = $response->id; + + if (null === $response->body) { + // Canceled response + $response->body = []; + } elseif ([] === $response->body) { + // Error chunk + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; + } elseif (null === $chunk = array_shift($response->body)) { + // Last chunk + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = array_shift($response->body); + } elseif (\is_array($chunk)) { + // First chunk + try { + $offset = 0; + $chunk[1]->getStatusCode(); + $chunk[1]->getHeaders(false); + self::readResponse($response, $chunk[0], $chunk[1], $offset); + $multi->handlesActivity[$id][] = new FirstChunk(); + $buffer = $response->requestOptions['buffer'] ?? null; + + if ($buffer instanceof \Closure && $response->content = $buffer($response->headers) ?: null) { + $response->content = \is_resource($response->content) ? $response->content : fopen('php://temp', 'w+'); + } + } catch (\Throwable $e) { + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = $e; + } + } elseif ($chunk instanceof \Throwable) { + $multi->handlesActivity[$id][] = null; + $multi->handlesActivity[$id][] = $chunk; + } else { + // Data or timeout chunk + $multi->handlesActivity[$id][] = $chunk; + } + } + } + + /** + * {@inheritdoc} + */ + protected static function select(ClientState $multi, float $timeout): int + { + return 42; + } + + /** + * Simulates sending the request. + */ + private static function writeRequest(self $response, array $options, ResponseInterface $mock) + { + $onProgress = $options['on_progress'] ?? static function () {}; + $response->info += $mock->getInfo() ?: []; + + // simulate "size_upload" if it is set + if (isset($response->info['size_upload'])) { + $response->info['size_upload'] = 0.0; + } + + // simulate "total_time" if it is not set + if (!isset($response->info['total_time'])) { + $response->info['total_time'] = microtime(true) - $response->info['start_time']; + } + + // "notify" DNS resolution + $onProgress(0, 0, $response->info); + + // consume the request body + if (\is_resource($body = $options['body'] ?? '')) { + $data = stream_get_contents($body); + if (isset($response->info['size_upload'])) { + $response->info['size_upload'] += \strlen($data); + } + } elseif ($body instanceof \Closure) { + while ('' !== $data = $body(16372)) { + if (!\is_string($data)) { + throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', get_debug_type($data))); + } + + // "notify" upload progress + if (isset($response->info['size_upload'])) { + $response->info['size_upload'] += \strlen($data); + } + + $onProgress(0, 0, $response->info); + } + } + } + + /** + * Simulates reading the response. + */ + private static function readResponse(self $response, array $options, ResponseInterface $mock, int &$offset) + { + $onProgress = $options['on_progress'] ?? static function () {}; + + // populate info related to headers + $info = $mock->getInfo() ?: []; + $response->info['http_code'] = ($info['http_code'] ?? 0) ?: $mock->getStatusCode() ?: 200; + $response->addResponseHeaders($info['response_headers'] ?? [], $response->info, $response->headers); + $dlSize = isset($response->headers['content-encoding']) || 'HEAD' === $response->info['http_method'] || \in_array($response->info['http_code'], [204, 304], true) ? 0 : (int) ($response->headers['content-length'][0] ?? 0); + + $response->info = [ + 'start_time' => $response->info['start_time'], + 'user_data' => $response->info['user_data'], + 'http_code' => $response->info['http_code'], + ] + $info + $response->info; + + if (null !== $response->info['error']) { + throw new TransportException($response->info['error']); + } + + if (!isset($response->info['total_time'])) { + $response->info['total_time'] = microtime(true) - $response->info['start_time']; + } + + // "notify" headers arrival + $onProgress(0, $dlSize, $response->info); + + // cast response body to activity list + $body = $mock instanceof self ? $mock->body : $mock->getContent(false); + + if (!\is_string($body)) { + try { + foreach ($body as $chunk) { + if ('' === $chunk = (string) $chunk) { + // simulate an idle timeout + $response->body[] = new ErrorChunk($offset, sprintf('Idle timeout reached for "%s".', $response->info['url'])); + } else { + $response->body[] = $chunk; + $offset += \strlen($chunk); + // "notify" download progress + $onProgress($offset, $dlSize, $response->info); + } + } + } catch (\Throwable $e) { + $response->body[] = $e; + } + } elseif ('' !== $body) { + $response->body[] = $body; + $offset = \strlen($body); + } + + if (!isset($response->info['total_time'])) { + $response->info['total_time'] = microtime(true) - $response->info['start_time']; + } + + // "notify" completion + $onProgress($offset, $dlSize, $response->info); + + if ($dlSize && $offset !== $dlSize) { + throw new TransportException(sprintf('Transfer closed with %d bytes remaining to read.', $dlSize - $offset)); + } + } +} diff --git a/vendor/symfony/http-client/Response/NativeResponse.php b/vendor/symfony/http-client/Response/NativeResponse.php new file mode 100644 index 0000000..c06237b --- /dev/null +++ b/vendor/symfony/http-client/Response/NativeResponse.php @@ -0,0 +1,375 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\Canary; +use Symfony\Component\HttpClient\Internal\ClientState; +use Symfony\Component\HttpClient\Internal\NativeClientState; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class NativeResponse implements ResponseInterface, StreamableInterface +{ + use CommonResponseTrait; + use TransportResponseTrait; + + private $context; + private $url; + private $resolver; + private $onProgress; + private $remaining; + private $buffer; + private $multi; + private $pauseExpiry = 0; + + /** + * @internal + */ + public function __construct(NativeClientState $multi, $context, string $url, array $options, array &$info, callable $resolver, ?callable $onProgress, ?LoggerInterface $logger) + { + $this->multi = $multi; + $this->id = $id = (int) $context; + $this->context = $context; + $this->url = $url; + $this->logger = $logger; + $this->timeout = $options['timeout']; + $this->info = &$info; + $this->resolver = $resolver; + $this->onProgress = $onProgress; + $this->inflate = !isset($options['normalized_headers']['accept-encoding']); + $this->shouldBuffer = $options['buffer'] ?? true; + + // Temporary resource to dechunk the response stream + $this->buffer = fopen('php://temp', 'w+'); + + $info['user_data'] = $options['user_data']; + ++$multi->responseCount; + + $this->initializer = static function (self $response) { + return null === $response->remaining; + }; + + $pauseExpiry = &$this->pauseExpiry; + $info['pause_handler'] = static function (float $duration) use (&$pauseExpiry) { + $pauseExpiry = 0 < $duration ? microtime(true) + $duration : 0; + }; + + $this->canary = new Canary(static function () use ($multi, $id) { + if (null !== ($host = $multi->openHandles[$id][6] ?? null) && 0 >= --$multi->hosts[$host]) { + unset($multi->hosts[$host]); + } + unset($multi->openHandles[$id], $multi->handlesActivity[$id]); + }); + } + + /** + * {@inheritdoc} + */ + public function getInfo(string $type = null) + { + if (!$info = $this->finalInfo) { + $info = $this->info; + $info['url'] = implode('', $info['url']); + unset($info['size_body'], $info['request_header']); + + if (null === $this->buffer) { + $this->finalInfo = $info; + } + } + + return null !== $type ? $info[$type] ?? null : $info; + } + + public function __destruct() + { + try { + $this->doDestruct(); + } finally { + // Clear the DNS cache when all requests completed + if (0 >= --$this->multi->responseCount) { + $this->multi->responseCount = 0; + $this->multi->dnsCache = []; + } + } + } + + private function open(): void + { + $url = $this->url; + + set_error_handler(function ($type, $msg) use (&$url) { + if (\E_NOTICE !== $type || 'fopen(): Content-type not specified assuming application/x-www-form-urlencoded' !== $msg) { + throw new TransportException($msg); + } + + $this->logger && $this->logger->info(sprintf('%s for "%s".', $msg, $url ?? $this->url)); + }); + + try { + $this->info['start_time'] = microtime(true); + + [$resolver, $url] = ($this->resolver)($this->multi); + + while (true) { + $context = stream_context_get_options($this->context); + + if ($proxy = $context['http']['proxy'] ?? null) { + $this->info['debug'] .= "* Establish HTTP proxy tunnel to {$proxy}\n"; + $this->info['request_header'] = $url; + } else { + $this->info['debug'] .= "* Trying {$this->info['primary_ip']}...\n"; + $this->info['request_header'] = $this->info['url']['path'].$this->info['url']['query']; + } + + $this->info['request_header'] = sprintf("> %s %s HTTP/%s \r\n", $context['http']['method'], $this->info['request_header'], $context['http']['protocol_version']); + $this->info['request_header'] .= implode("\r\n", $context['http']['header'])."\r\n\r\n"; + + if (\array_key_exists('peer_name', $context['ssl']) && null === $context['ssl']['peer_name']) { + unset($context['ssl']['peer_name']); + $this->context = stream_context_create([], ['options' => $context] + stream_context_get_params($this->context)); + } + + // Send request and follow redirects when needed + $this->handle = $h = fopen($url, 'r', false, $this->context); + self::addResponseHeaders(stream_get_meta_data($h)['wrapper_data'], $this->info, $this->headers, $this->info['debug']); + $url = $resolver($this->multi, $this->headers['location'][0] ?? null, $this->context); + + if (null === $url) { + break; + } + + $this->logger && $this->logger->info(sprintf('Redirecting: "%s %s"', $this->info['http_code'], $url ?? $this->url)); + } + } catch (\Throwable $e) { + $this->close(); + $this->multi->handlesActivity[$this->id][] = null; + $this->multi->handlesActivity[$this->id][] = $e; + + return; + } finally { + $this->info['pretransfer_time'] = $this->info['total_time'] = microtime(true) - $this->info['start_time']; + restore_error_handler(); + } + + if (isset($context['ssl']['capture_peer_cert_chain']) && isset(($context = stream_context_get_options($this->context))['ssl']['peer_certificate_chain'])) { + $this->info['peer_certificate_chain'] = $context['ssl']['peer_certificate_chain']; + } + + stream_set_blocking($h, false); + $this->context = $this->resolver = null; + + // Create dechunk buffers + if (isset($this->headers['content-length'])) { + $this->remaining = (int) $this->headers['content-length'][0]; + } elseif ('chunked' === ($this->headers['transfer-encoding'][0] ?? null)) { + stream_filter_append($this->buffer, 'dechunk', \STREAM_FILTER_WRITE); + $this->remaining = -1; + } else { + $this->remaining = -2; + } + + $this->multi->handlesActivity[$this->id] = [new FirstChunk()]; + + if ('HEAD' === $context['http']['method'] || \in_array($this->info['http_code'], [204, 304], true)) { + $this->multi->handlesActivity[$this->id][] = null; + $this->multi->handlesActivity[$this->id][] = null; + + return; + } + + $host = parse_url($this->info['redirect_url'] ?? $this->url, \PHP_URL_HOST); + $this->multi->lastTimeout = null; + $this->multi->openHandles[$this->id] = [&$this->pauseExpiry, $h, $this->buffer, $this->onProgress, &$this->remaining, &$this->info, $host]; + $this->multi->hosts[$host] = 1 + ($this->multi->hosts[$host] ?? 0); + } + + /** + * {@inheritdoc} + */ + private function close(): void + { + $this->canary->cancel(); + $this->handle = $this->buffer = $this->inflate = $this->onProgress = null; + } + + /** + * {@inheritdoc} + */ + private static function schedule(self $response, array &$runningResponses): void + { + if (!isset($runningResponses[$i = $response->multi->id])) { + $runningResponses[$i] = [$response->multi, []]; + } + + $runningResponses[$i][1][$response->id] = $response; + + if (null === $response->buffer) { + // Response already completed + $response->multi->handlesActivity[$response->id][] = null; + $response->multi->handlesActivity[$response->id][] = null !== $response->info['error'] ? new TransportException($response->info['error']) : null; + } + } + + /** + * {@inheritdoc} + * + * @param NativeClientState $multi + */ + private static function perform(ClientState $multi, array &$responses = null): void + { + foreach ($multi->openHandles as $i => [$pauseExpiry, $h, $buffer, $onProgress]) { + if ($pauseExpiry) { + if (microtime(true) < $pauseExpiry) { + continue; + } + + $multi->openHandles[$i][0] = 0; + } + + $hasActivity = false; + $remaining = &$multi->openHandles[$i][4]; + $info = &$multi->openHandles[$i][5]; + $e = null; + + // Read incoming buffer and write it to the dechunk one + try { + if ($remaining && '' !== $data = (string) fread($h, 0 > $remaining ? 16372 : $remaining)) { + fwrite($buffer, $data); + $hasActivity = true; + $multi->sleep = false; + + if (-1 !== $remaining) { + $remaining -= \strlen($data); + } + } + } catch (\Throwable $e) { + $hasActivity = $onProgress = false; + } + + if (!$hasActivity) { + if ($onProgress) { + try { + // Notify the progress callback so that it can e.g. cancel + // the request if the stream is inactive for too long + $info['total_time'] = microtime(true) - $info['start_time']; + $onProgress(); + } catch (\Throwable $e) { + // no-op + } + } + } elseif ('' !== $data = stream_get_contents($buffer, -1, 0)) { + rewind($buffer); + ftruncate($buffer, 0); + + if (null === $e) { + $multi->handlesActivity[$i][] = $data; + } + } + + if (null !== $e || !$remaining || feof($h)) { + // Stream completed + $info['total_time'] = microtime(true) - $info['start_time']; + $info['starttransfer_time'] = $info['starttransfer_time'] ?: $info['total_time']; + + if ($onProgress) { + try { + $onProgress(-1); + } catch (\Throwable $e) { + // no-op + } + } + + if (null === $e) { + if (0 < $remaining) { + $e = new TransportException(sprintf('Transfer closed with %s bytes remaining to read.', $remaining)); + } elseif (-1 === $remaining && fwrite($buffer, '-') && '' !== stream_get_contents($buffer, -1, 0)) { + $e = new TransportException('Transfer closed with outstanding data remaining from chunked response.'); + } + } + + $multi->handlesActivity[$i][] = null; + $multi->handlesActivity[$i][] = $e; + if (null !== ($host = $multi->openHandles[$i][6] ?? null) && 0 >= --$multi->hosts[$host]) { + unset($multi->hosts[$host]); + } + unset($multi->openHandles[$i]); + $multi->sleep = false; + } + } + + if (null === $responses) { + return; + } + + $maxHosts = $multi->maxHostConnections; + + foreach ($responses as $i => $response) { + if (null !== $response->remaining || null === $response->buffer) { + continue; + } + + if ($response->pauseExpiry && microtime(true) < $response->pauseExpiry) { + // Create empty open handles to tell we still have pending requests + $multi->openHandles[$i] = [\INF, null, null, null]; + } elseif ($maxHosts && $maxHosts > ($multi->hosts[parse_url($response->url, \PHP_URL_HOST)] ?? 0)) { + // Open the next pending request - this is a blocking operation so we do only one of them + $response->open(); + $multi->sleep = false; + self::perform($multi); + $maxHosts = 0; + } + } + } + + /** + * {@inheritdoc} + * + * @param NativeClientState $multi + */ + private static function select(ClientState $multi, float $timeout): int + { + if (!$multi->sleep = !$multi->sleep) { + return -1; + } + + $_ = $handles = []; + $now = null; + + foreach ($multi->openHandles as [$pauseExpiry, $h]) { + if (null === $h) { + continue; + } + + if ($pauseExpiry && ($now ?? $now = microtime(true)) < $pauseExpiry) { + $timeout = min($timeout, $pauseExpiry - $now); + continue; + } + + $handles[] = $h; + } + + if (!$handles) { + usleep((int) (1E6 * $timeout)); + + return 0; + } + + return stream_select($handles, $_, $_, (int) $timeout, (int) (1E6 * ($timeout - (int) $timeout))); + } +} diff --git a/vendor/symfony/http-client/Response/ResponseStream.php b/vendor/symfony/http-client/Response/ResponseStream.php new file mode 100644 index 0000000..f86d2d4 --- /dev/null +++ b/vendor/symfony/http-client/Response/ResponseStream.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Contracts\HttpClient\ChunkInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; + +/** + * @author Nicolas Grekas + */ +final class ResponseStream implements ResponseStreamInterface +{ + private $generator; + + public function __construct(\Generator $generator) + { + $this->generator = $generator; + } + + public function key(): ResponseInterface + { + return $this->generator->key(); + } + + public function current(): ChunkInterface + { + return $this->generator->current(); + } + + public function next(): void + { + $this->generator->next(); + } + + public function rewind(): void + { + $this->generator->rewind(); + } + + public function valid(): bool + { + return $this->generator->valid(); + } +} diff --git a/vendor/symfony/http-client/Response/StreamWrapper.php b/vendor/symfony/http-client/Response/StreamWrapper.php new file mode 100644 index 0000000..c350e00 --- /dev/null +++ b/vendor/symfony/http-client/Response/StreamWrapper.php @@ -0,0 +1,304 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * Allows turning ResponseInterface instances to PHP streams. + * + * @author Nicolas Grekas + */ +class StreamWrapper +{ + /** @var resource|string|null */ + public $context; + + /** @var HttpClientInterface */ + private $client; + + /** @var ResponseInterface */ + private $response; + + /** @var resource|null */ + private $content; + + /** @var resource|null */ + private $handle; + + private $blocking = true; + private $timeout; + private $eof = false; + private $offset = 0; + + /** + * Creates a PHP stream resource from a ResponseInterface. + * + * @return resource + */ + public static function createResource(ResponseInterface $response, HttpClientInterface $client = null) + { + if ($response instanceof StreamableInterface) { + $stack = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 2); + + if ($response !== ($stack[1]['object'] ?? null)) { + return $response->toStream(false); + } + } + + if (null === $client && !method_exists($response, 'stream')) { + throw new \InvalidArgumentException(sprintf('Providing a client to "%s()" is required when the response doesn\'t have any "stream()" method.', __CLASS__)); + } + + if (false === stream_wrapper_register('symfony', __CLASS__)) { + throw new \RuntimeException(error_get_last()['message'] ?? 'Registering the "symfony" stream wrapper failed.'); + } + + try { + $context = [ + 'client' => $client ?? $response, + 'response' => $response, + ]; + + return fopen('symfony://'.$response->getInfo('url'), 'r', false, stream_context_create(['symfony' => $context])) ?: null; + } finally { + stream_wrapper_unregister('symfony'); + } + } + + public function getResponse(): ResponseInterface + { + return $this->response; + } + + /** + * @param resource|callable|null $handle The resource handle that should be monitored when + * stream_select() is used on the created stream + * @param resource|null $content The seekable resource where the response body is buffered + */ + public function bindHandles(&$handle, &$content): void + { + $this->handle = &$handle; + $this->content = &$content; + } + + public function stream_open(string $path, string $mode, int $options): bool + { + if ('r' !== $mode) { + if ($options & \STREAM_REPORT_ERRORS) { + trigger_error(sprintf('Invalid mode "%s": only "r" is supported.', $mode), \E_USER_WARNING); + } + + return false; + } + + $context = stream_context_get_options($this->context)['symfony'] ?? null; + $this->client = $context['client'] ?? null; + $this->response = $context['response'] ?? null; + $this->context = null; + + if (null !== $this->client && null !== $this->response) { + return true; + } + + if ($options & \STREAM_REPORT_ERRORS) { + trigger_error('Missing options "client" or "response" in "symfony" stream context.', \E_USER_WARNING); + } + + return false; + } + + public function stream_read(int $count) + { + if (\is_resource($this->content)) { + // Empty the internal activity list + foreach ($this->client->stream([$this->response], 0) as $chunk) { + try { + if (!$chunk->isTimeout() && $chunk->isFirst()) { + $this->response->getStatusCode(); // ignore 3/4/5xx + } + } catch (ExceptionInterface $e) { + trigger_error($e->getMessage(), \E_USER_WARNING); + + return false; + } + } + + if (0 !== fseek($this->content, $this->offset)) { + return false; + } + + if ('' !== $data = fread($this->content, $count)) { + fseek($this->content, 0, \SEEK_END); + $this->offset += \strlen($data); + + return $data; + } + } + + if (\is_string($this->content)) { + if (\strlen($this->content) <= $count) { + $data = $this->content; + $this->content = null; + } else { + $data = substr($this->content, 0, $count); + $this->content = substr($this->content, $count); + } + $this->offset += \strlen($data); + + return $data; + } + + foreach ($this->client->stream([$this->response], $this->blocking ? $this->timeout : 0) as $chunk) { + try { + $this->eof = true; + $this->eof = !$chunk->isTimeout(); + $this->eof = $chunk->isLast(); + + if ($chunk->isFirst()) { + $this->response->getStatusCode(); // ignore 3/4/5xx + } + + if ('' !== $data = $chunk->getContent()) { + if (\strlen($data) > $count) { + if (null === $this->content) { + $this->content = substr($data, $count); + } + $data = substr($data, 0, $count); + } + $this->offset += \strlen($data); + + return $data; + } + } catch (ExceptionInterface $e) { + trigger_error($e->getMessage(), \E_USER_WARNING); + + return false; + } + } + + return ''; + } + + public function stream_set_option(int $option, int $arg1, ?int $arg2): bool + { + if (\STREAM_OPTION_BLOCKING === $option) { + $this->blocking = (bool) $arg1; + } elseif (\STREAM_OPTION_READ_TIMEOUT === $option) { + $this->timeout = $arg1 + $arg2 / 1e6; + } else { + return false; + } + + return true; + } + + public function stream_tell(): int + { + return $this->offset; + } + + public function stream_eof(): bool + { + return $this->eof && !\is_string($this->content); + } + + public function stream_seek(int $offset, int $whence = \SEEK_SET): bool + { + if (!\is_resource($this->content) || 0 !== fseek($this->content, 0, \SEEK_END)) { + return false; + } + + $size = ftell($this->content); + + if (\SEEK_CUR === $whence) { + $offset += $this->offset; + } + + if (\SEEK_END === $whence || $size < $offset) { + foreach ($this->client->stream([$this->response]) as $chunk) { + try { + if ($chunk->isFirst()) { + $this->response->getStatusCode(); // ignore 3/4/5xx + } + + // Chunks are buffered in $this->content already + $size += \strlen($chunk->getContent()); + + if (\SEEK_END !== $whence && $offset <= $size) { + break; + } + } catch (ExceptionInterface $e) { + trigger_error($e->getMessage(), \E_USER_WARNING); + + return false; + } + } + + if (\SEEK_END === $whence) { + $offset += $size; + } + } + + if (0 <= $offset && $offset <= $size) { + $this->eof = false; + $this->offset = $offset; + + return true; + } + + return false; + } + + public function stream_cast(int $castAs) + { + if (\STREAM_CAST_FOR_SELECT === $castAs) { + $this->response->getHeaders(false); + + return (\is_callable($this->handle) ? ($this->handle)() : $this->handle) ?? false; + } + + return false; + } + + public function stream_stat(): array + { + try { + $headers = $this->response->getHeaders(false); + } catch (ExceptionInterface $e) { + trigger_error($e->getMessage(), \E_USER_WARNING); + $headers = []; + } + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 33060, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => (int) ($headers['content-length'][0] ?? -1), + 'atime' => 0, + 'mtime' => strtotime($headers['last-modified'][0] ?? '') ?: 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0, + ]; + } + + private function __construct() + { + } +} diff --git a/vendor/symfony/http-client/Response/StreamableInterface.php b/vendor/symfony/http-client/Response/StreamableInterface.php new file mode 100644 index 0000000..eb1f933 --- /dev/null +++ b/vendor/symfony/http-client/Response/StreamableInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * @author Nicolas Grekas + */ +interface StreamableInterface +{ + /** + * Casts the response to a PHP stream resource. + * + * @return resource + * + * @throws TransportExceptionInterface When a network error occurs + * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached + * @throws ClientExceptionInterface On a 4xx when $throw is true + * @throws ServerExceptionInterface On a 5xx when $throw is true + */ + public function toStream(bool $throw = true); +} diff --git a/vendor/symfony/http-client/Response/TraceableResponse.php b/vendor/symfony/http-client/Response/TraceableResponse.php new file mode 100644 index 0000000..d656c0a --- /dev/null +++ b/vendor/symfony/http-client/Response/TraceableResponse.php @@ -0,0 +1,219 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Chunk\ErrorChunk; +use Symfony\Component\HttpClient\Exception\ClientException; +use Symfony\Component\HttpClient\Exception\RedirectionException; +use Symfony\Component\HttpClient\Exception\ServerException; +use Symfony\Component\HttpClient\TraceableHttpClient; +use Symfony\Component\Stopwatch\StopwatchEvent; +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class TraceableResponse implements ResponseInterface, StreamableInterface +{ + private $client; + private $response; + private $content; + private $event; + + public function __construct(HttpClientInterface $client, ResponseInterface $response, &$content, StopwatchEvent $event = null) + { + $this->client = $client; + $this->response = $response; + $this->content = &$content; + $this->event = $event; + } + + public function __sleep(): array + { + throw new \BadMethodCallException('Cannot serialize '.__CLASS__); + } + + public function __wakeup() + { + throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); + } + + public function __destruct() + { + try { + $this->response->__destruct(); + } finally { + if ($this->event && $this->event->isStarted()) { + $this->event->stop(); + } + } + } + + public function getStatusCode(): int + { + try { + return $this->response->getStatusCode(); + } finally { + if ($this->event && $this->event->isStarted()) { + $this->event->lap(); + } + } + } + + public function getHeaders(bool $throw = true): array + { + try { + return $this->response->getHeaders($throw); + } finally { + if ($this->event && $this->event->isStarted()) { + $this->event->lap(); + } + } + } + + public function getContent(bool $throw = true): string + { + try { + if (false === $this->content) { + return $this->response->getContent($throw); + } + + return $this->content = $this->response->getContent(false); + } finally { + if ($this->event && $this->event->isStarted()) { + $this->event->stop(); + } + if ($throw) { + $this->checkStatusCode($this->response->getStatusCode()); + } + } + } + + public function toArray(bool $throw = true): array + { + try { + if (false === $this->content) { + return $this->response->toArray($throw); + } + + return $this->content = $this->response->toArray(false); + } finally { + if ($this->event && $this->event->isStarted()) { + $this->event->stop(); + } + if ($throw) { + $this->checkStatusCode($this->response->getStatusCode()); + } + } + } + + public function cancel(): void + { + $this->response->cancel(); + + if ($this->event && $this->event->isStarted()) { + $this->event->stop(); + } + } + + public function getInfo(string $type = null) + { + return $this->response->getInfo($type); + } + + /** + * Casts the response to a PHP stream resource. + * + * @return resource + * + * @throws TransportExceptionInterface When a network error occurs + * @throws RedirectionExceptionInterface On a 3xx when $throw is true and the "max_redirects" option has been reached + * @throws ClientExceptionInterface On a 4xx when $throw is true + * @throws ServerExceptionInterface On a 5xx when $throw is true + */ + public function toStream(bool $throw = true) + { + if ($throw) { + // Ensure headers arrived + $this->response->getHeaders(true); + } + + if ($this->response instanceof StreamableInterface) { + return $this->response->toStream(false); + } + + return StreamWrapper::createResource($this->response, $this->client); + } + + /** + * @internal + */ + public static function stream(HttpClientInterface $client, iterable $responses, ?float $timeout): \Generator + { + $wrappedResponses = []; + $traceableMap = new \SplObjectStorage(); + + foreach ($responses as $r) { + if (!$r instanceof self) { + throw new \TypeError(sprintf('"%s::stream()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', TraceableHttpClient::class, get_debug_type($r))); + } + + $traceableMap[$r->response] = $r; + $wrappedResponses[] = $r->response; + if ($r->event && !$r->event->isStarted()) { + $r->event->start(); + } + } + + foreach ($client->stream($wrappedResponses, $timeout) as $r => $chunk) { + if ($traceableMap[$r]->event && $traceableMap[$r]->event->isStarted()) { + try { + if ($chunk->isTimeout() || !$chunk->isLast()) { + $traceableMap[$r]->event->lap(); + } else { + $traceableMap[$r]->event->stop(); + } + } catch (TransportExceptionInterface $e) { + $traceableMap[$r]->event->stop(); + if ($chunk instanceof ErrorChunk) { + $chunk->didThrow(false); + } else { + $chunk = new ErrorChunk($chunk->getOffset(), $e); + } + } + } + yield $traceableMap[$r] => $chunk; + } + } + + private function checkStatusCode(int $code) + { + if (500 <= $code) { + throw new ServerException($this); + } + + if (400 <= $code) { + throw new ClientException($this); + } + + if (300 <= $code) { + throw new RedirectionException($this); + } + } +} diff --git a/vendor/symfony/http-client/Response/TransportResponseTrait.php b/vendor/symfony/http-client/Response/TransportResponseTrait.php new file mode 100644 index 0000000..566d61e --- /dev/null +++ b/vendor/symfony/http-client/Response/TransportResponseTrait.php @@ -0,0 +1,312 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Response; + +use Symfony\Component\HttpClient\Chunk\DataChunk; +use Symfony\Component\HttpClient\Chunk\ErrorChunk; +use Symfony\Component\HttpClient\Chunk\FirstChunk; +use Symfony\Component\HttpClient\Chunk\LastChunk; +use Symfony\Component\HttpClient\Exception\TransportException; +use Symfony\Component\HttpClient\Internal\ClientState; + +/** + * Implements common logic for transport-level response classes. + * + * @author Nicolas Grekas + * + * @internal + */ +trait TransportResponseTrait +{ + private $canary; + private $headers = []; + private $info = [ + 'response_headers' => [], + 'http_code' => 0, + 'error' => null, + 'canceled' => false, + ]; + + /** @var object|resource */ + private $handle; + private $id; + private $timeout = 0; + private $inflate; + private $finalInfo; + private $logger; + + /** + * {@inheritdoc} + */ + public function getStatusCode(): int + { + if ($this->initializer) { + self::initialize($this); + } + + return $this->info['http_code']; + } + + /** + * {@inheritdoc} + */ + public function getHeaders(bool $throw = true): array + { + if ($this->initializer) { + self::initialize($this); + } + + if ($throw) { + $this->checkStatusCode(); + } + + return $this->headers; + } + + /** + * {@inheritdoc} + */ + public function cancel(): void + { + $this->info['canceled'] = true; + $this->info['error'] = 'Response has been canceled.'; + $this->close(); + } + + /** + * Closes the response and all its network handles. + */ + protected function close(): void + { + $this->canary->cancel(); + $this->inflate = null; + } + + /** + * Adds pending responses to the activity list. + */ + abstract protected static function schedule(self $response, array &$runningResponses): void; + + /** + * Performs all pending non-blocking operations. + */ + abstract protected static function perform(ClientState $multi, array &$responses): void; + + /** + * Waits for network activity. + */ + abstract protected static function select(ClientState $multi, float $timeout): int; + + private static function addResponseHeaders(array $responseHeaders, array &$info, array &$headers, string &$debug = ''): void + { + foreach ($responseHeaders as $h) { + if (11 <= \strlen($h) && '/' === $h[4] && preg_match('#^HTTP/\d+(?:\.\d+)? (\d\d\d)(?: |$)#', $h, $m)) { + if ($headers) { + $debug .= "< \r\n"; + $headers = []; + } + $info['http_code'] = (int) $m[1]; + } elseif (2 === \count($m = explode(':', $h, 2))) { + $headers[strtolower($m[0])][] = ltrim($m[1]); + } + + $debug .= "< {$h}\r\n"; + $info['response_headers'][] = $h; + } + + $debug .= "< \r\n"; + } + + /** + * Ensures the request is always sent and that the response code was checked. + */ + private function doDestruct() + { + $this->shouldBuffer = true; + + if ($this->initializer && null === $this->info['error']) { + self::initialize($this); + $this->checkStatusCode(); + } + } + + /** + * Implements an event loop based on a buffer activity queue. + * + * @param iterable $responses + * + * @internal + */ + public static function stream(iterable $responses, float $timeout = null): \Generator + { + $runningResponses = []; + + foreach ($responses as $response) { + self::schedule($response, $runningResponses); + } + + $lastActivity = microtime(true); + $elapsedTimeout = 0; + + if ($fromLastTimeout = 0.0 === $timeout && '-0' === (string) $timeout) { + $timeout = null; + } elseif ($fromLastTimeout = 0 > $timeout) { + $timeout = -$timeout; + } + + while (true) { + $hasActivity = false; + $timeoutMax = 0; + $timeoutMin = $timeout ?? \INF; + + /** @var ClientState $multi */ + foreach ($runningResponses as $i => [$multi]) { + $responses = &$runningResponses[$i][1]; + self::perform($multi, $responses); + + foreach ($responses as $j => $response) { + $timeoutMax = $timeout ?? max($timeoutMax, $response->timeout); + $timeoutMin = min($timeoutMin, $response->timeout, 1); + $chunk = false; + + if ($fromLastTimeout && null !== $multi->lastTimeout) { + $elapsedTimeout = microtime(true) - $multi->lastTimeout; + } + + if (isset($multi->handlesActivity[$j])) { + $multi->lastTimeout = null; + } elseif (!isset($multi->openHandles[$j])) { + unset($responses[$j]); + continue; + } elseif ($elapsedTimeout >= $timeoutMax) { + $multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))]; + $multi->lastTimeout ?? $multi->lastTimeout = $lastActivity; + } else { + continue; + } + + while ($multi->handlesActivity[$j] ?? false) { + $hasActivity = true; + $elapsedTimeout = 0; + + if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) { + if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) { + $multi->handlesActivity[$j] = [null, new TransportException(sprintf('Error while processing content unencoding for "%s".', $response->getInfo('url')))]; + continue; + } + + if ('' !== $chunk && null !== $response->content && \strlen($chunk) !== fwrite($response->content, $chunk)) { + $multi->handlesActivity[$j] = [null, new TransportException(sprintf('Failed writing %d bytes to the response buffer.', \strlen($chunk)))]; + continue; + } + + $chunkLen = \strlen($chunk); + $chunk = new DataChunk($response->offset, $chunk); + $response->offset += $chunkLen; + } elseif (null === $chunk) { + $e = $multi->handlesActivity[$j][0]; + unset($responses[$j], $multi->handlesActivity[$j]); + $response->close(); + + if (null !== $e) { + $response->info['error'] = $e->getMessage(); + + if ($e instanceof \Error) { + throw $e; + } + + $chunk = new ErrorChunk($response->offset, $e); + } else { + if (0 === $response->offset && null === $response->content) { + $response->content = fopen('php://memory', 'w+'); + } + + $chunk = new LastChunk($response->offset); + } + } elseif ($chunk instanceof ErrorChunk) { + unset($responses[$j]); + $elapsedTimeout = $timeoutMax; + } elseif ($chunk instanceof FirstChunk) { + if ($response->logger) { + $info = $response->getInfo(); + $response->logger->info(sprintf('Response: "%s %s"', $info['http_code'], $info['url'])); + } + + $response->inflate = \extension_loaded('zlib') && $response->inflate && 'gzip' === ($response->headers['content-encoding'][0] ?? null) ? inflate_init(\ZLIB_ENCODING_GZIP) : null; + + if ($response->shouldBuffer instanceof \Closure) { + try { + $response->shouldBuffer = ($response->shouldBuffer)($response->headers); + + if (null !== $response->info['error']) { + throw new TransportException($response->info['error']); + } + } catch (\Throwable $e) { + $response->close(); + $multi->handlesActivity[$j] = [null, $e]; + } + } + + if (true === $response->shouldBuffer) { + $response->content = fopen('php://temp', 'w+'); + } elseif (\is_resource($response->shouldBuffer)) { + $response->content = $response->shouldBuffer; + } + $response->shouldBuffer = null; + + yield $response => $chunk; + + if ($response->initializer && null === $response->info['error']) { + // Ensure the HTTP status code is always checked + $response->getHeaders(true); + } + + continue; + } + + yield $response => $chunk; + } + + unset($multi->handlesActivity[$j]); + + if ($chunk instanceof ErrorChunk && !$chunk->didThrow()) { + // Ensure transport exceptions are always thrown + $chunk->getContent(); + } + } + + if (!$responses) { + unset($runningResponses[$i]); + } + + // Prevent memory leaks + $multi->handlesActivity = $multi->handlesActivity ?: []; + $multi->openHandles = $multi->openHandles ?: []; + } + + if (!$runningResponses) { + break; + } + + if ($hasActivity) { + $lastActivity = microtime(true); + continue; + } + + if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $elapsedTimeout))) { + usleep(min(500, 1E6 * $timeoutMin)); + } + + $elapsedTimeout = microtime(true) - $lastActivity; + } + } +} diff --git a/vendor/symfony/http-client/Retry/GenericRetryStrategy.php b/vendor/symfony/http-client/Retry/GenericRetryStrategy.php new file mode 100644 index 0000000..ebe10a2 --- /dev/null +++ b/vendor/symfony/http-client/Retry/GenericRetryStrategy.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\Component\HttpClient\Retry; + +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Component\HttpClient\Response\AsyncContext; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * Decides to retry the request when HTTP status codes belong to the given list of codes. + * + * @author Jérémy Derussé + */ +class GenericRetryStrategy implements RetryStrategyInterface +{ + public const IDEMPOTENT_METHODS = ['GET', 'HEAD', 'PUT', 'DELETE', 'OPTIONS', 'TRACE']; + public const DEFAULT_RETRY_STATUS_CODES = [ + 0 => self::IDEMPOTENT_METHODS, // for transport exceptions + 423, + 425, + 429, + 500 => self::IDEMPOTENT_METHODS, + 502, + 503, + 504 => self::IDEMPOTENT_METHODS, + 507 => self::IDEMPOTENT_METHODS, + 510 => self::IDEMPOTENT_METHODS, + ]; + + private $statusCodes; + private $delayMs; + private $multiplier; + private $maxDelayMs; + private $jitter; + + /** + * @param array $statusCodes List of HTTP status codes that trigger a retry + * @param int $delayMs Amount of time to delay (or the initial value when multiplier is used) + * @param float $multiplier Multiplier to apply to the delay each time a retry occurs + * @param int $maxDelayMs Maximum delay to allow (0 means no maximum) + * @param float $jitter Probability of randomness int delay (0 = none, 1 = 100% random) + */ + public function __construct(array $statusCodes = self::DEFAULT_RETRY_STATUS_CODES, int $delayMs = 1000, float $multiplier = 2.0, int $maxDelayMs = 0, float $jitter = 0.1) + { + $this->statusCodes = $statusCodes; + + if ($delayMs < 0) { + throw new InvalidArgumentException(sprintf('Delay must be greater than or equal to zero: "%s" given.', $delayMs)); + } + $this->delayMs = $delayMs; + + if ($multiplier < 1) { + throw new InvalidArgumentException(sprintf('Multiplier must be greater than or equal to one: "%s" given.', $multiplier)); + } + $this->multiplier = $multiplier; + + if ($maxDelayMs < 0) { + throw new InvalidArgumentException(sprintf('Max delay must be greater than or equal to zero: "%s" given.', $maxDelayMs)); + } + $this->maxDelayMs = $maxDelayMs; + + if ($jitter < 0 || $jitter > 1) { + throw new InvalidArgumentException(sprintf('Jitter must be between 0 and 1: "%s" given.', $jitter)); + } + $this->jitter = $jitter; + } + + public function shouldRetry(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): ?bool + { + $statusCode = $context->getStatusCode(); + if (\in_array($statusCode, $this->statusCodes, true)) { + return true; + } + if (isset($this->statusCodes[$statusCode]) && \is_array($this->statusCodes[$statusCode])) { + return \in_array($context->getInfo('http_method'), $this->statusCodes[$statusCode], true); + } + if (null === $exception) { + return false; + } + + if (\in_array(0, $this->statusCodes, true)) { + return true; + } + if (isset($this->statusCodes[0]) && \is_array($this->statusCodes[0])) { + return \in_array($context->getInfo('http_method'), $this->statusCodes[0], true); + } + + return false; + } + + public function getDelay(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): int + { + $delay = $this->delayMs * $this->multiplier ** $context->getInfo('retry_count'); + + if ($this->jitter > 0) { + $randomness = $delay * $this->jitter; + $delay = $delay + random_int(-$randomness, +$randomness); + } + + if ($delay > $this->maxDelayMs && 0 !== $this->maxDelayMs) { + return $this->maxDelayMs; + } + + return (int) $delay; + } +} diff --git a/vendor/symfony/http-client/Retry/RetryStrategyInterface.php b/vendor/symfony/http-client/Retry/RetryStrategyInterface.php new file mode 100644 index 0000000..2576433 --- /dev/null +++ b/vendor/symfony/http-client/Retry/RetryStrategyInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient\Retry; + +use Symfony\Component\HttpClient\Response\AsyncContext; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; + +/** + * @author Jérémy Derussé + * @author Nicolas Grekas + */ +interface RetryStrategyInterface +{ + /** + * Returns whether the request should be retried. + * + * @param ?string $responseContent Null is passed when the body did not arrive yet + * + * @return bool|null Returns null to signal that the body is required to take a decision + */ + public function shouldRetry(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): ?bool; + + /** + * Returns the time to wait in milliseconds. + */ + public function getDelay(AsyncContext $context, ?string $responseContent, ?TransportExceptionInterface $exception): int; +} diff --git a/vendor/symfony/http-client/RetryableHttpClient.php b/vendor/symfony/http-client/RetryableHttpClient.php new file mode 100644 index 0000000..4df466f --- /dev/null +++ b/vendor/symfony/http-client/RetryableHttpClient.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; +use Symfony\Component\HttpClient\Response\AsyncContext; +use Symfony\Component\HttpClient\Response\AsyncResponse; +use Symfony\Component\HttpClient\Retry\GenericRetryStrategy; +use Symfony\Component\HttpClient\Retry\RetryStrategyInterface; +use Symfony\Contracts\HttpClient\ChunkInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Automatically retries failing HTTP requests. + * + * @author Jérémy Derussé + */ +class RetryableHttpClient implements HttpClientInterface, ResetInterface +{ + use AsyncDecoratorTrait; + + private $strategy; + private $maxRetries; + private $logger; + + /** + * @param int $maxRetries The maximum number of times to retry + */ + public function __construct(HttpClientInterface $client, RetryStrategyInterface $strategy = null, int $maxRetries = 3, LoggerInterface $logger = null) + { + $this->client = $client; + $this->strategy = $strategy ?? new GenericRetryStrategy(); + $this->maxRetries = $maxRetries; + $this->logger = $logger ?? new NullLogger(); + } + + public function request(string $method, string $url, array $options = []): ResponseInterface + { + if ($this->maxRetries <= 0) { + return new AsyncResponse($this->client, $method, $url, $options); + } + + $retryCount = 0; + $content = ''; + $firstChunk = null; + + return new AsyncResponse($this->client, $method, $url, $options, function (ChunkInterface $chunk, AsyncContext $context) use ($method, $url, $options, &$retryCount, &$content, &$firstChunk) { + $exception = null; + try { + if ($chunk->isTimeout() || null !== $chunk->getInformationalStatus() || $context->getInfo('canceled')) { + yield $chunk; + + return; + } + } catch (TransportExceptionInterface $exception) { + // catch TransportExceptionInterface to send it to the strategy + } + if (null !== $exception) { + // always retry request that fail to resolve DNS + if ('' !== $context->getInfo('primary_ip')) { + $shouldRetry = $this->strategy->shouldRetry($context, null, $exception); + if (null === $shouldRetry) { + throw new \LogicException(sprintf('The "%s::shouldRetry()" method must not return null when called with an exception.', \get_class($this->strategy))); + } + + if (false === $shouldRetry) { + yield from $this->passthru($context, $firstChunk, $content, $chunk); + + return; + } + } + } elseif ($chunk->isFirst()) { + if (false === $shouldRetry = $this->strategy->shouldRetry($context, null, null)) { + yield from $this->passthru($context, $firstChunk, $content, $chunk); + + return; + } + + // Body is needed to decide + if (null === $shouldRetry) { + $firstChunk = $chunk; + $content = ''; + + return; + } + } else { + if (!$chunk->isLast()) { + $content .= $chunk->getContent(); + + return; + } + + if (null === $shouldRetry = $this->strategy->shouldRetry($context, $content, null)) { + throw new \LogicException(sprintf('The "%s::shouldRetry()" method must not return null when called with a body.', \get_class($this->strategy))); + } + + if (false === $shouldRetry) { + yield from $this->passthru($context, $firstChunk, $content, $chunk); + + return; + } + } + + $context->getResponse()->cancel(); + + $delay = $this->getDelayFromHeader($context->getHeaders()) ?? $this->strategy->getDelay($context, !$exception && $chunk->isLast() ? $content : null, $exception); + ++$retryCount; + + $this->logger->info('Try #{count} after {delay}ms'.($exception ? ': '.$exception->getMessage() : ', status code: '.$context->getStatusCode()), [ + 'count' => $retryCount, + 'delay' => $delay, + ]); + + $context->setInfo('retry_count', $retryCount); + $context->replaceRequest($method, $url, $options); + $context->pause($delay / 1000); + + if ($retryCount >= $this->maxRetries) { + $context->passthru(); + } + }); + } + + private function getDelayFromHeader(array $headers): ?int + { + if (null !== $after = $headers['retry-after'][0] ?? null) { + if (is_numeric($after)) { + return (int) $after * 1000; + } + + if (false !== $time = strtotime($after)) { + return max(0, $time - time()) * 1000; + } + } + + return null; + } + + private function passthru(AsyncContext $context, ?ChunkInterface $firstChunk, string &$content, ChunkInterface $lastChunk): \Generator + { + $context->passthru(); + + if (null !== $firstChunk) { + yield $firstChunk; + } + + if ('' !== $content) { + $chunk = $context->createChunk($content); + $content = ''; + + yield $chunk; + } + + yield $lastChunk; + } +} diff --git a/vendor/symfony/http-client/ScopingHttpClient.php b/vendor/symfony/http-client/ScopingHttpClient.php new file mode 100644 index 0000000..85fa26a --- /dev/null +++ b/vendor/symfony/http-client/ScopingHttpClient.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Exception\InvalidArgumentException; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Auto-configure the default options based on the requested URL. + * + * @author Anthony Martin + */ +class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface +{ + use HttpClientTrait; + + private $client; + private $defaultOptionsByRegexp; + private $defaultRegexp; + + public function __construct(HttpClientInterface $client, array $defaultOptionsByRegexp, string $defaultRegexp = null) + { + $this->client = $client; + $this->defaultOptionsByRegexp = $defaultOptionsByRegexp; + $this->defaultRegexp = $defaultRegexp; + + if (null !== $defaultRegexp && !isset($defaultOptionsByRegexp[$defaultRegexp])) { + throw new InvalidArgumentException(sprintf('No options are mapped to the provided "%s" default regexp.', $defaultRegexp)); + } + } + + public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], string $regexp = null): self + { + if (null === $regexp) { + $regexp = preg_quote(implode('', self::resolveUrl(self::parseUrl('.'), self::parseUrl($baseUri)))); + } + + $defaultOptions['base_uri'] = $baseUri; + + return new self($client, [$regexp => $defaultOptions], $regexp); + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + $e = null; + $url = self::parseUrl($url, $options['query'] ?? []); + + if (\is_string($options['base_uri'] ?? null)) { + $options['base_uri'] = self::parseUrl($options['base_uri']); + } + + try { + $url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null)); + } catch (InvalidArgumentException $e) { + if (null === $this->defaultRegexp) { + throw $e; + } + + $defaultOptions = $this->defaultOptionsByRegexp[$this->defaultRegexp]; + $options = self::mergeDefaultOptions($options, $defaultOptions, true); + if (\is_string($options['base_uri'] ?? null)) { + $options['base_uri'] = self::parseUrl($options['base_uri']); + } + $url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null, $defaultOptions['query'] ?? [])); + } + + foreach ($this->defaultOptionsByRegexp as $regexp => $defaultOptions) { + if (preg_match("{{$regexp}}A", $url)) { + if (null === $e || $regexp !== $this->defaultRegexp) { + $options = self::mergeDefaultOptions($options, $defaultOptions, true); + } + break; + } + } + + return $this->client->request($method, $url, $options); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + return $this->client->stream($responses, $timeout); + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + } + + /** + * {@inheritdoc} + */ + public function setLogger(LoggerInterface $logger): void + { + if ($this->client instanceof LoggerAwareInterface) { + $this->client->setLogger($logger); + } + } + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->client = $this->client->withOptions($options); + + return $clone; + } +} diff --git a/vendor/symfony/http-client/TraceableHttpClient.php b/vendor/symfony/http-client/TraceableHttpClient.php new file mode 100644 index 0000000..76c9282 --- /dev/null +++ b/vendor/symfony/http-client/TraceableHttpClient.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpClient; + +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpClient\Response\ResponseStream; +use Symfony\Component\HttpClient\Response\TraceableResponse; +use Symfony\Component\Stopwatch\Stopwatch; +use Symfony\Contracts\HttpClient\HttpClientInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Symfony\Contracts\HttpClient\ResponseStreamInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * @author Jérémy Romey + */ +final class TraceableHttpClient implements HttpClientInterface, ResetInterface, LoggerAwareInterface +{ + private $client; + private $stopwatch; + private $tracedRequests; + + public function __construct(HttpClientInterface $client, Stopwatch $stopwatch = null) + { + $this->client = $client; + $this->stopwatch = $stopwatch; + $this->tracedRequests = new \ArrayObject(); + } + + /** + * {@inheritdoc} + */ + public function request(string $method, string $url, array $options = []): ResponseInterface + { + $content = null; + $traceInfo = []; + $this->tracedRequests[] = [ + 'method' => $method, + 'url' => $url, + 'options' => $options, + 'info' => &$traceInfo, + 'content' => &$content, + ]; + $onProgress = $options['on_progress'] ?? null; + + if (false === ($options['extra']['trace_content'] ?? true)) { + unset($content); + $content = false; + } + + $options['on_progress'] = function (int $dlNow, int $dlSize, array $info) use (&$traceInfo, $onProgress) { + $traceInfo = $info; + + if (null !== $onProgress) { + $onProgress($dlNow, $dlSize, $info); + } + }; + + return new TraceableResponse($this->client, $this->client->request($method, $url, $options), $content, null === $this->stopwatch ? null : $this->stopwatch->start("$method $url", 'http_client')); + } + + /** + * {@inheritdoc} + */ + public function stream($responses, float $timeout = null): ResponseStreamInterface + { + if ($responses instanceof TraceableResponse) { + $responses = [$responses]; + } elseif (!is_iterable($responses)) { + throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, get_debug_type($responses))); + } + + return new ResponseStream(TraceableResponse::stream($this->client, $responses, $timeout)); + } + + public function getTracedRequests(): array + { + return $this->tracedRequests->getArrayCopy(); + } + + public function reset() + { + if ($this->client instanceof ResetInterface) { + $this->client->reset(); + } + + $this->tracedRequests->exchangeArray([]); + } + + /** + * {@inheritdoc} + */ + public function setLogger(LoggerInterface $logger): void + { + if ($this->client instanceof LoggerAwareInterface) { + $this->client->setLogger($logger); + } + } + + /** + * {@inheritdoc} + */ + public function withOptions(array $options): self + { + $clone = clone $this; + $clone->client = $this->client->withOptions($options); + + return $clone; + } +} diff --git a/vendor/symfony/http-client/composer.json b/vendor/symfony/http-client/composer.json new file mode 100644 index 0000000..084c258 --- /dev/null +++ b/vendor/symfony/http-client/composer.json @@ -0,0 +1,53 @@ +{ + "name": "symfony/http-client", + "type": "library", + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "2.4" + }, + "require": { + "php": ">=7.2.5", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-client-contracts": "^2.4", + "symfony/polyfill-php73": "^1.11", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.0|^2|^3" + }, + "require-dev": { + "amphp/amp": "^2.5", + "amphp/http-client": "^4.2.1", + "amphp/http-tunnel": "^1.0", + "amphp/socket": "^1.1", + "guzzlehttp/promises": "^1.4", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4.13|^5.1.5|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\HttpClient\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/options-resolver/CHANGELOG.md b/vendor/symfony/options-resolver/CHANGELOG.md new file mode 100644 index 0000000..84c4594 --- /dev/null +++ b/vendor/symfony/options-resolver/CHANGELOG.md @@ -0,0 +1,81 @@ +CHANGELOG +========= + +5.3 +--- + + * Add prototype definition for nested options + +5.1.0 +----- + + * added fluent configuration of options using `OptionResolver::define()` + * added `setInfo()` and `getInfo()` methods + * updated the signature of method `OptionsResolver::setDeprecated()` to `OptionsResolver::setDeprecation(string $option, string $package, string $version, $message)` + * deprecated `OptionsResolverIntrospector::getDeprecationMessage()`, use `OptionsResolverIntrospector::getDeprecation()` instead + +5.0.0 +----- + + * added argument `$triggerDeprecation` to `OptionsResolver::offsetGet()` + +4.3.0 +----- + + * added `OptionsResolver::addNormalizer` method + +4.2.0 +----- + + * added support for nested options definition + * added `setDeprecated` and `isDeprecated` methods + +3.4.0 +----- + + * added `OptionsResolverIntrospector` to inspect options definitions inside an `OptionsResolver` instance + * added array of types support in allowed types (e.g int[]) + +2.6.0 +----- + + * deprecated OptionsResolverInterface + * [BC BREAK] removed "array" type hint from OptionsResolverInterface methods + setRequired(), setAllowedValues(), addAllowedValues(), setAllowedTypes() and + addAllowedTypes() + * added OptionsResolver::setDefault() + * added OptionsResolver::hasDefault() + * added OptionsResolver::setNormalizer() + * added OptionsResolver::isRequired() + * added OptionsResolver::getRequiredOptions() + * added OptionsResolver::isMissing() + * added OptionsResolver::getMissingOptions() + * added OptionsResolver::setDefined() + * added OptionsResolver::isDefined() + * added OptionsResolver::getDefinedOptions() + * added OptionsResolver::remove() + * added OptionsResolver::clear() + * deprecated OptionsResolver::replaceDefaults() + * deprecated OptionsResolver::setOptional() in favor of setDefined() + * deprecated OptionsResolver::isKnown() in favor of isDefined() + * [BC BREAK] OptionsResolver::isRequired() returns true now if a required + option has a default value set + * [BC BREAK] merged Options into OptionsResolver and turned Options into an + interface + * deprecated Options::overload() (now in OptionsResolver) + * deprecated Options::set() (now in OptionsResolver) + * deprecated Options::get() (now in OptionsResolver) + * deprecated Options::has() (now in OptionsResolver) + * deprecated Options::replace() (now in OptionsResolver) + * [BC BREAK] Options::get() (now in OptionsResolver) can only be used within + lazy option/normalizer closures now + * [BC BREAK] removed Traversable interface from Options since using within + lazy option/normalizer closures resulted in exceptions + * [BC BREAK] removed Options::all() since using within lazy option/normalizer + closures resulted in exceptions + * [BC BREAK] OptionDefinitionException now extends LogicException instead of + RuntimeException + * [BC BREAK] normalizers are not executed anymore for unset options + * normalizers are executed after validating the options now + * [BC BREAK] an UndefinedOptionsException is now thrown instead of an + InvalidOptionsException when non-existing options are passed diff --git a/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php new file mode 100644 index 0000000..95909f3 --- /dev/null +++ b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Debug; + +use Symfony\Component\OptionsResolver\Exception\NoConfigurationException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * @author Maxime Steinhausser + * + * @final + */ +class OptionsResolverIntrospector +{ + private $get; + + public function __construct(OptionsResolver $optionsResolver) + { + $this->get = \Closure::bind(function ($property, $option, $message) { + /** @var OptionsResolver $this */ + if (!$this->isDefined($option)) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist.', $option)); + } + + if (!\array_key_exists($option, $this->{$property})) { + throw new NoConfigurationException($message); + } + + return $this->{$property}[$option]; + }, $optionsResolver, $optionsResolver); + } + + /** + * @return mixed + * + * @throws NoConfigurationException on no configured value + */ + public function getDefault(string $option) + { + return ($this->get)('defaults', $option, sprintf('No default value was set for the "%s" option.', $option)); + } + + /** + * @return \Closure[] + * + * @throws NoConfigurationException on no configured closures + */ + public function getLazyClosures(string $option): array + { + return ($this->get)('lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option)); + } + + /** + * @return string[] + * + * @throws NoConfigurationException on no configured types + */ + public function getAllowedTypes(string $option): array + { + return ($this->get)('allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option)); + } + + /** + * @return mixed[] + * + * @throws NoConfigurationException on no configured values + */ + public function getAllowedValues(string $option): array + { + return ($this->get)('allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option)); + } + + /** + * @throws NoConfigurationException on no configured normalizer + */ + public function getNormalizer(string $option): \Closure + { + return current($this->getNormalizers($option)); + } + + /** + * @throws NoConfigurationException when no normalizer is configured + */ + public function getNormalizers(string $option): array + { + return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option)); + } + + /** + * @return string|\Closure + * + * @throws NoConfigurationException on no configured deprecation + * + * @deprecated since Symfony 5.1, use "getDeprecation()" instead. + */ + public function getDeprecationMessage(string $option) + { + trigger_deprecation('symfony/options-resolver', '5.1', 'The "%s()" method is deprecated, use "getDeprecation()" instead.', __METHOD__); + + return $this->getDeprecation($option)['message']; + } + + /** + * @throws NoConfigurationException on no configured deprecation + */ + public function getDeprecation(string $option): array + { + return ($this->get)('deprecated', $option, sprintf('No deprecation was set for the "%s" option.', $option)); + } +} diff --git a/vendor/symfony/options-resolver/Exception/AccessException.php b/vendor/symfony/options-resolver/Exception/AccessException.php new file mode 100644 index 0000000..c12b680 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/AccessException.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Thrown when trying to read an option outside of or write it inside of + * {@link \Symfony\Component\OptionsResolver\Options::resolve()}. + * + * @author Bernhard Schussek + */ +class AccessException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/ExceptionInterface.php b/vendor/symfony/options-resolver/Exception/ExceptionInterface.php new file mode 100644 index 0000000..ea99d05 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Marker interface for all exceptions thrown by the OptionsResolver component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php b/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..6d421d6 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Thrown when an argument is invalid. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php b/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php new file mode 100644 index 0000000..6fd4f12 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/InvalidOptionsException.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Thrown when the value of an option does not match its validation rules. + * + * You should make sure a valid value is passed to the option. + * + * @author Bernhard Schussek + */ +class InvalidOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/Exception/MissingOptionsException.php b/vendor/symfony/options-resolver/Exception/MissingOptionsException.php new file mode 100644 index 0000000..faa487f --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/MissingOptionsException.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Exception thrown when a required option is missing. + * + * Add the option to the passed options array. + * + * @author Bernhard Schussek + */ +class MissingOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/Exception/NoConfigurationException.php b/vendor/symfony/options-resolver/Exception/NoConfigurationException.php new file mode 100644 index 0000000..6693ec1 --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/NoConfigurationException.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector; + +/** + * Thrown when trying to introspect an option definition property + * for which no value was configured inside the OptionsResolver instance. + * + * @see OptionsResolverIntrospector + * + * @author Maxime Steinhausser + */ +class NoConfigurationException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php b/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php new file mode 100644 index 0000000..4c3280f --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Thrown when trying to read an option that has no value set. + * + * When accessing optional options from within a lazy option or normalizer you should first + * check whether the optional option is set. You can do this with `isset($options['optional'])`. + * In contrast to the {@link UndefinedOptionsException}, this is a runtime exception that can + * occur when evaluating lazy options. + * + * @author Tobias Schultze + */ +class NoSuchOptionException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php b/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php new file mode 100644 index 0000000..e8e339d --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/OptionDefinitionException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Thrown when two lazy options have a cyclic dependency. + * + * @author Bernhard Schussek + */ +class OptionDefinitionException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php b/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php new file mode 100644 index 0000000..6ca3fce --- /dev/null +++ b/vendor/symfony/options-resolver/Exception/UndefinedOptionsException.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver\Exception; + +/** + * Exception thrown when an undefined option is passed. + * + * You should remove the options in question from your code or define them + * beforehand. + * + * @author Bernhard Schussek + */ +class UndefinedOptionsException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/options-resolver/LICENSE b/vendor/symfony/options-resolver/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/options-resolver/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/options-resolver/OptionConfigurator.php b/vendor/symfony/options-resolver/OptionConfigurator.php new file mode 100644 index 0000000..62f03d0 --- /dev/null +++ b/vendor/symfony/options-resolver/OptionConfigurator.php @@ -0,0 +1,139 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver; + +use Symfony\Component\OptionsResolver\Exception\AccessException; + +final class OptionConfigurator +{ + private $name; + private $resolver; + + public function __construct(string $name, OptionsResolver $resolver) + { + $this->name = $name; + $this->resolver = $resolver; + $this->resolver->setDefined($name); + } + + /** + * Adds allowed types for this option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function allowedTypes(string ...$types): self + { + $this->resolver->setAllowedTypes($this->name, $types); + + return $this; + } + + /** + * Sets allowed values for this option. + * + * @param mixed ...$values One or more acceptable values/closures + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function allowedValues(...$values): self + { + $this->resolver->setAllowedValues($this->name, $values); + + return $this; + } + + /** + * Sets the default value for this option. + * + * @param mixed $value The default value of the option + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function default($value): self + { + $this->resolver->setDefault($this->name, $value); + + return $this; + } + + /** + * Defines an option configurator with the given name. + */ + public function define(string $option): self + { + return $this->resolver->define($option); + } + + /** + * Marks this option as deprecated. + * + * @param string $package The name of the composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string|\Closure $message The deprecation message to use + * + * @return $this + */ + public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self + { + $this->resolver->setDeprecated($this->name, $package, $version, $message); + + return $this; + } + + /** + * Sets the normalizer for this option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function normalize(\Closure $normalizer): self + { + $this->resolver->setNormalizer($this->name, $normalizer); + + return $this; + } + + /** + * Marks this option as required. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function required(): self + { + $this->resolver->setRequired($this->name); + + return $this; + } + + /** + * Sets an info message for an option. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function info(string $info): self + { + $this->resolver->setInfo($this->name, $info); + + return $this; + } +} diff --git a/vendor/symfony/options-resolver/Options.php b/vendor/symfony/options-resolver/Options.php new file mode 100644 index 0000000..d444ec4 --- /dev/null +++ b/vendor/symfony/options-resolver/Options.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver; + +/** + * Contains resolved option values. + * + * @author Bernhard Schussek + * @author Tobias Schultze + */ +interface Options extends \ArrayAccess, \Countable +{ +} diff --git a/vendor/symfony/options-resolver/OptionsResolver.php b/vendor/symfony/options-resolver/OptionsResolver.php new file mode 100644 index 0000000..be80a9a --- /dev/null +++ b/vendor/symfony/options-resolver/OptionsResolver.php @@ -0,0 +1,1347 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\OptionsResolver; + +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; + +/** + * Validates options and merges them with default values. + * + * @author Bernhard Schussek + * @author Tobias Schultze + */ +class OptionsResolver implements Options +{ + private const VALIDATION_FUNCTIONS = [ + 'bool' => 'is_bool', + 'boolean' => 'is_bool', + 'int' => 'is_int', + 'integer' => 'is_int', + 'long' => 'is_int', + 'float' => 'is_float', + 'double' => 'is_float', + 'real' => 'is_float', + 'numeric' => 'is_numeric', + 'string' => 'is_string', + 'scalar' => 'is_scalar', + 'array' => 'is_array', + 'iterable' => 'is_iterable', + 'countable' => 'is_countable', + 'callable' => 'is_callable', + 'object' => 'is_object', + 'resource' => 'is_resource', + ]; + + /** + * The names of all defined options. + */ + private $defined = []; + + /** + * The default option values. + */ + private $defaults = []; + + /** + * A list of closure for nested options. + * + * @var \Closure[][] + */ + private $nested = []; + + /** + * The names of required options. + */ + private $required = []; + + /** + * The resolved option values. + */ + private $resolved = []; + + /** + * A list of normalizer closures. + * + * @var \Closure[][] + */ + private $normalizers = []; + + /** + * A list of accepted values for each option. + */ + private $allowedValues = []; + + /** + * A list of accepted types for each option. + */ + private $allowedTypes = []; + + /** + * A list of info messages for each option. + */ + private $info = []; + + /** + * A list of closures for evaluating lazy options. + */ + private $lazy = []; + + /** + * A list of lazy options whose closure is currently being called. + * + * This list helps detecting circular dependencies between lazy options. + */ + private $calling = []; + + /** + * A list of deprecated options. + */ + private $deprecated = []; + + /** + * The list of options provided by the user. + */ + private $given = []; + + /** + * Whether the instance is locked for reading. + * + * Once locked, the options cannot be changed anymore. This is + * necessary in order to avoid inconsistencies during the resolving + * process. If any option is changed after being read, all evaluated + * lazy options that depend on this option would become invalid. + */ + private $locked = false; + + private $parentsOptions = []; + + /** + * Whether the whole options definition is marked as array prototype. + */ + private $prototype; + + /** + * The prototype array's index that is being read. + */ + private $prototypeIndex; + + /** + * Sets the default value of a given option. + * + * If the default value should be set based on other options, you can pass + * a closure with the following signature: + * + * function (Options $options) { + * // ... + * } + * + * The closure will be evaluated when {@link resolve()} is called. The + * closure has access to the resolved values of other options through the + * passed {@link Options} instance: + * + * function (Options $options) { + * if (isset($options['port'])) { + * // ... + * } + * } + * + * If you want to access the previously set default value, add a second + * argument to the closure's signature: + * + * $options->setDefault('name', 'Default Name'); + * + * $options->setDefault('name', function (Options $options, $previousValue) { + * // 'Default Name' === $previousValue + * }); + * + * This is mostly useful if the configuration of the {@link Options} object + * is spread across different locations of your code, such as base and + * sub-classes. + * + * If you want to define nested options, you can pass a closure with the + * following signature: + * + * $options->setDefault('database', function (OptionsResolver $resolver) { + * $resolver->setDefined(['dbname', 'host', 'port', 'user', 'pass']); + * } + * + * To get access to the parent options, add a second argument to the closure's + * signature: + * + * function (OptionsResolver $resolver, Options $parent) { + * // 'default' === $parent['connection'] + * } + * + * @param string $option The name of the option + * @param mixed $value The default value of the option + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefault(string $option, $value) + { + // Setting is not possible once resolving starts, because then lazy + // options could manipulate the state of the object, leading to + // inconsistent results. + if ($this->locked) { + throw new AccessException('Default values cannot be set from a lazy option or normalizer.'); + } + + // If an option is a closure that should be evaluated lazily, store it + // in the "lazy" property. + if ($value instanceof \Closure) { + $reflClosure = new \ReflectionFunction($value); + $params = $reflClosure->getParameters(); + + if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) { + // Initialize the option if no previous value exists + if (!isset($this->defaults[$option])) { + $this->defaults[$option] = null; + } + + // Ignore previous lazy options if the closure has no second parameter + if (!isset($this->lazy[$option]) || !isset($params[1])) { + $this->lazy[$option] = []; + } + + // Store closure for later evaluation + $this->lazy[$option][] = $value; + $this->defined[$option] = true; + + // Make sure the option is processed and is not nested anymore + unset($this->resolved[$option], $this->nested[$option]); + + return $this; + } + + if (isset($params[0]) && null !== ($type = $params[0]->getType()) && self::class === $type->getName() && (!isset($params[1]) || (($type = $params[1]->getType()) instanceof \ReflectionNamedType && Options::class === $type->getName()))) { + // Store closure for later evaluation + $this->nested[$option][] = $value; + $this->defaults[$option] = []; + $this->defined[$option] = true; + + // Make sure the option is processed and is not lazy anymore + unset($this->resolved[$option], $this->lazy[$option]); + + return $this; + } + } + + // This option is not lazy nor nested anymore + unset($this->lazy[$option], $this->nested[$option]); + + // Yet undefined options can be marked as resolved, because we only need + // to resolve options with lazy closures, normalizers or validation + // rules, none of which can exist for undefined options + // If the option was resolved before, update the resolved value + if (!isset($this->defined[$option]) || \array_key_exists($option, $this->resolved)) { + $this->resolved[$option] = $value; + } + + $this->defaults[$option] = $value; + $this->defined[$option] = true; + + return $this; + } + + /** + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefaults(array $defaults) + { + foreach ($defaults as $option => $value) { + $this->setDefault($option, $value); + } + + return $this; + } + + /** + * Returns whether a default value is set for an option. + * + * Returns true if {@link setDefault()} was called for this option. + * An option is also considered set if it was set to null. + * + * @return bool + */ + public function hasDefault(string $option) + { + return \array_key_exists($option, $this->defaults); + } + + /** + * Marks one or more options as required. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setRequired($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be made required from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + $this->defined[$option] = true; + $this->required[$option] = true; + } + + return $this; + } + + /** + * Returns whether an option is required. + * + * An option is required if it was passed to {@link setRequired()}. + * + * @return bool + */ + public function isRequired(string $option) + { + return isset($this->required[$option]); + } + + /** + * Returns the names of all required options. + * + * @return string[] + * + * @see isRequired() + */ + public function getRequiredOptions() + { + return array_keys($this->required); + } + + /** + * Returns whether an option is missing a default value. + * + * An option is missing if it was passed to {@link setRequired()}, but not + * to {@link setDefault()}. This option must be passed explicitly to + * {@link resolve()}, otherwise an exception will be thrown. + * + * @return bool + */ + public function isMissing(string $option) + { + return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults); + } + + /** + * Returns the names of all options missing a default value. + * + * @return string[] + */ + public function getMissingOptions() + { + return array_keys(array_diff_key($this->required, $this->defaults)); + } + + /** + * Defines a valid option name. + * + * Defines an option name without setting a default value. The option will + * be accepted when passed to {@link resolve()}. When not passed, the + * option will not be included in the resolved options. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function setDefined($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be defined from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + $this->defined[$option] = true; + } + + return $this; + } + + /** + * Returns whether an option is defined. + * + * Returns true for any option passed to {@link setDefault()}, + * {@link setRequired()} or {@link setDefined()}. + * + * @return bool + */ + public function isDefined(string $option) + { + return isset($this->defined[$option]); + } + + /** + * Returns the names of all defined options. + * + * @return string[] + * + * @see isDefined() + */ + public function getDefinedOptions() + { + return array_keys($this->defined); + } + + public function isNested(string $option): bool + { + return isset($this->nested[$option]); + } + + /** + * Deprecates an option, allowed types or values. + * + * Instead of passing the message, you may also pass a closure with the + * following signature: + * + * function (Options $options, $value): string { + * // ... + * } + * + * The closure receives the value as argument and should return a string. + * Return an empty string to ignore the option deprecation. + * + * The closure is invoked when {@link resolve()} is called. The parameter + * passed to the closure is the value of the option after validating it + * and before normalizing it. + * + * @param string $package The name of the composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string|\Closure $message The deprecation message to use + * + * @return $this + */ + public function setDeprecated(string $option/*, string $package, string $version, $message = 'The option "%name%" is deprecated.' */): self + { + if ($this->locked) { + throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $args = \func_get_args(); + + if (\func_num_args() < 3) { + trigger_deprecation('symfony/options-resolver', '5.1', 'The signature of method "%s()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.', __METHOD__); + + $message = $args[1] ?? 'The option "%name%" is deprecated.'; + $package = $version = ''; + } else { + $package = $args[1]; + $version = $args[2]; + $message = $args[3] ?? 'The option "%name%" is deprecated.'; + } + + if (!\is_string($message) && !$message instanceof \Closure) { + throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message))); + } + + // ignore if empty string + if ('' === $message) { + return $this; + } + + $this->deprecated[$option] = [ + 'package' => $package, + 'version' => $version, + 'message' => $message, + ]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + public function isDeprecated(string $option): bool + { + return isset($this->deprecated[$option]); + } + + /** + * Sets the normalizer for an option. + * + * The normalizer should be a closure with the following signature: + * + * function (Options $options, $value) { + * // ... + * } + * + * The closure is invoked when {@link resolve()} is called. The closure + * has access to the resolved values of other options through the passed + * {@link Options} instance. + * + * The second parameter passed to the closure is the value of + * the option. + * + * The resolved option value is set to the return value of the closure. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setNormalizer(string $option, \Closure $normalizer) + { + if ($this->locked) { + throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->normalizers[$option] = [$normalizer]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds a normalizer for an option. + * + * The normalizer should be a closure with the following signature: + * + * function (Options $options, $value): mixed { + * // ... + * } + * + * The closure is invoked when {@link resolve()} is called. The closure + * has access to the resolved values of other options through the passed + * {@link Options} instance. + * + * The second parameter passed to the closure is the value of + * the option. + * + * The resolved option value is set to the return value of the closure. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): self + { + if ($this->locked) { + throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if ($forcePrepend) { + $this->normalizers[$option] = $this->normalizers[$option] ?? []; + array_unshift($this->normalizers[$option], $normalizer); + } else { + $this->normalizers[$option][] = $normalizer; + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Sets allowed values for an option. + * + * Instead of passing values, you may also pass a closures with the + * following signature: + * + * function ($value) { + * // return true or false + * } + * + * The closure receives the value as argument and should return true to + * accept the value and false to reject the value. + * + * @param string $option The option name + * @param mixed $allowedValues One or more acceptable values/closures + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setAllowedValues(string $option, $allowedValues) + { + if ($this->locked) { + throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : [$allowedValues]; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds allowed values for an option. + * + * The values are merged with the allowed values defined previously. + * + * Instead of passing values, you may also pass a closures with the + * following signature: + * + * function ($value) { + * // return true or false + * } + * + * The closure receives the value as argument and should return true to + * accept the value and false to reject the value. + * + * @param string $option The option name + * @param mixed $allowedValues One or more acceptable values/closures + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addAllowedValues(string $option, $allowedValues) + { + if ($this->locked) { + throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if (!\is_array($allowedValues)) { + $allowedValues = [$allowedValues]; + } + + if (!isset($this->allowedValues[$option])) { + $this->allowedValues[$option] = $allowedValues; + } else { + $this->allowedValues[$option] = array_merge($this->allowedValues[$option], $allowedValues); + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Sets allowed types for an option. + * + * Any type for which a corresponding is_() function exists is + * acceptable. Additionally, fully-qualified class or interface names may + * be passed. + * + * @param string|string[] $allowedTypes One or more accepted types + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setAllowedTypes(string $option, $allowedTypes) + { + if ($this->locked) { + throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->allowedTypes[$option] = (array) $allowedTypes; + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Adds allowed types for an option. + * + * The types are merged with the allowed types defined previously. + * + * Any type for which a corresponding is_() function exists is + * acceptable. Additionally, fully-qualified class or interface names may + * be passed. + * + * @param string|string[] $allowedTypes One or more accepted types + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function addAllowedTypes(string $option, $allowedTypes) + { + if ($this->locked) { + throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + if (!isset($this->allowedTypes[$option])) { + $this->allowedTypes[$option] = (array) $allowedTypes; + } else { + $this->allowedTypes[$option] = array_merge($this->allowedTypes[$option], (array) $allowedTypes); + } + + // Make sure the option is processed + unset($this->resolved[$option]); + + return $this; + } + + /** + * Defines an option configurator with the given name. + */ + public function define(string $option): OptionConfigurator + { + if (isset($this->defined[$option])) { + throw new OptionDefinitionException(sprintf('The option "%s" is already defined.', $option)); + } + + return new OptionConfigurator($option, $this); + } + + /** + * Sets an info message for an option. + * + * @return $this + * + * @throws UndefinedOptionsException If the option is undefined + * @throws AccessException If called from a lazy option or normalizer + */ + public function setInfo(string $option, string $info): self + { + if ($this->locked) { + throw new AccessException('The Info message cannot be set from a lazy option or normalizer.'); + } + + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + $this->info[$option] = $info; + + return $this; + } + + /** + * Gets the info message for an option. + */ + public function getInfo(string $option): ?string + { + if (!isset($this->defined[$option])) { + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + return $this->info[$option] ?? null; + } + + /** + * Marks the whole options definition as array prototype. + * + * @return $this + * + * @throws AccessException If called from a lazy option, a normalizer or a root definition + */ + public function setPrototype(bool $prototype): self + { + if ($this->locked) { + throw new AccessException('The prototype property cannot be set from a lazy option or normalizer.'); + } + + if (null === $this->prototype && $prototype) { + throw new AccessException('The prototype property cannot be set from a root definition.'); + } + + $this->prototype = $prototype; + + return $this; + } + + public function isPrototype(): bool + { + return $this->prototype ?? false; + } + + /** + * Removes the option with the given name. + * + * Undefined options are ignored. + * + * @param string|string[] $optionNames One or more option names + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function remove($optionNames) + { + if ($this->locked) { + throw new AccessException('Options cannot be removed from a lazy option or normalizer.'); + } + + foreach ((array) $optionNames as $option) { + unset($this->defined[$option], $this->defaults[$option], $this->required[$option], $this->resolved[$option]); + unset($this->lazy[$option], $this->normalizers[$option], $this->allowedTypes[$option], $this->allowedValues[$option], $this->info[$option]); + } + + return $this; + } + + /** + * Removes all options. + * + * @return $this + * + * @throws AccessException If called from a lazy option or normalizer + */ + public function clear() + { + if ($this->locked) { + throw new AccessException('Options cannot be cleared from a lazy option or normalizer.'); + } + + $this->defined = []; + $this->defaults = []; + $this->nested = []; + $this->required = []; + $this->resolved = []; + $this->lazy = []; + $this->normalizers = []; + $this->allowedTypes = []; + $this->allowedValues = []; + $this->deprecated = []; + $this->info = []; + + return $this; + } + + /** + * Merges options with the default values stored in the container and + * validates them. + * + * Exceptions are thrown if: + * + * - Undefined options are passed; + * - Required options are missing; + * - Options have invalid types; + * - Options have invalid values. + * + * @return array + * + * @throws UndefinedOptionsException If an option name is undefined + * @throws InvalidOptionsException If an option doesn't fulfill the + * specified validation rules + * @throws MissingOptionsException If a required option is missing + * @throws OptionDefinitionException If there is a cyclic dependency between + * lazy options and/or normalizers + * @throws NoSuchOptionException If a lazy option reads an unavailable option + * @throws AccessException If called from a lazy option or normalizer + */ + public function resolve(array $options = []) + { + if ($this->locked) { + throw new AccessException('Options cannot be resolved from a lazy option or normalizer.'); + } + + // Allow this method to be called multiple times + $clone = clone $this; + + // Make sure that no unknown options are passed + $diff = array_diff_key($options, $clone->defined); + + if (\count($diff) > 0) { + ksort($clone->defined); + ksort($diff); + + throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', $this->formatOptions(array_keys($diff)), implode('", "', array_keys($clone->defined)))); + } + + // Override options set by the user + foreach ($options as $option => $value) { + $clone->given[$option] = true; + $clone->defaults[$option] = $value; + unset($clone->resolved[$option], $clone->lazy[$option]); + } + + // Check whether any required option is missing + $diff = array_diff_key($clone->required, $clone->defaults); + + if (\count($diff) > 0) { + ksort($diff); + + throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', $this->formatOptions(array_keys($diff)))); + } + + // Lock the container + $clone->locked = true; + + // Now process the individual options. Use offsetGet(), which resolves + // the option itself and any options that the option depends on + foreach ($clone->defaults as $option => $_) { + $clone->offsetGet($option); + } + + return $clone->resolved; + } + + /** + * Returns the resolved value of an option. + * + * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) + * + * @return mixed + * + * @throws AccessException If accessing this method outside of + * {@link resolve()} + * @throws NoSuchOptionException If the option is not set + * @throws InvalidOptionsException If the option doesn't fulfill the + * specified validation rules + * @throws OptionDefinitionException If there is a cyclic dependency between + * lazy options and/or normalizers + */ + #[\ReturnTypeWillChange] + public function offsetGet($option, bool $triggerDeprecation = true) + { + if (!$this->locked) { + throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); + } + + // Shortcut for resolved options + if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) { + if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option]['message'])) { + trigger_deprecation($this->deprecated[$option]['package'], $this->deprecated[$option]['version'], strtr($this->deprecated[$option]['message'], ['%name%' => $option])); + } + + return $this->resolved[$option]; + } + + // Check whether the option is set at all + if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) { + if (!isset($this->defined[$option])) { + throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined)))); + } + + throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $this->formatOptions([$option]))); + } + + $value = $this->defaults[$option]; + + // Resolve the option if it is a nested definition + if (isset($this->nested[$option])) { + // If the closure is already being called, we have a cyclic dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + if (!\is_array($value)) { + throw new InvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), get_debug_type($value))); + } + + // The following section must be protected from cyclic calls. + $this->calling[$option] = true; + try { + $resolver = new self(); + $resolver->prototype = false; + $resolver->parentsOptions = $this->parentsOptions; + $resolver->parentsOptions[] = $option; + foreach ($this->nested[$option] as $closure) { + $closure($resolver, $this); + } + + if ($resolver->prototype) { + $values = []; + foreach ($value as $index => $prototypeValue) { + if (!\is_array($prototypeValue)) { + throw new InvalidOptionsException(sprintf('The value of the option "%s" is expected to be of type array of array, but is of type array of "%s".', $this->formatOptions([$option]), get_debug_type($prototypeValue))); + } + + $resolver->prototypeIndex = $index; + $values[$index] = $resolver->resolve($prototypeValue); + } + $value = $values; + } else { + $value = $resolver->resolve($value); + } + } finally { + $resolver->prototypeIndex = null; + unset($this->calling[$option]); + } + } + + // Resolve the option if the default value is lazily evaluated + if (isset($this->lazy[$option])) { + // If the closure is already being called, we have a cyclic + // dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + // The following section must be protected from cyclic + // calls. Set $calling for the current $option to detect a cyclic + // dependency + // BEGIN + $this->calling[$option] = true; + try { + foreach ($this->lazy[$option] as $closure) { + $value = $closure($this, $value); + } + } finally { + unset($this->calling[$option]); + } + // END + } + + // Validate the type of the resolved option + if (isset($this->allowedTypes[$option])) { + $valid = true; + $invalidTypes = []; + + foreach ($this->allowedTypes[$option] as $type) { + if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) { + break; + } + } + + if (!$valid) { + $fmtActualValue = $this->formatValue($value); + $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]); + $fmtProvidedTypes = implode('|', array_keys($invalidTypes)); + $allowedContainsArrayType = \count(array_filter($this->allowedTypes[$option], static function ($item) { + return str_ends_with($item, '[]'); + })) > 0; + + if (\is_array($value) && $allowedContainsArrayType) { + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); + } + + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); + } + } + + // Validate the value of the resolved option + if (isset($this->allowedValues[$option])) { + $success = false; + $printableAllowedValues = []; + + foreach ($this->allowedValues[$option] as $allowedValue) { + if ($allowedValue instanceof \Closure) { + if ($allowedValue($value)) { + $success = true; + break; + } + + // Don't include closures in the exception message + continue; + } + + if ($value === $allowedValue) { + $success = true; + break; + } + + $printableAllowedValues[] = $allowedValue; + } + + if (!$success) { + $message = sprintf( + 'The option "%s" with value %s is invalid.', + $option, + $this->formatValue($value) + ); + + if (\count($printableAllowedValues) > 0) { + $message .= sprintf( + ' Accepted values are: %s.', + $this->formatValues($printableAllowedValues) + ); + } + + if (isset($this->info[$option])) { + $message .= sprintf(' Info: %s.', $this->info[$option]); + } + + throw new InvalidOptionsException($message); + } + } + + // Check whether the option is deprecated + // and it is provided by the user or is being called from a lazy evaluation + if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || ($this->calling && \is_string($this->deprecated[$option]['message'])))) { + $deprecation = $this->deprecated[$option]; + $message = $this->deprecated[$option]['message']; + + if ($message instanceof \Closure) { + // If the closure is already being called, we have a cyclic dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + $this->calling[$option] = true; + try { + if (!\is_string($message = $message($this, $value))) { + throw new InvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($message))); + } + } finally { + unset($this->calling[$option]); + } + } + + if ('' !== $message) { + trigger_deprecation($deprecation['package'], $deprecation['version'], strtr($message, ['%name%' => $option])); + } + } + + // Normalize the validated option + if (isset($this->normalizers[$option])) { + // If the closure is already being called, we have a cyclic + // dependency + if (isset($this->calling[$option])) { + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); + } + + // The following section must be protected from cyclic + // calls. Set $calling for the current $option to detect a cyclic + // dependency + // BEGIN + $this->calling[$option] = true; + try { + foreach ($this->normalizers[$option] as $normalizer) { + $value = $normalizer($this, $value); + } + } finally { + unset($this->calling[$option]); + } + // END + } + + // Mark as resolved + $this->resolved[$option] = $value; + + return $value; + } + + private function verifyTypes(string $type, $value, array &$invalidTypes, int $level = 0): bool + { + if (\is_array($value) && '[]' === substr($type, -2)) { + $type = substr($type, 0, -2); + $valid = true; + + foreach ($value as $val) { + if (!$this->verifyTypes($type, $val, $invalidTypes, $level + 1)) { + $valid = false; + } + } + + return $valid; + } + + if (('null' === $type && null === $value) || (isset(self::VALIDATION_FUNCTIONS[$type]) ? self::VALIDATION_FUNCTIONS[$type]($value) : $value instanceof $type)) { + return true; + } + + if (!$invalidTypes || $level > 0) { + $invalidTypes[get_debug_type($value)] = true; + } + + return false; + } + + /** + * Returns whether a resolved option with the given name exists. + * + * @param string $option The option name + * + * @return bool + * + * @throws AccessException If accessing this method outside of {@link resolve()} + * + * @see \ArrayAccess::offsetExists() + */ + #[\ReturnTypeWillChange] + public function offsetExists($option) + { + if (!$this->locked) { + throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); + } + + return \array_key_exists($option, $this->defaults); + } + + /** + * Not supported. + * + * @return void + * + * @throws AccessException + */ + #[\ReturnTypeWillChange] + public function offsetSet($option, $value) + { + throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.'); + } + + /** + * Not supported. + * + * @return void + * + * @throws AccessException + */ + #[\ReturnTypeWillChange] + public function offsetUnset($option) + { + throw new AccessException('Removing options via array access is not supported. Use remove() instead.'); + } + + /** + * Returns the number of set options. + * + * This may be only a subset of the defined options. + * + * @return int + * + * @throws AccessException If accessing this method outside of {@link resolve()} + * + * @see \Countable::count() + */ + #[\ReturnTypeWillChange] + public function count() + { + if (!$this->locked) { + throw new AccessException('Counting is only supported within closures of lazy options and normalizers.'); + } + + return \count($this->defaults); + } + + /** + * Returns a string representation of the value. + * + * This method returns the equivalent PHP tokens for most scalar types + * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped + * in double quotes ("). + * + * @param mixed $value The value to format as string + */ + private function formatValue($value): string + { + if (\is_object($value)) { + return \get_class($value); + } + + if (\is_array($value)) { + return 'array'; + } + + if (\is_string($value)) { + return '"'.$value.'"'; + } + + if (\is_resource($value)) { + return 'resource'; + } + + if (null === $value) { + return 'null'; + } + + if (false === $value) { + return 'false'; + } + + if (true === $value) { + return 'true'; + } + + return (string) $value; + } + + /** + * Returns a string representation of a list of values. + * + * Each of the values is converted to a string using + * {@link formatValue()}. The values are then concatenated with commas. + * + * @see formatValue() + */ + private function formatValues(array $values): string + { + foreach ($values as $key => $value) { + $values[$key] = $this->formatValue($value); + } + + return implode(', ', $values); + } + + private function formatOptions(array $options): string + { + if ($this->parentsOptions) { + $prefix = array_shift($this->parentsOptions); + if ($this->parentsOptions) { + $prefix .= sprintf('[%s]', implode('][', $this->parentsOptions)); + } + + if ($this->prototype && null !== $this->prototypeIndex) { + $prefix .= sprintf('[%s]', $this->prototypeIndex); + } + + $options = array_map(static function (string $option) use ($prefix): string { + return sprintf('%s[%s]', $prefix, $option); + }, $options); + } + + return implode('", "', $options); + } + + private function getParameterClassName(\ReflectionParameter $parameter): ?string + { + if (!($type = $parameter->getType()) instanceof \ReflectionNamedType || $type->isBuiltin()) { + return null; + } + + return $type->getName(); + } +} diff --git a/vendor/symfony/options-resolver/README.md b/vendor/symfony/options-resolver/README.md new file mode 100644 index 0000000..c63b900 --- /dev/null +++ b/vendor/symfony/options-resolver/README.md @@ -0,0 +1,15 @@ +OptionsResolver Component +========================= + +The OptionsResolver component is `array_replace` on steroids. It allows you to +create an options system with required options, defaults, validation (type, +value), normalization and more. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/options_resolver.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/options-resolver/composer.json b/vendor/symfony/options-resolver/composer.json new file mode 100644 index 0000000..a38d1bd --- /dev/null +++ b/vendor/symfony/options-resolver/composer.json @@ -0,0 +1,31 @@ +{ + "name": "symfony/options-resolver", + "type": "library", + "description": "Provides an improved replacement for the array_replace PHP function", + "keywords": ["options", "config", "configuration"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/password-hasher/CHANGELOG.md b/vendor/symfony/password-hasher/CHANGELOG.md new file mode 100644 index 0000000..53ea3f1 --- /dev/null +++ b/vendor/symfony/password-hasher/CHANGELOG.md @@ -0,0 +1,5 @@ +5.3 +--- + + * Add the component + * Use `bcrypt` as default algorithm in `NativePasswordHasher` diff --git a/vendor/symfony/password-hasher/Command/UserPasswordHashCommand.php b/vendor/symfony/password-hasher/Command/UserPasswordHashCommand.php new file mode 100644 index 0000000..1d0e1d0 --- /dev/null +++ b/vendor/symfony/password-hasher/Command/UserPasswordHashCommand.php @@ -0,0 +1,223 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +/** + * Hashes a user's password. + * + * @author Sarah Khalil + * @author Robin Chalas + * + * @final + */ +class UserPasswordHashCommand extends Command +{ + protected static $defaultName = 'security:hash-password'; + protected static $defaultDescription = 'Hash a user password'; + + private $hasherFactory; + private $userClasses; + + public function __construct(PasswordHasherFactoryInterface $hasherFactory, array $userClasses = []) + { + $this->hasherFactory = $hasherFactory; + $this->userClasses = $userClasses; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setDescription(self::$defaultDescription) + ->addArgument('password', InputArgument::OPTIONAL, 'The plain password to hash.') + ->addArgument('user-class', InputArgument::OPTIONAL, 'The User entity class path associated with the hasher used to hash the password.') + ->addOption('empty-salt', null, InputOption::VALUE_NONE, 'Do not generate a salt or let the hasher generate one.') + ->setHelp(<<%command.name% command hashes passwords according to your +security configuration. This command is mainly used to generate passwords for +the in_memory user provider type and for changing passwords +in the database while developing the application. + +Suppose that you have the following security configuration in your application: + + +# app/config/security.yml +security: + password_hashers: + Symfony\Component\Security\Core\User\InMemoryUser: plaintext + App\Entity\User: auto + + +If you execute the command non-interactively, the first available configured +user class under the security.password_hashers key is used and a random salt is +generated to hash the password: + + php %command.full_name% --no-interaction [password] + +Pass the full user class path as the second argument to hash passwords for +your own entities: + + php %command.full_name% --no-interaction [password] 'App\Entity\User' + +Executing the command interactively allows you to generate a random salt for +hashing the password: + + php %command.full_name% [password] 'App\Entity\User' + +In case your hasher doesn't require a salt, add the empty-salt option: + + php %command.full_name% --empty-salt [password] 'App\Entity\User' + +EOF + ) + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io; + + $input->isInteractive() ? $errorIo->title('Symfony Password Hash Utility') : $errorIo->newLine(); + + $password = $input->getArgument('password'); + $userClass = $this->getUserClass($input, $io); + $emptySalt = $input->getOption('empty-salt'); + + $hasher = $this->hasherFactory->getPasswordHasher($userClass); + $saltlessWithoutEmptySalt = !$emptySalt && !$hasher instanceof LegacyPasswordHasherInterface; + + if ($saltlessWithoutEmptySalt) { + $emptySalt = true; + } + + if (!$password) { + if (!$input->isInteractive()) { + $errorIo->error('The password must not be empty.'); + + return 1; + } + $passwordQuestion = $this->createPasswordQuestion(); + $password = $errorIo->askQuestion($passwordQuestion); + } + + $salt = null; + + if ($input->isInteractive() && !$emptySalt) { + $emptySalt = true; + + $errorIo->note('The command will take care of generating a salt for you. Be aware that some hashers advise to let them generate their own salt. If you\'re using one of those hashers, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the hasher handle the generation itself.'); + + if ($errorIo->confirm('Confirm salt generation ?')) { + $salt = $this->generateSalt(); + $emptySalt = false; + } + } elseif (!$emptySalt) { + $salt = $this->generateSalt(); + } + + $hashedPassword = $hasher->hash($password, $salt); + + $rows = [ + ['Hasher used', \get_class($hasher)], + ['Password hash', $hashedPassword], + ]; + if (!$emptySalt) { + $rows[] = ['Generated salt', $salt]; + } + $io->table(['Key', 'Value'], $rows); + + if (!$emptySalt) { + $errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars', \strlen($salt))); + } elseif ($saltlessWithoutEmptySalt) { + $errorIo->note('Self-salting hasher used: the hasher generated its own built-in salt.'); + } + + $errorIo->success('Password hashing succeeded'); + + return 0; + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestArgumentValuesFor('user-class')) { + $suggestions->suggestValues($this->userClasses); + + return; + } + } + + /** + * Create the password question to ask the user for the password to be hashed. + */ + private function createPasswordQuestion(): Question + { + $passwordQuestion = new Question('Type in your password to be hashed'); + + return $passwordQuestion->setValidator(function ($value) { + if ('' === trim($value)) { + throw new InvalidArgumentException('The password must not be empty.'); + } + + return $value; + })->setHidden(true)->setMaxAttempts(20); + } + + private function generateSalt(): string + { + return base64_encode(random_bytes(30)); + } + + private function getUserClass(InputInterface $input, SymfonyStyle $io): string + { + if (null !== $userClass = $input->getArgument('user-class')) { + return $userClass; + } + + if (!$this->userClasses) { + throw new RuntimeException('There are no configured password hashers for the "security" extension.'); + } + + if (!$input->isInteractive() || 1 === \count($this->userClasses)) { + return reset($this->userClasses); + } + + $userClasses = $this->userClasses; + natcasesort($userClasses); + $userClasses = array_values($userClasses); + + return $io->choice('For which user class would you like to hash a password?', $userClasses, reset($userClasses)); + } +} diff --git a/vendor/symfony/password-hasher/Exception/ExceptionInterface.php b/vendor/symfony/password-hasher/Exception/ExceptionInterface.php new file mode 100644 index 0000000..2d80d8a --- /dev/null +++ b/vendor/symfony/password-hasher/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Exception; + +/** + * Interface for exceptions thrown by the password-hasher component. + * + * @author Robin Chalas + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/password-hasher/Exception/InvalidPasswordException.php b/vendor/symfony/password-hasher/Exception/InvalidPasswordException.php new file mode 100644 index 0000000..30b09d8 --- /dev/null +++ b/vendor/symfony/password-hasher/Exception/InvalidPasswordException.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Exception; + +/** + * @author Robin Chalas + */ +class InvalidPasswordException extends \RuntimeException implements ExceptionInterface +{ + public function __construct(string $message = 'Invalid password.', int $code = 0, \Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + } +} diff --git a/vendor/symfony/password-hasher/Exception/LogicException.php b/vendor/symfony/password-hasher/Exception/LogicException.php new file mode 100644 index 0000000..f4d9f31 --- /dev/null +++ b/vendor/symfony/password-hasher/Exception/LogicException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Exception; + +/** + * @author Robin Chalas + */ +class LogicException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/password-hasher/Hasher/CheckPasswordLengthTrait.php b/vendor/symfony/password-hasher/Hasher/CheckPasswordLengthTrait.php new file mode 100644 index 0000000..2dce065 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/CheckPasswordLengthTrait.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\PasswordHasherInterface; + +/** + * @author Robin Chalas + */ +trait CheckPasswordLengthTrait +{ + private function isPasswordTooLong(string $password): bool + { + return PasswordHasherInterface::MAX_PASSWORD_LENGTH < \strlen($password); + } +} diff --git a/vendor/symfony/password-hasher/Hasher/MessageDigestPasswordHasher.php b/vendor/symfony/password-hasher/Hasher/MessageDigestPasswordHasher.php new file mode 100644 index 0000000..5611049 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/MessageDigestPasswordHasher.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\Exception\LogicException; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +/** + * MessageDigestPasswordHasher uses a message digest algorithm. + * + * @author Fabien Potencier + */ +class MessageDigestPasswordHasher implements LegacyPasswordHasherInterface +{ + use CheckPasswordLengthTrait; + + private $algorithm; + private $encodeHashAsBase64; + private $iterations = 1; + private $hashLength = -1; + + /** + * @param string $algorithm The digest algorithm to use + * @param bool $encodeHashAsBase64 Whether to base64 encode the password hash + * @param int $iterations The number of iterations to use to stretch the password hash + */ + public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 5000) + { + $this->algorithm = $algorithm; + $this->encodeHashAsBase64 = $encodeHashAsBase64; + + try { + $this->hashLength = \strlen($this->hash('', 'salt')); + } catch (\LogicException $e) { + // ignore algorithm not supported + } + + $this->iterations = $iterations; + } + + public function hash(string $plainPassword, string $salt = null): string + { + if ($this->isPasswordTooLong($plainPassword)) { + throw new InvalidPasswordException(); + } + + if (!\in_array($this->algorithm, hash_algos(), true)) { + throw new LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); + } + + $salted = $this->mergePasswordAndSalt($plainPassword, $salt); + $digest = hash($this->algorithm, $salted, true); + + // "stretch" hash + for ($i = 1; $i < $this->iterations; ++$i) { + $digest = hash($this->algorithm, $digest.$salted, true); + } + + return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); + } + + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool + { + if (\strlen($hashedPassword) !== $this->hashLength || false !== strpos($hashedPassword, '$')) { + return false; + } + + return !$this->isPasswordTooLong($plainPassword) && hash_equals($hashedPassword, $this->hash($plainPassword, $salt)); + } + + public function needsRehash(string $hashedPassword): bool + { + return false; + } + + private function mergePasswordAndSalt(string $password, ?string $salt): string + { + if (!$salt) { + return $password; + } + + if (false !== strrpos($salt, '{') || false !== strrpos($salt, '}')) { + throw new \InvalidArgumentException('Cannot use { or } in salt.'); + } + + return $password.'{'.$salt.'}'; + } +} diff --git a/vendor/symfony/password-hasher/Hasher/MigratingPasswordHasher.php b/vendor/symfony/password-hasher/Hasher/MigratingPasswordHasher.php new file mode 100644 index 0000000..3b12408 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/MigratingPasswordHasher.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\PasswordHasherInterface; + +/** + * Hashes passwords using the best available hasher. + * Verifies them using a chain of hashers. + * + * /!\ Don't put a PlaintextPasswordHasher in the list as that'd mean a leaked hash + * could be used to authenticate successfully without knowing the cleartext password. + * + * @author Nicolas Grekas + */ +final class MigratingPasswordHasher implements PasswordHasherInterface +{ + private $bestHasher; + private $extraHashers; + + public function __construct(PasswordHasherInterface $bestHasher, PasswordHasherInterface ...$extraHashers) + { + $this->bestHasher = $bestHasher; + $this->extraHashers = $extraHashers; + } + + public function hash(string $plainPassword, string $salt = null): string + { + return $this->bestHasher->hash($plainPassword, $salt); + } + + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool + { + if ($this->bestHasher->verify($hashedPassword, $plainPassword, $salt)) { + return true; + } + + if (!$this->bestHasher->needsRehash($hashedPassword)) { + return false; + } + + foreach ($this->extraHashers as $hasher) { + if ($hasher->verify($hashedPassword, $plainPassword, $salt)) { + return true; + } + } + + return false; + } + + public function needsRehash(string $hashedPassword): bool + { + return $this->bestHasher->needsRehash($hashedPassword); + } +} diff --git a/vendor/symfony/password-hasher/Hasher/NativePasswordHasher.php b/vendor/symfony/password-hasher/Hasher/NativePasswordHasher.php new file mode 100644 index 0000000..8933faa --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/NativePasswordHasher.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; + +/** + * Hashes passwords using password_hash(). + * + * @author Elnur Abdurrakhimov + * @author Terje Bråten + * @author Nicolas Grekas + */ +final class NativePasswordHasher implements PasswordHasherInterface +{ + use CheckPasswordLengthTrait; + + private $algorithm = \PASSWORD_BCRYPT; + private $options; + + /** + * @param string|null $algorithm An algorithm supported by password_hash() or null to use the best available algorithm + */ + public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algorithm = null) + { + $cost = $cost ?? 13; + $opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); + $memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024); + + if (3 > $opsLimit) { + throw new \InvalidArgumentException('$opsLimit must be 3 or greater.'); + } + + if (10 * 1024 > $memLimit) { + throw new \InvalidArgumentException('$memLimit must be 10k or greater.'); + } + + if ($cost < 4 || 31 < $cost) { + throw new \InvalidArgumentException('$cost must be in the range of 4-31.'); + } + + if (null !== $algorithm) { + $algorithms = [1 => \PASSWORD_BCRYPT, '2y' => \PASSWORD_BCRYPT]; + + if (\defined('PASSWORD_ARGON2I')) { + $algorithms[2] = $algorithms['argon2i'] = \PASSWORD_ARGON2I; + } + + if (\defined('PASSWORD_ARGON2ID')) { + $algorithms[3] = $algorithms['argon2id'] = \PASSWORD_ARGON2ID; + } + + $this->algorithm = $algorithms[$algorithm] ?? $algorithm; + } + + $this->options = [ + 'cost' => $cost, + 'time_cost' => $opsLimit, + 'memory_cost' => $memLimit >> 10, + 'threads' => 1, + ]; + } + + public function hash(string $plainPassword): string + { + if ($this->isPasswordTooLong($plainPassword)) { + throw new InvalidPasswordException(); + } + + if (\PASSWORD_BCRYPT === $this->algorithm && (72 < \strlen($plainPassword) || false !== strpos($plainPassword, "\0"))) { + $plainPassword = base64_encode(hash('sha512', $plainPassword, true)); + } + + return password_hash($plainPassword, $this->algorithm, $this->options); + } + + public function verify(string $hashedPassword, string $plainPassword): bool + { + if ('' === $plainPassword || $this->isPasswordTooLong($plainPassword)) { + return false; + } + + if (0 !== strpos($hashedPassword, '$argon')) { + // Bcrypt cuts on NUL chars and after 72 bytes + if (0 === strpos($hashedPassword, '$2') && (72 < \strlen($plainPassword) || false !== strpos($plainPassword, "\0"))) { + $plainPassword = base64_encode(hash('sha512', $plainPassword, true)); + } + + return password_verify($plainPassword, $hashedPassword); + } + + if (\extension_loaded('sodium') && version_compare(\SODIUM_LIBRARY_VERSION, '1.0.14', '>=')) { + return sodium_crypto_pwhash_str_verify($hashedPassword, $plainPassword); + } + + if (\extension_loaded('libsodium') && version_compare(phpversion('libsodium'), '1.0.14', '>=')) { + return \Sodium\crypto_pwhash_str_verify($hashedPassword, $plainPassword); + } + + return password_verify($plainPassword, $hashedPassword); + } + + /** + * {@inheritdoc} + */ + public function needsRehash(string $hashedPassword): bool + { + return password_needs_rehash($hashedPassword, $this->algorithm, $this->options); + } +} diff --git a/vendor/symfony/password-hasher/Hasher/PasswordHasherAwareInterface.php b/vendor/symfony/password-hasher/Hasher/PasswordHasherAwareInterface.php new file mode 100644 index 0000000..58046bc --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/PasswordHasherAwareInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +/** + * @author Christophe Coevoet + */ +interface PasswordHasherAwareInterface +{ + /** + * Gets the name of the password hasher used to hash the password. + * + * If the method returns null, the standard way to retrieve the password hasher + * will be used instead. + */ + public function getPasswordHasherName(): ?string; +} diff --git a/vendor/symfony/password-hasher/Hasher/PasswordHasherFactory.php b/vendor/symfony/password-hasher/Hasher/PasswordHasherFactory.php new file mode 100644 index 0000000..dd7e015 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/PasswordHasherFactory.php @@ -0,0 +1,242 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\LogicException; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface; +use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface; +use Symfony\Component\Security\Core\Encoder\PasswordHasherAdapter; + +/** + * A generic hasher factory implementation. + * + * @author Nicolas Grekas + * @author Robin Chalas + */ +class PasswordHasherFactory implements PasswordHasherFactoryInterface +{ + private $passwordHashers; + + /** + * @param array $passwordHashers + */ + public function __construct(array $passwordHashers) + { + $this->passwordHashers = $passwordHashers; + } + + /** + * {@inheritdoc} + */ + public function getPasswordHasher($user): PasswordHasherInterface + { + $hasherKey = null; + + if (($user instanceof PasswordHasherAwareInterface && null !== $hasherName = $user->getPasswordHasherName()) || ($user instanceof EncoderAwareInterface && null !== $hasherName = $user->getEncoderName())) { + if (!\array_key_exists($hasherName, $this->passwordHashers)) { + throw new \RuntimeException(sprintf('The password hasher "%s" was not configured.', $hasherName)); + } + + $hasherKey = $hasherName; + } else { + foreach ($this->passwordHashers as $class => $hasher) { + if ((\is_object($user) && $user instanceof $class) || (!\is_object($user) && (is_subclass_of($user, $class) || $user == $class))) { + $hasherKey = $class; + break; + } + } + } + + if (null === $hasherKey) { + throw new \RuntimeException(sprintf('No password hasher has been configured for account "%s".', \is_object($user) ? get_debug_type($user) : $user)); + } + + return $this->createHasherUsingAdapter($hasherKey); + } + + /** + * Creates the actual hasher instance. + * + * @throws \InvalidArgumentException + */ + private function createHasher(array $config, bool $isExtra = false): PasswordHasherInterface + { + if (isset($config['algorithm'])) { + $rawConfig = $config; + $config = $this->getHasherConfigFromAlgorithm($config); + } + if (!isset($config['class'])) { + throw new \InvalidArgumentException('"class" must be set in '.json_encode($config)); + } + if (!isset($config['arguments'])) { + throw new \InvalidArgumentException('"arguments" must be set in '.json_encode($config)); + } + + $hasher = new $config['class'](...$config['arguments']); + if (!$hasher instanceof PasswordHasherInterface && $hasher instanceof PasswordEncoderInterface) { + $hasher = new PasswordHasherAdapter($hasher); + } + + if ($isExtra || !\in_array($config['class'], [NativePasswordHasher::class, SodiumPasswordHasher::class], true)) { + return $hasher; + } + + if ($rawConfig ?? null) { + $extrapasswordHashers = array_map(function (string $algo) use ($rawConfig): PasswordHasherInterface { + $rawConfig['algorithm'] = $algo; + + return $this->createHasher($rawConfig); + }, ['pbkdf2', $rawConfig['hash_algorithm'] ?? 'sha512']); + } else { + $extrapasswordHashers = [new Pbkdf2PasswordHasher(), new MessageDigestPasswordHasher()]; + } + + return new MigratingPasswordHasher($hasher, ...$extrapasswordHashers); + } + + private function createHasherUsingAdapter(string $hasherKey): PasswordHasherInterface + { + if (!$this->passwordHashers[$hasherKey] instanceof PasswordHasherInterface) { + $this->passwordHashers[$hasherKey] = $this->passwordHashers[$hasherKey] instanceof PasswordEncoderInterface + ? new PasswordHasherAdapter($this->passwordHashers[$hasherKey]) + : $this->createHasher($this->passwordHashers[$hasherKey]) + ; + } + + return $this->passwordHashers[$hasherKey]; + } + + private function getHasherConfigFromAlgorithm(array $config): array + { + if ('auto' === $config['algorithm']) { + // "plaintext" is not listed as any leaked hashes could then be used to authenticate directly + if (SodiumPasswordHasher::isSupported()) { + $algorithms = ['native', 'sodium', 'pbkdf2']; + } else { + $algorithms = ['native', 'pbkdf2']; + } + + if ($config['hash_algorithm'] ?? '') { + $algorithms[] = $config['hash_algorithm']; + } + + $hasherChain = []; + foreach ($algorithms as $algorithm) { + $config['algorithm'] = $algorithm; + $hasherChain[] = $this->createHasher($config, true); + } + + return [ + 'class' => MigratingPasswordHasher::class, + 'arguments' => $hasherChain, + ]; + } + + if ($frompasswordHashers = ($config['migrate_from'] ?? false)) { + unset($config['migrate_from']); + $hasherChain = [$this->createHasher($config, true)]; + + foreach ($frompasswordHashers as $name) { + if (isset($this->passwordHashers[$name])) { + $hasher = $this->createHasherUsingAdapter($name); + } else { + $hasher = $this->createHasher(['algorithm' => $name], true); + } + + $hasherChain[] = $hasher; + } + + return [ + 'class' => MigratingPasswordHasher::class, + 'arguments' => $hasherChain, + ]; + } + + switch ($config['algorithm']) { + case 'plaintext': + return [ + 'class' => PlaintextPasswordHasher::class, + 'arguments' => [$config['ignore_case'] ?? false], + ]; + + case 'pbkdf2': + return [ + 'class' => Pbkdf2PasswordHasher::class, + 'arguments' => [ + $config['hash_algorithm'] ?? 'sha512', + $config['encode_as_base64'] ?? true, + $config['iterations'] ?? 1000, + $config['key_length'] ?? 40, + ], + ]; + + case 'bcrypt': + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_BCRYPT; + + return $this->getHasherConfigFromAlgorithm($config); + + case 'native': + return [ + 'class' => NativePasswordHasher::class, + 'arguments' => [ + $config['time_cost'] ?? null, + (($config['memory_cost'] ?? 0) << 10) ?: null, + $config['cost'] ?? null, + ] + (isset($config['native_algorithm']) ? [3 => $config['native_algorithm']] : []), + ]; + + case 'sodium': + return [ + 'class' => SodiumPasswordHasher::class, + 'arguments' => [ + $config['time_cost'] ?? null, + (($config['memory_cost'] ?? 0) << 10) ?: null, + ], + ]; + + case 'argon2i': + if (SodiumPasswordHasher::isSupported() && !\defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2I')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2I; + } else { + throw new LogicException(sprintf('Algorithm "argon2i" is not available. Use "%s" instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? 'argon2id" or "auto' : 'auto')); + } + + return $this->getHasherConfigFromAlgorithm($config); + + case 'argon2id': + if (($hasSodium = SodiumPasswordHasher::isSupported()) && \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2ID')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2ID; + } else { + throw new LogicException(sprintf('Algorithm "argon2id" is not available. Either use "%s", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? 'argon2i", "auto' : 'auto')); + } + + return $this->getHasherConfigFromAlgorithm($config); + } + + return [ + 'class' => MessageDigestPasswordHasher::class, + 'arguments' => [ + $config['algorithm'], + $config['encode_as_base64'] ?? true, + $config['iterations'] ?? 5000, + ], + ]; + } +} diff --git a/vendor/symfony/password-hasher/Hasher/PasswordHasherFactoryInterface.php b/vendor/symfony/password-hasher/Hasher/PasswordHasherFactoryInterface.php new file mode 100644 index 0000000..fed2a77 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/PasswordHasherFactoryInterface.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; + +/** + * PasswordHasherFactoryInterface to support different password hashers for different user accounts. + * + * @author Robin Chalas + * @author Johannes M. Schmitt + */ +interface PasswordHasherFactoryInterface +{ + /** + * Returns the password hasher to use for the given user. + * + * @param PasswordHasherAwareInterface|PasswordAuthenticatedUserInterface|string $user + * + * @throws \RuntimeException When no password hasher could be found for the user + */ + public function getPasswordHasher($user): PasswordHasherInterface; +} diff --git a/vendor/symfony/password-hasher/Hasher/Pbkdf2PasswordHasher.php b/vendor/symfony/password-hasher/Hasher/Pbkdf2PasswordHasher.php new file mode 100644 index 0000000..57fbe07 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/Pbkdf2PasswordHasher.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\Exception\LogicException; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +/** + * Pbkdf2PasswordHasher uses the PBKDF2 (Password-Based Key Derivation Function 2). + * + * Providing a high level of Cryptographic security, + * PBKDF2 is recommended by the National Institute of Standards and Technology (NIST). + * + * But also warrants a warning, using PBKDF2 (with a high number of iterations) slows down the process. + * PBKDF2 should be used with caution and care. + * + * @author Sebastiaan Stok + * @author Andrew Johnson + * @author Fabien Potencier + */ +final class Pbkdf2PasswordHasher implements LegacyPasswordHasherInterface +{ + use CheckPasswordLengthTrait; + + private $algorithm; + private $encodeHashAsBase64; + private $iterations = 1; + private $length; + private $encodedLength = -1; + + /** + * @param string $algorithm The digest algorithm to use + * @param bool $encodeHashAsBase64 Whether to base64 encode the password hash + * @param int $iterations The number of iterations to use to stretch the password hash + * @param int $length Length of derived key to create + */ + public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 1000, int $length = 40) + { + $this->algorithm = $algorithm; + $this->encodeHashAsBase64 = $encodeHashAsBase64; + $this->length = $length; + + try { + $this->encodedLength = \strlen($this->hash('', 'salt')); + } catch (\LogicException $e) { + // ignore unsupported algorithm + } + + $this->iterations = $iterations; + } + + public function hash(string $plainPassword, string $salt = null): string + { + if ($this->isPasswordTooLong($plainPassword)) { + throw new InvalidPasswordException(); + } + + if (!\in_array($this->algorithm, hash_algos(), true)) { + throw new LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); + } + + $digest = hash_pbkdf2($this->algorithm, $plainPassword, $salt, $this->iterations, $this->length, true); + + return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); + } + + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool + { + if (\strlen($hashedPassword) !== $this->encodedLength || false !== strpos($hashedPassword, '$')) { + return false; + } + + return !$this->isPasswordTooLong($plainPassword) && hash_equals($hashedPassword, $this->hash($plainPassword, $salt)); + } + + public function needsRehash(string $hashedPassword): bool + { + return false; + } +} diff --git a/vendor/symfony/password-hasher/Hasher/PlaintextPasswordHasher.php b/vendor/symfony/password-hasher/Hasher/PlaintextPasswordHasher.php new file mode 100644 index 0000000..d9a0557 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/PlaintextPasswordHasher.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +/** + * PlaintextPasswordHasher does not do any hashing but is useful in testing environments. + * + * As this hasher is not cryptographically secure, usage of it in production environments is discouraged. + * + * @author Fabien Potencier + */ +class PlaintextPasswordHasher implements LegacyPasswordHasherInterface +{ + use CheckPasswordLengthTrait; + + private $ignorePasswordCase; + + /** + * @param bool $ignorePasswordCase Compare password case-insensitive + */ + public function __construct(bool $ignorePasswordCase = false) + { + $this->ignorePasswordCase = $ignorePasswordCase; + } + + /** + * {@inheritdoc} + */ + public function hash(string $plainPassword, string $salt = null): string + { + if ($this->isPasswordTooLong($plainPassword)) { + throw new InvalidPasswordException(); + } + + return $this->mergePasswordAndSalt($plainPassword, $salt); + } + + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool + { + if ($this->isPasswordTooLong($plainPassword)) { + return false; + } + + $pass2 = $this->mergePasswordAndSalt($plainPassword, $salt); + + if (!$this->ignorePasswordCase) { + return hash_equals($hashedPassword, $pass2); + } + + return hash_equals(strtolower($hashedPassword), strtolower($pass2)); + } + + public function needsRehash(string $hashedPassword): bool + { + return false; + } + + private function mergePasswordAndSalt(string $password, ?string $salt): string + { + if (empty($salt)) { + return $password; + } + + if (false !== strrpos($salt, '{') || false !== strrpos($salt, '}')) { + throw new \InvalidArgumentException('Cannot use { or } in salt.'); + } + + return $password.'{'.$salt.'}'; + } +} diff --git a/vendor/symfony/password-hasher/Hasher/SodiumPasswordHasher.php b/vendor/symfony/password-hasher/Hasher/SodiumPasswordHasher.php new file mode 100644 index 0000000..2a22b82 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/SodiumPasswordHasher.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\Exception\LogicException; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; + +/** + * Hashes passwords using libsodium. + * + * @author Robin Chalas + * @author Zan Baldwin + * @author Dominik Müller + */ +final class SodiumPasswordHasher implements PasswordHasherInterface +{ + use CheckPasswordLengthTrait; + + private $opsLimit; + private $memLimit; + + public function __construct(int $opsLimit = null, int $memLimit = null) + { + if (!self::isSupported()) { + throw new LogicException('Libsodium is not available. You should either install the sodium extension or use a different password hasher.'); + } + + $this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4); + $this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024); + + if (3 > $this->opsLimit) { + throw new \InvalidArgumentException('$opsLimit must be 3 or greater.'); + } + + if (10 * 1024 > $this->memLimit) { + throw new \InvalidArgumentException('$memLimit must be 10k or greater.'); + } + } + + public static function isSupported(): bool + { + return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.14', '>='); + } + + public function hash(string $plainPassword): string + { + if ($this->isPasswordTooLong($plainPassword)) { + throw new InvalidPasswordException(); + } + + if (\function_exists('sodium_crypto_pwhash_str')) { + return sodium_crypto_pwhash_str($plainPassword, $this->opsLimit, $this->memLimit); + } + + if (\extension_loaded('libsodium')) { + return \Sodium\crypto_pwhash_str($plainPassword, $this->opsLimit, $this->memLimit); + } + + throw new LogicException('Libsodium is not available. You should either install the sodium extension or use a different password hasher.'); + } + + public function verify(string $hashedPassword, string $plainPassword): bool + { + if ('' === $plainPassword) { + return false; + } + + if ($this->isPasswordTooLong($plainPassword)) { + return false; + } + + if (0 !== strpos($hashedPassword, '$argon')) { + if (0 === strpos($hashedPassword, '$2') && (72 < \strlen($plainPassword) || false !== strpos($plainPassword, "\0"))) { + $plainPassword = base64_encode(hash('sha512', $plainPassword, true)); + } + + // Accept validating non-argon passwords for seamless migrations + return password_verify($plainPassword, $hashedPassword); + } + + if (\function_exists('sodium_crypto_pwhash_str_verify')) { + return sodium_crypto_pwhash_str_verify($hashedPassword, $plainPassword); + } + + if (\extension_loaded('libsodium')) { + return \Sodium\crypto_pwhash_str_verify($hashedPassword, $plainPassword); + } + + return false; + } + + public function needsRehash(string $hashedPassword): bool + { + if (\function_exists('sodium_crypto_pwhash_str_needs_rehash')) { + return sodium_crypto_pwhash_str_needs_rehash($hashedPassword, $this->opsLimit, $this->memLimit); + } + + if (\extension_loaded('libsodium')) { + return \Sodium\crypto_pwhash_str_needs_rehash($hashedPassword, $this->opsLimit, $this->memLimit); + } + + throw new LogicException('Libsodium is not available. You should either install the sodium extension or use a different password hasher.'); + } +} diff --git a/vendor/symfony/password-hasher/Hasher/UserPasswordHasher.php b/vendor/symfony/password-hasher/Hasher/UserPasswordHasher.php new file mode 100644 index 0000000..1c73d53 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/UserPasswordHasher.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Hashes passwords based on the user and the PasswordHasherFactory. + * + * @author Ariel Ferrandini + * + * @final + */ +class UserPasswordHasher implements UserPasswordHasherInterface +{ + private $hasherFactory; + + public function __construct(PasswordHasherFactoryInterface $hasherFactory) + { + $this->hasherFactory = $hasherFactory; + } + + /** + * @param PasswordAuthenticatedUserInterface $user + */ + public function hashPassword($user, string $plainPassword): string + { + if (!$user instanceof PasswordAuthenticatedUserInterface) { + if (!$user instanceof UserInterface) { + throw new \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user))); + } + trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $salt = null; + + if ($user instanceof LegacyPasswordAuthenticatedUserInterface) { + $salt = $user->getSalt(); + } elseif ($user instanceof UserInterface) { + $salt = method_exists($user, 'getSalt') ? $user->getSalt() : null; + + if ($salt) { + trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + } + + $hasher = $this->hasherFactory->getPasswordHasher($user); + + return $hasher->hash($plainPassword, $salt); + } + + /** + * @param PasswordAuthenticatedUserInterface $user + */ + public function isPasswordValid($user, string $plainPassword): bool + { + if (!$user instanceof PasswordAuthenticatedUserInterface) { + if (!$user instanceof UserInterface) { + throw new \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user))); + } + trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $salt = null; + + if ($user instanceof LegacyPasswordAuthenticatedUserInterface) { + $salt = $user->getSalt(); + } elseif ($user instanceof UserInterface) { + $salt = $user->getSalt(); + + if (null !== $salt) { + trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + } + + if (null === $user->getPassword()) { + return false; + } + + $hasher = $this->hasherFactory->getPasswordHasher($user); + + return $hasher->verify($user->getPassword(), $plainPassword, $salt); + } + + /** + * @param PasswordAuthenticatedUserInterface $user + */ + public function needsRehash($user): bool + { + if (null === $user->getPassword()) { + return false; + } + + if (!$user instanceof PasswordAuthenticatedUserInterface) { + if (!$user instanceof UserInterface) { + throw new \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user))); + } + trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $hasher = $this->hasherFactory->getPasswordHasher($user); + + return $hasher->needsRehash($user->getPassword()); + } +} diff --git a/vendor/symfony/password-hasher/Hasher/UserPasswordHasherInterface.php b/vendor/symfony/password-hasher/Hasher/UserPasswordHasherInterface.php new file mode 100644 index 0000000..cf29220 --- /dev/null +++ b/vendor/symfony/password-hasher/Hasher/UserPasswordHasherInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher\Hasher; + +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; + +/** + * Interface for the user password hasher service. + * + * @author Ariel Ferrandini + * + * @method string hashPassword(PasswordAuthenticatedUserInterface $user, string $plainPassword) Hashes the plain password for the given user. + * @method bool isPasswordValid(PasswordAuthenticatedUserInterface $user, string $plainPassword) Checks if the plaintext password matches the user's password. + * @method bool needsRehash(PasswordAuthenticatedUserInterface $user) Checks if an encoded password would benefit from rehashing. + */ +interface UserPasswordHasherInterface +{ +} diff --git a/vendor/symfony/password-hasher/LICENSE b/vendor/symfony/password-hasher/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/password-hasher/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/password-hasher/LegacyPasswordHasherInterface.php b/vendor/symfony/password-hasher/LegacyPasswordHasherInterface.php new file mode 100644 index 0000000..7897b00 --- /dev/null +++ b/vendor/symfony/password-hasher/LegacyPasswordHasherInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; + +/** + * Provides password hashing and verification capabilities for "legacy" hashers that require external salts. + * + * @author Fabien Potencier + * @author Nicolas Grekas + * @author Robin Chalas + */ +interface LegacyPasswordHasherInterface extends PasswordHasherInterface +{ + /** + * Hashes a plain password. + * + * @throws InvalidPasswordException If the plain password is invalid, e.g. excessively long + */ + public function hash(string $plainPassword, string $salt = null): string; + + /** + * Checks that a plain password and a salt match a password hash. + */ + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool; +} diff --git a/vendor/symfony/password-hasher/PasswordHasherInterface.php b/vendor/symfony/password-hasher/PasswordHasherInterface.php new file mode 100644 index 0000000..6b35757 --- /dev/null +++ b/vendor/symfony/password-hasher/PasswordHasherInterface.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PasswordHasher; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; + +/** + * Provides password hashing capabilities. + * + * @author Robin Chalas + * @author Fabien Potencier + * @author Nicolas Grekas + */ +interface PasswordHasherInterface +{ + public const MAX_PASSWORD_LENGTH = 4096; + + /** + * Hashes a plain password. + * + * @throws InvalidPasswordException When the plain password is invalid, e.g. excessively long + */ + public function hash(string $plainPassword): string; + + /** + * Verifies a plain password against a hash. + */ + public function verify(string $hashedPassword, string $plainPassword): bool; + + /** + * Checks if a password hash would benefit from rehashing. + */ + public function needsRehash(string $hashedPassword): bool; +} diff --git a/vendor/symfony/password-hasher/README.md b/vendor/symfony/password-hasher/README.md new file mode 100644 index 0000000..0878746 --- /dev/null +++ b/vendor/symfony/password-hasher/README.md @@ -0,0 +1,40 @@ +PasswordHasher Component +======================== + +The PasswordHasher component provides secure password hashing utilities. + +Getting Started +--------------- + +``` +$ composer require symfony/password-hasher +``` + +```php +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; + +// Configure different password hashers via the factory +$factory = new PasswordHasherFactory([ + 'common' => ['algorithm' => 'bcrypt'], + 'memory-hard' => ['algorithm' => 'sodium'], +]); + +// Retrieve the right password hasher by its name +$passwordHasher = $factory->getPasswordHasher('common'); + +// Hash a plain password +$hash = $passwordHasher->hash('plain'); // returns a bcrypt hash + +// Verify that a given plain password matches the hash +$passwordHasher->verify($hash, 'wrong'); // returns false +$passwordHasher->verify($hash, 'plain'); // returns true (valid) +``` + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/security.html#c-hashing-passwords) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/password-hasher/composer.json b/vendor/symfony/password-hasher/composer.json new file mode 100644 index 0000000..ccea812 --- /dev/null +++ b/vendor/symfony/password-hasher/composer.json @@ -0,0 +1,36 @@ +{ + "name": "symfony/password-hasher", + "type": "library", + "description": "Provides password hashing utilities", + "keywords": ["password", "hashing"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Robin Chalas", + "email": "robin.chalas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" + }, + "require-dev": { + "symfony/security-core": "^5.3|^6.0", + "symfony/console": "^5.3|^6.0" + }, + "conflict": { + "symfony/security-core": "<5.3" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\PasswordHasher\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/polyfill-intl-icu/Collator.php b/vendor/symfony/polyfill-intl-icu/Collator.php new file mode 100644 index 0000000..685522b --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Collator.php @@ -0,0 +1,262 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +use Symfony\Polyfill\Intl\Icu\Exception\MethodArgumentValueNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\MethodNotImplementedException; + +/** + * Replacement for PHP's native {@link \Collator} class. + * + * The only methods currently supported in this class are: + * + * - {@link \__construct} + * - {@link create} + * - {@link asort} + * - {@link getErrorCode} + * - {@link getErrorMessage} + * - {@link getLocale} + * + * @author Igor Wiedler + * @author Bernhard Schussek + * + * @internal + */ +abstract class Collator +{ + /* Attribute constants */ + public const FRENCH_COLLATION = 0; + public const ALTERNATE_HANDLING = 1; + public const CASE_FIRST = 2; + public const CASE_LEVEL = 3; + public const NORMALIZATION_MODE = 4; + public const STRENGTH = 5; + public const HIRAGANA_QUATERNARY_MODE = 6; + public const NUMERIC_COLLATION = 7; + + /* Attribute constants values */ + public const DEFAULT_VALUE = -1; + + public const PRIMARY = 0; + public const SECONDARY = 1; + public const TERTIARY = 2; + public const DEFAULT_STRENGTH = 2; + public const QUATERNARY = 3; + public const IDENTICAL = 15; + + public const OFF = 16; + public const ON = 17; + + public const SHIFTED = 20; + public const NON_IGNORABLE = 21; + + public const LOWER_FIRST = 24; + public const UPPER_FIRST = 25; + + /* Sorting options */ + public const SORT_REGULAR = 0; + public const SORT_NUMERIC = 2; + public const SORT_STRING = 1; + + /** + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + */ + public function __construct(?string $locale) + { + if ('en' !== $locale && null !== $locale) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported'); + } + } + + /** + * Static constructor. + * + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * + * @return static + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + */ + public static function create(?string $locale) + { + return new static($locale); + } + + /** + * Sort array maintaining index association. + * + * @param array &$array Input array + * @param int $flags Flags for sorting, can be one of the following: + * Collator::SORT_REGULAR - compare items normally (don't change types) + * Collator::SORT_NUMERIC - compare items numerically + * Collator::SORT_STRING - compare items as strings + * + * @return bool True on success or false on failure + */ + public function asort(array &$array, int $flags = self::SORT_REGULAR) + { + $intlToPlainFlagMap = [ + self::SORT_REGULAR => \SORT_REGULAR, + self::SORT_NUMERIC => \SORT_NUMERIC, + self::SORT_STRING => \SORT_STRING, + ]; + + $plainSortFlag = $intlToPlainFlagMap[$flags] ?? self::SORT_REGULAR; + + return asort($array, $plainSortFlag); + } + + /** + * Not supported. Compare two Unicode strings. + * + * @return bool|int + * + * @see https://php.net/collator.compare + * + * @throws MethodNotImplementedException + */ + public function compare(string $string1, string $string2) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Get a value of an integer collator attribute. + * + * @return bool|int The attribute value on success or false on error + * + * @see https://php.net/collator.getattribute + * + * @throws MethodNotImplementedException + */ + public function getAttribute(int $attribute) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns collator's last error code. Always returns the U_ZERO_ERROR class constant value. + * + * @return int The error code from last collator call + */ + public function getErrorCode() + { + return Icu::U_ZERO_ERROR; + } + + /** + * Returns collator's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value. + * + * @return string The error message from last collator call + */ + public function getErrorMessage() + { + return 'U_ZERO_ERROR'; + } + + /** + * Returns the collator's locale. + * + * @return string The locale used to create the collator. Currently always + * returns "en". + */ + public function getLocale(int $type = Locale::ACTUAL_LOCALE) + { + return 'en'; + } + + /** + * Not supported. Get sorting key for a string. + * + * @return string The collation key for $string + * + * @see https://php.net/collator.getsortkey + * + * @throws MethodNotImplementedException + */ + public function getSortKey(string $string) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Get current collator's strength. + * + * @return bool|int The current collator's strength or false on failure + * + * @see https://php.net/collator.getstrength + * + * @throws MethodNotImplementedException + */ + public function getStrength() + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Set a collator's attribute. + * + * @return bool True on success or false on failure + * + * @see https://php.net/collator.setattribute + * + * @throws MethodNotImplementedException + */ + public function setAttribute(int $attribute, int $value) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Set the collator's strength. + * + * @return bool True on success or false on failure + * + * @see https://php.net/collator.setstrength + * + * @throws MethodNotImplementedException + */ + public function setStrength(int $strength) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Sort array using specified collator and sort keys. + * + * @return bool True on success or false on failure + * + * @see https://php.net/collator.sortwithsortkeys + * + * @throws MethodNotImplementedException + */ + public function sortWithSortKeys(array &$array) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Sort array using specified collator. + * + * @return bool True on success or false on failure + * + * @see https://php.net/collator.sort + * + * @throws MethodNotImplementedException + */ + public function sort(array &$array, int $flags = self::SORT_REGULAR) + { + throw new MethodNotImplementedException(__METHOD__); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Currencies.php b/vendor/symfony/polyfill-intl-icu/Currencies.php new file mode 100644 index 0000000..90b1efa --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Currencies.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class Currencies +{ + private static $data; + + public static function getSymbol(string $currency): ?string + { + $data = self::$data ?? self::$data = require __DIR__.'/Resources/currencies.php'; + + return $data[$currency][0] ?? $data[strtoupper($currency)][0] ?? null; + } + + public static function getFractionDigits(string $currency): int + { + $data = self::$data ?? self::$data = require __DIR__.'/Resources/currencies.php'; + + return $data[$currency][1] ?? $data[strtoupper($currency)][1] ?? $data['DEFAULT'][1]; + } + + public static function getRoundingIncrement(string $currency): int + { + $data = self::$data ?? self::$data = require __DIR__.'/Resources/currencies.php'; + + return $data[$currency][2] ?? $data[strtoupper($currency)][2] ?? $data['DEFAULT'][2]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/AmPmTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/AmPmTransformer.php new file mode 100644 index 0000000..931e844 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/AmPmTransformer.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for AM/PM markers format. + * + * @author Igor Wiedler + * + * @internal + */ +class AmPmTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + return $dateTime->format('A'); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 'AM|PM'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'marker' => $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfWeekTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfWeekTransformer.php new file mode 100644 index 0000000..19c4994 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfWeekTransformer.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for day of week format. + * + * @author Igor Wiedler + * + * @internal + */ +class DayOfWeekTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $dayOfWeek = $dateTime->format('l'); + switch ($length) { + case 4: + return $dayOfWeek; + case 5: + return $dayOfWeek[0]; + case 6: + return substr($dayOfWeek, 0, 2); + default: + return substr($dayOfWeek, 0, 3); + } + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + switch ($length) { + case 4: + return 'Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday'; + case 5: + return '[MTWFS]'; + case 6: + return 'Mo|Tu|We|Th|Fr|Sa|Su'; + default: + return 'Mon|Tue|Wed|Thu|Fri|Sat|Sun'; + } + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return []; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfYearTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfYearTransformer.php new file mode 100644 index 0000000..5db0930 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/DayOfYearTransformer.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for day of year format. + * + * @author Igor Wiedler + * + * @internal + */ +class DayOfYearTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $dayOfYear = (int) $dateTime->format('z') + 1; + + return $this->padLeft($dayOfYear, $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return '\d{'.$length.'}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return []; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/DayTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/DayTransformer.php new file mode 100644 index 0000000..db4b57b --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/DayTransformer.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for day format. + * + * @author Igor Wiedler + * + * @internal + */ +class DayTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + return $this->padLeft($dateTime->format('j'), $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 1 === $length ? '\d{1,2}' : '\d{1,'.$length.'}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'day' => (int) $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/FullTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/FullTransformer.php new file mode 100644 index 0000000..02d071d --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/FullTransformer.php @@ -0,0 +1,312 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +use Symfony\Polyfill\Intl\Icu\Exception\NotImplementedException; +use Symfony\Polyfill\Intl\Icu\Icu; + +/** + * Parser and formatter for date formats. + * + * @author Igor Wiedler + * + * @internal + */ +class FullTransformer +{ + private $quoteMatch = "'(?:[^']+|'')*'"; + private $implementedChars = 'MLydQqhDEaHkKmsz'; + private $notImplementedChars = 'GYuwWFgecSAZvVW'; + private $regExp; + + /** + * @var Transformer[] + */ + private $transformers; + + private $pattern; + private $timezone; + + /** + * @param string $pattern The pattern to be used to format and/or parse values + * @param string $timezone The timezone to perform the date/time calculations + */ + public function __construct(string $pattern, string $timezone) + { + $this->pattern = $pattern; + $this->timezone = $timezone; + + $implementedCharsMatch = $this->buildCharsMatch($this->implementedChars); + $notImplementedCharsMatch = $this->buildCharsMatch($this->notImplementedChars); + $this->regExp = "/($this->quoteMatch|$implementedCharsMatch|$notImplementedCharsMatch)/"; + + $this->transformers = [ + 'M' => new MonthTransformer(), + 'L' => new MonthTransformer(), + 'y' => new YearTransformer(), + 'd' => new DayTransformer(), + 'q' => new QuarterTransformer(), + 'Q' => new QuarterTransformer(), + 'h' => new Hour1201Transformer(), + 'D' => new DayOfYearTransformer(), + 'E' => new DayOfWeekTransformer(), + 'a' => new AmPmTransformer(), + 'H' => new Hour2400Transformer(), + 'K' => new Hour1200Transformer(), + 'k' => new Hour2401Transformer(), + 'm' => new MinuteTransformer(), + 's' => new SecondTransformer(), + 'z' => new TimezoneTransformer(), + ]; + } + + /** + * Format a DateTime using ICU dateformat pattern. + * + * @return string The formatted value + */ + public function format(\DateTime $dateTime): string + { + $formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) { + return $this->formatReplace($matches[0], $dateTime); + }, $this->pattern); + + return $formatted; + } + + /** + * Return the formatted ICU value for the matched date characters. + * + * @throws NotImplementedException When it encounters a not implemented date character + */ + private function formatReplace(string $dateChars, \DateTime $dateTime): string + { + $length = \strlen($dateChars); + + if ($this->isQuoteMatch($dateChars)) { + return $this->replaceQuoteMatch($dateChars); + } + + if (isset($this->transformers[$dateChars[0]])) { + $transformer = $this->transformers[$dateChars[0]]; + + return $transformer->format($dateTime, $length); + } + + // handle unimplemented characters + if (false !== strpos($this->notImplementedChars, $dateChars[0])) { + throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s".', $dateChars[0], $this->pattern)); + } + + return ''; + } + + /** + * Parse a pattern based string to a timestamp value. + * + * @param \DateTime $dateTime A configured DateTime object to use to perform the date calculation + * @param string $value String to convert to a time value + * + * @return int|false The corresponding Unix timestamp + * + * @throws \InvalidArgumentException When the value can not be matched with pattern + */ + public function parse(\DateTime $dateTime, string $value) + { + $reverseMatchingRegExp = $this->getReverseMatchingRegExp($this->pattern); + $reverseMatchingRegExp = '/^'.$reverseMatchingRegExp.'$/'; + + $options = []; + + if (preg_match($reverseMatchingRegExp, $value, $matches)) { + $matches = $this->normalizeArray($matches); + + foreach ($this->transformers as $char => $transformer) { + if (isset($matches[$char])) { + $length = \strlen($matches[$char]['pattern']); + $options = array_merge($options, $transformer->extractDateOptions($matches[$char]['value'], $length)); + } + } + + // reset error code and message + Icu::setError(Icu::U_ZERO_ERROR); + + return $this->calculateUnixTimestamp($dateTime, $options); + } + + // behave like the intl extension + Icu::setError(Icu::U_PARSE_ERROR, 'Date parsing failed'); + + return false; + } + + /** + * Retrieve a regular expression to match with a formatted value. + * + * @return string The reverse matching regular expression with named captures being formed by the + * transformer index in the $transformer array + */ + private function getReverseMatchingRegExp(string $pattern): string + { + $escapedPattern = preg_quote($pattern, '/'); + + // ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") and vice-versa + // when parsing a date/time value + $escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $escapedPattern); + + $reverseMatchingRegExp = preg_replace_callback($this->regExp, function ($matches) { + $length = \strlen($matches[0]); + $transformerIndex = $matches[0][0]; + + $dateChars = $matches[0]; + if ($this->isQuoteMatch($dateChars)) { + return $this->replaceQuoteMatch($dateChars); + } + + if (isset($this->transformers[$transformerIndex])) { + $transformer = $this->transformers[$transformerIndex]; + $captureName = str_repeat($transformerIndex, $length); + + return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')'; + } + + return null; + }, $escapedPattern); + + return $reverseMatchingRegExp; + } + + /** + * Check if the first char of a string is a single quote. + */ + private function isQuoteMatch(string $quoteMatch): bool + { + return "'" === $quoteMatch[0]; + } + + /** + * Replaces single quotes at the start or end of a string with two single quotes. + */ + private function replaceQuoteMatch(string $quoteMatch): string + { + if (preg_match("/^'+$/", $quoteMatch)) { + return str_replace("''", "'", $quoteMatch); + } + + return str_replace("''", "'", substr($quoteMatch, 1, -1)); + } + + /** + * Builds a chars match regular expression. + */ + private function buildCharsMatch(string $specialChars): string + { + $specialCharsArray = str_split($specialChars); + + $specialCharsMatch = implode('|', array_map(function ($char) { + return $char.'+'; + }, $specialCharsArray)); + + return $specialCharsMatch; + } + + /** + * Normalize a preg_replace match array, removing the numeric keys and returning an associative array + * with the value and pattern values for the matched Transformer. + */ + private function normalizeArray(array $data): array + { + $ret = []; + + foreach ($data as $key => $value) { + if (!\is_string($key)) { + continue; + } + + $ret[$key[0]] = [ + 'value' => $value, + 'pattern' => $key, + ]; + } + + return $ret; + } + + /** + * Calculates the Unix timestamp based on the matched values by the reverse matching regular + * expression of parse(). + * + * @return bool|int The calculated timestamp or false if matched date is invalid + */ + private function calculateUnixTimestamp(\DateTime $dateTime, array $options) + { + $options = $this->getDefaultValueForOptions($options); + + $year = $options['year']; + $month = $options['month']; + $day = $options['day']; + $hour = $options['hour']; + $hourInstance = $options['hourInstance']; + $minute = $options['minute']; + $second = $options['second']; + $marker = $options['marker']; + $timezone = $options['timezone']; + + // If month is false, return immediately (intl behavior) + if (false === $month) { + Icu::setError(Icu::U_PARSE_ERROR, 'Date parsing failed'); + + return false; + } + + // Normalize hour + if ($hourInstance instanceof HourTransformer) { + $hour = $hourInstance->normalizeHour($hour, $marker); + } + + // Set the timezone if different from the default one + if (null !== $timezone && $timezone !== $this->timezone) { + $dateTime->setTimezone(new \DateTimeZone($timezone)); + } + + // Normalize yy year + preg_match_all($this->regExp, $this->pattern, $matches); + if (\in_array('yy', $matches[0])) { + $dateTime->setTimestamp(time()); + $year = $year > (int) $dateTime->format('y') + 20 ? 1900 + $year : 2000 + $year; + } + + $dateTime->setDate($year, $month, $day); + $dateTime->setTime($hour, $minute, $second); + + return $dateTime->getTimestamp(); + } + + /** + * Add sensible default values for missing items in the extracted date/time options array. The values + * are base in the beginning of the Unix era. + */ + private function getDefaultValueForOptions(array $options): array + { + return [ + 'year' => $options['year'] ?? 1970, + 'month' => $options['month'] ?? 1, + 'day' => $options['day'] ?? 1, + 'hour' => $options['hour'] ?? 0, + 'hourInstance' => $options['hourInstance'] ?? null, + 'minute' => $options['minute'] ?? 0, + 'second' => $options['second'] ?? 0, + 'marker' => $options['marker'] ?? null, + 'timezone' => $options['timezone'] ?? null, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1200Transformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1200Transformer.php new file mode 100644 index 0000000..5e7c18f --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1200Transformer.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for 12 hour format (0-11). + * + * @author Igor Wiedler + * + * @internal + */ +class Hour1200Transformer extends HourTransformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $hourOfDay = $dateTime->format('g'); + $hourOfDay = '12' === $hourOfDay ? '0' : $hourOfDay; + + return $this->padLeft($hourOfDay, $length); + } + + /** + * {@inheritdoc} + */ + public function normalizeHour(int $hour, string $marker = null): int + { + if ('PM' === $marker) { + $hour += 12; + } + + return $hour; + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return '\d{1,2}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'hour' => (int) $matched, + 'hourInstance' => $this, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1201Transformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1201Transformer.php new file mode 100644 index 0000000..0606bcf --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour1201Transformer.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for 12 hour format (1-12). + * + * @author Igor Wiedler + * + * @internal + */ +class Hour1201Transformer extends HourTransformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + return $this->padLeft($dateTime->format('g'), $length); + } + + /** + * {@inheritdoc} + */ + public function normalizeHour(int $hour, string $marker = null): int + { + if ('PM' !== $marker && 12 === $hour) { + $hour = 0; + } elseif ('PM' === $marker && 12 !== $hour) { + // If PM and hour is not 12 (1-12), sum 12 hour + $hour += 12; + } + + return $hour; + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return '\d{1,2}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'hour' => (int) $matched, + 'hourInstance' => $this, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2400Transformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2400Transformer.php new file mode 100644 index 0000000..8536587 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2400Transformer.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for 24 hour format (0-23). + * + * @author Igor Wiedler + * + * @internal + */ +class Hour2400Transformer extends HourTransformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + return $this->padLeft($dateTime->format('G'), $length); + } + + /** + * {@inheritdoc} + */ + public function normalizeHour(int $hour, string $marker = null): int + { + if ('AM' === $marker) { + $hour = 0; + } elseif ('PM' === $marker) { + $hour = 12; + } + + return $hour; + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return '\d{1,2}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'hour' => (int) $matched, + 'hourInstance' => $this, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2401Transformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2401Transformer.php new file mode 100644 index 0000000..929f11f --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/Hour2401Transformer.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for 24 hour format (1-24). + * + * @author Igor Wiedler + * + * @internal + */ +class Hour2401Transformer extends HourTransformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $hourOfDay = $dateTime->format('G'); + $hourOfDay = '0' === $hourOfDay ? '24' : $hourOfDay; + + return $this->padLeft($hourOfDay, $length); + } + + /** + * {@inheritdoc} + */ + public function normalizeHour(int $hour, string $marker = null): int + { + if ((null === $marker && 24 === $hour) || 'AM' === $marker) { + $hour = 0; + } elseif ('PM' === $marker) { + $hour = 12; + } + + return $hour; + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return '\d{1,2}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'hour' => (int) $matched, + 'hourInstance' => $this, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/HourTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/HourTransformer.php new file mode 100644 index 0000000..b042ccf --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/HourTransformer.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Base class for hour transformers. + * + * @author Eriksen Costa + * + * @internal + */ +abstract class HourTransformer extends Transformer +{ + /** + * Returns a normalized hour value suitable for the hour transformer type. + * + * @param int $hour The hour value + * @param string $marker An optional AM/PM marker + * + * @return int The normalized hour value + */ + abstract public function normalizeHour(int $hour, string $marker = null): int; +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/MinuteTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/MinuteTransformer.php new file mode 100644 index 0000000..5926740 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/MinuteTransformer.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for minute format. + * + * @author Igor Wiedler + * + * @internal + */ +class MinuteTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $minuteOfHour = (int) $dateTime->format('i'); + + return $this->padLeft($minuteOfHour, $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 1 === $length ? '\d{1,2}' : '\d{'.$length.'}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'minute' => (int) $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/MonthTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/MonthTransformer.php new file mode 100644 index 0000000..d418857 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/MonthTransformer.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for month format. + * + * @author Igor Wiedler + * + * @internal + */ +class MonthTransformer extends Transformer +{ + protected static $months = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; + + /** + * Short months names (first 3 letters). + */ + protected static $shortMonths = []; + + /** + * Flipped $months array, $name => $index. + */ + protected static $flippedMonths = []; + + /** + * Flipped $shortMonths array, $name => $index. + */ + protected static $flippedShortMonths = []; + + public function __construct() + { + if (0 === \count(self::$shortMonths)) { + self::$shortMonths = array_map(function ($month) { + return substr($month, 0, 3); + }, self::$months); + + self::$flippedMonths = array_flip(self::$months); + self::$flippedShortMonths = array_flip(self::$shortMonths); + } + } + + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $matchLengthMap = [ + 1 => 'n', + 2 => 'm', + 3 => 'M', + 4 => 'F', + ]; + + if (isset($matchLengthMap[$length])) { + return $dateTime->format($matchLengthMap[$length]); + } + + if (5 === $length) { + return substr($dateTime->format('M'), 0, 1); + } + + return $this->padLeft($dateTime->format('m'), $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + switch ($length) { + case 1: + $regExp = '\d{1,2}'; + break; + case 3: + $regExp = implode('|', self::$shortMonths); + break; + case 4: + $regExp = implode('|', self::$months); + break; + case 5: + $regExp = '[JFMASOND]'; + break; + default: + $regExp = '\d{1,'.$length.'}'; + break; + } + + return $regExp; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + if (!is_numeric($matched)) { + if (3 === $length) { + $matched = self::$flippedShortMonths[$matched] + 1; + } elseif (4 === $length) { + $matched = self::$flippedMonths[$matched] + 1; + } elseif (5 === $length) { + // IntlDateFormatter::parse() always returns false for MMMMM or LLLLL + $matched = false; + } + } else { + $matched = (int) $matched; + } + + return [ + 'month' => $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/QuarterTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/QuarterTransformer.php new file mode 100644 index 0000000..4291a72 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/QuarterTransformer.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for quarter format. + * + * @author Igor Wiedler + * + * @internal + */ +class QuarterTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $month = (int) $dateTime->format('n'); + $quarter = (int) floor(($month - 1) / 3) + 1; + switch ($length) { + case 1: + case 2: + return $this->padLeft($quarter, $length); + case 3: + return 'Q'.$quarter; + default: + $map = [1 => '1st quarter', 2 => '2nd quarter', 3 => '3rd quarter', 4 => '4th quarter']; + + return $map[$quarter]; + } + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + switch ($length) { + case 1: + case 2: + return '\d{'.$length.'}'; + case 3: + return 'Q\d'; + default: + return '(?:1st|2nd|3rd|4th) quarter'; + } + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return []; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/SecondTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/SecondTransformer.php new file mode 100644 index 0000000..456abd3 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/SecondTransformer.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for the second format. + * + * @author Igor Wiedler + * + * @internal + */ +class SecondTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + $secondOfMinute = (int) $dateTime->format('s'); + + return $this->padLeft($secondOfMinute, $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 1 === $length ? '\d{1,2}' : '\d{'.$length.'}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'second' => (int) $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/TimezoneTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/TimezoneTransformer.php new file mode 100644 index 0000000..241e847 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/TimezoneTransformer.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +use Symfony\Polyfill\Intl\Icu\Exception\NotImplementedException; + +/** + * Parser and formatter for time zone format. + * + * @author Igor Wiedler + * + * @internal + */ +class TimezoneTransformer extends Transformer +{ + /** + * {@inheritdoc} + * + * @throws NotImplementedException When time zone is different than UTC or GMT (Etc/GMT) + */ + public function format(\DateTime $dateTime, int $length): string + { + $timeZone = substr($dateTime->getTimezone()->getName(), 0, 3); + + if (!\in_array($timeZone, ['Etc', 'UTC', 'GMT'])) { + throw new NotImplementedException('Time zone different than GMT or UTC is not supported as a formatting output.'); + } + + if ('Etc' === $timeZone) { + // i.e. Etc/GMT+1, Etc/UTC, Etc/Zulu + $timeZone = substr($dateTime->getTimezone()->getName(), 4); + } + + // From ICU >= 59.1 GMT and UTC are no longer unified + if (\in_array($timeZone, ['UTC', 'UCT', 'Universal', 'Zulu'])) { + // offset is not supported with UTC + return $length > 3 ? 'Coordinated Universal Time' : 'UTC'; + } + + $offset = (int) $dateTime->format('O'); + + // From ICU >= 4.8, the zero offset is no more used, example: GMT instead of GMT+00:00 + if (0 === $offset) { + return $length > 3 ? 'Greenwich Mean Time' : 'GMT'; + } + + if ($length > 3) { + return $dateTime->format('\G\M\TP'); + } + + return sprintf('GMT%s%d', ($offset >= 0 ? '+' : ''), $offset / 100); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 'GMT[+-]\d{2}:?\d{2}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'timezone' => self::getEtcTimeZoneId($matched), + ]; + } + + /** + * Get an Etc/GMT timezone identifier for the specified timezone. + * + * The PHP documentation for timezones states to not use the 'Other' time zones because them exists + * "for backwards compatibility". However all Etc/GMT time zones are in the tz database 'etcetera' file, + * which indicates they are not deprecated (neither are old names). + * + * Only GMT, Etc/Universal, Etc/Zulu, Etc/Greenwich, Etc/GMT-0, Etc/GMT+0 and Etc/GMT0 are old names and + * are linked to Etc/GMT or Etc/UTC. + * + * @param string $formattedTimeZone A GMT timezone string (GMT-03:00, e.g.) + * + * @return string A timezone identifier + * + * @see https://php.net/timezones.others + * + * @throws NotImplementedException When the GMT time zone have minutes offset different than zero + * @throws \InvalidArgumentException When the value can not be matched with pattern + */ + public static function getEtcTimeZoneId(string $formattedTimeZone): string + { + if (preg_match('/GMT(?P[+-])(?P\d{2}):?(?P\d{2})/', $formattedTimeZone, $matches)) { + $hours = (int) $matches['hours']; + $minutes = (int) $matches['minutes']; + $signal = '-' === $matches['signal'] ? '+' : '-'; + + if (0 < $minutes) { + throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: "%s".', $formattedTimeZone)); + } + + return 'Etc/GMT'.(0 !== $hours ? $signal.$hours : ''); + } + + throw new \InvalidArgumentException(sprintf('The GMT time zone "%s" does not match with the supported formats GMT[+-]HH:MM or GMT[+-]HHMM.', $formattedTimeZone)); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/Transformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/Transformer.php new file mode 100644 index 0000000..7f8bf25 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/Transformer.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for date formats. + * + * @author Igor Wiedler + * + * @internal + */ +abstract class Transformer +{ + /** + * Format a value using a configured DateTime as date/time source. + * + * @param \DateTime $dateTime A DateTime object to be used to generate the formatted value + * @param int $length The formatted value string length + * + * @return string The formatted value + */ + abstract public function format(\DateTime $dateTime, int $length): string; + + /** + * Returns a reverse matching regular expression of a string generated by format(). + * + * @param int $length The length of the value to be reverse matched + * + * @return string The reverse matching regular expression + */ + abstract public function getReverseMatchingRegExp(int $length): string; + + /** + * Extract date options from a matched value returned by the processing of the reverse matching + * regular expression. + * + * @param string $matched The matched value + * @param int $length The length of the Transformer pattern string + * + * @return array An associative array + */ + abstract public function extractDateOptions(string $matched, int $length): array; + + /** + * Pad a string with zeros to the left. + * + * @param string $value The string to be padded + * @param int $length The length to pad + * + * @return string The padded string + */ + protected function padLeft(string $value, int $length): string + { + return str_pad($value, $length, '0', \STR_PAD_LEFT); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/DateFormat/YearTransformer.php b/vendor/symfony/polyfill-intl-icu/DateFormat/YearTransformer.php new file mode 100644 index 0000000..3bb6acd --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/DateFormat/YearTransformer.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\DateFormat; + +/** + * Parser and formatter for year format. + * + * @author Igor Wiedler + * + * @internal + */ +class YearTransformer extends Transformer +{ + /** + * {@inheritdoc} + */ + public function format(\DateTime $dateTime, int $length): string + { + if (2 === $length) { + return $dateTime->format('y'); + } + + return $this->padLeft($dateTime->format('Y'), $length); + } + + /** + * {@inheritdoc} + */ + public function getReverseMatchingRegExp(int $length): string + { + return 2 === $length ? '\d{2}' : '\d{1,4}'; + } + + /** + * {@inheritdoc} + */ + public function extractDateOptions(string $matched, int $length): array + { + return [ + 'year' => (int) $matched, + ]; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/ExceptionInterface.php b/vendor/symfony/polyfill-intl-icu/Exception/ExceptionInterface.php new file mode 100644 index 0000000..a453b5e --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * Base ExceptionInterface for the Intl component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentNotImplementedException.php b/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentNotImplementedException.php new file mode 100644 index 0000000..db120a3 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentNotImplementedException.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * @author Eriksen Costa + */ +class MethodArgumentNotImplementedException extends NotImplementedException +{ + /** + * @param string $methodName The method name that raised the exception + * @param string $argName The argument name that is not implemented + */ + public function __construct(string $methodName, string $argName) + { + $message = sprintf('The %s() method\'s argument $%s behavior is not implemented.', $methodName, $argName); + parent::__construct($message); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentValueNotImplementedException.php b/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentValueNotImplementedException.php new file mode 100644 index 0000000..bd92042 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/MethodArgumentValueNotImplementedException.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * @author Eriksen Costa + */ +class MethodArgumentValueNotImplementedException extends NotImplementedException +{ + /** + * @param string $methodName The method name that raised the exception + * @param string $argName The argument name + * @param mixed $argValue The argument value that is not implemented + * @param string $additionalMessage An optional additional message to append to the exception message + */ + public function __construct(string $methodName, string $argName, $argValue, string $additionalMessage = '') + { + $message = sprintf( + 'The %s() method\'s argument $%s value %s behavior is not implemented.%s', + $methodName, + $argName, + var_export($argValue, true), + '' !== $additionalMessage ? ' '.$additionalMessage.'. ' : '' + ); + + parent::__construct($message); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/MethodNotImplementedException.php b/vendor/symfony/polyfill-intl-icu/Exception/MethodNotImplementedException.php new file mode 100644 index 0000000..9e1a439 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/MethodNotImplementedException.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * @author Eriksen Costa + */ +class MethodNotImplementedException extends NotImplementedException +{ + /** + * @param string $methodName The name of the method + */ + public function __construct(string $methodName) + { + parent::__construct(sprintf('The %s() is not implemented.', $methodName)); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/NotImplementedException.php b/vendor/symfony/polyfill-intl-icu/Exception/NotImplementedException.php new file mode 100644 index 0000000..929b933 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/NotImplementedException.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * Base exception class for not implemented behaviors of the intl extension in the Locale component. + * + * @author Eriksen Costa + */ +class NotImplementedException extends RuntimeException +{ + public const INTL_INSTALL_MESSAGE = 'Please install the "intl" extension for full localization capabilities.'; + + /** + * @param string $message The exception message. A note to install the intl extension is appended to this string + */ + public function __construct(string $message) + { + parent::__construct($message.' '.self::INTL_INSTALL_MESSAGE); + } +} diff --git a/vendor/symfony/polyfill-intl-icu/Exception/RuntimeException.php b/vendor/symfony/polyfill-intl-icu/Exception/RuntimeException.php new file mode 100644 index 0000000..ceedffe --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu\Exception; + +/** + * RuntimeException for the Intl component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/Icu.php b/vendor/symfony/polyfill-intl-icu/Icu.php new file mode 100644 index 0000000..b9590f4 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Icu.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +/** + * Provides fake static versions of the global functions in the intl extension. + * + * @author Bernhard Schussek + * + * @internal + */ +abstract class Icu +{ + /** + * Indicates that no error occurred. + */ + public const U_ZERO_ERROR = 0; + + /** + * Indicates that an invalid argument was passed. + */ + public const U_ILLEGAL_ARGUMENT_ERROR = 1; + + /** + * Indicates that the parse() operation failed. + */ + public const U_PARSE_ERROR = 9; + + /** + * All known error codes. + */ + private static $errorCodes = [ + self::U_ZERO_ERROR => 'U_ZERO_ERROR', + self::U_ILLEGAL_ARGUMENT_ERROR => 'U_ILLEGAL_ARGUMENT_ERROR', + self::U_PARSE_ERROR => 'U_PARSE_ERROR', + ]; + + /** + * The error code of the last operation. + */ + private static $errorCode = self::U_ZERO_ERROR; + + /** + * The error code of the last operation. + */ + private static $errorMessage = 'U_ZERO_ERROR'; + + /** + * Returns whether the error code indicates a failure. + * + * @param int $errorCode The error code returned by Icu::getErrorCode() + */ + public static function isFailure(int $errorCode): bool + { + return isset(self::$errorCodes[$errorCode]) + && $errorCode > self::U_ZERO_ERROR; + } + + /** + * Returns the error code of the last operation. + * + * Returns Icu::U_ZERO_ERROR if no error occurred. + * + * @return int + */ + public static function getErrorCode() + { + return self::$errorCode; + } + + /** + * Returns the error message of the last operation. + * + * Returns "U_ZERO_ERROR" if no error occurred. + */ + public static function getErrorMessage(): string + { + return self::$errorMessage; + } + + /** + * Returns the symbolic name for a given error code. + * + * @param int $code The error code returned by Icu::getErrorCode() + */ + public static function getErrorName(int $code): string + { + return self::$errorCodes[$code] ?? '[BOGUS UErrorCode]'; + } + + /** + * Sets the current error. + * + * @param int $code One of the error constants in this class + * @param string $message The ICU class error message + * + * @throws \InvalidArgumentException If the code is not one of the error constants in this class + */ + public static function setError(int $code, string $message = '') + { + if (!isset(self::$errorCodes[$code])) { + throw new \InvalidArgumentException(sprintf('No such error code: "%s".', $code)); + } + + self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code]; + self::$errorCode = $code; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/IntlDateFormatter.php b/vendor/symfony/polyfill-intl-icu/IntlDateFormatter.php new file mode 100644 index 0000000..718ce9b --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/IntlDateFormatter.php @@ -0,0 +1,645 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +use Symfony\Polyfill\Intl\Icu\DateFormat\FullTransformer; +use Symfony\Polyfill\Intl\Icu\Exception\MethodArgumentNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\MethodArgumentValueNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\MethodNotImplementedException; + +/** + * Replacement for PHP's native {@link \IntlDateFormatter} class. + * + * The only methods currently supported in this class are: + * + * - {@link __construct} + * - {@link create} + * - {@link format} + * - {@link getCalendar} + * - {@link getDateType} + * - {@link getErrorCode} + * - {@link getErrorMessage} + * - {@link getLocale} + * - {@link getPattern} + * - {@link getTimeType} + * - {@link getTimeZoneId} + * - {@link isLenient} + * - {@link parse} + * - {@link setLenient} + * - {@link setPattern} + * - {@link setTimeZoneId} + * - {@link setTimeZone} + * + * @author Igor Wiedler + * @author Bernhard Schussek + * + * @internal + */ +abstract class IntlDateFormatter +{ + /** + * The error code from the last operation. + * + * @var int + */ + protected $errorCode = Icu::U_ZERO_ERROR; + + /** + * The error message from the last operation. + * + * @var string + */ + protected $errorMessage = 'U_ZERO_ERROR'; + + /* date/time format types */ + public const NONE = -1; + public const FULL = 0; + public const LONG = 1; + public const MEDIUM = 2; + public const SHORT = 3; + + /* date format types */ + public const RELATIVE_FULL = 128; + public const RELATIVE_LONG = 129; + public const RELATIVE_MEDIUM = 130; + public const RELATIVE_SHORT = 131; + + /* calendar formats */ + public const TRADITIONAL = 0; + public const GREGORIAN = 1; + + /** + * Patterns used to format the date when no pattern is provided. + */ + private $defaultDateFormats = [ + self::NONE => '', + self::FULL => 'EEEE, MMMM d, y', + self::LONG => 'MMMM d, y', + self::MEDIUM => 'MMM d, y', + self::SHORT => 'M/d/yy', + self::RELATIVE_FULL => 'EEEE, MMMM d, y', + self::RELATIVE_LONG => 'MMMM d, y', + self::RELATIVE_MEDIUM => 'MMM d, y', + self::RELATIVE_SHORT => 'M/d/yy', + ]; + + /** + * Patterns used to format the time when no pattern is provided. + */ + private $defaultTimeFormats = [ + self::FULL => 'h:mm:ss a zzzz', + self::LONG => 'h:mm:ss a z', + self::MEDIUM => 'h:mm:ss a', + self::SHORT => 'h:mm a', + ]; + + private $dateType; + private $timeType; + + /** + * @var string + */ + private $pattern; + + /** + * @var \DateTimeZone + */ + private $dateTimeZone; + + /** + * @var bool + */ + private $uninitializedTimeZoneId = false; + + /** + * @var string + */ + private $timezoneId; + + /** + * @var bool + */ + private $isRelativeDateType = false; + + /** + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier + * @param \IntlCalendar|int|null $calendar Calendar to use for formatting or parsing. The only currently + * supported value is IntlDateFormatter::GREGORIAN (or null using the default calendar, i.e. "GREGORIAN") + * + * @see https://php.net/intldateformatter.create + * @see http://userguide.icu-project.org/formatparse/datetime + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + * @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed + */ + public function __construct(?string $locale, ?int $dateType, ?int $timeType, $timezone = null, $calendar = null, ?string $pattern = '') + { + if ('en' !== $locale && null !== $locale) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported'); + } + + if (self::GREGORIAN !== $calendar && null !== $calendar) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'calendar', $calendar, 'Only the GREGORIAN calendar is supported'); + } + + if (\PHP_VERSION_ID >= 80100) { + if (null === $dateType) { + @trigger_error('Passing null to parameter #2 ($dateType) of type int is deprecated', \E_USER_DEPRECATED); + } + + if (null === $timeType) { + @trigger_error('Passing null to parameter #3 ($timeType) of type int is deprecated', \E_USER_DEPRECATED); + } + } + + $this->dateType = $dateType ?? self::FULL; + $this->timeType = $timeType ?? self::FULL; + + if ('' === ($pattern ?? '')) { + $pattern = $this->getDefaultPattern(); + } + + $this->setPattern($pattern); + $this->setTimeZone($timezone); + + if (\in_array($this->dateType, [self::RELATIVE_FULL, self::RELATIVE_LONG, self::RELATIVE_MEDIUM, self::RELATIVE_SHORT], true)) { + $this->isRelativeDateType = true; + } + } + + /** + * Static constructor. + * + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier + * @param \IntlCalendar|int|null $calendar Calendar to use for formatting or parsing; default is Gregorian + * One of the calendar constants + * + * @return static + * + * @see https://php.net/intldateformatter.create + * @see http://userguide.icu-project.org/formatparse/datetime + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + * @throws MethodArgumentValueNotImplementedException When $calendar different than GREGORIAN is passed + */ + public static function create(?string $locale, ?int $dateType, ?int $timeType, $timezone = null, int $calendar = null, ?string $pattern = '') + { + return new static($locale, $dateType, $timeType, $timezone, $calendar, $pattern); + } + + /** + * Format the date/time value (timestamp) as a string. + * + * @param int|string|\DateTimeInterface $datetime The timestamp to format + * + * @return string|bool The formatted value or false if formatting failed + * + * @see https://php.net/intldateformatter.format + * + * @throws MethodArgumentValueNotImplementedException If one of the formatting characters is not implemented + */ + public function format($datetime) + { + // intl allows timestamps to be passed as arrays - we don't + if (\is_array($datetime)) { + $message = 'Only Unix timestamps and DateTime objects are supported'; + + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'datetime', $datetime, $message); + } + + if (\is_string($datetime) && $dt = \DateTime::createFromFormat('U', $datetime)) { + $datetime = $dt; + } + + // behave like the intl extension + $argumentError = null; + if (!\is_int($datetime) && !$datetime instanceof \DateTimeInterface) { + $argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $datetime); + } + + if (null !== $argumentError) { + Icu::setError(Icu::U_ILLEGAL_ARGUMENT_ERROR, $argumentError); + $this->errorCode = Icu::getErrorCode(); + $this->errorMessage = Icu::getErrorMessage(); + + return false; + } + + if ($datetime instanceof \DateTimeInterface) { + $datetime = $datetime->format('U'); + } + + $pattern = $this->getPattern(); + $formatted = ''; + + if ($this->isRelativeDateType && $formatted = $this->getRelativeDateFormat($datetime)) { + if (self::NONE === $this->timeType) { + $pattern = ''; + } else { + $pattern = $this->defaultTimeFormats[$this->timeType]; + if (\in_array($this->dateType, [self::RELATIVE_MEDIUM, self::RELATIVE_SHORT], true)) { + $formatted .= ', '; + } else { + $formatted .= ' at '; + } + } + } + + $transformer = new FullTransformer($pattern, $this->getTimeZoneId()); + $formatted .= $transformer->format($this->createDateTime($datetime)); + + // behave like the intl extension + Icu::setError(Icu::U_ZERO_ERROR); + $this->errorCode = Icu::getErrorCode(); + $this->errorMessage = Icu::getErrorMessage(); + + return $formatted; + } + + /** + * Not supported. Formats an object. + * + * @return string The formatted value + * + * @see https://php.net/intldateformatter.formatobject + * + * @throws MethodNotImplementedException + */ + public function formatObject($datetime, $format = null, string $locale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns the formatter's calendar. + * + * @return int The calendar being used by the formatter. Currently always returns + * IntlDateFormatter::GREGORIAN. + * + * @see https://php.net/intldateformatter.getcalendar + */ + public function getCalendar() + { + return self::GREGORIAN; + } + + /** + * Not supported. Returns the formatter's calendar object. + * + * @return object The calendar's object being used by the formatter + * + * @see https://php.net/intldateformatter.getcalendarobject + * + * @throws MethodNotImplementedException + */ + public function getCalendarObject() + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns the formatter's datetype. + * + * @return int The current value of the formatter + * + * @see https://php.net/intldateformatter.getdatetype + */ + public function getDateType() + { + return $this->dateType; + } + + /** + * Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value. + * + * @return int The error code from last formatter call + * + * @see https://php.net/intldateformatter.geterrorcode + */ + public function getErrorCode() + { + return $this->errorCode; + } + + /** + * Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value. + * + * @return string The error message from last formatter call + * + * @see https://php.net/intldateformatter.geterrormessage + */ + public function getErrorMessage() + { + return $this->errorMessage; + } + + /** + * Returns the formatter's locale. + * + * @param int $type Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE) + * + * @return string The locale used to create the formatter. Currently always + * returns "en". + * + * @see https://php.net/intldateformatter.getlocale + */ + public function getLocale(int $type = Locale::ACTUAL_LOCALE) + { + return 'en'; + } + + /** + * Returns the formatter's pattern. + * + * @return string The pattern string used by the formatter + * + * @see https://php.net/intldateformatter.getpattern + */ + public function getPattern() + { + return $this->pattern; + } + + /** + * Returns the formatter's time type. + * + * @return int The time type used by the formatter + * + * @see https://php.net/intldateformatter.gettimetype + */ + public function getTimeType() + { + return $this->timeType; + } + + /** + * Returns the formatter's timezone identifier. + * + * @return string The timezone identifier used by the formatter + * + * @see https://php.net/intldateformatter.gettimezoneid + */ + public function getTimeZoneId() + { + if (!$this->uninitializedTimeZoneId) { + return $this->timezoneId; + } + + return date_default_timezone_get(); + } + + /** + * Not supported. Returns the formatter's timezone. + * + * @return mixed The timezone used by the formatter + * + * @see https://php.net/intldateformatter.gettimezone + * + * @throws MethodNotImplementedException + */ + public function getTimeZone() + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns whether the formatter is lenient. + * + * @return bool Currently always returns false + * + * @see https://php.net/intldateformatter.islenient + * + * @throws MethodNotImplementedException + */ + public function isLenient() + { + return false; + } + + /** + * Not supported. Parse string to a field-based time value. + * + * @return string Localtime compatible array of integers: contains 24 hour clock value in tm_hour field + * + * @see https://php.net/intldateformatter.localtime + * + * @throws MethodNotImplementedException + */ + public function localtime(string $string, &$offset = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Parse string to a timestamp value. + * + * @return int|false Parsed value as a timestamp + * + * @see https://php.net/intldateformatter.parse + * + * @throws MethodArgumentNotImplementedException When $offset different than null, behavior not implemented + */ + public function parse(string $string, &$offset = null) + { + // We don't calculate the position when parsing the value + if (null !== $offset) { + throw new MethodArgumentNotImplementedException(__METHOD__, 'offset'); + } + + $dateTime = $this->createDateTime(0); + $transformer = new FullTransformer($this->getPattern(), $this->getTimeZoneId()); + + $timestamp = $transformer->parse($dateTime, $string); + + // behave like the intl extension. FullTransformer::parse() set the proper error + $this->errorCode = Icu::getErrorCode(); + $this->errorMessage = Icu::getErrorMessage(); + + return $timestamp; + } + + /** + * Not supported. Set the formatter's calendar. + * + * @param \IntlCalendar|int|null $calendar + * + * @return bool true on success or false on failure + * + * @see https://php.net/intldateformatter.setcalendar + * + * @throws MethodNotImplementedException + */ + public function setCalendar($calendar) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Set the leniency of the parser. + * + * Define if the parser is strict or lenient in interpreting inputs that do not match the pattern + * exactly. Enabling lenient parsing allows the parser to accept otherwise flawed date or time + * patterns, parsing as much as possible to obtain a value. Extra space, unrecognized tokens, or + * invalid values ("February 30th") are not accepted. + * + * @param bool $lenient Sets whether the parser is lenient or not. Currently + * only false (strict) is supported. + * + * @return bool true on success or false on failure + * + * @see https://php.net/intldateformatter.setlenient + * + * @throws MethodArgumentValueNotImplementedException When $lenient is true + */ + public function setLenient(bool $lenient) + { + if ($lenient) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'lenient', $lenient, 'Only the strict parser is supported'); + } + + return true; + } + + /** + * Set the formatter's pattern. + * + * @return bool true on success or false on failure + * + * @see https://php.net/intldateformatter.setpattern + * @see http://userguide.icu-project.org/formatparse/datetime + */ + public function setPattern(string $pattern) + { + $this->pattern = $pattern; + + return true; + } + + /** + * Sets formatterʼs timezone. + * + * @param \IntlTimeZone|\DateTimeZone|string|null $timezone + * + * @return bool true on success or false on failure + * + * @see https://php.net/intldateformatter.settimezone + */ + public function setTimeZone($timezone) + { + if ($timezone instanceof \IntlTimeZone) { + $timezone = $timezone->getID(); + } + + if ($timezone instanceof \DateTimeZone) { + $timezone = $timezone->getName(); + + // DateTimeZone returns the GMT offset timezones without the leading GMT, while our parsing requires it. + if (!empty($timezone) && ('+' === $timezone[0] || '-' === $timezone[0])) { + $timezone = 'GMT'.$timezone; + } + } + + if (null === $timezone) { + $timezone = date_default_timezone_get(); + + $this->uninitializedTimeZoneId = true; + } + + // Backup original passed time zone + $timezoneId = $timezone; + + // Get an Etc/GMT time zone that is accepted for \DateTimeZone + if ('GMT' !== $timezone && 0 === strpos($timezone, 'GMT')) { + try { + $timezone = DateFormat\TimezoneTransformer::getEtcTimeZoneId($timezone); + } catch (\InvalidArgumentException $e) { + // Does nothing, will fallback to UTC + } + } + + try { + $this->dateTimeZone = new \DateTimeZone($timezone); + if ('GMT' !== $timezone && $this->dateTimeZone->getName() !== $timezone) { + $timezoneId = $this->getTimeZoneId(); + } + } catch (\Exception $e) { + $timezoneId = $timezone = $this->getTimeZoneId(); + $this->dateTimeZone = new \DateTimeZone($timezone); + } + + $this->timezoneId = $timezoneId; + + return true; + } + + /** + * Create and returns a DateTime object with the specified timestamp and with the + * current time zone. + * + * @return \DateTime + */ + protected function createDateTime($timestamp) + { + $dateTime = \DateTime::createFromFormat('U', $timestamp); + $dateTime->setTimezone($this->dateTimeZone); + + return $dateTime; + } + + /** + * Returns a pattern string based in the datetype and timetype values. + * + * @return string + */ + protected function getDefaultPattern() + { + $pattern = ''; + if (self::NONE !== $this->dateType) { + $pattern = $this->defaultDateFormats[$this->dateType]; + } + if (self::NONE !== $this->timeType) { + if (\in_array($this->dateType, [self::FULL, self::LONG, self::RELATIVE_FULL, self::RELATIVE_LONG], true)) { + $pattern .= ' \'at\' '; + } elseif (self::NONE !== $this->dateType) { + $pattern .= ', '; + } + $pattern .= $this->defaultTimeFormats[$this->timeType]; + } + + return $pattern; + } + + private function getRelativeDateFormat(int $timestamp): string + { + $today = $this->createDateTime(time()); + $today->setTime(0, 0, 0); + + $datetime = $this->createDateTime($timestamp); + $datetime->setTime(0, 0, 0); + + $interval = $today->diff($datetime); + + if (false !== $interval) { + if (0 === $interval->days) { + return 'today'; + } + + if (1 === $interval->days) { + return 1 === $interval->invert ? 'yesterday' : 'tomorrow'; + } + } + + return ''; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/LICENSE b/vendor/symfony/polyfill-intl-icu/LICENSE new file mode 100644 index 0000000..9e936ec --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-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-intl-icu/Locale.php b/vendor/symfony/polyfill-intl-icu/Locale.php new file mode 100644 index 0000000..91a157d --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Locale.php @@ -0,0 +1,310 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +use Symfony\Polyfill\Intl\Icu\Exception\MethodNotImplementedException; + +/** + * Replacement for PHP's native {@link \Locale} class. + * + * The only methods supported in this class are `getDefault` and `canonicalize`. + * All other methods will throw an exception when used. + * + * @author Eriksen Costa + * @author Bernhard Schussek + * + * @internal + */ +abstract class Locale +{ + public const DEFAULT_LOCALE = null; + + /* Locale method constants */ + public const ACTUAL_LOCALE = 0; + public const VALID_LOCALE = 1; + + /* Language tags constants */ + public const LANG_TAG = 'language'; + public const EXTLANG_TAG = 'extlang'; + public const SCRIPT_TAG = 'script'; + public const REGION_TAG = 'region'; + public const VARIANT_TAG = 'variant'; + public const GRANDFATHERED_LANG_TAG = 'grandfathered'; + public const PRIVATE_TAG = 'private'; + + /** + * Not supported. Returns the best available locale based on HTTP "Accept-Language" header according to RFC 2616. + * + * @return string The corresponding locale code + * + * @see https://php.net/locale.acceptfromhttp + * + * @throws MethodNotImplementedException + */ + public static function acceptFromHttp(string $header) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns a canonicalized locale string. + * + * This polyfill doesn't implement the full-spec algorithm. It only + * canonicalizes locale strings handled by the `LocaleBundle` class. + * + * @return string + */ + public static function canonicalize(string $locale) + { + if ('' === $locale || '.' === $locale[0]) { + return self::getDefault(); + } + + if (!preg_match('/^([a-z]{2})[-_]([a-z]{2})(?:([a-z]{2})(?:[-_]([a-z]{2}))?)?(?:\..*)?$/i', $locale, $m)) { + return $locale; + } + + if (!empty($m[4])) { + return strtolower($m[1]).'_'.ucfirst(strtolower($m[2].$m[3])).'_'.strtoupper($m[4]); + } + + if (!empty($m[3])) { + return strtolower($m[1]).'_'.ucfirst(strtolower($m[2].$m[3])); + } + + return strtolower($m[1]).'_'.strtoupper($m[2]); + } + + /** + * Not supported. Returns a correctly ordered and delimited locale code. + * + * @return string The corresponding locale code + * + * @see https://php.net/locale.composelocale + * + * @throws MethodNotImplementedException + */ + public static function composeLocale(array $subtags) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Checks if a language tag filter matches with locale. + * + * @return string The corresponding locale code + * + * @see https://php.net/locale.filtermatches + * + * @throws MethodNotImplementedException + */ + public static function filterMatches(string $languageTag, string $locale, bool $canonicalize = false) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the variants for the input locale. + * + * @return array The locale variants + * + * @see https://php.net/locale.getallvariants + * + * @throws MethodNotImplementedException + */ + public static function getAllVariants(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Returns the default locale. + * + * @return string The default locale code. Always returns 'en' + * + * @see https://php.net/locale.getdefault + */ + public static function getDefault() + { + return 'en'; + } + + /** + * Not supported. Returns the localized display name for the locale language. + * + * @return string The localized language display name + * + * @see https://php.net/locale.getdisplaylanguage + * + * @throws MethodNotImplementedException + */ + public static function getDisplayLanguage(string $locale, string $displayLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the localized display name for the locale. + * + * @return string The localized locale display name + * + * @see https://php.net/locale.getdisplayname + * + * @throws MethodNotImplementedException + */ + public static function getDisplayName(string $locale, string $displayLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the localized display name for the locale region. + * + * @return string The localized region display name + * + * @see https://php.net/locale.getdisplayregion + * + * @throws MethodNotImplementedException + */ + public static function getDisplayRegion(string $locale, string $displayLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the localized display name for the locale script. + * + * @return string The localized script display name + * + * @see https://php.net/locale.getdisplayscript + * + * @throws MethodNotImplementedException + */ + public static function getDisplayScript(string $locale, string $displayLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the localized display name for the locale variant. + * + * @return string The localized variant display name + * + * @see https://php.net/locale.getdisplayvariant + * + * @throws MethodNotImplementedException + */ + public static function getDisplayVariant(string $locale, string $displayLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the keywords for the locale. + * + * @return array Associative array with the extracted variants + * + * @see https://php.net/locale.getkeywords + * + * @throws MethodNotImplementedException + */ + public static function getKeywords(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the primary language for the locale. + * + * @return string|null The extracted language code or null in case of error + * + * @see https://php.net/locale.getprimarylanguage + * + * @throws MethodNotImplementedException + */ + public static function getPrimaryLanguage(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the region for the locale. + * + * @return string|null The extracted region code or null if not present + * + * @see https://php.net/locale.getregion + * + * @throws MethodNotImplementedException + */ + public static function getRegion(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the script for the locale. + * + * @return string|null The extracted script code or null if not present + * + * @see https://php.net/locale.getscript + * + * @throws MethodNotImplementedException + */ + public static function getScript(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns the closest language tag for the locale. + * + * @see https://php.net/locale.lookup + * + * @throws MethodNotImplementedException + */ + public static function lookup(array $languageTag, string $locale, bool $canonicalize = false, string $defaultLocale = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns an associative array of locale identifier subtags. + * + * @return array Associative array with the extracted subtags + * + * @see https://php.net/locale.parselocale + * + * @throws MethodNotImplementedException + */ + public static function parseLocale(string $locale) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Sets the default runtime locale. + * + * @return bool true on success or false on failure + * + * @see https://php.net/locale.setdefault + * + * @throws MethodNotImplementedException + */ + public static function setDefault(string $locale) + { + if ('en' !== $locale) { + throw new MethodNotImplementedException(__METHOD__); + } + + return true; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/NumberFormatter.php b/vendor/symfony/polyfill-intl-icu/NumberFormatter.php new file mode 100644 index 0000000..9c79e3f --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/NumberFormatter.php @@ -0,0 +1,835 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Intl\Icu; + +use Symfony\Polyfill\Intl\Icu\Exception\MethodArgumentNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\MethodArgumentValueNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\MethodNotImplementedException; +use Symfony\Polyfill\Intl\Icu\Exception\NotImplementedException; + +/** + * Replacement for PHP's native {@link \NumberFormatter} class. + * + * The only methods currently supported in this class are: + * + * - {@link __construct} + * - {@link create} + * - {@link formatCurrency} + * - {@link format} + * - {@link getAttribute} + * - {@link getErrorCode} + * - {@link getErrorMessage} + * - {@link getLocale} + * - {@link parse} + * - {@link setAttribute} + * + * @author Eriksen Costa + * @author Bernhard Schussek + * + * @internal + */ +abstract class NumberFormatter +{ + /* Format style constants */ + public const PATTERN_DECIMAL = 0; + public const DECIMAL = 1; + public const CURRENCY = 2; + public const PERCENT = 3; + public const SCIENTIFIC = 4; + public const SPELLOUT = 5; + public const ORDINAL = 6; + public const DURATION = 7; + public const PATTERN_RULEBASED = 9; + public const IGNORE = 0; + public const DEFAULT_STYLE = 1; + + /* Format type constants */ + public const TYPE_DEFAULT = 0; + public const TYPE_INT32 = 1; + public const TYPE_INT64 = 2; + public const TYPE_DOUBLE = 3; + public const TYPE_CURRENCY = 4; + + /* Numeric attribute constants */ + public const PARSE_INT_ONLY = 0; + public const GROUPING_USED = 1; + public const DECIMAL_ALWAYS_SHOWN = 2; + public const MAX_INTEGER_DIGITS = 3; + public const MIN_INTEGER_DIGITS = 4; + public const INTEGER_DIGITS = 5; + public const MAX_FRACTION_DIGITS = 6; + public const MIN_FRACTION_DIGITS = 7; + public const FRACTION_DIGITS = 8; + public const MULTIPLIER = 9; + public const GROUPING_SIZE = 10; + public const ROUNDING_MODE = 11; + public const ROUNDING_INCREMENT = 12; + public const FORMAT_WIDTH = 13; + public const PADDING_POSITION = 14; + public const SECONDARY_GROUPING_SIZE = 15; + public const SIGNIFICANT_DIGITS_USED = 16; + public const MIN_SIGNIFICANT_DIGITS = 17; + public const MAX_SIGNIFICANT_DIGITS = 18; + public const LENIENT_PARSE = 19; + + /* Text attribute constants */ + public const POSITIVE_PREFIX = 0; + public const POSITIVE_SUFFIX = 1; + public const NEGATIVE_PREFIX = 2; + public const NEGATIVE_SUFFIX = 3; + public const PADDING_CHARACTER = 4; + public const CURRENCY_CODE = 5; + public const DEFAULT_RULESET = 6; + public const PUBLIC_RULESETS = 7; + + /* Format symbol constants */ + public const DECIMAL_SEPARATOR_SYMBOL = 0; + public const GROUPING_SEPARATOR_SYMBOL = 1; + public const PATTERN_SEPARATOR_SYMBOL = 2; + public const PERCENT_SYMBOL = 3; + public const ZERO_DIGIT_SYMBOL = 4; + public const DIGIT_SYMBOL = 5; + public const MINUS_SIGN_SYMBOL = 6; + public const PLUS_SIGN_SYMBOL = 7; + public const CURRENCY_SYMBOL = 8; + public const INTL_CURRENCY_SYMBOL = 9; + public const MONETARY_SEPARATOR_SYMBOL = 10; + public const EXPONENTIAL_SYMBOL = 11; + public const PERMILL_SYMBOL = 12; + public const PAD_ESCAPE_SYMBOL = 13; + public const INFINITY_SYMBOL = 14; + public const NAN_SYMBOL = 15; + public const SIGNIFICANT_DIGIT_SYMBOL = 16; + public const MONETARY_GROUPING_SEPARATOR_SYMBOL = 17; + + /* Rounding mode values used by NumberFormatter::setAttribute() with NumberFormatter::ROUNDING_MODE attribute */ + public const ROUND_CEILING = 0; + public const ROUND_FLOOR = 1; + public const ROUND_DOWN = 2; + public const ROUND_UP = 3; + public const ROUND_HALFEVEN = 4; + public const ROUND_HALFDOWN = 5; + public const ROUND_HALFUP = 6; + + /* Pad position values used by NumberFormatter::setAttribute() with NumberFormatter::PADDING_POSITION attribute */ + public const PAD_BEFORE_PREFIX = 0; + public const PAD_AFTER_PREFIX = 1; + public const PAD_BEFORE_SUFFIX = 2; + public const PAD_AFTER_SUFFIX = 3; + + /** + * The error code from the last operation. + * + * @var int + */ + protected $errorCode = Icu::U_ZERO_ERROR; + + /** + * The error message from the last operation. + * + * @var string + */ + protected $errorMessage = 'U_ZERO_ERROR'; + + /** + * @var int + */ + private $style; + + /** + * Default values for the en locale. + */ + private $attributes = [ + self::FRACTION_DIGITS => 0, + self::GROUPING_USED => 1, + self::ROUNDING_MODE => self::ROUND_HALFEVEN, + ]; + + /** + * Holds the initialized attributes code. + */ + private $initializedAttributes = []; + + /** + * The supported styles to the constructor $styles argument. + */ + private static $supportedStyles = [ + 'CURRENCY' => self::CURRENCY, + 'DECIMAL' => self::DECIMAL, + ]; + + /** + * Supported attributes to the setAttribute() $attr argument. + */ + private static $supportedAttributes = [ + 'FRACTION_DIGITS' => self::FRACTION_DIGITS, + 'GROUPING_USED' => self::GROUPING_USED, + 'ROUNDING_MODE' => self::ROUNDING_MODE, + ]; + + /** + * The available rounding modes for setAttribute() usage with + * NumberFormatter::ROUNDING_MODE. NumberFormatter::ROUND_DOWN + * and NumberFormatter::ROUND_UP does not have a PHP only equivalent. + */ + private static $roundingModes = [ + 'ROUND_HALFEVEN' => self::ROUND_HALFEVEN, + 'ROUND_HALFDOWN' => self::ROUND_HALFDOWN, + 'ROUND_HALFUP' => self::ROUND_HALFUP, + 'ROUND_CEILING' => self::ROUND_CEILING, + 'ROUND_FLOOR' => self::ROUND_FLOOR, + 'ROUND_DOWN' => self::ROUND_DOWN, + 'ROUND_UP' => self::ROUND_UP, + ]; + + /** + * The mapping between NumberFormatter rounding modes to the available + * modes in PHP's round() function. + * + * @see https://php.net/round + */ + private static $phpRoundingMap = [ + self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN, + self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN, + self::ROUND_HALFUP => \PHP_ROUND_HALF_UP, + ]; + + /** + * The list of supported rounding modes which aren't available modes in + * PHP's round() function, but there's an equivalent. Keys are rounding + * modes, values does not matter. + */ + private static $customRoundingList = [ + self::ROUND_CEILING => true, + self::ROUND_FLOOR => true, + self::ROUND_DOWN => true, + self::ROUND_UP => true, + ]; + + /** + * The maximum value of the integer type in 32 bit platforms. + */ + private static $int32Max = 2147483647; + + /** + * The maximum value of the integer type in 64 bit platforms. + * + * @var int|float + */ + private static $int64Max = 9223372036854775807; + + private static $enSymbols = [ + self::DECIMAL => ['.', ',', ';', '%', '0', '#', '-', '+', '¤', '¤¤', '.', 'E', '‰', '*', '∞', 'NaN', '@', ','], + self::CURRENCY => ['.', ',', ';', '%', '0', '#', '-', '+', '¤', '¤¤', '.', 'E', '‰', '*', '∞', 'NaN', '@', ','], + ]; + + private static $enTextAttributes = [ + self::DECIMAL => ['', '', '-', '', ' ', 'XXX', ''], + self::CURRENCY => ['¤', '', '-¤', '', ' ', 'XXX'], + ]; + + /** + * @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en") + * @param int $style Style of the formatting, one of the format style constants. + * The only supported styles are NumberFormatter::DECIMAL + * and NumberFormatter::CURRENCY. + * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or + * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax + * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation + * + * @see https://php.net/numberformatter.create + * @see https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1DecimalFormat.html#details + * @see https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1RuleBasedNumberFormat.html#details + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + * @throws MethodArgumentValueNotImplementedException When the $style is not supported + * @throws MethodArgumentNotImplementedException When the pattern value is different than null + */ + public function __construct(?string $locale = 'en', int $style = null, string $pattern = null) + { + if ('en' !== $locale && null !== $locale) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported'); + } + + if (!\in_array($style, self::$supportedStyles)) { + $message = sprintf('The available styles are: %s.', implode(', ', array_keys(self::$supportedStyles))); + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'style', $style, $message); + } + + if (null !== $pattern) { + throw new MethodArgumentNotImplementedException(__METHOD__, 'pattern'); + } + + $this->style = $style; + } + + /** + * Static constructor. + * + * @param string|null $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en") + * @param int $style Style of the formatting, one of the format style constants. + * The only currently supported styles are NumberFormatter::DECIMAL + * and NumberFormatter::CURRENCY. + * @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or + * NumberFormat::PATTERN_RULEBASED. It must conform to the syntax + * described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation + * + * @return static + * + * @see https://php.net/numberformatter.create + * @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details + * @see http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#_details + * + * @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed + * @throws MethodArgumentValueNotImplementedException When the $style is not supported + * @throws MethodArgumentNotImplementedException When the pattern value is different than null + */ + public static function create(?string $locale = 'en', int $style = null, string $pattern = null) + { + return new static($locale, $style, $pattern); + } + + /** + * Format a currency value. + * + * @return string The formatted currency value + * + * @see https://php.net/numberformatter.formatcurrency + * @see https://en.wikipedia.org/wiki/ISO_4217#Active_codes + */ + public function formatCurrency(float $amount, string $currency) + { + if (self::DECIMAL === $this->style) { + return $this->format($amount); + } + + if (null === $symbol = Currencies::getSymbol($currency)) { + return false; + } + $fractionDigits = Currencies::getFractionDigits($currency); + + $amount = $this->roundCurrency($amount, $currency); + + $negative = false; + if (0 > $amount) { + $negative = true; + $amount *= -1; + } + + $amount = $this->formatNumber($amount, $fractionDigits); + + // There's a non-breaking space after the currency code (i.e. CRC 100), but not if the currency has a symbol (i.e. £100). + $ret = $symbol.(mb_strlen($symbol, 'UTF-8') > 2 ? "\xc2\xa0" : '').$amount; + + return $negative ? '-'.$ret : $ret; + } + + /** + * Format a number. + * + * @param int|float $num The value to format + * @param int $type Type of the formatting, one of the format type constants. + * Only type NumberFormatter::TYPE_DEFAULT is currently supported. + * + * @return bool|string The formatted value or false on error + * + * @see https://php.net/numberformatter.format + * + * @throws NotImplementedException If the method is called with the class $style 'CURRENCY' + * @throws MethodArgumentValueNotImplementedException If the $type is different than TYPE_DEFAULT + */ + public function format($num, int $type = self::TYPE_DEFAULT) + { + // The original NumberFormatter does not support this format type + if (self::TYPE_CURRENCY === $type) { + if (\PHP_VERSION_ID >= 80000) { + throw new \ValueError(sprintf('The format type must be a NumberFormatter::TYPE_* constant (%s given).', $type)); + } + + trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); + + return false; + } + + if (self::CURRENCY === $this->style) { + throw new NotImplementedException(sprintf('"%s()" method does not support the formatting of currencies (instance with CURRENCY style). "%s".', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE)); + } + + // Only the default type is supported. + if (self::TYPE_DEFAULT !== $type) { + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'type', $type, 'Only TYPE_DEFAULT is supported'); + } + + $fractionDigits = $this->getAttribute(self::FRACTION_DIGITS); + + $num = $this->round($num, $fractionDigits); + $num = $this->formatNumber($num, $fractionDigits); + + // behave like the intl extension + $this->resetError(); + + return $num; + } + + /** + * Returns an attribute value. + * + * @return int|false The attribute value on success or false on error + * + * @see https://php.net/numberformatter.getattribute + */ + public function getAttribute(int $attribute) + { + return $this->attributes[$attribute] ?? null; + } + + /** + * Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value. + * + * @return int The error code from last formatter call + * + * @see https://php.net/numberformatter.geterrorcode + */ + public function getErrorCode() + { + return $this->errorCode; + } + + /** + * Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value. + * + * @return string The error message from last formatter call + * + * @see https://php.net/numberformatter.geterrormessage + */ + public function getErrorMessage() + { + return $this->errorMessage; + } + + /** + * Returns the formatter's locale. + * + * The parameter $type is currently ignored. + * + * @param int $type Not supported. The locale name type to return (Locale::VALID_LOCALE or Locale::ACTUAL_LOCALE) + * + * @return string The locale used to create the formatter. Currently always + * returns "en". + * + * @see https://php.net/numberformatter.getlocale + */ + public function getLocale(int $type = Locale::ACTUAL_LOCALE) + { + return 'en'; + } + + /** + * Not supported. Returns the formatter's pattern. + * + * @return string|false The pattern string used by the formatter or false on error + * + * @see https://php.net/numberformatter.getpattern + * + * @throws MethodNotImplementedException + */ + public function getPattern() + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Returns a formatter symbol value. + * + * @return string|false The symbol value or false on error + * + * @see https://php.net/numberformatter.getsymbol + */ + public function getSymbol(int $symbol) + { + return \array_key_exists($this->style, self::$enSymbols) && \array_key_exists($symbol, self::$enSymbols[$this->style]) ? self::$enSymbols[$this->style][$symbol] : false; + } + + /** + * Not supported. Returns a formatter text attribute value. + * + * @return string|false The attribute value or false on error + * + * @see https://php.net/numberformatter.gettextattribute + */ + public function getTextAttribute(int $attribute) + { + return \array_key_exists($this->style, self::$enTextAttributes) && \array_key_exists($attribute, self::$enTextAttributes[$this->style]) ? self::$enTextAttributes[$this->style][$attribute] : false; + } + + /** + * Not supported. Parse a currency number. + * + * @return float|false The parsed numeric value or false on error + * + * @see https://php.net/numberformatter.parsecurrency + * + * @throws MethodNotImplementedException + */ + public function parseCurrency(string $string, &$currency, &$offset = null) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Parse a number. + * + * @return int|float|false The parsed value or false on error + * + * @see https://php.net/numberformatter.parse + */ + public function parse(string $string, int $type = self::TYPE_DOUBLE, &$offset = null) + { + if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) { + if (\PHP_VERSION_ID >= 80000) { + throw new \ValueError(sprintf('The format type must be a NumberFormatter::TYPE_* constant (%d given).', $type)); + } + + trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING); + + return false; + } + + // Any invalid number at the end of the string is removed. + // Only numbers and the fraction separator is expected in the string. + // If grouping is used, grouping separator also becomes a valid character. + $groupingMatch = $this->getAttribute(self::GROUPING_USED) ? '|(?P\d++(,{1}\d+)++(\.\d*+)?)' : ''; + if (preg_match("/^-?(?:\.\d++{$groupingMatch}|\d++(\.\d*+)?)/", $string, $matches)) { + $string = $matches[0]; + $offset = \strlen($string); + // value is not valid if grouping is used, but digits are not grouped in groups of three + if ($error = isset($matches['grouping']) && !preg_match('/^-?(?:\d{1,3}+)?(?:(?:,\d{3})++|\d*+)(?:\.\d*+)?$/', $string)) { + // the position on error is 0 for positive and 1 for negative numbers + $offset = 0 === strpos($string, '-') ? 1 : 0; + } + } else { + $error = true; + $offset = 0; + } + + if ($error) { + Icu::setError(Icu::U_PARSE_ERROR, 'Number parsing failed'); + $this->errorCode = Icu::getErrorCode(); + $this->errorMessage = Icu::getErrorMessage(); + + return false; + } + + $string = str_replace(',', '', $string); + $string = $this->convertValueDataType($string, $type); + + // behave like the intl extension + $this->resetError(); + + return $string; + } + + /** + * Set an attribute. + * + * @param int|float $value + * + * @return bool true on success or false on failure + * + * @see https://php.net/numberformatter.setattribute + * + * @throws MethodArgumentValueNotImplementedException When the $attribute is not supported + * @throws MethodArgumentValueNotImplementedException When the $value is not supported + */ + public function setAttribute(int $attribute, $value) + { + if (!\in_array($attribute, self::$supportedAttributes)) { + $message = sprintf( + 'The available attributes are: %s', + implode(', ', array_keys(self::$supportedAttributes)) + ); + + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'attribute', $value, $message); + } + + if (self::$supportedAttributes['ROUNDING_MODE'] === $attribute && $this->isInvalidRoundingMode($value)) { + $message = sprintf( + 'The supported values for ROUNDING_MODE are: %s', + implode(', ', array_keys(self::$roundingModes)) + ); + + throw new MethodArgumentValueNotImplementedException(__METHOD__, 'attribute', $value, $message); + } + + if (self::$supportedAttributes['GROUPING_USED'] === $attribute) { + $value = $this->normalizeGroupingUsedValue($value); + } + + if (self::$supportedAttributes['FRACTION_DIGITS'] === $attribute) { + $value = $this->normalizeFractionDigitsValue($value); + if ($value < 0) { + // ignore negative values but do not raise an error + return true; + } + } + + $this->attributes[$attribute] = $value; + $this->initializedAttributes[$attribute] = true; + + return true; + } + + /** + * Not supported. Set the formatter's pattern. + * + * @return bool true on success or false on failure + * + * @see https://php.net/numberformatter.setpattern + * @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details + * + * @throws MethodNotImplementedException + */ + public function setPattern(string $pattern) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Set the formatter's symbol. + * + * @return bool true on success or false on failure + * + * @see https://php.net/numberformatter.setsymbol + * + * @throws MethodNotImplementedException + */ + public function setSymbol(int $symbol, string $value) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Not supported. Set a text attribute. + * + * @return bool true on success or false on failure + * + * @see https://php.net/numberformatter.settextattribute + * + * @throws MethodNotImplementedException + */ + public function setTextAttribute(int $attribute, string $value) + { + throw new MethodNotImplementedException(__METHOD__); + } + + /** + * Set the error to the default U_ZERO_ERROR. + */ + protected function resetError() + { + Icu::setError(Icu::U_ZERO_ERROR); + $this->errorCode = Icu::getErrorCode(); + $this->errorMessage = Icu::getErrorMessage(); + } + + /** + * Rounds a currency value, applying increment rounding if applicable. + * + * When a currency have a rounding increment, an extra round is made after the first one. The rounding factor is + * determined in the ICU data and is explained as of: + * + * "the rounding increment is given in units of 10^(-fraction_digits)" + * + * The only actual rounding data as of this writing, is CHF. + * + * @see http://en.wikipedia.org/wiki/Swedish_rounding + * @see http://www.docjar.com/html/api/com/ibm/icu/util/Currency.java.html#1007 + */ + private function roundCurrency(float $value, string $currency): float + { + $fractionDigits = Currencies::getFractionDigits($currency); + $roundingIncrement = Currencies::getRoundingIncrement($currency); + + // Round with the formatter rounding mode + $value = $this->round($value, $fractionDigits); + + // Swiss rounding + if (0 < $roundingIncrement && 0 < $fractionDigits) { + $roundingFactor = $roundingIncrement / 10 ** $fractionDigits; + $value = round($value / $roundingFactor) * $roundingFactor; + } + + return $value; + } + + /** + * Rounds a value. + * + * @param int|float $value The value to round + * + * @return int|float The rounded value + */ + private function round($value, int $precision) + { + $precision = $this->getUninitializedPrecision($value, $precision); + + $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE); + if (isset(self::$phpRoundingMap[$roundingModeAttribute])) { + $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]); + } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) { + $roundingCoef = 10 ** $precision; + $value *= $roundingCoef; + $value = (float) (string) $value; + + switch ($roundingModeAttribute) { + case self::ROUND_CEILING: + $value = ceil($value); + break; + case self::ROUND_FLOOR: + $value = floor($value); + break; + case self::ROUND_UP: + $value = $value > 0 ? ceil($value) : floor($value); + break; + case self::ROUND_DOWN: + $value = $value > 0 ? floor($value) : ceil($value); + break; + } + + $value /= $roundingCoef; + } + + return $value; + } + + /** + * Formats a number. + * + * @param int|float $value The numeric value to format + */ + private function formatNumber($value, int $precision): string + { + $precision = $this->getUninitializedPrecision($value, $precision); + + return number_format($value, $precision, '.', $this->getAttribute(self::GROUPING_USED) ? ',' : ''); + } + + /** + * Returns the precision value if the DECIMAL style is being used and the FRACTION_DIGITS attribute is uninitialized. + * + * @param int|float $value The value to get the precision from if the FRACTION_DIGITS attribute is uninitialized + */ + private function getUninitializedPrecision($value, int $precision): int + { + if (self::CURRENCY === $this->style) { + return $precision; + } + + if (!$this->isInitializedAttribute(self::FRACTION_DIGITS)) { + preg_match('/.*\.(.*)/', (string) $value, $digits); + if (isset($digits[1])) { + $precision = \strlen($digits[1]); + } + } + + return $precision; + } + + /** + * Check if the attribute is initialized (value set by client code). + */ + private function isInitializedAttribute(string $attr): bool + { + return isset($this->initializedAttributes[$attr]); + } + + /** + * Returns the numeric value using the $type to convert to the right data type. + * + * @param mixed $value The value to be converted + * + * @return int|float|false The converted value + */ + private function convertValueDataType($value, int $type) + { + if (self::TYPE_DOUBLE === $type) { + $value = (float) $value; + } elseif (self::TYPE_INT32 === $type) { + $value = $this->getInt32Value($value); + } elseif (self::TYPE_INT64 === $type) { + $value = $this->getInt64Value($value); + } + + return $value; + } + + /** + * Convert the value data type to int or returns false if the value is out of the integer value range. + * + * @return int|false The converted value + */ + private function getInt32Value($value) + { + if ($value > self::$int32Max || $value < -self::$int32Max - 1) { + return false; + } + + return (int) $value; + } + + /** + * Convert the value data type to int or returns false if the value is out of the integer value range. + * + * @return int|float|false The converted value + */ + private function getInt64Value($value) + { + if ($value > self::$int64Max || $value < -self::$int64Max - 1) { + return false; + } + + if (\PHP_INT_SIZE !== 8 && ($value > self::$int32Max || $value < -self::$int32Max - 1)) { + return (float) $value; + } + + return (int) $value; + } + + /** + * Check if the rounding mode is invalid. + */ + private function isInvalidRoundingMode(int $value): bool + { + if (\in_array($value, self::$roundingModes, true)) { + return false; + } + + return true; + } + + /** + * Returns the normalized value for the GROUPING_USED attribute. Any value that can be converted to int will be + * cast to Boolean and then to int again. This way, negative values are converted to 1 and string values to 0. + */ + private function normalizeGroupingUsedValue($value): int + { + return (int) (bool) (int) $value; + } + + /** + * Returns the normalized value for the FRACTION_DIGITS attribute. + */ + private function normalizeFractionDigitsValue($value): int + { + return (int) $value; + } +} diff --git a/vendor/symfony/polyfill-intl-icu/README.md b/vendor/symfony/polyfill-intl-icu/README.md new file mode 100644 index 0000000..2eccdc6 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/README.md @@ -0,0 +1,23 @@ +Symfony Polyfill / Intl: ICU +============================ + +This package provides fallback implementations when the +[Intl](https://php.net/intl) extension is not installed. +It is limited to the "en" locale and to: + +- [`intl_is_failure()`](https://php.net/intl-is-failure) +- [`intl_get_error_code()`](https://php.net/intl-get-error-code) +- [`intl_get_error_message()`](https://php.net/intl-get-error-message) +- [`intl_error_name()`](https://php.net/intl-error-name) +- [`Collator`](https://php.net/Collator) +- [`NumberFormatter`](https://php.net/NumberFormatter) +- [`Locale`](https://php.net/Locale) +- [`IntlDateFormatter`](https://php.net/IntlDateFormatter) + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-intl-icu/Resources/currencies.php b/vendor/symfony/polyfill-intl-icu/Resources/currencies.php new file mode 100644 index 0000000..6cd5c32 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Resources/currencies.php @@ -0,0 +1,1311 @@ + + array ( + 0 => 'ADP', + 1 => 0, + 2 => 0, + ), + 'AED' => + array ( + 0 => 'AED', + ), + 'AFA' => + array ( + 0 => 'AFA', + ), + 'AFN' => + array ( + 0 => 'AFN', + 1 => 0, + 2 => 0, + ), + 'ALK' => + array ( + 0 => 'ALK', + ), + 'ALL' => + array ( + 0 => 'ALL', + 1 => 0, + 2 => 0, + ), + 'AMD' => + array ( + 0 => 'AMD', + 1 => 2, + 2 => 0, + ), + 'ANG' => + array ( + 0 => 'ANG', + ), + 'AOA' => + array ( + 0 => 'AOA', + ), + 'AOK' => + array ( + 0 => 'AOK', + ), + 'AON' => + array ( + 0 => 'AON', + ), + 'AOR' => + array ( + 0 => 'AOR', + ), + 'ARA' => + array ( + 0 => 'ARA', + ), + 'ARL' => + array ( + 0 => 'ARL', + ), + 'ARM' => + array ( + 0 => 'ARM', + ), + 'ARP' => + array ( + 0 => 'ARP', + ), + 'ARS' => + array ( + 0 => 'ARS', + ), + 'ATS' => + array ( + 0 => 'ATS', + ), + 'AUD' => + array ( + 0 => 'A$', + ), + 'AWG' => + array ( + 0 => 'AWG', + ), + 'AZM' => + array ( + 0 => 'AZM', + ), + 'AZN' => + array ( + 0 => 'AZN', + ), + 'BAD' => + array ( + 0 => 'BAD', + ), + 'BAM' => + array ( + 0 => 'BAM', + ), + 'BAN' => + array ( + 0 => 'BAN', + ), + 'BBD' => + array ( + 0 => 'BBD', + ), + 'BDT' => + array ( + 0 => 'BDT', + ), + 'BEC' => + array ( + 0 => 'BEC', + ), + 'BEF' => + array ( + 0 => 'BEF', + ), + 'BEL' => + array ( + 0 => 'BEL', + ), + 'BGL' => + array ( + 0 => 'BGL', + ), + 'BGM' => + array ( + 0 => 'BGM', + ), + 'BGN' => + array ( + 0 => 'BGN', + ), + 'BGO' => + array ( + 0 => 'BGO', + ), + 'BHD' => + array ( + 0 => 'BHD', + 1 => 3, + 2 => 0, + ), + 'BIF' => + array ( + 0 => 'BIF', + 1 => 0, + 2 => 0, + ), + 'BMD' => + array ( + 0 => 'BMD', + ), + 'BND' => + array ( + 0 => 'BND', + ), + 'BOB' => + array ( + 0 => 'BOB', + ), + 'BOL' => + array ( + 0 => 'BOL', + ), + 'BOP' => + array ( + 0 => 'BOP', + ), + 'BOV' => + array ( + 0 => 'BOV', + ), + 'BRB' => + array ( + 0 => 'BRB', + ), + 'BRC' => + array ( + 0 => 'BRC', + ), + 'BRE' => + array ( + 0 => 'BRE', + ), + 'BRL' => + array ( + 0 => 'R$', + ), + 'BRN' => + array ( + 0 => 'BRN', + ), + 'BRR' => + array ( + 0 => 'BRR', + ), + 'BRZ' => + array ( + 0 => 'BRZ', + ), + 'BSD' => + array ( + 0 => 'BSD', + ), + 'BTN' => + array ( + 0 => 'BTN', + ), + 'BUK' => + array ( + 0 => 'BUK', + ), + 'BWP' => + array ( + 0 => 'BWP', + ), + 'BYB' => + array ( + 0 => 'BYB', + ), + 'BYN' => + array ( + 0 => 'BYN', + 1 => 2, + 2 => 0, + ), + 'BYR' => + array ( + 0 => 'BYR', + 1 => 0, + 2 => 0, + ), + 'BZD' => + array ( + 0 => 'BZD', + ), + 'CAD' => + array ( + 0 => 'CA$', + 1 => 2, + 2 => 0, + ), + 'CDF' => + array ( + 0 => 'CDF', + ), + 'CHE' => + array ( + 0 => 'CHE', + ), + 'CHF' => + array ( + 0 => 'CHF', + 1 => 2, + 2 => 0, + ), + 'CHW' => + array ( + 0 => 'CHW', + ), + 'CLE' => + array ( + 0 => 'CLE', + ), + 'CLF' => + array ( + 0 => 'CLF', + 1 => 4, + 2 => 0, + ), + 'CLP' => + array ( + 0 => 'CLP', + 1 => 0, + 2 => 0, + ), + 'CNH' => + array ( + 0 => 'CNH', + ), + 'CNX' => + array ( + 0 => 'CNX', + ), + 'CNY' => + array ( + 0 => 'CN¥', + ), + 'COP' => + array ( + 0 => 'COP', + 1 => 2, + 2 => 0, + ), + 'COU' => + array ( + 0 => 'COU', + ), + 'CRC' => + array ( + 0 => 'CRC', + 1 => 2, + 2 => 0, + ), + 'CSD' => + array ( + 0 => 'CSD', + ), + 'CSK' => + array ( + 0 => 'CSK', + ), + 'CUC' => + array ( + 0 => 'CUC', + ), + 'CUP' => + array ( + 0 => 'CUP', + ), + 'CVE' => + array ( + 0 => 'CVE', + ), + 'CYP' => + array ( + 0 => 'CYP', + ), + 'CZK' => + array ( + 0 => 'CZK', + 1 => 2, + 2 => 0, + ), + 'DDM' => + array ( + 0 => 'DDM', + ), + 'DEM' => + array ( + 0 => 'DEM', + ), + 'DJF' => + array ( + 0 => 'DJF', + 1 => 0, + 2 => 0, + ), + 'DKK' => + array ( + 0 => 'DKK', + 1 => 2, + 2 => 0, + ), + 'DOP' => + array ( + 0 => 'DOP', + ), + 'DZD' => + array ( + 0 => 'DZD', + ), + 'ECS' => + array ( + 0 => 'ECS', + ), + 'ECV' => + array ( + 0 => 'ECV', + ), + 'EEK' => + array ( + 0 => 'EEK', + ), + 'EGP' => + array ( + 0 => 'EGP', + ), + 'ERN' => + array ( + 0 => 'ERN', + ), + 'ESA' => + array ( + 0 => 'ESA', + ), + 'ESB' => + array ( + 0 => 'ESB', + ), + 'ESP' => + array ( + 0 => 'ESP', + 1 => 0, + 2 => 0, + ), + 'ETB' => + array ( + 0 => 'ETB', + ), + 'EUR' => + array ( + 0 => '€', + ), + 'FIM' => + array ( + 0 => 'FIM', + ), + 'FJD' => + array ( + 0 => 'FJD', + ), + 'FKP' => + array ( + 0 => 'FKP', + ), + 'FRF' => + array ( + 0 => 'FRF', + ), + 'GBP' => + array ( + 0 => '£', + ), + 'GEK' => + array ( + 0 => 'GEK', + ), + 'GEL' => + array ( + 0 => 'GEL', + ), + 'GHC' => + array ( + 0 => 'GHC', + ), + 'GHS' => + array ( + 0 => 'GHS', + ), + 'GIP' => + array ( + 0 => 'GIP', + ), + 'GMD' => + array ( + 0 => 'GMD', + ), + 'GNF' => + array ( + 0 => 'GNF', + 1 => 0, + 2 => 0, + ), + 'GNS' => + array ( + 0 => 'GNS', + ), + 'GQE' => + array ( + 0 => 'GQE', + ), + 'GRD' => + array ( + 0 => 'GRD', + ), + 'GTQ' => + array ( + 0 => 'GTQ', + ), + 'GWE' => + array ( + 0 => 'GWE', + ), + 'GWP' => + array ( + 0 => 'GWP', + ), + 'GYD' => + array ( + 0 => 'GYD', + 1 => 2, + 2 => 0, + ), + 'HKD' => + array ( + 0 => 'HK$', + ), + 'HNL' => + array ( + 0 => 'HNL', + ), + 'HRD' => + array ( + 0 => 'HRD', + ), + 'HRK' => + array ( + 0 => 'HRK', + ), + 'HTG' => + array ( + 0 => 'HTG', + ), + 'HUF' => + array ( + 0 => 'HUF', + 1 => 2, + 2 => 0, + ), + 'IDR' => + array ( + 0 => 'IDR', + 1 => 2, + 2 => 0, + ), + 'IEP' => + array ( + 0 => 'IEP', + ), + 'ILP' => + array ( + 0 => 'ILP', + ), + 'ILR' => + array ( + 0 => 'ILR', + ), + 'ILS' => + array ( + 0 => '₪', + ), + 'INR' => + array ( + 0 => '₹', + ), + 'IQD' => + array ( + 0 => 'IQD', + 1 => 0, + 2 => 0, + ), + 'IRR' => + array ( + 0 => 'IRR', + 1 => 0, + 2 => 0, + ), + 'ISJ' => + array ( + 0 => 'ISJ', + ), + 'ISK' => + array ( + 0 => 'ISK', + 1 => 0, + 2 => 0, + ), + 'ITL' => + array ( + 0 => 'ITL', + 1 => 0, + 2 => 0, + ), + 'JMD' => + array ( + 0 => 'JMD', + ), + 'JOD' => + array ( + 0 => 'JOD', + 1 => 3, + 2 => 0, + ), + 'JPY' => + array ( + 0 => '¥', + 1 => 0, + 2 => 0, + ), + 'KES' => + array ( + 0 => 'KES', + ), + 'KGS' => + array ( + 0 => 'KGS', + ), + 'KHR' => + array ( + 0 => 'KHR', + ), + 'KMF' => + array ( + 0 => 'KMF', + 1 => 0, + 2 => 0, + ), + 'KPW' => + array ( + 0 => 'KPW', + 1 => 0, + 2 => 0, + ), + 'KRH' => + array ( + 0 => 'KRH', + ), + 'KRO' => + array ( + 0 => 'KRO', + ), + 'KRW' => + array ( + 0 => '₩', + 1 => 0, + 2 => 0, + ), + 'KWD' => + array ( + 0 => 'KWD', + 1 => 3, + 2 => 0, + ), + 'KYD' => + array ( + 0 => 'KYD', + ), + 'KZT' => + array ( + 0 => 'KZT', + ), + 'LAK' => + array ( + 0 => 'LAK', + 1 => 0, + 2 => 0, + ), + 'LBP' => + array ( + 0 => 'LBP', + 1 => 0, + 2 => 0, + ), + 'LKR' => + array ( + 0 => 'LKR', + ), + 'LRD' => + array ( + 0 => 'LRD', + ), + 'LSL' => + array ( + 0 => 'LSL', + ), + 'LTL' => + array ( + 0 => 'LTL', + ), + 'LTT' => + array ( + 0 => 'LTT', + ), + 'LUC' => + array ( + 0 => 'LUC', + ), + 'LUF' => + array ( + 0 => 'LUF', + 1 => 0, + 2 => 0, + ), + 'LUL' => + array ( + 0 => 'LUL', + ), + 'LVL' => + array ( + 0 => 'LVL', + ), + 'LVR' => + array ( + 0 => 'LVR', + ), + 'LYD' => + array ( + 0 => 'LYD', + 1 => 3, + 2 => 0, + ), + 'MAD' => + array ( + 0 => 'MAD', + ), + 'MAF' => + array ( + 0 => 'MAF', + ), + 'MCF' => + array ( + 0 => 'MCF', + ), + 'MDC' => + array ( + 0 => 'MDC', + ), + 'MDL' => + array ( + 0 => 'MDL', + ), + 'MGA' => + array ( + 0 => 'MGA', + 1 => 0, + 2 => 0, + ), + 'MGF' => + array ( + 0 => 'MGF', + 1 => 0, + 2 => 0, + ), + 'MKD' => + array ( + 0 => 'MKD', + ), + 'MKN' => + array ( + 0 => 'MKN', + ), + 'MLF' => + array ( + 0 => 'MLF', + ), + 'MMK' => + array ( + 0 => 'MMK', + 1 => 0, + 2 => 0, + ), + 'MNT' => + array ( + 0 => 'MNT', + 1 => 2, + 2 => 0, + ), + 'MOP' => + array ( + 0 => 'MOP', + ), + 'MRO' => + array ( + 0 => 'MRO', + 1 => 0, + 2 => 0, + ), + 'MRU' => + array ( + 0 => 'MRU', + ), + 'MTL' => + array ( + 0 => 'MTL', + ), + 'MTP' => + array ( + 0 => 'MTP', + ), + 'MUR' => + array ( + 0 => 'MUR', + 1 => 2, + 2 => 0, + ), + 'MVP' => + array ( + 0 => 'MVP', + ), + 'MVR' => + array ( + 0 => 'MVR', + ), + 'MWK' => + array ( + 0 => 'MWK', + ), + 'MXN' => + array ( + 0 => 'MX$', + ), + 'MXP' => + array ( + 0 => 'MXP', + ), + 'MXV' => + array ( + 0 => 'MXV', + ), + 'MYR' => + array ( + 0 => 'MYR', + ), + 'MZE' => + array ( + 0 => 'MZE', + ), + 'MZM' => + array ( + 0 => 'MZM', + ), + 'MZN' => + array ( + 0 => 'MZN', + ), + 'NAD' => + array ( + 0 => 'NAD', + ), + 'NGN' => + array ( + 0 => 'NGN', + ), + 'NIC' => + array ( + 0 => 'NIC', + ), + 'NIO' => + array ( + 0 => 'NIO', + ), + 'NLG' => + array ( + 0 => 'NLG', + ), + 'NOK' => + array ( + 0 => 'NOK', + 1 => 2, + 2 => 0, + ), + 'NPR' => + array ( + 0 => 'NPR', + ), + 'NZD' => + array ( + 0 => 'NZ$', + ), + 'OMR' => + array ( + 0 => 'OMR', + 1 => 3, + 2 => 0, + ), + 'PAB' => + array ( + 0 => 'PAB', + ), + 'PEI' => + array ( + 0 => 'PEI', + ), + 'PEN' => + array ( + 0 => 'PEN', + ), + 'PES' => + array ( + 0 => 'PES', + ), + 'PGK' => + array ( + 0 => 'PGK', + ), + 'PHP' => + array ( + 0 => '₱', + ), + 'PKR' => + array ( + 0 => 'PKR', + 1 => 2, + 2 => 0, + ), + 'PLN' => + array ( + 0 => 'PLN', + ), + 'PLZ' => + array ( + 0 => 'PLZ', + ), + 'PTE' => + array ( + 0 => 'PTE', + ), + 'PYG' => + array ( + 0 => 'PYG', + 1 => 0, + 2 => 0, + ), + 'QAR' => + array ( + 0 => 'QAR', + ), + 'RHD' => + array ( + 0 => 'RHD', + ), + 'ROL' => + array ( + 0 => 'ROL', + ), + 'RON' => + array ( + 0 => 'RON', + ), + 'RSD' => + array ( + 0 => 'RSD', + 1 => 0, + 2 => 0, + ), + 'RUB' => + array ( + 0 => 'RUB', + ), + 'RUR' => + array ( + 0 => 'RUR', + ), + 'RWF' => + array ( + 0 => 'RWF', + 1 => 0, + 2 => 0, + ), + 'SAR' => + array ( + 0 => 'SAR', + ), + 'SBD' => + array ( + 0 => 'SBD', + ), + 'SCR' => + array ( + 0 => 'SCR', + ), + 'SDD' => + array ( + 0 => 'SDD', + ), + 'SDG' => + array ( + 0 => 'SDG', + ), + 'SDP' => + array ( + 0 => 'SDP', + ), + 'SEK' => + array ( + 0 => 'SEK', + 1 => 2, + 2 => 0, + ), + 'SGD' => + array ( + 0 => 'SGD', + ), + 'SHP' => + array ( + 0 => 'SHP', + ), + 'SIT' => + array ( + 0 => 'SIT', + ), + 'SKK' => + array ( + 0 => 'SKK', + ), + 'SLL' => + array ( + 0 => 'SLL', + 1 => 0, + 2 => 0, + ), + 'SOS' => + array ( + 0 => 'SOS', + 1 => 0, + 2 => 0, + ), + 'SRD' => + array ( + 0 => 'SRD', + ), + 'SRG' => + array ( + 0 => 'SRG', + ), + 'SSP' => + array ( + 0 => 'SSP', + ), + 'STD' => + array ( + 0 => 'STD', + 1 => 0, + 2 => 0, + ), + 'STN' => + array ( + 0 => 'STN', + ), + 'SUR' => + array ( + 0 => 'SUR', + ), + 'SVC' => + array ( + 0 => 'SVC', + ), + 'SYP' => + array ( + 0 => 'SYP', + 1 => 0, + 2 => 0, + ), + 'SZL' => + array ( + 0 => 'SZL', + ), + 'THB' => + array ( + 0 => 'THB', + ), + 'TJR' => + array ( + 0 => 'TJR', + ), + 'TJS' => + array ( + 0 => 'TJS', + ), + 'TMM' => + array ( + 0 => 'TMM', + 1 => 0, + 2 => 0, + ), + 'TMT' => + array ( + 0 => 'TMT', + ), + 'TND' => + array ( + 0 => 'TND', + 1 => 3, + 2 => 0, + ), + 'TOP' => + array ( + 0 => 'TOP', + ), + 'TPE' => + array ( + 0 => 'TPE', + ), + 'TRL' => + array ( + 0 => 'TRL', + 1 => 0, + 2 => 0, + ), + 'TRY' => + array ( + 0 => 'TRY', + ), + 'TTD' => + array ( + 0 => 'TTD', + ), + 'TWD' => + array ( + 0 => 'NT$', + 1 => 2, + 2 => 0, + ), + 'TZS' => + array ( + 0 => 'TZS', + 1 => 2, + 2 => 0, + ), + 'UAH' => + array ( + 0 => 'UAH', + ), + 'UAK' => + array ( + 0 => 'UAK', + ), + 'UGS' => + array ( + 0 => 'UGS', + ), + 'UGX' => + array ( + 0 => 'UGX', + 1 => 0, + 2 => 0, + ), + 'USD' => + array ( + 0 => '$', + ), + 'USN' => + array ( + 0 => 'USN', + ), + 'USS' => + array ( + 0 => 'USS', + ), + 'UYI' => + array ( + 0 => 'UYI', + 1 => 0, + 2 => 0, + ), + 'UYP' => + array ( + 0 => 'UYP', + ), + 'UYU' => + array ( + 0 => 'UYU', + ), + 'UYW' => + array ( + 0 => 'UYW', + 1 => 4, + 2 => 0, + ), + 'UZS' => + array ( + 0 => 'UZS', + 1 => 2, + 2 => 0, + ), + 'VEB' => + array ( + 0 => 'VEB', + ), + 'VEF' => + array ( + 0 => 'VEF', + 1 => 2, + 2 => 0, + ), + 'VES' => + array ( + 0 => 'VES', + ), + 'VND' => + array ( + 0 => '₫', + 1 => 0, + 2 => 0, + ), + 'VNN' => + array ( + 0 => 'VNN', + ), + 'VUV' => + array ( + 0 => 'VUV', + 1 => 0, + 2 => 0, + ), + 'WST' => + array ( + 0 => 'WST', + ), + 'XAF' => + array ( + 0 => 'FCFA', + 1 => 0, + 2 => 0, + ), + 'XCD' => + array ( + 0 => 'EC$', + ), + 'XEU' => + array ( + 0 => 'XEU', + ), + 'XFO' => + array ( + 0 => 'XFO', + ), + 'XFU' => + array ( + 0 => 'XFU', + ), + 'XOF' => + array ( + 0 => 'F CFA', + 1 => 0, + 2 => 0, + ), + 'XPF' => + array ( + 0 => 'CFPF', + 1 => 0, + 2 => 0, + ), + 'XRE' => + array ( + 0 => 'XRE', + ), + 'YDD' => + array ( + 0 => 'YDD', + ), + 'YER' => + array ( + 0 => 'YER', + 1 => 0, + 2 => 0, + ), + 'YUD' => + array ( + 0 => 'YUD', + ), + 'YUM' => + array ( + 0 => 'YUM', + ), + 'YUN' => + array ( + 0 => 'YUN', + ), + 'YUR' => + array ( + 0 => 'YUR', + ), + 'ZAL' => + array ( + 0 => 'ZAL', + ), + 'ZAR' => + array ( + 0 => 'ZAR', + ), + 'ZMK' => + array ( + 0 => 'ZMK', + 1 => 0, + 2 => 0, + ), + 'ZMW' => + array ( + 0 => 'ZMW', + ), + 'ZRN' => + array ( + 0 => 'ZRN', + ), + 'ZRZ' => + array ( + 0 => 'ZRZ', + ), + 'ZWD' => + array ( + 0 => 'ZWD', + 1 => 0, + 2 => 0, + ), + 'ZWL' => + array ( + 0 => 'ZWL', + ), + 'ZWR' => + array ( + 0 => 'ZWR', + ), + 'DEFAULT' => + array ( + 1 => 2, + 2 => 0, + ), +); diff --git a/vendor/symfony/polyfill-intl-icu/Resources/stubs/Collator.php b/vendor/symfony/polyfill-intl-icu/Resources/stubs/Collator.php new file mode 100644 index 0000000..a1efbcb --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Resources/stubs/Collator.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu\Collator as CollatorPolyfill; + +/** + * Stub implementation for the Collator class of the intl extension. + * + * @author Bernhard Schussek + */ +class Collator extends CollatorPolyfill +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/Resources/stubs/IntlDateFormatter.php b/vendor/symfony/polyfill-intl-icu/Resources/stubs/IntlDateFormatter.php new file mode 100644 index 0000000..e701200 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Resources/stubs/IntlDateFormatter.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu\IntlDateFormatter as IntlDateFormatterPolyfill; + +/** + * Stub implementation for the IntlDateFormatter class of the intl extension. + * + * @author Bernhard Schussek + */ +class IntlDateFormatter extends IntlDateFormatterPolyfill +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/Resources/stubs/Locale.php b/vendor/symfony/polyfill-intl-icu/Resources/stubs/Locale.php new file mode 100644 index 0000000..f1b951e --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Resources/stubs/Locale.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu\Locale as LocalePolyfill; + +/** + * Stub implementation for the Locale class of the intl extension. + * + * @author Bernhard Schussek + */ +class Locale extends LocalePolyfill +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php b/vendor/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php new file mode 100644 index 0000000..9288b9d --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/Resources/stubs/NumberFormatter.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu\NumberFormatter as NumberFormatterPolyfill; + +/** + * Stub implementation for the NumberFormatter class of the intl extension. + * + * @author Bernhard Schussek + * + * @see IntlNumberFormatter + */ +class NumberFormatter extends NumberFormatterPolyfill +{ +} diff --git a/vendor/symfony/polyfill-intl-icu/bootstrap.php b/vendor/symfony/polyfill-intl-icu/bootstrap.php new file mode 100644 index 0000000..77d7543 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/bootstrap.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu as p; + +if (extension_loaded('intl')) { + return; +} + +if (\PHP_VERSION_ID >= 80000) { + return require __DIR__.'/bootstrap80.php'; +} + +if (!function_exists('intl_is_failure')) { + function intl_is_failure($errorCode) { return p\Icu::isFailure($errorCode); } +} +if (!function_exists('intl_get_error_code')) { + function intl_get_error_code() { return p\Icu::getErrorCode(); } +} +if (!function_exists('intl_get_error_message')) { + function intl_get_error_message() { return p\Icu::getErrorMessage(); } +} +if (!function_exists('intl_error_name')) { + function intl_error_name($errorCode) { return p\Icu::getErrorName($errorCode); } +} diff --git a/vendor/symfony/polyfill-intl-icu/bootstrap80.php b/vendor/symfony/polyfill-intl-icu/bootstrap80.php new file mode 100644 index 0000000..ee1653a --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/bootstrap80.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Intl\Icu as p; + +if (!function_exists('intl_is_failure')) { + function intl_is_failure(?int $errorCode): bool { return p\Icu::isFailure((int) $errorCode); } +} +if (!function_exists('intl_get_error_code')) { + function intl_get_error_code(): int { return p\Icu::getErrorCode(); } +} +if (!function_exists('intl_get_error_message')) { + function intl_get_error_message(): string { return p\Icu::getErrorMessage(); } +} +if (!function_exists('intl_error_name')) { + function intl_error_name(?int $errorCode): string { return p\Icu::getErrorName((int) $errorCode); } +} diff --git a/vendor/symfony/polyfill-intl-icu/composer.json b/vendor/symfony/polyfill-intl-icu/composer.json new file mode 100644 index 0000000..d1ed2d8 --- /dev/null +++ b/vendor/symfony/polyfill-intl-icu/composer.json @@ -0,0 +1,42 @@ +{ + "name": "symfony/polyfill-intl-icu", + "type": "library", + "description": "Symfony polyfill for intl's ICU-related data and classes", + "keywords": ["polyfill", "shim", "compatibility", "portable", "intl", "icu"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.1" + }, + "autoload": { + "files": [ "bootstrap.php" ], + "psr-4": { "Symfony\\Polyfill\\Intl\\Icu\\": "" }, + "classmap": [ "Resources/stubs" ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "suggest": { + "ext-intl": "For best performance and support of other locales than \"en\"" + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/vendor/symfony/property-access/CHANGELOG.md b/vendor/symfony/property-access/CHANGELOG.md new file mode 100644 index 0000000..f90c6f5 --- /dev/null +++ b/vendor/symfony/property-access/CHANGELOG.md @@ -0,0 +1,70 @@ +CHANGELOG +========= + +5.3.0 +----- + + * deprecate passing a boolean as the second argument of `PropertyAccessor::__construct()`, expecting a combination of bitwise flags instead + +5.2.0 +----- + + * deprecated passing a boolean as the first argument of `PropertyAccessor::__construct()`, expecting a combination of bitwise flags instead + * added the ability to disable usage of the magic `__get` & `__set` methods + +5.1.0 +----- + + * Added an `UninitializedPropertyException` + * Linking to PropertyInfo extractor to remove a lot of duplicate code + +4.4.0 +----- + + * deprecated passing `null` as `$defaultLifetime` 2nd argument of `PropertyAccessor::createCache()` method, + pass `0` instead + +4.3.0 +----- + + * added a `$throwExceptionOnInvalidPropertyPath` argument to the PropertyAccessor constructor. + * added `enableExceptionOnInvalidPropertyPath()`, `disableExceptionOnInvalidPropertyPath()` and + `isExceptionOnInvalidPropertyPath()` methods to `PropertyAccessorBuilder` + +4.0.0 +----- + + * removed the `StringUtil` class, use `Symfony\Component\Inflector\Inflector` + +3.1.0 +----- + + * deprecated the `StringUtil` class, use `Symfony\Component\Inflector\Inflector` + instead + +2.7.0 +------ + + * `UnexpectedTypeException` now expects three constructor arguments: The invalid property value, + the `PropertyPathInterface` object and the current index of the property path. + +2.5.0 +------ + + * allowed non alpha numeric characters in second level and deeper object properties names + * [BC BREAK] when accessing an index on an object that does not implement + ArrayAccess, a NoSuchIndexException is now thrown instead of the + semantically wrong NoSuchPropertyException + * [BC BREAK] added isReadable() and isWritable() to PropertyAccessorInterface + +2.3.0 +------ + + * added PropertyAccessorBuilder, to enable or disable the support of "__call" + * added support for "__call" in the PropertyAccessor (disabled by default) + * [BC BREAK] changed PropertyAccessor to continue its search for a property or + method even if a non-public match was found. Before, a PropertyAccessDeniedException + was thrown in this case. Class PropertyAccessDeniedException was removed + now. + * deprecated PropertyAccess::getPropertyAccessor + * added PropertyAccess::createPropertyAccessor and PropertyAccess::createPropertyAccessorBuilder diff --git a/vendor/symfony/property-access/Exception/AccessException.php b/vendor/symfony/property-access/Exception/AccessException.php new file mode 100644 index 0000000..b3a8546 --- /dev/null +++ b/vendor/symfony/property-access/Exception/AccessException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Thrown when a property path is not available. + * + * @author Stéphane Escandell + */ +class AccessException extends RuntimeException +{ +} diff --git a/vendor/symfony/property-access/Exception/ExceptionInterface.php b/vendor/symfony/property-access/Exception/ExceptionInterface.php new file mode 100644 index 0000000..fabf9a0 --- /dev/null +++ b/vendor/symfony/property-access/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Marker interface for the PropertyAccess component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/property-access/Exception/InvalidArgumentException.php b/vendor/symfony/property-access/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..47bc7e1 --- /dev/null +++ b/vendor/symfony/property-access/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Base InvalidArgumentException for the PropertyAccess component. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/property-access/Exception/InvalidPropertyPathException.php b/vendor/symfony/property-access/Exception/InvalidPropertyPathException.php new file mode 100644 index 0000000..69de31c --- /dev/null +++ b/vendor/symfony/property-access/Exception/InvalidPropertyPathException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Thrown when a property path is malformed. + * + * @author Bernhard Schussek + */ +class InvalidPropertyPathException extends RuntimeException +{ +} diff --git a/vendor/symfony/property-access/Exception/NoSuchIndexException.php b/vendor/symfony/property-access/Exception/NoSuchIndexException.php new file mode 100644 index 0000000..597b990 --- /dev/null +++ b/vendor/symfony/property-access/Exception/NoSuchIndexException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Thrown when an index cannot be found. + * + * @author Stéphane Escandell + */ +class NoSuchIndexException extends AccessException +{ +} diff --git a/vendor/symfony/property-access/Exception/NoSuchPropertyException.php b/vendor/symfony/property-access/Exception/NoSuchPropertyException.php new file mode 100644 index 0000000..1c7eda5 --- /dev/null +++ b/vendor/symfony/property-access/Exception/NoSuchPropertyException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Thrown when a property cannot be found. + * + * @author Bernhard Schussek + */ +class NoSuchPropertyException extends AccessException +{ +} diff --git a/vendor/symfony/property-access/Exception/OutOfBoundsException.php b/vendor/symfony/property-access/Exception/OutOfBoundsException.php new file mode 100644 index 0000000..a3c4559 --- /dev/null +++ b/vendor/symfony/property-access/Exception/OutOfBoundsException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Base OutOfBoundsException for the PropertyAccess component. + * + * @author Bernhard Schussek + */ +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/property-access/Exception/RuntimeException.php b/vendor/symfony/property-access/Exception/RuntimeException.php new file mode 100644 index 0000000..9fe843e --- /dev/null +++ b/vendor/symfony/property-access/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Base RuntimeException for the PropertyAccess component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/property-access/Exception/UnexpectedTypeException.php b/vendor/symfony/property-access/Exception/UnexpectedTypeException.php new file mode 100644 index 0000000..78bc416 --- /dev/null +++ b/vendor/symfony/property-access/Exception/UnexpectedTypeException.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +use Symfony\Component\PropertyAccess\PropertyPathInterface; + +/** + * Thrown when a value does not match an expected type. + * + * @author Bernhard Schussek + */ +class UnexpectedTypeException extends RuntimeException +{ + /** + * @param mixed $value The unexpected value found while traversing property path + * @param int $pathIndex The property path index when the unexpected value was found + */ + public function __construct($value, PropertyPathInterface $path, int $pathIndex) + { + $message = sprintf( + 'PropertyAccessor requires a graph of objects or arrays to operate on, '. + 'but it found type "%s" while trying to traverse path "%s" at property "%s".', + \gettype($value), + (string) $path, + $path->getElement($pathIndex) + ); + + parent::__construct($message); + } +} diff --git a/vendor/symfony/property-access/Exception/UninitializedPropertyException.php b/vendor/symfony/property-access/Exception/UninitializedPropertyException.php new file mode 100644 index 0000000..c0d6973 --- /dev/null +++ b/vendor/symfony/property-access/Exception/UninitializedPropertyException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Exception; + +/** + * Thrown when a property is not initialized. + * + * @author Jules Pietri + */ +class UninitializedPropertyException extends AccessException +{ +} diff --git a/vendor/symfony/property-access/LICENSE b/vendor/symfony/property-access/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/property-access/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/property-access/PropertyAccess.php b/vendor/symfony/property-access/PropertyAccess.php new file mode 100644 index 0000000..1953ac0 --- /dev/null +++ b/vendor/symfony/property-access/PropertyAccess.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +/** + * Entry point of the PropertyAccess component. + * + * @author Bernhard Schussek + */ +final class PropertyAccess +{ + /** + * Creates a property accessor with the default configuration. + */ + public static function createPropertyAccessor(): PropertyAccessor + { + return self::createPropertyAccessorBuilder()->getPropertyAccessor(); + } + + public static function createPropertyAccessorBuilder(): PropertyAccessorBuilder + { + return new PropertyAccessorBuilder(); + } + + /** + * This class cannot be instantiated. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/property-access/PropertyAccessor.php b/vendor/symfony/property-access/PropertyAccessor.php new file mode 100644 index 0000000..f4eb475 --- /dev/null +++ b/vendor/symfony/property-access/PropertyAccessor.php @@ -0,0 +1,748 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +use Psr\Cache\CacheItemPoolInterface; +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; +use Symfony\Component\Cache\Adapter\AdapterInterface; +use Symfony\Component\Cache\Adapter\ApcuAdapter; +use Symfony\Component\Cache\Adapter\NullAdapter; +use Symfony\Component\PropertyAccess\Exception\AccessException; +use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; +use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException; +use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException; +use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException; +use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; +use Symfony\Component\PropertyInfo\PropertyReadInfo; +use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyWriteInfo; +use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface; + +/** + * Default implementation of {@link PropertyAccessorInterface}. + * + * @author Bernhard Schussek + * @author Kévin Dunglas + * @author Nicolas Grekas + */ +class PropertyAccessor implements PropertyAccessorInterface +{ + /** @var int Allow none of the magic methods */ + public const DISALLOW_MAGIC_METHODS = ReflectionExtractor::DISALLOW_MAGIC_METHODS; + /** @var int Allow magic __get methods */ + public const MAGIC_GET = ReflectionExtractor::ALLOW_MAGIC_GET; + /** @var int Allow magic __set methods */ + public const MAGIC_SET = ReflectionExtractor::ALLOW_MAGIC_SET; + /** @var int Allow magic __call methods */ + public const MAGIC_CALL = ReflectionExtractor::ALLOW_MAGIC_CALL; + + public const DO_NOT_THROW = 0; + public const THROW_ON_INVALID_INDEX = 1; + public const THROW_ON_INVALID_PROPERTY_PATH = 2; + + private const VALUE = 0; + private const REF = 1; + private const IS_REF_CHAINED = 2; + private const CACHE_PREFIX_READ = 'r'; + private const CACHE_PREFIX_WRITE = 'w'; + private const CACHE_PREFIX_PROPERTY_PATH = 'p'; + + private $magicMethodsFlags; + private $ignoreInvalidIndices; + private $ignoreInvalidProperty; + + /** + * @var CacheItemPoolInterface + */ + private $cacheItemPool; + + private $propertyPathCache = []; + + /** + * @var PropertyReadInfoExtractorInterface + */ + private $readInfoExtractor; + + /** + * @var PropertyWriteInfoExtractorInterface + */ + private $writeInfoExtractor; + private $readPropertyCache = []; + private $writePropertyCache = []; + private const RESULT_PROTO = [self::VALUE => null]; + + /** + * Should not be used by application code. Use + * {@link PropertyAccess::createPropertyAccessor()} instead. + * + * @param int $magicMethods A bitwise combination of the MAGIC_* constants + * to specify the allowed magic methods (__get, __set, __call) + * or self::DISALLOW_MAGIC_METHODS for none + * @param int $throw A bitwise combination of the THROW_* constants + * to specify when exceptions should be thrown + * @param PropertyReadInfoExtractorInterface $readInfoExtractor + * @param PropertyWriteInfoExtractorInterface $writeInfoExtractor + */ + public function __construct($magicMethods = self::MAGIC_GET | self::MAGIC_SET, $throw = self::THROW_ON_INVALID_PROPERTY_PATH, CacheItemPoolInterface $cacheItemPool = null, $readInfoExtractor = null, $writeInfoExtractor = null) + { + if (\is_bool($magicMethods)) { + trigger_deprecation('symfony/property-access', '5.2', 'Passing a boolean as the first argument to "%s()" is deprecated. Pass a combination of bitwise flags instead (i.e an integer).', __METHOD__); + + $magicMethods = ($magicMethods ? self::MAGIC_CALL : 0) | self::MAGIC_GET | self::MAGIC_SET; + } elseif (!\is_int($magicMethods)) { + throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an integer, "%s" given.', __METHOD__, get_debug_type($readInfoExtractor))); + } + + if (\is_bool($throw)) { + trigger_deprecation('symfony/property-access', '5.3', 'Passing a boolean as the second argument to "%s()" is deprecated. Pass a combination of bitwise flags instead (i.e an integer).', __METHOD__); + + $throw = $throw ? self::THROW_ON_INVALID_INDEX : self::DO_NOT_THROW; + + if (!\is_bool($readInfoExtractor)) { + $throw |= self::THROW_ON_INVALID_PROPERTY_PATH; + } + } + + if (\is_bool($readInfoExtractor)) { + trigger_deprecation('symfony/property-access', '5.3', 'Passing a boolean as the fourth argument to "%s()" is deprecated. Pass a combination of bitwise flags as the second argument instead (i.e an integer).', __METHOD__); + + if ($readInfoExtractor) { + $throw |= self::THROW_ON_INVALID_PROPERTY_PATH; + } + + $readInfoExtractor = $writeInfoExtractor; + $writeInfoExtractor = 4 < \func_num_args() ? func_get_arg(4) : null; + } + + if (null !== $readInfoExtractor && !$readInfoExtractor instanceof PropertyReadInfoExtractorInterface) { + throw new \TypeError(sprintf('Argument 4 passed to "%s()" must be null or an instance of "%s", "%s" given.', __METHOD__, PropertyReadInfoExtractorInterface::class, get_debug_type($readInfoExtractor))); + } + + if (null !== $writeInfoExtractor && !$writeInfoExtractor instanceof PropertyWriteInfoExtractorInterface) { + throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be null or an instance of "%s", "%s" given.', __METHOD__, PropertyWriteInfoExtractorInterface::class, get_debug_type($writeInfoExtractor))); + } + + $this->magicMethodsFlags = $magicMethods; + $this->ignoreInvalidIndices = 0 === ($throw & self::THROW_ON_INVALID_INDEX); + $this->cacheItemPool = $cacheItemPool instanceof NullAdapter ? null : $cacheItemPool; // Replace the NullAdapter by the null value + $this->ignoreInvalidProperty = 0 === ($throw & self::THROW_ON_INVALID_PROPERTY_PATH); + $this->readInfoExtractor = $readInfoExtractor ?? new ReflectionExtractor([], null, null, false); + $this->writeInfoExtractor = $writeInfoExtractor ?? new ReflectionExtractor(['set'], null, null, false); + } + + /** + * {@inheritdoc} + */ + public function getValue($objectOrArray, $propertyPath) + { + $zval = [ + self::VALUE => $objectOrArray, + ]; + + if (\is_object($objectOrArray) && false === strpbrk((string) $propertyPath, '.[')) { + return $this->readProperty($zval, $propertyPath, $this->ignoreInvalidProperty)[self::VALUE]; + } + + $propertyPath = $this->getPropertyPath($propertyPath); + + $propertyValues = $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices); + + return $propertyValues[\count($propertyValues) - 1][self::VALUE]; + } + + /** + * {@inheritdoc} + */ + public function setValue(&$objectOrArray, $propertyPath, $value) + { + if (\is_object($objectOrArray) && false === strpbrk((string) $propertyPath, '.[')) { + $zval = [ + self::VALUE => $objectOrArray, + ]; + + try { + $this->writeProperty($zval, $propertyPath, $value); + + return; + } catch (\TypeError $e) { + self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath, $e); + // It wasn't thrown in this class so rethrow it + throw $e; + } + } + + $propertyPath = $this->getPropertyPath($propertyPath); + + $zval = [ + self::VALUE => $objectOrArray, + self::REF => &$objectOrArray, + ]; + $propertyValues = $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength() - 1); + $overwrite = true; + + try { + for ($i = \count($propertyValues) - 1; 0 <= $i; --$i) { + $zval = $propertyValues[$i]; + unset($propertyValues[$i]); + + // You only need set value for current element if: + // 1. it's the parent of the last index element + // OR + // 2. its child is not passed by reference + // + // This may avoid uncessary value setting process for array elements. + // For example: + // '[a][b][c]' => 'old-value' + // If you want to change its value to 'new-value', + // you only need set value for '[a][b][c]' and it's safe to ignore '[a][b]' and '[a]' + if ($overwrite) { + $property = $propertyPath->getElement($i); + + if ($propertyPath->isIndex($i)) { + if ($overwrite = !isset($zval[self::REF])) { + $ref = &$zval[self::REF]; + $ref = $zval[self::VALUE]; + } + $this->writeIndex($zval, $property, $value); + if ($overwrite) { + $zval[self::VALUE] = $zval[self::REF]; + } + } else { + $this->writeProperty($zval, $property, $value); + } + + // if current element is an object + // OR + // if current element's reference chain is not broken - current element + // as well as all its ancients in the property path are all passed by reference, + // then there is no need to continue the value setting process + if (\is_object($zval[self::VALUE]) || isset($zval[self::IS_REF_CHAINED])) { + break; + } + } + + $value = $zval[self::VALUE]; + } + } catch (\TypeError $e) { + self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath, $e); + + // It wasn't thrown in this class so rethrow it + throw $e; + } + } + + private static function throwInvalidArgumentException(string $message, array $trace, int $i, string $propertyPath, \Throwable $previous = null): void + { + if (!isset($trace[$i]['file']) || __FILE__ !== $trace[$i]['file']) { + return; + } + + if (\PHP_VERSION_ID < 80000) { + if (preg_match('/^Typed property \S+::\$\S+ must be (\S+), (\S+) used$/', $message, $matches)) { + [, $expectedType, $actualType] = $matches; + + throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $propertyPath), 0, $previous); + } + + if (!str_starts_with($message, 'Argument ')) { + return; + } + + $pos = strpos($message, $delim = 'must be of the type ') ?: (strpos($message, $delim = 'must be an instance of ') ?: strpos($message, $delim = 'must implement interface ')); + $pos += \strlen($delim); + $j = strpos($message, ',', $pos); + $type = substr($message, 2 + $j, strpos($message, ' given', $j) - $j - 2); + $message = substr($message, $pos, $j - $pos); + + throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $message, 'NULL' === $type ? 'null' : $type, $propertyPath), 0, $previous); + } + + if (preg_match('/^\S+::\S+\(\): Argument #\d+ \(\$\S+\) must be of type (\S+), (\S+) given/', $message, $matches)) { + [, $expectedType, $actualType] = $matches; + + throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $propertyPath), 0, $previous); + } + if (preg_match('/^Cannot assign (\S+) to property \S+::\$\S+ of type (\S+)$/', $message, $matches)) { + [, $actualType, $expectedType] = $matches; + + throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $propertyPath), 0, $previous); + } + } + + /** + * {@inheritdoc} + */ + public function isReadable($objectOrArray, $propertyPath) + { + if (!$propertyPath instanceof PropertyPathInterface) { + $propertyPath = new PropertyPath($propertyPath); + } + + try { + $zval = [ + self::VALUE => $objectOrArray, + ]; + $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices); + + return true; + } catch (AccessException $e) { + return false; + } catch (UnexpectedTypeException $e) { + return false; + } + } + + /** + * {@inheritdoc} + */ + public function isWritable($objectOrArray, $propertyPath) + { + $propertyPath = $this->getPropertyPath($propertyPath); + + try { + $zval = [ + self::VALUE => $objectOrArray, + ]; + $propertyValues = $this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength() - 1); + + for ($i = \count($propertyValues) - 1; 0 <= $i; --$i) { + $zval = $propertyValues[$i]; + unset($propertyValues[$i]); + + if ($propertyPath->isIndex($i)) { + if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { + return false; + } + } elseif (!\is_object($zval[self::VALUE]) || !$this->isPropertyWritable($zval[self::VALUE], $propertyPath->getElement($i))) { + return false; + } + + if (\is_object($zval[self::VALUE])) { + return true; + } + } + + return true; + } catch (AccessException $e) { + return false; + } catch (UnexpectedTypeException $e) { + return false; + } + } + + /** + * Reads the path from an object up to a given path index. + * + * @throws UnexpectedTypeException if a value within the path is neither object nor array + * @throws NoSuchIndexException If a non-existing index is accessed + */ + private function readPropertiesUntil(array $zval, PropertyPathInterface $propertyPath, int $lastIndex, bool $ignoreInvalidIndices = true): array + { + if (!\is_object($zval[self::VALUE]) && !\is_array($zval[self::VALUE])) { + throw new UnexpectedTypeException($zval[self::VALUE], $propertyPath, 0); + } + + // Add the root object to the list + $propertyValues = [$zval]; + + for ($i = 0; $i < $lastIndex; ++$i) { + $property = $propertyPath->getElement($i); + $isIndex = $propertyPath->isIndex($i); + + if ($isIndex) { + // Create missing nested arrays on demand + if (($zval[self::VALUE] instanceof \ArrayAccess && !$zval[self::VALUE]->offsetExists($property)) || + (\is_array($zval[self::VALUE]) && !isset($zval[self::VALUE][$property]) && !\array_key_exists($property, $zval[self::VALUE])) + ) { + if (!$ignoreInvalidIndices) { + if (!\is_array($zval[self::VALUE])) { + if (!$zval[self::VALUE] instanceof \Traversable) { + throw new NoSuchIndexException(sprintf('Cannot read index "%s" while trying to traverse path "%s".', $property, (string) $propertyPath)); + } + + $zval[self::VALUE] = iterator_to_array($zval[self::VALUE]); + } + + throw new NoSuchIndexException(sprintf('Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".', $property, (string) $propertyPath, print_r(array_keys($zval[self::VALUE]), true))); + } + + if ($i + 1 < $propertyPath->getLength()) { + if (isset($zval[self::REF])) { + $zval[self::VALUE][$property] = []; + $zval[self::REF] = $zval[self::VALUE]; + } else { + $zval[self::VALUE] = [$property => []]; + } + } + } + + $zval = $this->readIndex($zval, $property); + } else { + $zval = $this->readProperty($zval, $property, $this->ignoreInvalidProperty); + } + + // the final value of the path must not be validated + if ($i + 1 < $propertyPath->getLength() && !\is_object($zval[self::VALUE]) && !\is_array($zval[self::VALUE])) { + throw new UnexpectedTypeException($zval[self::VALUE], $propertyPath, $i + 1); + } + + if (isset($zval[self::REF]) && (0 === $i || isset($propertyValues[$i - 1][self::IS_REF_CHAINED]))) { + // Set the IS_REF_CHAINED flag to true if: + // current property is passed by reference and + // it is the first element in the property path or + // the IS_REF_CHAINED flag of its parent element is true + // Basically, this flag is true only when the reference chain from the top element to current element is not broken + $zval[self::IS_REF_CHAINED] = true; + } + + $propertyValues[] = $zval; + } + + return $propertyValues; + } + + /** + * Reads a key from an array-like structure. + * + * @param string|int $index The key to read + * + * @throws NoSuchIndexException If the array does not implement \ArrayAccess or it is not an array + */ + private function readIndex(array $zval, $index): array + { + if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { + throw new NoSuchIndexException(sprintf('Cannot read index "%s" from object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE]))); + } + + $result = self::RESULT_PROTO; + + if (isset($zval[self::VALUE][$index])) { + $result[self::VALUE] = $zval[self::VALUE][$index]; + + if (!isset($zval[self::REF])) { + // Save creating references when doing read-only lookups + } elseif (\is_array($zval[self::VALUE])) { + $result[self::REF] = &$zval[self::REF][$index]; + } elseif (\is_object($result[self::VALUE])) { + $result[self::REF] = $result[self::VALUE]; + } + } + + return $result; + } + + /** + * Reads the value of a property from an object. + * + * @throws NoSuchPropertyException If $ignoreInvalidProperty is false and the property does not exist or is not public + */ + private function readProperty(array $zval, string $property, bool $ignoreInvalidProperty = false): array + { + if (!\is_object($zval[self::VALUE])) { + throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property)); + } + + $result = self::RESULT_PROTO; + $object = $zval[self::VALUE]; + $class = \get_class($object); + $access = $this->getReadInfo($class, $property); + + if (null !== $access) { + $name = $access->getName(); + $type = $access->getType(); + + try { + if (PropertyReadInfo::TYPE_METHOD === $type) { + try { + $result[self::VALUE] = $object->$name(); + } catch (\TypeError $e) { + [$trace] = $e->getTrace(); + + // handle uninitialized properties in PHP >= 7 + if (__FILE__ === $trace['file'] + && $name === $trace['function'] + && $object instanceof $trace['class'] + && preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches) + ) { + throw new UninitializedPropertyException(sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', get_debug_type($object), $name, $matches[1]), 0, $e); + } + + throw $e; + } + } elseif (PropertyReadInfo::TYPE_PROPERTY === $type) { + if ($access->canBeReference() && !isset($object->$name) && !\array_key_exists($name, (array) $object) && (\PHP_VERSION_ID < 70400 || !(new \ReflectionProperty($class, $name))->hasType())) { + throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not initialized.', $class, $name)); + } + + $result[self::VALUE] = $object->$name; + + if (isset($zval[self::REF]) && $access->canBeReference()) { + $result[self::REF] = &$object->$name; + } + } + } catch (\Error $e) { + // handle uninitialized properties in PHP >= 7.4 + if (\PHP_VERSION_ID >= 70400 && preg_match('/^Typed property ([\w\\\\@]+)::\$(\w+) must not be accessed before initialization$/', $e->getMessage(), $matches)) { + $r = new \ReflectionProperty(str_contains($matches[1], '@anonymous') ? $class : $matches[1], $matches[2]); + $type = ($type = $r->getType()) instanceof \ReflectionNamedType ? $type->getName() : (string) $type; + + throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $matches[1], $r->getName(), $type), 0, $e); + } + + throw $e; + } + } elseif (property_exists($object, $property) && \array_key_exists($property, (array) $object)) { + $result[self::VALUE] = $object->$property; + if (isset($zval[self::REF])) { + $result[self::REF] = &$object->$property; + } + } elseif (!$ignoreInvalidProperty) { + throw new NoSuchPropertyException(sprintf('Can\'t get a way to read the property "%s" in class "%s".', $property, $class)); + } + + // Objects are always passed around by reference + if (isset($zval[self::REF]) && \is_object($result[self::VALUE])) { + $result[self::REF] = $result[self::VALUE]; + } + + return $result; + } + + /** + * Guesses how to read the property value. + */ + private function getReadInfo(string $class, string $property): ?PropertyReadInfo + { + $key = str_replace('\\', '.', $class).'..'.$property; + + if (isset($this->readPropertyCache[$key])) { + return $this->readPropertyCache[$key]; + } + + if ($this->cacheItemPool) { + $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_READ.rawurlencode($key)); + if ($item->isHit()) { + return $this->readPropertyCache[$key] = $item->get(); + } + } + + $accessor = $this->readInfoExtractor->getReadInfo($class, $property, [ + 'enable_getter_setter_extraction' => true, + 'enable_magic_methods_extraction' => $this->magicMethodsFlags, + 'enable_constructor_extraction' => false, + ]); + + if (isset($item)) { + $this->cacheItemPool->save($item->set($accessor)); + } + + return $this->readPropertyCache[$key] = $accessor; + } + + /** + * Sets the value of an index in a given array-accessible value. + * + * @param string|int $index The index to write at + * @param mixed $value The value to write + * + * @throws NoSuchIndexException If the array does not implement \ArrayAccess or it is not an array + */ + private function writeIndex(array $zval, $index, $value) + { + if (!$zval[self::VALUE] instanceof \ArrayAccess && !\is_array($zval[self::VALUE])) { + throw new NoSuchIndexException(sprintf('Cannot modify index "%s" in object of type "%s" because it doesn\'t implement \ArrayAccess.', $index, get_debug_type($zval[self::VALUE]))); + } + + $zval[self::REF][$index] = $value; + } + + /** + * Sets the value of a property in the given object. + * + * @param mixed $value The value to write + * + * @throws NoSuchPropertyException if the property does not exist or is not public + */ + private function writeProperty(array $zval, string $property, $value) + { + if (!\is_object($zval[self::VALUE])) { + throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property)); + } + + $object = $zval[self::VALUE]; + $class = \get_class($object); + $mutator = $this->getWriteInfo($class, $property, $value); + + if (PropertyWriteInfo::TYPE_NONE !== $mutator->getType()) { + $type = $mutator->getType(); + + if (PropertyWriteInfo::TYPE_METHOD === $type) { + $object->{$mutator->getName()}($value); + } elseif (PropertyWriteInfo::TYPE_PROPERTY === $type) { + $object->{$mutator->getName()} = $value; + } elseif (PropertyWriteInfo::TYPE_ADDER_AND_REMOVER === $type) { + $this->writeCollection($zval, $property, $value, $mutator->getAdderInfo(), $mutator->getRemoverInfo()); + } + } elseif ($object instanceof \stdClass && property_exists($object, $property)) { + $object->$property = $value; + } elseif (!$this->ignoreInvalidProperty) { + if ($mutator->hasErrors()) { + throw new NoSuchPropertyException(implode('. ', $mutator->getErrors()).'.'); + } + + throw new NoSuchPropertyException(sprintf('Could not determine access type for property "%s" in class "%s".', $property, get_debug_type($object))); + } + } + + /** + * Adjusts a collection-valued property by calling add*() and remove*() methods. + */ + private function writeCollection(array $zval, string $property, iterable $collection, PropertyWriteInfo $addMethod, PropertyWriteInfo $removeMethod) + { + // At this point the add and remove methods have been found + $previousValue = $this->readProperty($zval, $property); + $previousValue = $previousValue[self::VALUE]; + + $removeMethodName = $removeMethod->getName(); + $addMethodName = $addMethod->getName(); + + if ($previousValue instanceof \Traversable) { + $previousValue = iterator_to_array($previousValue); + } + if ($previousValue && \is_array($previousValue)) { + if (\is_object($collection)) { + $collection = iterator_to_array($collection); + } + foreach ($previousValue as $key => $item) { + if (!\in_array($item, $collection, true)) { + unset($previousValue[$key]); + $zval[self::VALUE]->$removeMethodName($item); + } + } + } else { + $previousValue = false; + } + + foreach ($collection as $item) { + if (!$previousValue || !\in_array($item, $previousValue, true)) { + $zval[self::VALUE]->$addMethodName($item); + } + } + } + + private function getWriteInfo(string $class, string $property, $value): PropertyWriteInfo + { + $useAdderAndRemover = is_iterable($value); + $key = str_replace('\\', '.', $class).'..'.$property.'..'.(int) $useAdderAndRemover; + + if (isset($this->writePropertyCache[$key])) { + return $this->writePropertyCache[$key]; + } + + if ($this->cacheItemPool) { + $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_WRITE.rawurlencode($key)); + if ($item->isHit()) { + return $this->writePropertyCache[$key] = $item->get(); + } + } + + $mutator = $this->writeInfoExtractor->getWriteInfo($class, $property, [ + 'enable_getter_setter_extraction' => true, + 'enable_magic_methods_extraction' => $this->magicMethodsFlags, + 'enable_constructor_extraction' => false, + 'enable_adder_remover_extraction' => $useAdderAndRemover, + ]); + + if (isset($item)) { + $this->cacheItemPool->save($item->set($mutator)); + } + + return $this->writePropertyCache[$key] = $mutator; + } + + /** + * Returns whether a property is writable in the given object. + */ + private function isPropertyWritable(object $object, string $property): bool + { + $mutatorForArray = $this->getWriteInfo(\get_class($object), $property, []); + + if (PropertyWriteInfo::TYPE_NONE !== $mutatorForArray->getType() || ($object instanceof \stdClass && property_exists($object, $property))) { + return true; + } + + $mutator = $this->getWriteInfo(\get_class($object), $property, ''); + + return PropertyWriteInfo::TYPE_NONE !== $mutator->getType() || ($object instanceof \stdClass && property_exists($object, $property)); + } + + /** + * Gets a PropertyPath instance and caches it. + * + * @param string|PropertyPath $propertyPath + */ + private function getPropertyPath($propertyPath): PropertyPath + { + if ($propertyPath instanceof PropertyPathInterface) { + // Don't call the copy constructor has it is not needed here + return $propertyPath; + } + + if (isset($this->propertyPathCache[$propertyPath])) { + return $this->propertyPathCache[$propertyPath]; + } + + if ($this->cacheItemPool) { + $item = $this->cacheItemPool->getItem(self::CACHE_PREFIX_PROPERTY_PATH.rawurlencode($propertyPath)); + if ($item->isHit()) { + return $this->propertyPathCache[$propertyPath] = $item->get(); + } + } + + $propertyPathInstance = new PropertyPath($propertyPath); + if (isset($item)) { + $item->set($propertyPathInstance); + $this->cacheItemPool->save($item); + } + + return $this->propertyPathCache[$propertyPath] = $propertyPathInstance; + } + + /** + * Creates the APCu adapter if applicable. + * + * @return AdapterInterface + * + * @throws \LogicException When the Cache Component isn't available + */ + public static function createCache(string $namespace, int $defaultLifetime, string $version, LoggerInterface $logger = null) + { + if (!class_exists(ApcuAdapter::class)) { + throw new \LogicException(sprintf('The Symfony Cache component must be installed to use "%s()".', __METHOD__)); + } + + if (!ApcuAdapter::isSupported()) { + return new NullAdapter(); + } + + $apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version); + if ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), \FILTER_VALIDATE_BOOLEAN)) { + $apcu->setLogger(new NullLogger()); + } elseif (null !== $logger) { + $apcu->setLogger($logger); + } + + return $apcu; + } +} diff --git a/vendor/symfony/property-access/PropertyAccessorBuilder.php b/vendor/symfony/property-access/PropertyAccessorBuilder.php new file mode 100644 index 0000000..68c1984 --- /dev/null +++ b/vendor/symfony/property-access/PropertyAccessorBuilder.php @@ -0,0 +1,308 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface; + +/** + * A configurable builder to create a PropertyAccessor. + * + * @author Jérémie Augustin + */ +class PropertyAccessorBuilder +{ + /** @var int */ + private $magicMethods = PropertyAccessor::MAGIC_GET | PropertyAccessor::MAGIC_SET; + private $throwExceptionOnInvalidIndex = false; + private $throwExceptionOnInvalidPropertyPath = true; + + /** + * @var CacheItemPoolInterface|null + */ + private $cacheItemPool; + + /** + * @var PropertyReadInfoExtractorInterface|null + */ + private $readInfoExtractor; + + /** + * @var PropertyWriteInfoExtractorInterface|null + */ + private $writeInfoExtractor; + + /** + * Enables the use of all magic methods by the PropertyAccessor. + * + * @return $this + */ + public function enableMagicMethods(): self + { + $this->magicMethods = PropertyAccessor::MAGIC_GET | PropertyAccessor::MAGIC_SET | PropertyAccessor::MAGIC_CALL; + + return $this; + } + + /** + * Disable the use of all magic methods by the PropertyAccessor. + * + * @return $this + */ + public function disableMagicMethods(): self + { + $this->magicMethods = PropertyAccessor::DISALLOW_MAGIC_METHODS; + + return $this; + } + + /** + * Enables the use of "__call" by the PropertyAccessor. + * + * @return $this + */ + public function enableMagicCall() + { + $this->magicMethods |= PropertyAccessor::MAGIC_CALL; + + return $this; + } + + /** + * Enables the use of "__get" by the PropertyAccessor. + */ + public function enableMagicGet(): self + { + $this->magicMethods |= PropertyAccessor::MAGIC_GET; + + return $this; + } + + /** + * Enables the use of "__set" by the PropertyAccessor. + * + * @return $this + */ + public function enableMagicSet(): self + { + $this->magicMethods |= PropertyAccessor::MAGIC_SET; + + return $this; + } + + /** + * Disables the use of "__call" by the PropertyAccessor. + * + * @return $this + */ + public function disableMagicCall() + { + $this->magicMethods &= ~PropertyAccessor::MAGIC_CALL; + + return $this; + } + + /** + * Disables the use of "__get" by the PropertyAccessor. + * + * @return $this + */ + public function disableMagicGet(): self + { + $this->magicMethods &= ~PropertyAccessor::MAGIC_GET; + + return $this; + } + + /** + * Disables the use of "__set" by the PropertyAccessor. + * + * @return $this + */ + public function disableMagicSet(): self + { + $this->magicMethods &= ~PropertyAccessor::MAGIC_SET; + + return $this; + } + + /** + * @return bool whether the use of "__call" by the PropertyAccessor is enabled + */ + public function isMagicCallEnabled() + { + return (bool) ($this->magicMethods & PropertyAccessor::MAGIC_CALL); + } + + /** + * @return bool whether the use of "__get" by the PropertyAccessor is enabled + */ + public function isMagicGetEnabled(): bool + { + return $this->magicMethods & PropertyAccessor::MAGIC_GET; + } + + /** + * @return bool whether the use of "__set" by the PropertyAccessor is enabled + */ + public function isMagicSetEnabled(): bool + { + return $this->magicMethods & PropertyAccessor::MAGIC_SET; + } + + /** + * Enables exceptions when reading a non-existing index. + * + * This has no influence on writing non-existing indices with PropertyAccessorInterface::setValue() + * which are always created on-the-fly. + * + * @return $this + */ + public function enableExceptionOnInvalidIndex() + { + $this->throwExceptionOnInvalidIndex = true; + + return $this; + } + + /** + * Disables exceptions when reading a non-existing index. + * + * Instead, null is returned when calling PropertyAccessorInterface::getValue() on a non-existing index. + * + * @return $this + */ + public function disableExceptionOnInvalidIndex() + { + $this->throwExceptionOnInvalidIndex = false; + + return $this; + } + + /** + * @return bool whether an exception is thrown or null is returned when reading a non-existing index + */ + public function isExceptionOnInvalidIndexEnabled() + { + return $this->throwExceptionOnInvalidIndex; + } + + /** + * Enables exceptions when reading a non-existing property. + * + * This has no influence on writing non-existing indices with PropertyAccessorInterface::setValue() + * which are always created on-the-fly. + * + * @return $this + */ + public function enableExceptionOnInvalidPropertyPath() + { + $this->throwExceptionOnInvalidPropertyPath = true; + + return $this; + } + + /** + * Disables exceptions when reading a non-existing index. + * + * Instead, null is returned when calling PropertyAccessorInterface::getValue() on a non-existing index. + * + * @return $this + */ + public function disableExceptionOnInvalidPropertyPath() + { + $this->throwExceptionOnInvalidPropertyPath = false; + + return $this; + } + + /** + * @return bool whether an exception is thrown or null is returned when reading a non-existing property + */ + public function isExceptionOnInvalidPropertyPath() + { + return $this->throwExceptionOnInvalidPropertyPath; + } + + /** + * Sets a cache system. + * + * @return $this + */ + public function setCacheItemPool(CacheItemPoolInterface $cacheItemPool = null) + { + $this->cacheItemPool = $cacheItemPool; + + return $this; + } + + /** + * Gets the used cache system. + * + * @return CacheItemPoolInterface|null + */ + public function getCacheItemPool() + { + return $this->cacheItemPool; + } + + /** + * @return $this + */ + public function setReadInfoExtractor(?PropertyReadInfoExtractorInterface $readInfoExtractor) + { + $this->readInfoExtractor = $readInfoExtractor; + + return $this; + } + + public function getReadInfoExtractor(): ?PropertyReadInfoExtractorInterface + { + return $this->readInfoExtractor; + } + + /** + * @return $this + */ + public function setWriteInfoExtractor(?PropertyWriteInfoExtractorInterface $writeInfoExtractor) + { + $this->writeInfoExtractor = $writeInfoExtractor; + + return $this; + } + + public function getWriteInfoExtractor(): ?PropertyWriteInfoExtractorInterface + { + return $this->writeInfoExtractor; + } + + /** + * Builds and returns a new PropertyAccessor object. + * + * @return PropertyAccessorInterface + */ + public function getPropertyAccessor() + { + $throw = PropertyAccessor::DO_NOT_THROW; + + if ($this->throwExceptionOnInvalidIndex) { + $throw |= PropertyAccessor::THROW_ON_INVALID_INDEX; + } + + if ($this->throwExceptionOnInvalidPropertyPath) { + $throw |= PropertyAccessor::THROW_ON_INVALID_PROPERTY_PATH; + } + + return new PropertyAccessor($this->magicMethods, $throw, $this->cacheItemPool, $this->readInfoExtractor, $this->writeInfoExtractor); + } +} diff --git a/vendor/symfony/property-access/PropertyAccessorInterface.php b/vendor/symfony/property-access/PropertyAccessorInterface.php new file mode 100644 index 0000000..c5226b2 --- /dev/null +++ b/vendor/symfony/property-access/PropertyAccessorInterface.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +/** + * Writes and reads values to/from an object/array graph. + * + * @author Bernhard Schussek + */ +interface PropertyAccessorInterface +{ + /** + * Sets the value at the end of the property path of the object graph. + * + * Example: + * + * use Symfony\Component\PropertyAccess\PropertyAccess; + * + * $propertyAccessor = PropertyAccess::createPropertyAccessor(); + * + * echo $propertyAccessor->setValue($object, 'child.name', 'Fabien'); + * // equals echo $object->getChild()->setName('Fabien'); + * + * This method first tries to find a public setter for each property in the + * path. The name of the setter must be the camel-cased property name + * prefixed with "set". + * + * If the setter does not exist, this method tries to find a public + * property. The value of the property is then changed. + * + * If neither is found, an exception is thrown. + * + * @param object|array $objectOrArray The object or array to modify + * @param string|PropertyPathInterface $propertyPath The property path to modify + * @param mixed $value The value to set at the end of the property path + * + * @throws Exception\InvalidArgumentException If the property path is invalid + * @throws Exception\AccessException If a property/index does not exist or is not public + * @throws Exception\UnexpectedTypeException If a value within the path is neither object nor array + */ + public function setValue(&$objectOrArray, $propertyPath, $value); + + /** + * Returns the value at the end of the property path of the object graph. + * + * Example: + * + * use Symfony\Component\PropertyAccess\PropertyAccess; + * + * $propertyAccessor = PropertyAccess::createPropertyAccessor(); + * + * echo $propertyAccessor->getValue($object, 'child.name'); + * // equals echo $object->getChild()->getName(); + * + * This method first tries to find a public getter for each property in the + * path. The name of the getter must be the camel-cased property name + * prefixed with "get", "is", or "has". + * + * If the getter does not exist, this method tries to find a public + * property. The value of the property is then returned. + * + * If none of them are found, an exception is thrown. + * + * @param object|array $objectOrArray The object or array to traverse + * @param string|PropertyPathInterface $propertyPath The property path to read + * + * @return mixed + * + * @throws Exception\InvalidArgumentException If the property path is invalid + * @throws Exception\AccessException If a property/index does not exist or is not public + * @throws Exception\UnexpectedTypeException If a value within the path is neither object + * nor array + */ + public function getValue($objectOrArray, $propertyPath); + + /** + * Returns whether a value can be written at a given property path. + * + * Whenever this method returns true, {@link setValue()} is guaranteed not + * to throw an exception when called with the same arguments. + * + * @param object|array $objectOrArray The object or array to check + * @param string|PropertyPathInterface $propertyPath The property path to check + * + * @return bool + * + * @throws Exception\InvalidArgumentException If the property path is invalid + */ + public function isWritable($objectOrArray, $propertyPath); + + /** + * Returns whether a property path can be read from an object graph. + * + * Whenever this method returns true, {@link getValue()} is guaranteed not + * to throw an exception when called with the same arguments. + * + * @param object|array $objectOrArray The object or array to check + * @param string|PropertyPathInterface $propertyPath The property path to check + * + * @return bool + * + * @throws Exception\InvalidArgumentException If the property path is invalid + */ + public function isReadable($objectOrArray, $propertyPath); +} diff --git a/vendor/symfony/property-access/PropertyPath.php b/vendor/symfony/property-access/PropertyPath.php new file mode 100644 index 0000000..e99c019 --- /dev/null +++ b/vendor/symfony/property-access/PropertyPath.php @@ -0,0 +1,208 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; +use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException; +use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException; + +/** + * Default implementation of {@link PropertyPathInterface}. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class PropertyPath implements \IteratorAggregate, PropertyPathInterface +{ + /** + * Character used for separating between plural and singular of an element. + */ + public const SINGULAR_SEPARATOR = '|'; + + /** + * The elements of the property path. + * + * @var list + */ + private $elements = []; + + /** + * The number of elements in the property path. + * + * @var int + */ + private $length; + + /** + * Contains a Boolean for each property in $elements denoting whether this + * element is an index. It is a property otherwise. + * + * @var array + */ + private $isIndex = []; + + /** + * String representation of the path. + * + * @var string + */ + private $pathAsString; + + /** + * Constructs a property path from a string. + * + * @param PropertyPath|string $propertyPath The property path as string or instance + * + * @throws InvalidArgumentException If the given path is not a string + * @throws InvalidPropertyPathException If the syntax of the property path is not valid + */ + public function __construct($propertyPath) + { + // Can be used as copy constructor + if ($propertyPath instanceof self) { + /* @var PropertyPath $propertyPath */ + $this->elements = $propertyPath->elements; + $this->length = $propertyPath->length; + $this->isIndex = $propertyPath->isIndex; + $this->pathAsString = $propertyPath->pathAsString; + + return; + } + if (!\is_string($propertyPath)) { + throw new InvalidArgumentException(sprintf('The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "%s".', get_debug_type($propertyPath))); + } + + if ('' === $propertyPath) { + throw new InvalidPropertyPathException('The property path should not be empty.'); + } + + $this->pathAsString = $propertyPath; + $position = 0; + $remaining = $propertyPath; + + // first element is evaluated differently - no leading dot for properties + $pattern = '/^(([^\.\[]++)|\[([^\]]++)\])(.*)/'; + + while (preg_match($pattern, $remaining, $matches)) { + if ('' !== $matches[2]) { + $element = $matches[2]; + $this->isIndex[] = false; + } else { + $element = $matches[3]; + $this->isIndex[] = true; + } + + $this->elements[] = $element; + + $position += \strlen($matches[1]); + $remaining = $matches[4]; + $pattern = '/^(\.([^\.|\[]++)|\[([^\]]++)\])(.*)/'; + } + + if ('' !== $remaining) { + throw new InvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d.', $propertyPath, $remaining[0], $position)); + } + + $this->length = \count($this->elements); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->pathAsString; + } + + /** + * {@inheritdoc} + */ + public function getLength() + { + return $this->length; + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + if ($this->length <= 1) { + return null; + } + + $parent = clone $this; + + --$parent->length; + $parent->pathAsString = substr($parent->pathAsString, 0, max(strrpos($parent->pathAsString, '.'), strrpos($parent->pathAsString, '['))); + array_pop($parent->elements); + array_pop($parent->isIndex); + + return $parent; + } + + /** + * Returns a new iterator for this path. + * + * @return PropertyPathIteratorInterface + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new PropertyPathIterator($this); + } + + /** + * {@inheritdoc} + */ + public function getElements() + { + return $this->elements; + } + + /** + * {@inheritdoc} + */ + public function getElement(int $index) + { + if (!isset($this->elements[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); + } + + return $this->elements[$index]; + } + + /** + * {@inheritdoc} + */ + public function isProperty(int $index) + { + if (!isset($this->isIndex[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); + } + + return !$this->isIndex[$index]; + } + + /** + * {@inheritdoc} + */ + public function isIndex(int $index) + { + if (!isset($this->isIndex[$index])) { + throw new OutOfBoundsException(sprintf('The index "%s" is not within the property path.', $index)); + } + + return $this->isIndex[$index]; + } +} diff --git a/vendor/symfony/property-access/PropertyPathBuilder.php b/vendor/symfony/property-access/PropertyPathBuilder.php new file mode 100644 index 0000000..b521f6a --- /dev/null +++ b/vendor/symfony/property-access/PropertyPathBuilder.php @@ -0,0 +1,281 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +use Symfony\Component\PropertyAccess\Exception\OutOfBoundsException; + +/** + * @author Bernhard Schussek + */ +class PropertyPathBuilder +{ + private $elements = []; + private $isIndex = []; + + /** + * Creates a new property path builder. + * + * @param PropertyPathInterface|string|null $path The path to initially store + * in the builder. Optional. + */ + public function __construct($path = null) + { + if (null !== $path) { + $this->append($path); + } + } + + /** + * Appends a (sub-) path to the current path. + * + * @param PropertyPathInterface|string $path The path to append + * @param int $offset The offset where the appended + * piece starts in $path + * @param int $length The length of the appended piece + * If 0, the full path is appended + */ + public function append($path, int $offset = 0, int $length = 0) + { + if (\is_string($path)) { + $path = new PropertyPath($path); + } + + if (0 === $length) { + $end = $path->getLength(); + } else { + $end = $offset + $length; + } + + for (; $offset < $end; ++$offset) { + $this->elements[] = $path->getElement($offset); + $this->isIndex[] = $path->isIndex($offset); + } + } + + /** + * Appends an index element to the current path. + */ + public function appendIndex(string $name) + { + $this->elements[] = $name; + $this->isIndex[] = true; + } + + /** + * Appends a property element to the current path. + */ + public function appendProperty(string $name) + { + $this->elements[] = $name; + $this->isIndex[] = false; + } + + /** + * Removes elements from the current path. + * + * @throws OutOfBoundsException if offset is invalid + */ + public function remove(int $offset, int $length = 1) + { + if (!isset($this->elements[$offset])) { + throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset)); + } + + $this->resize($offset, $length, 0); + } + + /** + * Replaces a sub-path by a different (sub-) path. + * + * @param int $offset The offset at which to replace + * @param int $length The length of the piece to replace + * @param PropertyPathInterface|string $path The path to insert + * @param int $pathOffset The offset where the inserted piece + * starts in $path + * @param int $pathLength The length of the inserted piece + * If 0, the full path is inserted + * + * @throws OutOfBoundsException If the offset is invalid + */ + public function replace(int $offset, int $length, $path, int $pathOffset = 0, int $pathLength = 0) + { + if (\is_string($path)) { + $path = new PropertyPath($path); + } + + if ($offset < 0 && abs($offset) <= $this->getLength()) { + $offset = $this->getLength() + $offset; + } elseif (!isset($this->elements[$offset])) { + throw new OutOfBoundsException('The offset '.$offset.' is not within the property path'); + } + + if (0 === $pathLength) { + $pathLength = $path->getLength() - $pathOffset; + } + + $this->resize($offset, $length, $pathLength); + + for ($i = 0; $i < $pathLength; ++$i) { + $this->elements[$offset + $i] = $path->getElement($pathOffset + $i); + $this->isIndex[$offset + $i] = $path->isIndex($pathOffset + $i); + } + ksort($this->elements); + } + + /** + * Replaces a property element by an index element. + * + * @throws OutOfBoundsException If the offset is invalid + */ + public function replaceByIndex(int $offset, string $name = null) + { + if (!isset($this->elements[$offset])) { + throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset)); + } + + if (null !== $name) { + $this->elements[$offset] = $name; + } + + $this->isIndex[$offset] = true; + } + + /** + * Replaces an index element by a property element. + * + * @throws OutOfBoundsException If the offset is invalid + */ + public function replaceByProperty(int $offset, string $name = null) + { + if (!isset($this->elements[$offset])) { + throw new OutOfBoundsException(sprintf('The offset "%s" is not within the property path.', $offset)); + } + + if (null !== $name) { + $this->elements[$offset] = $name; + } + + $this->isIndex[$offset] = false; + } + + /** + * Returns the length of the current path. + * + * @return int + */ + public function getLength() + { + return \count($this->elements); + } + + /** + * Returns the current property path. + * + * @return PropertyPathInterface|null + */ + public function getPropertyPath() + { + $pathAsString = $this->__toString(); + + return '' !== $pathAsString ? new PropertyPath($pathAsString) : null; + } + + /** + * Returns the current property path as string. + * + * @return string + */ + public function __toString() + { + $string = ''; + + foreach ($this->elements as $offset => $element) { + if ($this->isIndex[$offset]) { + $element = '['.$element.']'; + } elseif ('' !== $string) { + $string .= '.'; + } + + $string .= $element; + } + + return $string; + } + + /** + * Resizes the path so that a chunk of length $cutLength is + * removed at $offset and another chunk of length $insertionLength + * can be inserted. + */ + private function resize(int $offset, int $cutLength, int $insertionLength) + { + // Nothing else to do in this case + if ($insertionLength === $cutLength) { + return; + } + + $length = \count($this->elements); + + if ($cutLength > $insertionLength) { + // More elements should be removed than inserted + $diff = $cutLength - $insertionLength; + $newLength = $length - $diff; + + // Shift elements to the left (left-to-right until the new end) + // Max allowed offset to be shifted is such that + // $offset + $diff < $length (otherwise invalid index access) + // i.e. $offset < $length - $diff = $newLength + for ($i = $offset; $i < $newLength; ++$i) { + $this->elements[$i] = $this->elements[$i + $diff]; + $this->isIndex[$i] = $this->isIndex[$i + $diff]; + } + + // All remaining elements should be removed + $this->elements = \array_slice($this->elements, 0, $i); + $this->isIndex = \array_slice($this->isIndex, 0, $i); + } else { + $diff = $insertionLength - $cutLength; + + $newLength = $length + $diff; + $indexAfterInsertion = $offset + $insertionLength; + + // $diff <= $insertionLength + // $indexAfterInsertion >= $insertionLength + // => $diff <= $indexAfterInsertion + + // In each of the following loops, $i >= $diff must hold, + // otherwise ($i - $diff) becomes negative. + + // Shift old elements to the right to make up space for the + // inserted elements. This needs to be done left-to-right in + // order to preserve an ascending array index order + // Since $i = max($length, $indexAfterInsertion) and $indexAfterInsertion >= $diff, + // $i >= $diff is guaranteed. + for ($i = max($length, $indexAfterInsertion); $i < $newLength; ++$i) { + $this->elements[$i] = $this->elements[$i - $diff]; + $this->isIndex[$i] = $this->isIndex[$i - $diff]; + } + + // Shift remaining elements to the right. Do this right-to-left + // so we don't overwrite elements before copying them + // The last written index is the immediate index after the inserted + // string, because the indices before that will be overwritten + // anyway. + // Since $i >= $indexAfterInsertion and $indexAfterInsertion >= $diff, + // $i >= $diff is guaranteed. + for ($i = $length - 1; $i >= $indexAfterInsertion; --$i) { + $this->elements[$i] = $this->elements[$i - $diff]; + $this->isIndex[$i] = $this->isIndex[$i - $diff]; + } + } + } +} diff --git a/vendor/symfony/property-access/PropertyPathInterface.php b/vendor/symfony/property-access/PropertyPathInterface.php new file mode 100644 index 0000000..d58ad32 --- /dev/null +++ b/vendor/symfony/property-access/PropertyPathInterface.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +/** + * A sequence of property names or array indices. + * + * @author Bernhard Schussek + * + * @extends \Traversable + */ +interface PropertyPathInterface extends \Traversable +{ + /** + * Returns the string representation of the property path. + * + * @return string + */ + public function __toString(); + + /** + * Returns the length of the property path, i.e. the number of elements. + * + * @return int + */ + public function getLength(); + + /** + * Returns the parent property path. + * + * The parent property path is the one that contains the same items as + * this one except for the last one. + * + * If this property path only contains one item, null is returned. + * + * @return self|null + */ + public function getParent(); + + /** + * Returns the elements of the property path as array. + * + * @return list + */ + public function getElements(); + + /** + * Returns the element at the given index in the property path. + * + * @param int $index The index key + * + * @return string + * + * @throws Exception\OutOfBoundsException If the offset is invalid + */ + public function getElement(int $index); + + /** + * Returns whether the element at the given index is a property. + * + * @param int $index The index in the property path + * + * @return bool + * + * @throws Exception\OutOfBoundsException If the offset is invalid + */ + public function isProperty(int $index); + + /** + * Returns whether the element at the given index is an array index. + * + * @param int $index The index in the property path + * + * @return bool + * + * @throws Exception\OutOfBoundsException If the offset is invalid + */ + public function isIndex(int $index); +} diff --git a/vendor/symfony/property-access/PropertyPathIterator.php b/vendor/symfony/property-access/PropertyPathIterator.php new file mode 100644 index 0000000..a3335e3 --- /dev/null +++ b/vendor/symfony/property-access/PropertyPathIterator.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +/** + * Traverses a property path and provides additional methods to find out + * information about the current element. + * + * @author Bernhard Schussek + * + * @extends \ArrayIterator + */ +class PropertyPathIterator extends \ArrayIterator implements PropertyPathIteratorInterface +{ + protected $path; + + public function __construct(PropertyPathInterface $path) + { + parent::__construct($path->getElements()); + + $this->path = $path; + } + + /** + * {@inheritdoc} + */ + public function isIndex() + { + return $this->path->isIndex($this->key()); + } + + /** + * {@inheritdoc} + */ + public function isProperty() + { + return $this->path->isProperty($this->key()); + } +} diff --git a/vendor/symfony/property-access/PropertyPathIteratorInterface.php b/vendor/symfony/property-access/PropertyPathIteratorInterface.php new file mode 100644 index 0000000..0397f9c --- /dev/null +++ b/vendor/symfony/property-access/PropertyPathIteratorInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess; + +/** + * @author Bernhard Schussek + * + * @extends \SeekableIterator + */ +interface PropertyPathIteratorInterface extends \SeekableIterator +{ + /** + * Returns whether the current element in the property path is an array + * index. + * + * @return bool + */ + public function isIndex(); + + /** + * Returns whether the current element in the property path is a property + * name. + * + * @return bool + */ + public function isProperty(); +} diff --git a/vendor/symfony/property-access/README.md b/vendor/symfony/property-access/README.md new file mode 100644 index 0000000..29cb233 --- /dev/null +++ b/vendor/symfony/property-access/README.md @@ -0,0 +1,14 @@ +PropertyAccess Component +======================== + +The PropertyAccess component provides functions to read and write from/to an +object or array using a simple string notation. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/property_access.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/property-access/composer.json b/vendor/symfony/property-access/composer.json new file mode 100644 index 0000000..fb6103a --- /dev/null +++ b/vendor/symfony/property-access/composer.json @@ -0,0 +1,37 @@ +{ + "name": "symfony/property-access", + "type": "library", + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "keywords": ["property", "index", "access", "object", "array", "extraction", "injection", "reflection", "property path"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/property-info": "^5.2|^6.0" + }, + "require-dev": { + "symfony/cache": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." + }, + "autoload": { + "psr-4": { "Symfony\\Component\\PropertyAccess\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/property-info/CHANGELOG.md b/vendor/symfony/property-info/CHANGELOG.md new file mode 100644 index 0000000..8963b94 --- /dev/null +++ b/vendor/symfony/property-info/CHANGELOG.md @@ -0,0 +1,39 @@ +CHANGELOG +========= + +5.4 +--- + + * Add PhpStanExtractor + +5.3 +--- + + * Add support for multiple types for collection keys & values + * Deprecate the `Type::getCollectionKeyType()` and `Type::getCollectionValueType()` methods, use `Type::getCollectionKeyTypes()` and `Type::getCollectionValueTypes()` instead + +5.2.0 +----- + + * deprecated the `enable_magic_call_extraction` context option in `ReflectionExtractor::getWriteInfo()` and `ReflectionExtractor::getReadInfo()` in favor of `enable_magic_methods_extraction` + +5.1.0 +----- + + * Add support for extracting accessor and mutator via PHP Reflection + +4.3.0 +----- + + * Added the ability to extract private and protected properties and methods on `ReflectionExtractor` + * Added the ability to extract property type based on its initial value + +4.2.0 +----- + + * added `PropertyInitializableExtractorInterface` to test if a property can be initialized through the constructor (implemented by `ReflectionExtractor`) + +3.3.0 +----- + + * Added `PropertyInfoPass` diff --git a/vendor/symfony/property-info/DependencyInjection/PropertyInfoConstructorPass.php b/vendor/symfony/property-info/DependencyInjection/PropertyInfoConstructorPass.php new file mode 100644 index 0000000..cab31b3 --- /dev/null +++ b/vendor/symfony/property-info/DependencyInjection/PropertyInfoConstructorPass.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\DependencyInjection; + +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Adds extractors to the property_info.constructor_extractor service. + * + * @author Dmitrii Poddubnyi + */ +final class PropertyInfoConstructorPass implements CompilerPassInterface +{ + use PriorityTaggedServiceTrait; + + private $service; + private $tag; + + public function __construct(string $service = 'property_info.constructor_extractor', string $tag = 'property_info.constructor_extractor') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/property-info', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->service = $service; + $this->tag = $tag; + } + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition($this->service)) { + return; + } + $definition = $container->getDefinition($this->service); + + $listExtractors = $this->findAndSortTaggedServices($this->tag, $container); + $definition->replaceArgument(0, new IteratorArgument($listExtractors)); + } +} diff --git a/vendor/symfony/property-info/DependencyInjection/PropertyInfoPass.php b/vendor/symfony/property-info/DependencyInjection/PropertyInfoPass.php new file mode 100644 index 0000000..289b114 --- /dev/null +++ b/vendor/symfony/property-info/DependencyInjection/PropertyInfoPass.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\DependencyInjection; + +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Adds extractors to the property_info service. + * + * @author Kévin Dunglas + */ +class PropertyInfoPass implements CompilerPassInterface +{ + use PriorityTaggedServiceTrait; + + private $propertyInfoService; + private $listExtractorTag; + private $typeExtractorTag; + private $descriptionExtractorTag; + private $accessExtractorTag; + private $initializableExtractorTag; + + public function __construct(string $propertyInfoService = 'property_info', string $listExtractorTag = 'property_info.list_extractor', string $typeExtractorTag = 'property_info.type_extractor', string $descriptionExtractorTag = 'property_info.description_extractor', string $accessExtractorTag = 'property_info.access_extractor', string $initializableExtractorTag = 'property_info.initializable_extractor') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/property-info', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->propertyInfoService = $propertyInfoService; + $this->listExtractorTag = $listExtractorTag; + $this->typeExtractorTag = $typeExtractorTag; + $this->descriptionExtractorTag = $descriptionExtractorTag; + $this->accessExtractorTag = $accessExtractorTag; + $this->initializableExtractorTag = $initializableExtractorTag; + } + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition($this->propertyInfoService)) { + return; + } + + $definition = $container->getDefinition($this->propertyInfoService); + + $listExtractors = $this->findAndSortTaggedServices($this->listExtractorTag, $container); + $definition->replaceArgument(0, new IteratorArgument($listExtractors)); + + $typeExtractors = $this->findAndSortTaggedServices($this->typeExtractorTag, $container); + $definition->replaceArgument(1, new IteratorArgument($typeExtractors)); + + $descriptionExtractors = $this->findAndSortTaggedServices($this->descriptionExtractorTag, $container); + $definition->replaceArgument(2, new IteratorArgument($descriptionExtractors)); + + $accessExtractors = $this->findAndSortTaggedServices($this->accessExtractorTag, $container); + $definition->replaceArgument(3, new IteratorArgument($accessExtractors)); + + $initializableExtractors = $this->findAndSortTaggedServices($this->initializableExtractorTag, $container); + $definition->setArgument(4, new IteratorArgument($initializableExtractors)); + } +} diff --git a/vendor/symfony/property-info/Extractor/ConstructorArgumentTypeExtractorInterface.php b/vendor/symfony/property-info/Extractor/ConstructorArgumentTypeExtractorInterface.php new file mode 100644 index 0000000..cbde902 --- /dev/null +++ b/vendor/symfony/property-info/Extractor/ConstructorArgumentTypeExtractorInterface.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use Symfony\Component\PropertyInfo\Type; + +/** + * Infers the constructor argument type. + * + * @author Dmitrii Poddubnyi + * + * @internal + */ +interface ConstructorArgumentTypeExtractorInterface +{ + /** + * Gets types of an argument from constructor. + * + * @return Type[]|null + * + * @internal + */ + public function getTypesFromConstructor(string $class, string $property): ?array; +} diff --git a/vendor/symfony/property-info/Extractor/ConstructorExtractor.php b/vendor/symfony/property-info/Extractor/ConstructorExtractor.php new file mode 100644 index 0000000..fb32634 --- /dev/null +++ b/vendor/symfony/property-info/Extractor/ConstructorExtractor.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; + +/** + * Extracts the constructor argument type using ConstructorArgumentTypeExtractorInterface implementations. + * + * @author Dmitrii Poddubnyi + */ +final class ConstructorExtractor implements PropertyTypeExtractorInterface +{ + private $extractors; + + /** + * @param iterable $extractors + */ + public function __construct(iterable $extractors = []) + { + $this->extractors = $extractors; + } + + /** + * {@inheritdoc} + */ + public function getTypes(string $class, string $property, array $context = []): ?array + { + foreach ($this->extractors as $extractor) { + $value = $extractor->getTypesFromConstructor($class, $property); + if (null !== $value) { + return $value; + } + } + + return null; + } +} diff --git a/vendor/symfony/property-info/Extractor/PhpDocExtractor.php b/vendor/symfony/property-info/Extractor/PhpDocExtractor.php new file mode 100644 index 0000000..0f2fba5 --- /dev/null +++ b/vendor/symfony/property-info/Extractor/PhpDocExtractor.php @@ -0,0 +1,360 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; +use phpDocumentor\Reflection\DocBlockFactory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\ContextFactory; +use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; +use Symfony\Component\PropertyInfo\Type; +use Symfony\Component\PropertyInfo\Util\PhpDocTypeHelper; + +/** + * Extracts data using a PHPDoc parser. + * + * @author Kévin Dunglas + * + * @final + */ +class PhpDocExtractor implements PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface +{ + public const PROPERTY = 0; + public const ACCESSOR = 1; + public const MUTATOR = 2; + + /** + * @var array + */ + private $docBlocks = []; + + /** + * @var Context[] + */ + private $contexts = []; + + private $docBlockFactory; + private $contextFactory; + private $phpDocTypeHelper; + private $mutatorPrefixes; + private $accessorPrefixes; + private $arrayMutatorPrefixes; + + /** + * @param string[]|null $mutatorPrefixes + * @param string[]|null $accessorPrefixes + * @param string[]|null $arrayMutatorPrefixes + */ + public function __construct(DocBlockFactoryInterface $docBlockFactory = null, array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) + { + if (!class_exists(DocBlockFactory::class)) { + throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpdocumentor/reflection-docblock" package is not installed.', __CLASS__)); + } + + $this->docBlockFactory = $docBlockFactory ?: DocBlockFactory::createInstance(); + $this->contextFactory = new ContextFactory(); + $this->phpDocTypeHelper = new PhpDocTypeHelper(); + $this->mutatorPrefixes = $mutatorPrefixes ?? ReflectionExtractor::$defaultMutatorPrefixes; + $this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes; + $this->arrayMutatorPrefixes = $arrayMutatorPrefixes ?? ReflectionExtractor::$defaultArrayMutatorPrefixes; + } + + /** + * {@inheritdoc} + */ + public function getShortDescription(string $class, string $property, array $context = []): ?string + { + /** @var $docBlock DocBlock */ + [$docBlock] = $this->getDocBlock($class, $property); + if (!$docBlock) { + return null; + } + + $shortDescription = $docBlock->getSummary(); + + if (!empty($shortDescription)) { + return $shortDescription; + } + + foreach ($docBlock->getTagsByName('var') as $var) { + if ($var && !$var instanceof InvalidTag) { + $varDescription = $var->getDescription()->render(); + + if (!empty($varDescription)) { + return $varDescription; + } + } + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function getLongDescription(string $class, string $property, array $context = []): ?string + { + /** @var $docBlock DocBlock */ + [$docBlock] = $this->getDocBlock($class, $property); + if (!$docBlock) { + return null; + } + + $contents = $docBlock->getDescription()->render(); + + return '' === $contents ? null : $contents; + } + + /** + * {@inheritdoc} + */ + public function getTypes(string $class, string $property, array $context = []): ?array + { + /** @var $docBlock DocBlock */ + [$docBlock, $source, $prefix] = $this->getDocBlock($class, $property); + if (!$docBlock) { + return null; + } + + switch ($source) { + case self::PROPERTY: + $tag = 'var'; + break; + + case self::ACCESSOR: + $tag = 'return'; + break; + + case self::MUTATOR: + $tag = 'param'; + break; + } + + $parentClass = null; + $types = []; + /** @var DocBlock\Tags\Var_|DocBlock\Tags\Return_|DocBlock\Tags\Param $tag */ + foreach ($docBlock->getTagsByName($tag) as $tag) { + if ($tag && !$tag instanceof InvalidTag && null !== $tag->getType()) { + foreach ($this->phpDocTypeHelper->getTypes($tag->getType()) as $type) { + switch ($type->getClassName()) { + case 'self': + case 'static': + $resolvedClass = $class; + break; + + case 'parent': + if (false !== $resolvedClass = $parentClass ?? $parentClass = get_parent_class($class)) { + break; + } + // no break + + default: + $types[] = $type; + continue 2; + } + + $types[] = new Type(Type::BUILTIN_TYPE_OBJECT, $type->isNullable(), $resolvedClass, $type->isCollection(), $type->getCollectionKeyTypes(), $type->getCollectionValueTypes()); + } + } + } + + if (!isset($types[0])) { + return null; + } + + if (!\in_array($prefix, $this->arrayMutatorPrefixes)) { + return $types; + } + + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $types[0])]; + } + + /** + * {@inheritdoc} + */ + public function getTypesFromConstructor(string $class, string $property): ?array + { + $docBlock = $this->getDocBlockFromConstructor($class, $property); + + if (!$docBlock) { + return null; + } + + $types = []; + /** @var DocBlock\Tags\Var_|DocBlock\Tags\Return_|DocBlock\Tags\Param $tag */ + foreach ($docBlock->getTagsByName('param') as $tag) { + if ($tag && null !== $tag->getType()) { + $types[] = $this->phpDocTypeHelper->getTypes($tag->getType()); + } + } + + if (!isset($types[0])) { + return null; + } + + return array_merge([], ...$types); + } + + private function getDocBlockFromConstructor(string $class, string $property): ?DocBlock + { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + $reflectionConstructor = $reflectionClass->getConstructor(); + if (!$reflectionConstructor) { + return null; + } + + try { + $docBlock = $this->docBlockFactory->create($reflectionConstructor, $this->contextFactory->createFromReflector($reflectionConstructor)); + + return $this->filterDocBlockParams($docBlock, $property); + } catch (\InvalidArgumentException $e) { + return null; + } + } + + private function filterDocBlockParams(DocBlock $docBlock, string $allowedParam): DocBlock + { + $tags = array_values(array_filter($docBlock->getTagsByName('param'), function ($tag) use ($allowedParam) { + return $tag instanceof DocBlock\Tags\Param && $allowedParam === $tag->getVariableName(); + })); + + return new DocBlock($docBlock->getSummary(), $docBlock->getDescription(), $tags, $docBlock->getContext(), + $docBlock->getLocation(), $docBlock->isTemplateStart(), $docBlock->isTemplateEnd()); + } + + /** + * @return array{DocBlock|null, int|null, string|null} + */ + private function getDocBlock(string $class, string $property): array + { + $propertyHash = sprintf('%s::%s', $class, $property); + + if (isset($this->docBlocks[$propertyHash])) { + return $this->docBlocks[$propertyHash]; + } + + $ucFirstProperty = ucfirst($property); + + switch (true) { + case $docBlock = $this->getDocBlockFromProperty($class, $property): + $data = [$docBlock, self::PROPERTY, null]; + break; + + case [$docBlock] = $this->getDocBlockFromMethod($class, $ucFirstProperty, self::ACCESSOR): + $data = [$docBlock, self::ACCESSOR, null]; + break; + + case [$docBlock, $prefix] = $this->getDocBlockFromMethod($class, $ucFirstProperty, self::MUTATOR): + $data = [$docBlock, self::MUTATOR, $prefix]; + break; + + default: + $data = [null, null, null]; + } + + return $this->docBlocks[$propertyHash] = $data; + } + + private function getDocBlockFromProperty(string $class, string $property): ?DocBlock + { + // Use a ReflectionProperty instead of $class to get the parent class if applicable + try { + $reflectionProperty = new \ReflectionProperty($class, $property); + } catch (\ReflectionException $e) { + return null; + } + + $reflector = $reflectionProperty->getDeclaringClass(); + + foreach ($reflector->getTraits() as $trait) { + if ($trait->hasProperty($property)) { + return $this->getDocBlockFromProperty($trait->getName(), $property); + } + } + + try { + return $this->docBlockFactory->create($reflectionProperty, $this->createFromReflector($reflector)); + } catch (\InvalidArgumentException|\RuntimeException $e) { + return null; + } + } + + /** + * @return array{DocBlock, string}|null + */ + private function getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type): ?array + { + $prefixes = self::ACCESSOR === $type ? $this->accessorPrefixes : $this->mutatorPrefixes; + $prefix = null; + + foreach ($prefixes as $prefix) { + $methodName = $prefix.$ucFirstProperty; + + try { + $reflectionMethod = new \ReflectionMethod($class, $methodName); + if ($reflectionMethod->isStatic()) { + continue; + } + + if ( + (self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) || + (self::MUTATOR === $type && $reflectionMethod->getNumberOfParameters() >= 1) + ) { + break; + } + } catch (\ReflectionException $e) { + // Try the next prefix if the method doesn't exist + } + } + + if (!isset($reflectionMethod)) { + return null; + } + + $reflector = $reflectionMethod->getDeclaringClass(); + + foreach ($reflector->getTraits() as $trait) { + if ($trait->hasMethod($methodName)) { + return $this->getDocBlockFromMethod($trait->getName(), $ucFirstProperty, $type); + } + } + + try { + return [$this->docBlockFactory->create($reflectionMethod, $this->createFromReflector($reflector)), $prefix]; + } catch (\InvalidArgumentException|\RuntimeException $e) { + return null; + } + } + + /** + * Prevents a lot of redundant calls to ContextFactory::createForNamespace(). + */ + private function createFromReflector(\ReflectionClass $reflector): Context + { + $cacheKey = $reflector->getNamespaceName().':'.$reflector->getFileName(); + + if (isset($this->contexts[$cacheKey])) { + return $this->contexts[$cacheKey]; + } + + $this->contexts[$cacheKey] = $this->contextFactory->createFromReflector($reflector); + + return $this->contexts[$cacheKey]; + } +} diff --git a/vendor/symfony/property-info/Extractor/PhpStanExtractor.php b/vendor/symfony/property-info/Extractor/PhpStanExtractor.php new file mode 100644 index 0000000..f833731 --- /dev/null +++ b/vendor/symfony/property-info/Extractor/PhpStanExtractor.php @@ -0,0 +1,277 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\Parser\ConstExprParser; +use PHPStan\PhpDocParser\Parser\PhpDocParser; +use PHPStan\PhpDocParser\Parser\TokenIterator; +use PHPStan\PhpDocParser\Parser\TypeParser; +use Symfony\Component\PropertyInfo\PhpStan\NameScopeFactory; +use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; +use Symfony\Component\PropertyInfo\Type; +use Symfony\Component\PropertyInfo\Util\PhpStanTypeHelper; + +/** + * Extracts data using PHPStan parser. + * + * @author Baptiste Leduc + */ +final class PhpStanExtractor implements PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface +{ + private const PROPERTY = 0; + private const ACCESSOR = 1; + private const MUTATOR = 2; + + /** @var PhpDocParser */ + private $phpDocParser; + + /** @var Lexer */ + private $lexer; + + /** @var NameScopeFactory */ + private $nameScopeFactory; + + /** @var array */ + private $docBlocks = []; + private $phpStanTypeHelper; + private $mutatorPrefixes; + private $accessorPrefixes; + private $arrayMutatorPrefixes; + + /** + * @param list|null $mutatorPrefixes + * @param list|null $accessorPrefixes + * @param list|null $arrayMutatorPrefixes + */ + public function __construct(array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) + { + $this->phpStanTypeHelper = new PhpStanTypeHelper(); + $this->mutatorPrefixes = $mutatorPrefixes ?? ReflectionExtractor::$defaultMutatorPrefixes; + $this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes; + $this->arrayMutatorPrefixes = $arrayMutatorPrefixes ?? ReflectionExtractor::$defaultArrayMutatorPrefixes; + + $this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser()); + $this->lexer = new Lexer(); + $this->nameScopeFactory = new NameScopeFactory(); + } + + public function getTypes(string $class, string $property, array $context = []): ?array + { + /** @var PhpDocNode|null $docNode */ + [$docNode, $source, $prefix, $declaringClass] = $this->getDocBlock($class, $property); + $nameScope = $this->nameScopeFactory->create($class, $declaringClass); + if (null === $docNode) { + return null; + } + + switch ($source) { + case self::PROPERTY: + $tag = '@var'; + break; + + case self::ACCESSOR: + $tag = '@return'; + break; + + case self::MUTATOR: + $tag = '@param'; + break; + } + + $parentClass = null; + $types = []; + foreach ($docNode->getTagsByName($tag) as $tagDocNode) { + if ($tagDocNode->value instanceof InvalidTagValueNode) { + continue; + } + + foreach ($this->phpStanTypeHelper->getTypes($tagDocNode->value, $nameScope) as $type) { + switch ($type->getClassName()) { + case 'self': + case 'static': + $resolvedClass = $class; + break; + + case 'parent': + if (false !== $resolvedClass = $parentClass ?? $parentClass = get_parent_class($class)) { + break; + } + // no break + + default: + $types[] = $type; + continue 2; + } + + $types[] = new Type(Type::BUILTIN_TYPE_OBJECT, $type->isNullable(), $resolvedClass, $type->isCollection(), $type->getCollectionKeyTypes(), $type->getCollectionValueTypes()); + } + } + + if (!isset($types[0])) { + return null; + } + + if (!\in_array($prefix, $this->arrayMutatorPrefixes, true)) { + return $types; + } + + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $types[0])]; + } + + public function getTypesFromConstructor(string $class, string $property): ?array + { + if (null === $tagDocNode = $this->getDocBlockFromConstructor($class, $property)) { + return null; + } + + $types = []; + foreach ($this->phpStanTypeHelper->getTypes($tagDocNode, $this->nameScopeFactory->create($class)) as $type) { + $types[] = $type; + } + + if (!isset($types[0])) { + return null; + } + + return $types; + } + + private function getDocBlockFromConstructor(string $class, string $property): ?ParamTagValueNode + { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + if (null === $reflectionConstructor = $reflectionClass->getConstructor()) { + return null; + } + + $rawDocNode = $reflectionConstructor->getDocComment(); + $tokens = new TokenIterator($this->lexer->tokenize($rawDocNode)); + $phpDocNode = $this->phpDocParser->parse($tokens); + $tokens->consumeTokenType(Lexer::TOKEN_END); + + return $this->filterDocBlockParams($phpDocNode, $property); + } + + private function filterDocBlockParams(PhpDocNode $docNode, string $allowedParam): ?ParamTagValueNode + { + $tags = array_values(array_filter($docNode->getTagsByName('@param'), function ($tagNode) use ($allowedParam) { + return $tagNode instanceof PhpDocTagNode && ('$'.$allowedParam) === $tagNode->value->parameterName; + })); + + if (!$tags) { + return null; + } + + return $tags[0]->value; + } + + /** + * @return array{PhpDocNode|null, int|null, string|null, string|null} + */ + private function getDocBlock(string $class, string $property): array + { + $propertyHash = $class.'::'.$property; + + if (isset($this->docBlocks[$propertyHash])) { + return $this->docBlocks[$propertyHash]; + } + + $ucFirstProperty = ucfirst($property); + + if ([$docBlock, $declaringClass] = $this->getDocBlockFromProperty($class, $property)) { + $data = [$docBlock, self::PROPERTY, null, $declaringClass]; + } elseif ([$docBlock, $_, $declaringClass] = $this->getDocBlockFromMethod($class, $ucFirstProperty, self::ACCESSOR)) { + $data = [$docBlock, self::ACCESSOR, null, $declaringClass]; + } elseif ([$docBlock, $prefix, $declaringClass] = $this->getDocBlockFromMethod($class, $ucFirstProperty, self::MUTATOR)) { + $data = [$docBlock, self::MUTATOR, $prefix, $declaringClass]; + } else { + $data = [null, null, null, null]; + } + + return $this->docBlocks[$propertyHash] = $data; + } + + /** + * @return array{PhpDocNode, string}|null + */ + private function getDocBlockFromProperty(string $class, string $property): ?array + { + // Use a ReflectionProperty instead of $class to get the parent class if applicable + try { + $reflectionProperty = new \ReflectionProperty($class, $property); + } catch (\ReflectionException $e) { + return null; + } + + if (null === $rawDocNode = $reflectionProperty->getDocComment() ?: null) { + return null; + } + + $tokens = new TokenIterator($this->lexer->tokenize($rawDocNode)); + $phpDocNode = $this->phpDocParser->parse($tokens); + $tokens->consumeTokenType(Lexer::TOKEN_END); + + return [$phpDocNode, $reflectionProperty->class]; + } + + /** + * @return array{PhpDocNode, string, string}|null + */ + private function getDocBlockFromMethod(string $class, string $ucFirstProperty, int $type): ?array + { + $prefixes = self::ACCESSOR === $type ? $this->accessorPrefixes : $this->mutatorPrefixes; + $prefix = null; + + foreach ($prefixes as $prefix) { + $methodName = $prefix.$ucFirstProperty; + + try { + $reflectionMethod = new \ReflectionMethod($class, $methodName); + if ($reflectionMethod->isStatic()) { + continue; + } + + if ( + (self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) + || (self::MUTATOR === $type && $reflectionMethod->getNumberOfParameters() >= 1) + ) { + break; + } + } catch (\ReflectionException $e) { + // Try the next prefix if the method doesn't exist + } + } + + if (!isset($reflectionMethod)) { + return null; + } + + if (null === $rawDocNode = $reflectionMethod->getDocComment() ?: null) { + return null; + } + + $tokens = new TokenIterator($this->lexer->tokenize($rawDocNode)); + $phpDocNode = $this->phpDocParser->parse($tokens); + $tokens->consumeTokenType(Lexer::TOKEN_END); + + return [$phpDocNode, $prefix, $reflectionMethod->class]; + } +} diff --git a/vendor/symfony/property-info/Extractor/ReflectionExtractor.php b/vendor/symfony/property-info/Extractor/ReflectionExtractor.php new file mode 100644 index 0000000..b9011bf --- /dev/null +++ b/vendor/symfony/property-info/Extractor/ReflectionExtractor.php @@ -0,0 +1,872 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyReadInfo; +use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyWriteInfo; +use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface; +use Symfony\Component\PropertyInfo\Type; +use Symfony\Component\String\Inflector\EnglishInflector; +use Symfony\Component\String\Inflector\InflectorInterface; + +/** + * Extracts data using the reflection API. + * + * @author Kévin Dunglas + * + * @final + */ +class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, PropertyReadInfoExtractorInterface, PropertyWriteInfoExtractorInterface, ConstructorArgumentTypeExtractorInterface +{ + /** + * @internal + */ + public static $defaultMutatorPrefixes = ['add', 'remove', 'set']; + + /** + * @internal + */ + public static $defaultAccessorPrefixes = ['get', 'is', 'has', 'can']; + + /** + * @internal + */ + public static $defaultArrayMutatorPrefixes = ['add', 'remove']; + + public const ALLOW_PRIVATE = 1; + public const ALLOW_PROTECTED = 2; + public const ALLOW_PUBLIC = 4; + + /** @var int Allow none of the magic methods */ + public const DISALLOW_MAGIC_METHODS = 0; + /** @var int Allow magic __get methods */ + public const ALLOW_MAGIC_GET = 1 << 0; + /** @var int Allow magic __set methods */ + public const ALLOW_MAGIC_SET = 1 << 1; + /** @var int Allow magic __call methods */ + public const ALLOW_MAGIC_CALL = 1 << 2; + + private const MAP_TYPES = [ + 'integer' => Type::BUILTIN_TYPE_INT, + 'boolean' => Type::BUILTIN_TYPE_BOOL, + 'double' => Type::BUILTIN_TYPE_FLOAT, + ]; + + private $mutatorPrefixes; + private $accessorPrefixes; + private $arrayMutatorPrefixes; + private $enableConstructorExtraction; + private $methodReflectionFlags; + private $magicMethodsFlags; + private $propertyReflectionFlags; + private $inflector; + + private $arrayMutatorPrefixesFirst; + private $arrayMutatorPrefixesLast; + + /** + * @param string[]|null $mutatorPrefixes + * @param string[]|null $accessorPrefixes + * @param string[]|null $arrayMutatorPrefixes + */ + public function __construct(array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null, bool $enableConstructorExtraction = true, int $accessFlags = self::ALLOW_PUBLIC, InflectorInterface $inflector = null, int $magicMethodsFlags = self::ALLOW_MAGIC_GET | self::ALLOW_MAGIC_SET) + { + $this->mutatorPrefixes = $mutatorPrefixes ?? self::$defaultMutatorPrefixes; + $this->accessorPrefixes = $accessorPrefixes ?? self::$defaultAccessorPrefixes; + $this->arrayMutatorPrefixes = $arrayMutatorPrefixes ?? self::$defaultArrayMutatorPrefixes; + $this->enableConstructorExtraction = $enableConstructorExtraction; + $this->methodReflectionFlags = $this->getMethodsFlags($accessFlags); + $this->propertyReflectionFlags = $this->getPropertyFlags($accessFlags); + $this->magicMethodsFlags = $magicMethodsFlags; + $this->inflector = $inflector ?? new EnglishInflector(); + + $this->arrayMutatorPrefixesFirst = array_merge($this->arrayMutatorPrefixes, array_diff($this->mutatorPrefixes, $this->arrayMutatorPrefixes)); + $this->arrayMutatorPrefixesLast = array_reverse($this->arrayMutatorPrefixesFirst); + } + + /** + * {@inheritdoc} + */ + public function getProperties(string $class, array $context = []): ?array + { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + $reflectionProperties = $reflectionClass->getProperties(); + + $properties = []; + foreach ($reflectionProperties as $reflectionProperty) { + if ($reflectionProperty->getModifiers() & $this->propertyReflectionFlags) { + $properties[$reflectionProperty->name] = $reflectionProperty->name; + } + } + + foreach ($reflectionClass->getMethods($this->methodReflectionFlags) as $reflectionMethod) { + if ($reflectionMethod->isStatic()) { + continue; + } + + $propertyName = $this->getPropertyName($reflectionMethod->name, $reflectionProperties); + if (!$propertyName || isset($properties[$propertyName])) { + continue; + } + if ($reflectionClass->hasProperty($lowerCasedPropertyName = lcfirst($propertyName)) || (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName))) { + $propertyName = $lowerCasedPropertyName; + } + $properties[$propertyName] = $propertyName; + } + + return $properties ? array_values($properties) : null; + } + + /** + * {@inheritdoc} + */ + public function getTypes(string $class, string $property, array $context = []): ?array + { + if ($fromMutator = $this->extractFromMutator($class, $property)) { + return $fromMutator; + } + + if ($fromAccessor = $this->extractFromAccessor($class, $property)) { + return $fromAccessor; + } + + if ( + ($context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction) && + $fromConstructor = $this->extractFromConstructor($class, $property) + ) { + return $fromConstructor; + } + + if ($fromPropertyDeclaration = $this->extractFromPropertyDeclaration($class, $property)) { + return $fromPropertyDeclaration; + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function getTypesFromConstructor(string $class, string $property): ?array + { + try { + $reflection = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + if (!$reflectionConstructor = $reflection->getConstructor()) { + return null; + } + if (!$reflectionParameter = $this->getReflectionParameterFromConstructor($property, $reflectionConstructor)) { + return null; + } + if (!$reflectionType = $reflectionParameter->getType()) { + return null; + } + if (!$types = $this->extractFromReflectionType($reflectionType, $reflectionConstructor->getDeclaringClass())) { + return null; + } + + return $types; + } + + private function getReflectionParameterFromConstructor(string $property, \ReflectionMethod $reflectionConstructor): ?\ReflectionParameter + { + $reflectionParameter = null; + foreach ($reflectionConstructor->getParameters() as $reflectionParameter) { + if ($reflectionParameter->getName() === $property) { + return $reflectionParameter; + } + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function isReadable(string $class, string $property, array $context = []): ?bool + { + if ($this->isAllowedProperty($class, $property)) { + return true; + } + + return null !== $this->getReadInfo($class, $property, $context); + } + + /** + * {@inheritdoc} + */ + public function isWritable(string $class, string $property, array $context = []): ?bool + { + if ($this->isAllowedProperty($class, $property)) { + return true; + } + + [$reflectionMethod] = $this->getMutatorMethod($class, $property); + + return null !== $reflectionMethod; + } + + /** + * {@inheritdoc} + */ + public function isInitializable(string $class, string $property, array $context = []): ?bool + { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + if (!$reflectionClass->isInstantiable()) { + return false; + } + + if ($constructor = $reflectionClass->getConstructor()) { + foreach ($constructor->getParameters() as $parameter) { + if ($property === $parameter->name) { + return true; + } + } + } elseif ($parentClass = $reflectionClass->getParentClass()) { + return $this->isInitializable($parentClass->getName(), $property); + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getReadInfo(string $class, string $property, array $context = []): ?PropertyReadInfo + { + try { + $reflClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + $allowGetterSetter = $context['enable_getter_setter_extraction'] ?? false; + $magicMethods = $context['enable_magic_methods_extraction'] ?? $this->magicMethodsFlags; + $allowMagicCall = (bool) ($magicMethods & self::ALLOW_MAGIC_CALL); + $allowMagicGet = (bool) ($magicMethods & self::ALLOW_MAGIC_GET); + + if (isset($context['enable_magic_call_extraction'])) { + trigger_deprecation('symfony/property-info', '5.2', 'Using the "enable_magic_call_extraction" context option in "%s()" is deprecated. Use "enable_magic_methods_extraction" instead.', __METHOD__); + + $allowMagicCall = $context['enable_magic_call_extraction'] ?? false; + } + + $hasProperty = $reflClass->hasProperty($property); + $camelProp = $this->camelize($property); + $getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item) + + foreach ($this->accessorPrefixes as $prefix) { + $methodName = $prefix.$camelProp; + + if ($reflClass->hasMethod($methodName) && $reflClass->getMethod($methodName)->getModifiers() & $this->methodReflectionFlags && !$reflClass->getMethod($methodName)->getNumberOfRequiredParameters()) { + $method = $reflClass->getMethod($methodName); + + return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, $methodName, $this->getReadVisiblityForMethod($method), $method->isStatic(), false); + } + } + + if ($allowGetterSetter && $reflClass->hasMethod($getsetter) && ($reflClass->getMethod($getsetter)->getModifiers() & $this->methodReflectionFlags)) { + $method = $reflClass->getMethod($getsetter); + + return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, $getsetter, $this->getReadVisiblityForMethod($method), $method->isStatic(), false); + } + + if ($allowMagicGet && $reflClass->hasMethod('__get') && ($reflClass->getMethod('__get')->getModifiers() & $this->methodReflectionFlags)) { + return new PropertyReadInfo(PropertyReadInfo::TYPE_PROPERTY, $property, PropertyReadInfo::VISIBILITY_PUBLIC, false, false); + } + + if ($hasProperty && ($reflClass->getProperty($property)->getModifiers() & $this->propertyReflectionFlags)) { + $reflProperty = $reflClass->getProperty($property); + + return new PropertyReadInfo(PropertyReadInfo::TYPE_PROPERTY, $property, $this->getReadVisiblityForProperty($reflProperty), $reflProperty->isStatic(), true); + } + + if ($allowMagicCall && $reflClass->hasMethod('__call') && ($reflClass->getMethod('__call')->getModifiers() & $this->methodReflectionFlags)) { + return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, 'get'.$camelProp, PropertyReadInfo::VISIBILITY_PUBLIC, false, false); + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function getWriteInfo(string $class, string $property, array $context = []): ?PropertyWriteInfo + { + try { + $reflClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + $allowGetterSetter = $context['enable_getter_setter_extraction'] ?? false; + $magicMethods = $context['enable_magic_methods_extraction'] ?? $this->magicMethodsFlags; + $allowMagicCall = (bool) ($magicMethods & self::ALLOW_MAGIC_CALL); + $allowMagicSet = (bool) ($magicMethods & self::ALLOW_MAGIC_SET); + + if (isset($context['enable_magic_call_extraction'])) { + trigger_deprecation('symfony/property-info', '5.2', 'Using the "enable_magic_call_extraction" context option in "%s()" is deprecated. Use "enable_magic_methods_extraction" instead.', __METHOD__); + + $allowMagicCall = $context['enable_magic_call_extraction'] ?? false; + } + + $allowConstruct = $context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction; + $allowAdderRemover = $context['enable_adder_remover_extraction'] ?? true; + + $camelized = $this->camelize($property); + $constructor = $reflClass->getConstructor(); + $singulars = $this->inflector->singularize($camelized); + $errors = []; + + if (null !== $constructor && $allowConstruct) { + foreach ($constructor->getParameters() as $parameter) { + if ($parameter->getName() === $property) { + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_CONSTRUCTOR, $property); + } + } + } + + [$adderAccessName, $removerAccessName, $adderAndRemoverErrors] = $this->findAdderAndRemover($reflClass, $singulars); + if ($allowAdderRemover && null !== $adderAccessName && null !== $removerAccessName) { + $adderMethod = $reflClass->getMethod($adderAccessName); + $removerMethod = $reflClass->getMethod($removerAccessName); + + $mutator = new PropertyWriteInfo(PropertyWriteInfo::TYPE_ADDER_AND_REMOVER); + $mutator->setAdderInfo(new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, $adderAccessName, $this->getWriteVisiblityForMethod($adderMethod), $adderMethod->isStatic())); + $mutator->setRemoverInfo(new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, $removerAccessName, $this->getWriteVisiblityForMethod($removerMethod), $removerMethod->isStatic())); + + return $mutator; + } + + $errors[] = $adderAndRemoverErrors; + + foreach ($this->mutatorPrefixes as $mutatorPrefix) { + $methodName = $mutatorPrefix.$camelized; + + [$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, $methodName, 1); + if (!$accessible) { + $errors[] = $methodAccessibleErrors; + continue; + } + + $method = $reflClass->getMethod($methodName); + + if (!\in_array($mutatorPrefix, $this->arrayMutatorPrefixes, true)) { + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, $methodName, $this->getWriteVisiblityForMethod($method), $method->isStatic()); + } + } + + $getsetter = lcfirst($camelized); + + if ($allowGetterSetter) { + [$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, $getsetter, 1); + if ($accessible) { + $method = $reflClass->getMethod($getsetter); + + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, $getsetter, $this->getWriteVisiblityForMethod($method), $method->isStatic()); + } + + $errors[] = $methodAccessibleErrors; + } + + if ($reflClass->hasProperty($property) && ($reflClass->getProperty($property)->getModifiers() & $this->propertyReflectionFlags)) { + $reflProperty = $reflClass->getProperty($property); + + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_PROPERTY, $property, $this->getWriteVisiblityForProperty($reflProperty), $reflProperty->isStatic()); + } + + if ($allowMagicSet) { + [$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, '__set', 2); + if ($accessible) { + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_PROPERTY, $property, PropertyWriteInfo::VISIBILITY_PUBLIC, false); + } + + $errors[] = $methodAccessibleErrors; + } + + if ($allowMagicCall) { + [$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, '__call', 2); + if ($accessible) { + return new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, 'set'.$camelized, PropertyWriteInfo::VISIBILITY_PUBLIC, false); + } + + $errors[] = $methodAccessibleErrors; + } + + if (!$allowAdderRemover && null !== $adderAccessName && null !== $removerAccessName) { + $errors[] = [sprintf( + 'The property "%s" in class "%s" can be defined with the methods "%s()" but '. + 'the new value must be an array or an instance of \Traversable', + $property, + $reflClass->getName(), + implode('()", "', [$adderAccessName, $removerAccessName]) + )]; + } + + $noneProperty = new PropertyWriteInfo(); + $noneProperty->setErrors(array_merge([], ...$errors)); + + return $noneProperty; + } + + /** + * @return Type[]|null + */ + private function extractFromMutator(string $class, string $property): ?array + { + [$reflectionMethod, $prefix] = $this->getMutatorMethod($class, $property); + if (null === $reflectionMethod) { + return null; + } + + $reflectionParameters = $reflectionMethod->getParameters(); + $reflectionParameter = $reflectionParameters[0]; + + if (!$reflectionType = $reflectionParameter->getType()) { + return null; + } + $type = $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass()); + + if (1 === \count($type) && \in_array($prefix, $this->arrayMutatorPrefixes)) { + $type = [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), $type[0])]; + } + + return $type; + } + + /** + * Tries to extract type information from accessors. + * + * @return Type[]|null + */ + private function extractFromAccessor(string $class, string $property): ?array + { + [$reflectionMethod, $prefix] = $this->getAccessorMethod($class, $property); + if (null === $reflectionMethod) { + return null; + } + + if ($reflectionType = $reflectionMethod->getReturnType()) { + return $this->extractFromReflectionType($reflectionType, $reflectionMethod->getDeclaringClass()); + } + + if (\in_array($prefix, ['is', 'can', 'has'])) { + return [new Type(Type::BUILTIN_TYPE_BOOL)]; + } + + return null; + } + + /** + * Tries to extract type information from constructor. + * + * @return Type[]|null + */ + private function extractFromConstructor(string $class, string $property): ?array + { + try { + $reflectionClass = new \ReflectionClass($class); + } catch (\ReflectionException $e) { + return null; + } + + $constructor = $reflectionClass->getConstructor(); + + if (!$constructor) { + return null; + } + + foreach ($constructor->getParameters() as $parameter) { + if ($property !== $parameter->name) { + continue; + } + $reflectionType = $parameter->getType(); + + return $reflectionType ? $this->extractFromReflectionType($reflectionType, $constructor->getDeclaringClass()) : null; + } + + if ($parentClass = $reflectionClass->getParentClass()) { + return $this->extractFromConstructor($parentClass->getName(), $property); + } + + return null; + } + + private function extractFromPropertyDeclaration(string $class, string $property): ?array + { + try { + $reflectionClass = new \ReflectionClass($class); + + if (\PHP_VERSION_ID >= 70400) { + $reflectionProperty = $reflectionClass->getProperty($property); + $reflectionPropertyType = $reflectionProperty->getType(); + + if (null !== $reflectionPropertyType && $types = $this->extractFromReflectionType($reflectionPropertyType, $reflectionProperty->getDeclaringClass())) { + return $types; + } + } + } catch (\ReflectionException $e) { + return null; + } + + $defaultValue = $reflectionClass->getDefaultProperties()[$property] ?? null; + + if (null === $defaultValue) { + return null; + } + + $type = \gettype($defaultValue); + $type = static::MAP_TYPES[$type] ?? $type; + + return [new Type($type, $this->isNullableProperty($class, $property), null, Type::BUILTIN_TYPE_ARRAY === $type)]; + } + + private function extractFromReflectionType(\ReflectionType $reflectionType, \ReflectionClass $declaringClass): array + { + $types = []; + $nullable = $reflectionType->allowsNull(); + + foreach (($reflectionType instanceof \ReflectionUnionType || $reflectionType instanceof \ReflectionIntersectionType) ? $reflectionType->getTypes() : [$reflectionType] as $type) { + $phpTypeOrClass = $type->getName(); + if ('null' === $phpTypeOrClass || 'mixed' === $phpTypeOrClass || 'never' === $phpTypeOrClass) { + continue; + } + + if (Type::BUILTIN_TYPE_ARRAY === $phpTypeOrClass) { + $types[] = new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true); + } elseif ('void' === $phpTypeOrClass) { + $types[] = new Type(Type::BUILTIN_TYPE_NULL, $nullable); + } elseif ($type->isBuiltin()) { + $types[] = new Type($phpTypeOrClass, $nullable); + } else { + $types[] = new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, $this->resolveTypeName($phpTypeOrClass, $declaringClass)); + } + } + + return $types; + } + + private function resolveTypeName(string $name, \ReflectionClass $declaringClass): string + { + if ('self' === $lcName = strtolower($name)) { + return $declaringClass->name; + } + if ('parent' === $lcName && $parent = $declaringClass->getParentClass()) { + return $parent->name; + } + + return $name; + } + + private function isNullableProperty(string $class, string $property): bool + { + try { + $reflectionProperty = new \ReflectionProperty($class, $property); + + if (\PHP_VERSION_ID >= 70400) { + $reflectionPropertyType = $reflectionProperty->getType(); + + return null !== $reflectionPropertyType && $reflectionPropertyType->allowsNull(); + } + + return false; + } catch (\ReflectionException $e) { + // Return false if the property doesn't exist + } + + return false; + } + + private function isAllowedProperty(string $class, string $property): bool + { + try { + $reflectionProperty = new \ReflectionProperty($class, $property); + + return (bool) ($reflectionProperty->getModifiers() & $this->propertyReflectionFlags); + } catch (\ReflectionException $e) { + // Return false if the property doesn't exist + } + + return false; + } + + /** + * Gets the accessor method. + * + * Returns an array with a the instance of \ReflectionMethod as first key + * and the prefix of the method as second or null if not found. + */ + private function getAccessorMethod(string $class, string $property): ?array + { + $ucProperty = ucfirst($property); + + foreach ($this->accessorPrefixes as $prefix) { + try { + $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); + if ($reflectionMethod->isStatic()) { + continue; + } + + if (0 === $reflectionMethod->getNumberOfRequiredParameters()) { + return [$reflectionMethod, $prefix]; + } + } catch (\ReflectionException $e) { + // Return null if the property doesn't exist + } + } + + return null; + } + + /** + * Returns an array with a the instance of \ReflectionMethod as first key + * and the prefix of the method as second or null if not found. + */ + private function getMutatorMethod(string $class, string $property): ?array + { + $ucProperty = ucfirst($property); + $ucSingulars = $this->inflector->singularize($ucProperty); + + $mutatorPrefixes = \in_array($ucProperty, $ucSingulars, true) ? $this->arrayMutatorPrefixesLast : $this->arrayMutatorPrefixesFirst; + + foreach ($mutatorPrefixes as $prefix) { + $names = [$ucProperty]; + if (\in_array($prefix, $this->arrayMutatorPrefixes)) { + $names = array_merge($names, $ucSingulars); + } + + foreach ($names as $name) { + try { + $reflectionMethod = new \ReflectionMethod($class, $prefix.$name); + if ($reflectionMethod->isStatic()) { + continue; + } + + // Parameter can be optional to allow things like: method(array $foo = null) + if ($reflectionMethod->getNumberOfParameters() >= 1) { + return [$reflectionMethod, $prefix]; + } + } catch (\ReflectionException $e) { + // Try the next prefix if the method doesn't exist + } + } + } + + return null; + } + + private function getPropertyName(string $methodName, array $reflectionProperties): ?string + { + $pattern = implode('|', array_merge($this->accessorPrefixes, $this->mutatorPrefixes)); + + if ('' !== $pattern && preg_match('/^('.$pattern.')(.+)$/i', $methodName, $matches)) { + if (!\in_array($matches[1], $this->arrayMutatorPrefixes)) { + return $matches[2]; + } + + foreach ($reflectionProperties as $reflectionProperty) { + foreach ($this->inflector->singularize($reflectionProperty->name) as $name) { + if (strtolower($name) === strtolower($matches[2])) { + return $reflectionProperty->name; + } + } + } + + return $matches[2]; + } + + return null; + } + + /** + * Searches for add and remove methods. + * + * @param \ReflectionClass $reflClass The reflection class for the given object + * @param array $singulars The singular form of the property name or null + * + * @return array An array containing the adder and remover when found and errors + */ + private function findAdderAndRemover(\ReflectionClass $reflClass, array $singulars): array + { + if (!\is_array($this->arrayMutatorPrefixes) && 2 !== \count($this->arrayMutatorPrefixes)) { + return [null, null, []]; + } + + [$addPrefix, $removePrefix] = $this->arrayMutatorPrefixes; + $errors = []; + + foreach ($singulars as $singular) { + $addMethod = $addPrefix.$singular; + $removeMethod = $removePrefix.$singular; + + [$addMethodFound, $addMethodAccessibleErrors] = $this->isMethodAccessible($reflClass, $addMethod, 1); + [$removeMethodFound, $removeMethodAccessibleErrors] = $this->isMethodAccessible($reflClass, $removeMethod, 1); + $errors[] = $addMethodAccessibleErrors; + $errors[] = $removeMethodAccessibleErrors; + + if ($addMethodFound && $removeMethodFound) { + return [$addMethod, $removeMethod, []]; + } + + if ($addMethodFound && !$removeMethodFound) { + $errors[] = [sprintf('The add method "%s" in class "%s" was found, but the corresponding remove method "%s" was not found', $addMethod, $reflClass->getName(), $removeMethod)]; + } elseif (!$addMethodFound && $removeMethodFound) { + $errors[] = [sprintf('The remove method "%s" in class "%s" was found, but the corresponding add method "%s" was not found', $removeMethod, $reflClass->getName(), $addMethod)]; + } + } + + return [null, null, array_merge([], ...$errors)]; + } + + /** + * Returns whether a method is public and has the number of required parameters and errors. + */ + private function isMethodAccessible(\ReflectionClass $class, string $methodName, int $parameters): array + { + $errors = []; + + if ($class->hasMethod($methodName)) { + $method = $class->getMethod($methodName); + + if (\ReflectionMethod::IS_PUBLIC === $this->methodReflectionFlags && !$method->isPublic()) { + $errors[] = sprintf('The method "%s" in class "%s" was found but does not have public access.', $methodName, $class->getName()); + } elseif ($method->getNumberOfRequiredParameters() > $parameters || $method->getNumberOfParameters() < $parameters) { + $errors[] = sprintf('The method "%s" in class "%s" requires %d arguments, but should accept only %d.', $methodName, $class->getName(), $method->getNumberOfRequiredParameters(), $parameters); + } else { + return [true, $errors]; + } + } + + return [false, $errors]; + } + + /** + * Camelizes a given string. + */ + private function camelize(string $string): string + { + return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); + } + + /** + * Return allowed reflection method flags. + */ + private function getMethodsFlags(int $accessFlags): int + { + $methodFlags = 0; + + if ($accessFlags & self::ALLOW_PUBLIC) { + $methodFlags |= \ReflectionMethod::IS_PUBLIC; + } + + if ($accessFlags & self::ALLOW_PRIVATE) { + $methodFlags |= \ReflectionMethod::IS_PRIVATE; + } + + if ($accessFlags & self::ALLOW_PROTECTED) { + $methodFlags |= \ReflectionMethod::IS_PROTECTED; + } + + return $methodFlags; + } + + /** + * Return allowed reflection property flags. + */ + private function getPropertyFlags(int $accessFlags): int + { + $propertyFlags = 0; + + if ($accessFlags & self::ALLOW_PUBLIC) { + $propertyFlags |= \ReflectionProperty::IS_PUBLIC; + } + + if ($accessFlags & self::ALLOW_PRIVATE) { + $propertyFlags |= \ReflectionProperty::IS_PRIVATE; + } + + if ($accessFlags & self::ALLOW_PROTECTED) { + $propertyFlags |= \ReflectionProperty::IS_PROTECTED; + } + + return $propertyFlags; + } + + private function getReadVisiblityForProperty(\ReflectionProperty $reflectionProperty): string + { + if ($reflectionProperty->isPrivate()) { + return PropertyReadInfo::VISIBILITY_PRIVATE; + } + + if ($reflectionProperty->isProtected()) { + return PropertyReadInfo::VISIBILITY_PROTECTED; + } + + return PropertyReadInfo::VISIBILITY_PUBLIC; + } + + private function getReadVisiblityForMethod(\ReflectionMethod $reflectionMethod): string + { + if ($reflectionMethod->isPrivate()) { + return PropertyReadInfo::VISIBILITY_PRIVATE; + } + + if ($reflectionMethod->isProtected()) { + return PropertyReadInfo::VISIBILITY_PROTECTED; + } + + return PropertyReadInfo::VISIBILITY_PUBLIC; + } + + private function getWriteVisiblityForProperty(\ReflectionProperty $reflectionProperty): string + { + if ($reflectionProperty->isPrivate()) { + return PropertyWriteInfo::VISIBILITY_PRIVATE; + } + + if ($reflectionProperty->isProtected()) { + return PropertyWriteInfo::VISIBILITY_PROTECTED; + } + + return PropertyWriteInfo::VISIBILITY_PUBLIC; + } + + private function getWriteVisiblityForMethod(\ReflectionMethod $reflectionMethod): string + { + if ($reflectionMethod->isPrivate()) { + return PropertyWriteInfo::VISIBILITY_PRIVATE; + } + + if ($reflectionMethod->isProtected()) { + return PropertyWriteInfo::VISIBILITY_PROTECTED; + } + + return PropertyWriteInfo::VISIBILITY_PUBLIC; + } +} diff --git a/vendor/symfony/property-info/Extractor/SerializerExtractor.php b/vendor/symfony/property-info/Extractor/SerializerExtractor.php new file mode 100644 index 0000000..08ff10d --- /dev/null +++ b/vendor/symfony/property-info/Extractor/SerializerExtractor.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Extractor; + +use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; +use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; + +/** + * Lists available properties using Symfony Serializer Component metadata. + * + * @author Kévin Dunglas + * + * @final + */ +class SerializerExtractor implements PropertyListExtractorInterface +{ + private $classMetadataFactory; + + public function __construct(ClassMetadataFactoryInterface $classMetadataFactory) + { + $this->classMetadataFactory = $classMetadataFactory; + } + + /** + * {@inheritdoc} + */ + public function getProperties(string $class, array $context = []): ?array + { + if (!\array_key_exists('serializer_groups', $context) || (null !== $context['serializer_groups'] && !\is_array($context['serializer_groups']))) { + return null; + } + + if (!$this->classMetadataFactory->getMetadataFor($class)) { + return null; + } + + $properties = []; + $serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class); + + foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) { + $ignored = method_exists($serializerAttributeMetadata, 'isIgnored') && $serializerAttributeMetadata->isIgnored(); + if (!$ignored && (null === $context['serializer_groups'] || array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups()))) { + $properties[] = $serializerAttributeMetadata->getName(); + } + } + + return $properties; + } +} diff --git a/vendor/symfony/property-info/LICENSE b/vendor/symfony/property-info/LICENSE new file mode 100644 index 0000000..4e90b1b --- /dev/null +++ b/vendor/symfony/property-info/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-2022 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/property-info/PhpStan/NameScope.php b/vendor/symfony/property-info/PhpStan/NameScope.php new file mode 100644 index 0000000..7d9a5f9 --- /dev/null +++ b/vendor/symfony/property-info/PhpStan/NameScope.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\PhpStan; + +/** + * NameScope class adapted from PHPStan code. + * + * @copyright Copyright (c) 2016, PHPStan https://github.com/phpstan/phpstan-src + * @copyright Copyright (c) 2016, Ondřej Mirtes + * @author Baptiste Leduc + * + * @internal + */ +final class NameScope +{ + private $calledClassName; + private $namespace; + /** @var array alias(string) => fullName(string) */ + private $uses; + + public function __construct(string $calledClassName, string $namespace, array $uses = []) + { + $this->calledClassName = $calledClassName; + $this->namespace = $namespace; + $this->uses = $uses; + } + + public function resolveStringName(string $name): string + { + if (0 === strpos($name, '\\')) { + return ltrim($name, '\\'); + } + + $nameParts = explode('\\', $name); + $firstNamePart = $nameParts[0]; + if (isset($this->uses[$firstNamePart])) { + if (1 === \count($nameParts)) { + return $this->uses[$firstNamePart]; + } + array_shift($nameParts); + + return sprintf('%s\\%s', $this->uses[$firstNamePart], implode('\\', $nameParts)); + } + + if (null !== $this->namespace) { + return sprintf('%s\\%s', $this->namespace, $name); + } + + return $name; + } + + public function resolveRootClass(): string + { + return $this->resolveStringName($this->calledClassName); + } +} diff --git a/vendor/symfony/property-info/PhpStan/NameScopeFactory.php b/vendor/symfony/property-info/PhpStan/NameScopeFactory.php new file mode 100644 index 0000000..32f2f33 --- /dev/null +++ b/vendor/symfony/property-info/PhpStan/NameScopeFactory.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\PhpStan; + +use phpDocumentor\Reflection\Types\ContextFactory; + +/** + * @author Baptiste Leduc + * + * @internal + */ +final class NameScopeFactory +{ + public function create(string $calledClassName, string $declaringClassName = null): NameScope + { + $declaringClassName = $declaringClassName ?? $calledClassName; + + $path = explode('\\', $calledClassName); + $calledClassName = array_pop($path); + + $declaringReflection = new \ReflectionClass($declaringClassName); + [$declaringNamespace, $declaringUses] = $this->extractFromFullClassName($declaringReflection); + $declaringUses = array_merge($declaringUses, $this->collectUses($declaringReflection)); + + return new NameScope($calledClassName, $declaringNamespace, $declaringUses); + } + + private function collectUses(\ReflectionClass $reflection): array + { + $uses = [$this->extractFromFullClassName($reflection)[1]]; + + foreach ($reflection->getTraits() as $traitReflection) { + $uses[] = $this->extractFromFullClassName($traitReflection)[1]; + } + + if (false !== $parentClass = $reflection->getParentClass()) { + $uses[] = $this->collectUses($parentClass); + } + + return $uses ? array_merge(...$uses) : []; + } + + private function extractFromFullClassName(\ReflectionClass $reflection): array + { + $namespace = trim($reflection->getNamespaceName(), '\\'); + $fileName = $reflection->getFileName(); + + if (\is_string($fileName) && is_file($fileName)) { + if (false === $contents = file_get_contents($fileName)) { + throw new \RuntimeException(sprintf('Unable to read file "%s".', $fileName)); + } + + $factory = new ContextFactory(); + $context = $factory->createForNamespace($namespace, $contents); + + return [$namespace, $context->getNamespaceAliases()]; + } + + return [$namespace, []]; + } +} diff --git a/vendor/symfony/property-info/PropertyAccessExtractorInterface.php b/vendor/symfony/property-info/PropertyAccessExtractorInterface.php new file mode 100644 index 0000000..f9ee787 --- /dev/null +++ b/vendor/symfony/property-info/PropertyAccessExtractorInterface.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Guesses if the property can be accessed or mutated. + * + * @author Kévin Dunglas + */ +interface PropertyAccessExtractorInterface +{ + /** + * Is the property readable? + * + * @return bool|null + */ + public function isReadable(string $class, string $property, array $context = []); + + /** + * Is the property writable? + * + * @return bool|null + */ + public function isWritable(string $class, string $property, array $context = []); +} diff --git a/vendor/symfony/property-info/PropertyDescriptionExtractorInterface.php b/vendor/symfony/property-info/PropertyDescriptionExtractorInterface.php new file mode 100644 index 0000000..f376537 --- /dev/null +++ b/vendor/symfony/property-info/PropertyDescriptionExtractorInterface.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Guesses the property's human readable description. + * + * @author Kévin Dunglas + */ +interface PropertyDescriptionExtractorInterface +{ + /** + * Gets the short description of the property. + * + * @return string|null + */ + public function getShortDescription(string $class, string $property, array $context = []); + + /** + * Gets the long description of the property. + * + * @return string|null + */ + public function getLongDescription(string $class, string $property, array $context = []); +} diff --git a/vendor/symfony/property-info/PropertyInfoCacheExtractor.php b/vendor/symfony/property-info/PropertyInfoCacheExtractor.php new file mode 100644 index 0000000..ca7b324 --- /dev/null +++ b/vendor/symfony/property-info/PropertyInfoCacheExtractor.php @@ -0,0 +1,124 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +use Psr\Cache\CacheItemPoolInterface; + +/** + * Adds a PSR-6 cache layer on top of an extractor. + * + * @author Kévin Dunglas + * + * @final + */ +class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, PropertyInitializableExtractorInterface +{ + private $propertyInfoExtractor; + private $cacheItemPool; + private $arrayCache = []; + + public function __construct(PropertyInfoExtractorInterface $propertyInfoExtractor, CacheItemPoolInterface $cacheItemPool) + { + $this->propertyInfoExtractor = $propertyInfoExtractor; + $this->cacheItemPool = $cacheItemPool; + } + + /** + * {@inheritdoc} + */ + public function isReadable(string $class, string $property, array $context = []): ?bool + { + return $this->extract('isReadable', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function isWritable(string $class, string $property, array $context = []): ?bool + { + return $this->extract('isWritable', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function getShortDescription(string $class, string $property, array $context = []): ?string + { + return $this->extract('getShortDescription', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function getLongDescription(string $class, string $property, array $context = []): ?string + { + return $this->extract('getLongDescription', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function getProperties(string $class, array $context = []): ?array + { + return $this->extract('getProperties', [$class, $context]); + } + + /** + * {@inheritdoc} + */ + public function getTypes(string $class, string $property, array $context = []): ?array + { + return $this->extract('getTypes', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function isInitializable(string $class, string $property, array $context = []): ?bool + { + return $this->extract('isInitializable', [$class, $property, $context]); + } + + /** + * Retrieves the cached data if applicable or delegates to the decorated extractor. + * + * @return mixed + */ + private function extract(string $method, array $arguments) + { + try { + $serializedArguments = serialize($arguments); + } catch (\Exception $exception) { + // If arguments are not serializable, skip the cache + return $this->propertyInfoExtractor->{$method}(...$arguments); + } + + // Calling rawurlencode escapes special characters not allowed in PSR-6's keys + $key = rawurlencode($method.'.'.$serializedArguments); + + if (\array_key_exists($key, $this->arrayCache)) { + return $this->arrayCache[$key]; + } + + $item = $this->cacheItemPool->getItem($key); + + if ($item->isHit()) { + return $this->arrayCache[$key] = $item->get(); + } + + $value = $this->propertyInfoExtractor->{$method}(...$arguments); + $item->set($value); + $this->cacheItemPool->save($item); + + return $this->arrayCache[$key] = $value; + } +} diff --git a/vendor/symfony/property-info/PropertyInfoExtractor.php b/vendor/symfony/property-info/PropertyInfoExtractor.php new file mode 100644 index 0000000..eca169f --- /dev/null +++ b/vendor/symfony/property-info/PropertyInfoExtractor.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Default {@see PropertyInfoExtractorInterface} implementation. + * + * @author Kévin Dunglas + * + * @final + */ +class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyInitializableExtractorInterface +{ + private $listExtractors; + private $typeExtractors; + private $descriptionExtractors; + private $accessExtractors; + private $initializableExtractors; + + /** + * @param iterable $listExtractors + * @param iterable $typeExtractors + * @param iterable $descriptionExtractors + * @param iterable $accessExtractors + * @param iterable $initializableExtractors + */ + public function __construct(iterable $listExtractors = [], iterable $typeExtractors = [], iterable $descriptionExtractors = [], iterable $accessExtractors = [], iterable $initializableExtractors = []) + { + $this->listExtractors = $listExtractors; + $this->typeExtractors = $typeExtractors; + $this->descriptionExtractors = $descriptionExtractors; + $this->accessExtractors = $accessExtractors; + $this->initializableExtractors = $initializableExtractors; + } + + /** + * {@inheritdoc} + */ + public function getProperties(string $class, array $context = []): ?array + { + return $this->extract($this->listExtractors, 'getProperties', [$class, $context]); + } + + /** + * {@inheritdoc} + */ + public function getShortDescription(string $class, string $property, array $context = []): ?string + { + return $this->extract($this->descriptionExtractors, 'getShortDescription', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function getLongDescription(string $class, string $property, array $context = []): ?string + { + return $this->extract($this->descriptionExtractors, 'getLongDescription', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function getTypes(string $class, string $property, array $context = []): ?array + { + return $this->extract($this->typeExtractors, 'getTypes', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function isReadable(string $class, string $property, array $context = []): ?bool + { + return $this->extract($this->accessExtractors, 'isReadable', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function isWritable(string $class, string $property, array $context = []): ?bool + { + return $this->extract($this->accessExtractors, 'isWritable', [$class, $property, $context]); + } + + /** + * {@inheritdoc} + */ + public function isInitializable(string $class, string $property, array $context = []): ?bool + { + return $this->extract($this->initializableExtractors, 'isInitializable', [$class, $property, $context]); + } + + /** + * Iterates over registered extractors and return the first value found. + * + * @param iterable $extractors + * @param list $arguments + * + * @return mixed + */ + private function extract(iterable $extractors, string $method, array $arguments) + { + foreach ($extractors as $extractor) { + if (null !== $value = $extractor->{$method}(...$arguments)) { + return $value; + } + } + + return null; + } +} diff --git a/vendor/symfony/property-info/PropertyInfoExtractorInterface.php b/vendor/symfony/property-info/PropertyInfoExtractorInterface.php new file mode 100644 index 0000000..8893018 --- /dev/null +++ b/vendor/symfony/property-info/PropertyInfoExtractorInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Gets info about PHP class properties. + * + * A convenient interface inheriting all specific info interfaces. + * + * @author Kévin Dunglas + */ +interface PropertyInfoExtractorInterface extends PropertyTypeExtractorInterface, PropertyDescriptionExtractorInterface, PropertyAccessExtractorInterface, PropertyListExtractorInterface +{ +} diff --git a/vendor/symfony/property-info/PropertyInitializableExtractorInterface.php b/vendor/symfony/property-info/PropertyInitializableExtractorInterface.php new file mode 100644 index 0000000..13248fc --- /dev/null +++ b/vendor/symfony/property-info/PropertyInitializableExtractorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Guesses if the property can be initialized through the constructor. + * + * @author Kévin Dunglas + */ +interface PropertyInitializableExtractorInterface +{ + /** + * Is the property initializable? Returns true if a constructor's parameter matches the given property name. + */ + public function isInitializable(string $class, string $property, array $context = []): ?bool; +} diff --git a/vendor/symfony/property-info/PropertyListExtractorInterface.php b/vendor/symfony/property-info/PropertyListExtractorInterface.php new file mode 100644 index 0000000..326e6cc --- /dev/null +++ b/vendor/symfony/property-info/PropertyListExtractorInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Extracts the list of properties available for the given class. + * + * @author Kévin Dunglas + */ +interface PropertyListExtractorInterface +{ + /** + * Gets the list of properties available for the given class. + * + * @return string[]|null + */ + public function getProperties(string $class, array $context = []); +} diff --git a/vendor/symfony/property-info/PropertyReadInfo.php b/vendor/symfony/property-info/PropertyReadInfo.php new file mode 100644 index 0000000..ae10352 --- /dev/null +++ b/vendor/symfony/property-info/PropertyReadInfo.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * The property read info tells how a property can be read. + * + * @author Joel Wurtz + * + * @internal + */ +final class PropertyReadInfo +{ + public const TYPE_METHOD = 'method'; + public const TYPE_PROPERTY = 'property'; + + public const VISIBILITY_PUBLIC = 'public'; + public const VISIBILITY_PROTECTED = 'protected'; + public const VISIBILITY_PRIVATE = 'private'; + + private $type; + + private $name; + + private $visibility; + + private $static; + + private $byRef; + + public function __construct(string $type, string $name, string $visibility, bool $static, bool $byRef) + { + $this->type = $type; + $this->name = $name; + $this->visibility = $visibility; + $this->static = $static; + $this->byRef = $byRef; + } + + /** + * Get type of access. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Get name of the access, which can be a method name or a property name, depending on the type. + */ + public function getName(): string + { + return $this->name; + } + + public function getVisibility(): string + { + return $this->visibility; + } + + public function isStatic(): bool + { + return $this->static; + } + + /** + * Whether this accessor can be accessed by reference. + */ + public function canBeReference(): bool + { + return $this->byRef; + } +} diff --git a/vendor/symfony/property-info/PropertyReadInfoExtractorInterface.php b/vendor/symfony/property-info/PropertyReadInfoExtractorInterface.php new file mode 100644 index 0000000..816b282 --- /dev/null +++ b/vendor/symfony/property-info/PropertyReadInfoExtractorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Extract read information for the property of a class. + * + * @author Joel Wurtz + */ +interface PropertyReadInfoExtractorInterface +{ + /** + * Get read information object for a given property of a class. + */ + public function getReadInfo(string $class, string $property, array $context = []): ?PropertyReadInfo; +} diff --git a/vendor/symfony/property-info/PropertyTypeExtractorInterface.php b/vendor/symfony/property-info/PropertyTypeExtractorInterface.php new file mode 100644 index 0000000..6da0bcb --- /dev/null +++ b/vendor/symfony/property-info/PropertyTypeExtractorInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Type Extractor Interface. + * + * @author Kévin Dunglas + */ +interface PropertyTypeExtractorInterface +{ + /** + * Gets types of a property. + * + * @return Type[]|null + */ + public function getTypes(string $class, string $property, array $context = []); +} diff --git a/vendor/symfony/property-info/PropertyWriteInfo.php b/vendor/symfony/property-info/PropertyWriteInfo.php new file mode 100644 index 0000000..b4e33b2 --- /dev/null +++ b/vendor/symfony/property-info/PropertyWriteInfo.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * The write mutator defines how a property can be written. + * + * @author Joel Wurtz + * + * @internal + */ +final class PropertyWriteInfo +{ + public const TYPE_NONE = 'none'; + public const TYPE_METHOD = 'method'; + public const TYPE_PROPERTY = 'property'; + public const TYPE_ADDER_AND_REMOVER = 'adder_and_remover'; + public const TYPE_CONSTRUCTOR = 'constructor'; + + public const VISIBILITY_PUBLIC = 'public'; + public const VISIBILITY_PROTECTED = 'protected'; + public const VISIBILITY_PRIVATE = 'private'; + + private $type; + private $name; + private $visibility; + private $static; + private $adderInfo; + private $removerInfo; + private $errors = []; + + public function __construct(string $type = self::TYPE_NONE, string $name = null, string $visibility = null, bool $static = null) + { + $this->type = $type; + $this->name = $name; + $this->visibility = $visibility; + $this->static = $static; + } + + public function getType(): string + { + return $this->type; + } + + public function getName(): string + { + if (null === $this->name) { + throw new \LogicException("Calling getName() when having a mutator of type {$this->type} is not tolerated."); + } + + return $this->name; + } + + public function setAdderInfo(self $adderInfo): void + { + $this->adderInfo = $adderInfo; + } + + public function getAdderInfo(): self + { + if (null === $this->adderInfo) { + throw new \LogicException("Calling getAdderInfo() when having a mutator of type {$this->type} is not tolerated."); + } + + return $this->adderInfo; + } + + public function setRemoverInfo(self $removerInfo): void + { + $this->removerInfo = $removerInfo; + } + + public function getRemoverInfo(): self + { + if (null === $this->removerInfo) { + throw new \LogicException("Calling getRemoverInfo() when having a mutator of type {$this->type} is not tolerated."); + } + + return $this->removerInfo; + } + + public function getVisibility(): string + { + if (null === $this->visibility) { + throw new \LogicException("Calling getVisibility() when having a mutator of type {$this->type} is not tolerated."); + } + + return $this->visibility; + } + + public function isStatic(): bool + { + if (null === $this->static) { + throw new \LogicException("Calling isStatic() when having a mutator of type {$this->type} is not tolerated."); + } + + return $this->static; + } + + public function setErrors(array $errors): void + { + $this->errors = $errors; + } + + public function getErrors(): array + { + return $this->errors; + } + + public function hasErrors(): bool + { + return (bool) \count($this->errors); + } +} diff --git a/vendor/symfony/property-info/PropertyWriteInfoExtractorInterface.php b/vendor/symfony/property-info/PropertyWriteInfoExtractorInterface.php new file mode 100644 index 0000000..f113463 --- /dev/null +++ b/vendor/symfony/property-info/PropertyWriteInfoExtractorInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Extract write information for the property of a class. + * + * @author Joel Wurtz + */ +interface PropertyWriteInfoExtractorInterface +{ + /** + * Get write information object for a given property of a class. + */ + public function getWriteInfo(string $class, string $property, array $context = []): ?PropertyWriteInfo; +} diff --git a/vendor/symfony/property-info/README.md b/vendor/symfony/property-info/README.md new file mode 100644 index 0000000..da3514f --- /dev/null +++ b/vendor/symfony/property-info/README.md @@ -0,0 +1,14 @@ +PropertyInfo Component +====================== + +The PropertyInfo component extracts information about PHP class' properties +using metadata of popular sources. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/property_info.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/property-info/Type.php b/vendor/symfony/property-info/Type.php new file mode 100644 index 0000000..6aecc01 --- /dev/null +++ b/vendor/symfony/property-info/Type.php @@ -0,0 +1,206 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo; + +/** + * Type value object (immutable). + * + * @author Kévin Dunglas + * + * @final + */ +class Type +{ + public const BUILTIN_TYPE_INT = 'int'; + public const BUILTIN_TYPE_FLOAT = 'float'; + public const BUILTIN_TYPE_STRING = 'string'; + public const BUILTIN_TYPE_BOOL = 'bool'; + public const BUILTIN_TYPE_TRUE = 'true'; + public const BUILTIN_TYPE_FALSE = 'false'; + public const BUILTIN_TYPE_RESOURCE = 'resource'; + public const BUILTIN_TYPE_OBJECT = 'object'; + public const BUILTIN_TYPE_ARRAY = 'array'; + public const BUILTIN_TYPE_NULL = 'null'; + public const BUILTIN_TYPE_CALLABLE = 'callable'; + public const BUILTIN_TYPE_ITERABLE = 'iterable'; + + /** + * List of PHP builtin types. + * + * @var string[] + */ + public static $builtinTypes = [ + self::BUILTIN_TYPE_INT, + self::BUILTIN_TYPE_FLOAT, + self::BUILTIN_TYPE_STRING, + self::BUILTIN_TYPE_BOOL, + self::BUILTIN_TYPE_TRUE, + self::BUILTIN_TYPE_FALSE, + self::BUILTIN_TYPE_RESOURCE, + self::BUILTIN_TYPE_OBJECT, + self::BUILTIN_TYPE_ARRAY, + self::BUILTIN_TYPE_CALLABLE, + self::BUILTIN_TYPE_NULL, + self::BUILTIN_TYPE_ITERABLE, + ]; + + /** + * List of PHP builtin collection types. + * + * @var string[] + */ + public static $builtinCollectionTypes = [ + self::BUILTIN_TYPE_ARRAY, + self::BUILTIN_TYPE_ITERABLE, + ]; + + private $builtinType; + private $nullable; + private $class; + private $collection; + private $collectionKeyType; + private $collectionValueType; + + /** + * @param Type[]|Type|null $collectionKeyType + * @param Type[]|Type|null $collectionValueType + * + * @throws \InvalidArgumentException + */ + public function __construct(string $builtinType, bool $nullable = false, string $class = null, bool $collection = false, $collectionKeyType = null, $collectionValueType = null) + { + if (!\in_array($builtinType, self::$builtinTypes)) { + throw new \InvalidArgumentException(sprintf('"%s" is not a valid PHP type.', $builtinType)); + } + + $this->builtinType = $builtinType; + $this->nullable = $nullable; + $this->class = $class; + $this->collection = $collection; + $this->collectionKeyType = $this->validateCollectionArgument($collectionKeyType, 5, '$collectionKeyType') ?? []; + $this->collectionValueType = $this->validateCollectionArgument($collectionValueType, 6, '$collectionValueType') ?? []; + } + + private function validateCollectionArgument($collectionArgument, int $argumentIndex, string $argumentName): ?array + { + if (null === $collectionArgument) { + return null; + } + + if (!\is_array($collectionArgument) && !$collectionArgument instanceof self) { + throw new \TypeError(sprintf('"%s()": Argument #%d (%s) must be of type "%s[]", "%s" or "null", "%s" given.', __METHOD__, $argumentIndex, $argumentName, self::class, self::class, get_debug_type($collectionArgument))); + } + + if (\is_array($collectionArgument)) { + foreach ($collectionArgument as $type) { + if (!$type instanceof self) { + throw new \TypeError(sprintf('"%s()": Argument #%d (%s) must be of type "%s[]", "%s" or "null", array value "%s" given.', __METHOD__, $argumentIndex, $argumentName, self::class, self::class, get_debug_type($collectionArgument))); + } + } + + return $collectionArgument; + } + + return [$collectionArgument]; + } + + /** + * Gets built-in type. + * + * Can be bool, int, float, string, array, object, resource, null, callback or iterable. + */ + public function getBuiltinType(): string + { + return $this->builtinType; + } + + public function isNullable(): bool + { + return $this->nullable; + } + + /** + * Gets the class name. + * + * Only applicable if the built-in type is object. + */ + public function getClassName(): ?string + { + return $this->class; + } + + public function isCollection(): bool + { + return $this->collection; + } + + /** + * Gets collection key type. + * + * Only applicable for a collection type. + * + * @deprecated since Symfony 5.3, use "getCollectionKeyTypes()" instead + */ + public function getCollectionKeyType(): ?self + { + trigger_deprecation('symfony/property-info', '5.3', 'The "%s()" method is deprecated, use "getCollectionKeyTypes()" instead.', __METHOD__); + + $type = $this->getCollectionKeyTypes(); + if (0 === \count($type)) { + return null; + } + + if (\is_array($type)) { + [$type] = $type; + } + + return $type; + } + + /** + * Gets collection key types. + * + * Only applicable for a collection type. + * + * @return Type[] + */ + public function getCollectionKeyTypes(): array + { + return $this->collectionKeyType; + } + + /** + * Gets collection value type. + * + * Only applicable for a collection type. + * + * @deprecated since Symfony 5.3, use "getCollectionValueTypes()" instead + */ + public function getCollectionValueType(): ?self + { + trigger_deprecation('symfony/property-info', '5.3', 'The "%s()" method is deprecated, use "getCollectionValueTypes()" instead.', __METHOD__); + + return $this->getCollectionValueTypes()[0] ?? null; + } + + /** + * Gets collection value types. + * + * Only applicable for a collection type. + * + * @return Type[] + */ + public function getCollectionValueTypes(): array + { + return $this->collectionValueType; + } +} diff --git a/vendor/symfony/property-info/Util/PhpDocTypeHelper.php b/vendor/symfony/property-info/Util/PhpDocTypeHelper.php new file mode 100644 index 0000000..cafbaaf --- /dev/null +++ b/vendor/symfony/property-info/Util/PhpDocTypeHelper.php @@ -0,0 +1,192 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Util; + +use phpDocumentor\Reflection\PseudoTypes\List_; +use phpDocumentor\Reflection\Type as DocType; +use phpDocumentor\Reflection\Types\Array_; +use phpDocumentor\Reflection\Types\Collection; +use phpDocumentor\Reflection\Types\Compound; +use phpDocumentor\Reflection\Types\Null_; +use phpDocumentor\Reflection\Types\Nullable; +use Symfony\Component\PropertyInfo\Type; + +// Workaround for phpdocumentor/type-resolver < 1.6 +// We trigger the autoloader here, so we don't need to trigger it inside the loop later. +class_exists(List_::class); + +/** + * Transforms a php doc type to a {@link Type} instance. + * + * @author Kévin Dunglas + * @author Guilhem N. + */ +final class PhpDocTypeHelper +{ + /** + * Creates a {@see Type} from a PHPDoc type. + * + * @return Type[] + */ + public function getTypes(DocType $varType): array + { + $types = []; + $nullable = false; + + if ($varType instanceof Nullable) { + $nullable = true; + $varType = $varType->getActualType(); + } + + if (!$varType instanceof Compound) { + if ($varType instanceof Null_) { + $nullable = true; + } + + $type = $this->createType($varType, $nullable); + if (null !== $type) { + $types[] = $type; + } + + return $types; + } + + $varTypes = []; + for ($typeIndex = 0; $varType->has($typeIndex); ++$typeIndex) { + $type = $varType->get($typeIndex); + + // If null is present, all types are nullable + if ($type instanceof Null_) { + $nullable = true; + continue; + } + + if ($type instanceof Nullable) { + $nullable = true; + $type = $type->getActualType(); + } + + $varTypes[] = $type; + } + + foreach ($varTypes as $varType) { + $type = $this->createType($varType, $nullable); + if (null !== $type) { + $types[] = $type; + } + } + + return $types; + } + + /** + * Creates a {@see Type} from a PHPDoc type. + */ + private function createType(DocType $type, bool $nullable, string $docType = null): ?Type + { + $docType = $docType ?? (string) $type; + + if ($type instanceof Collection) { + $fqsen = $type->getFqsen(); + if ($fqsen && 'list' === $fqsen->getName() && !class_exists(List_::class, false) && !class_exists((string) $fqsen)) { + // Workaround for phpdocumentor/type-resolver < 1.6 + return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), $this->getTypes($type->getValueType())); + } + + [$phpType, $class] = $this->getPhpTypeAndClass((string) $fqsen); + + $key = $this->getTypes($type->getKeyType()); + $value = $this->getTypes($type->getValueType()); + + // More than 1 type returned means it is a Compound type, which is + // not handled by Type, so better use a null value. + $key = 1 === \count($key) ? $key[0] : null; + $value = 1 === \count($value) ? $value[0] : null; + + return new Type($phpType, $nullable, $class, true, $key, $value); + } + + // Cannot guess + if (!$docType || 'mixed' === $docType) { + return null; + } + + if (str_ends_with($docType, '[]')) { + $collectionKeyType = new Type(Type::BUILTIN_TYPE_INT); + $collectionValueType = $this->createType($type, false, substr($docType, 0, -2)); + + return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, $collectionKeyType, $collectionValueType); + } + + if ((str_starts_with($docType, 'list<') || str_starts_with($docType, 'array<')) && $type instanceof Array_) { + // array is converted to x[] which is handled above + // so it's only necessary to handle array here + $collectionKeyType = $this->getTypes($type->getKeyType())[0]; + + $collectionValueTypes = $this->getTypes($type->getValueType()); + if (1 != \count($collectionValueTypes)) { + // the Type class does not support union types yet, so assume that no type was defined + $collectionValueType = null; + } else { + $collectionValueType = $collectionValueTypes[0]; + } + + return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, $collectionKeyType, $collectionValueType); + } + + $docType = $this->normalizeType($docType); + [$phpType, $class] = $this->getPhpTypeAndClass($docType); + + if ('array' === $docType) { + return new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, null, null); + } + + return new Type($phpType, $nullable, $class); + } + + private function normalizeType(string $docType): string + { + switch ($docType) { + case 'integer': + return 'int'; + + case 'boolean': + return 'bool'; + + // real is not part of the PHPDoc standard, so we ignore it + case 'double': + return 'float'; + + case 'callback': + return 'callable'; + + case 'void': + return 'null'; + + default: + return $docType; + } + } + + private function getPhpTypeAndClass(string $docType): array + { + if (\in_array($docType, Type::$builtinTypes)) { + return [$docType, null]; + } + + if (\in_array($docType, ['parent', 'self', 'static'], true)) { + return ['object', $docType]; + } + + return ['object', ltrim($docType, '\\')]; + } +} diff --git a/vendor/symfony/property-info/Util/PhpStanTypeHelper.php b/vendor/symfony/property-info/Util/PhpStanTypeHelper.php new file mode 100644 index 0000000..f3812ea --- /dev/null +++ b/vendor/symfony/property-info/Util/PhpStanTypeHelper.php @@ -0,0 +1,188 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyInfo\Util; + +use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode; +use PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode; +use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode; +use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode; +use PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode; +use PHPStan\PhpDocParser\Ast\Type\ConstTypeNode; +use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; +use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; +use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode; +use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode; +use PHPStan\PhpDocParser\Ast\Type\TypeNode; +use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode; +use Symfony\Component\PropertyInfo\PhpStan\NameScope; +use Symfony\Component\PropertyInfo\Type; + +/** + * Transforms a php doc tag value to a {@link Type} instance. + * + * @author Baptiste Leduc + * + * @internal + */ +final class PhpStanTypeHelper +{ + /** + * Creates a {@see Type} from a PhpDocTagValueNode type. + * + * @return Type[] + */ + public function getTypes(PhpDocTagValueNode $node, NameScope $nameScope): array + { + if ($node instanceof ParamTagValueNode || $node instanceof ReturnTagValueNode || $node instanceof VarTagValueNode) { + return $this->compressNullableType($this->extractTypes($node->type, $nameScope)); + } + + return []; + } + + /** + * Because PhpStan extract null as a separated type when Symfony / PHP compress it in the first available type we + * need this method to mimic how Symfony want null types. + * + * @param Type[] $types + * + * @return Type[] + */ + private function compressNullableType(array $types): array + { + $firstTypeIndex = null; + $nullableTypeIndex = null; + + foreach ($types as $k => $type) { + if (null === $firstTypeIndex && Type::BUILTIN_TYPE_NULL !== $type->getBuiltinType() && !$type->isNullable()) { + $firstTypeIndex = $k; + } + + if (null === $nullableTypeIndex && Type::BUILTIN_TYPE_NULL === $type->getBuiltinType()) { + $nullableTypeIndex = $k; + } + + if (null !== $firstTypeIndex && null !== $nullableTypeIndex) { + break; + } + } + + if (null !== $firstTypeIndex && null !== $nullableTypeIndex) { + $firstType = $types[$firstTypeIndex]; + $types[$firstTypeIndex] = new Type( + $firstType->getBuiltinType(), + true, + $firstType->getClassName(), + $firstType->isCollection(), + $firstType->getCollectionKeyTypes(), + $firstType->getCollectionValueTypes() + ); + unset($types[$nullableTypeIndex]); + } + + return array_values($types); + } + + /** + * @return Type[] + */ + private function extractTypes(TypeNode $node, NameScope $nameScope): array + { + if ($node instanceof UnionTypeNode) { + $types = []; + foreach ($node->types as $type) { + if ($type instanceof ConstTypeNode) { + // It's safer to fall back to other extractors here, as resolving const types correctly is not easy at the moment + return []; + } + foreach ($this->extractTypes($type, $nameScope) as $subType) { + $types[] = $subType; + } + } + + return $this->compressNullableType($types); + } + if ($node instanceof GenericTypeNode) { + [$mainType] = $this->extractTypes($node->type, $nameScope); + + $collectionKeyTypes = $mainType->getCollectionKeyTypes(); + $collectionKeyValues = []; + if (1 === \count($node->genericTypes)) { + foreach ($this->extractTypes($node->genericTypes[0], $nameScope) as $subType) { + $collectionKeyValues[] = $subType; + } + } elseif (2 === \count($node->genericTypes)) { + foreach ($this->extractTypes($node->genericTypes[0], $nameScope) as $keySubType) { + $collectionKeyTypes[] = $keySubType; + } + foreach ($this->extractTypes($node->genericTypes[1], $nameScope) as $valueSubType) { + $collectionKeyValues[] = $valueSubType; + } + } + + return [new Type($mainType->getBuiltinType(), $mainType->isNullable(), $mainType->getClassName(), true, $collectionKeyTypes, $collectionKeyValues)]; + } + if ($node instanceof ArrayShapeNode) { + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]; + } + if ($node instanceof ArrayTypeNode) { + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, [new Type(Type::BUILTIN_TYPE_INT)], $this->extractTypes($node->type, $nameScope))]; + } + if ($node instanceof CallableTypeNode || $node instanceof CallableTypeParameterNode) { + return [new Type(Type::BUILTIN_TYPE_CALLABLE)]; + } + if ($node instanceof NullableTypeNode) { + $subTypes = $this->extractTypes($node->type, $nameScope); + if (\count($subTypes) > 1) { + $subTypes[] = new Type(Type::BUILTIN_TYPE_NULL); + + return $subTypes; + } + + return [new Type($subTypes[0]->getBuiltinType(), true, $subTypes[0]->getClassName(), $subTypes[0]->isCollection(), $subTypes[0]->getCollectionKeyTypes(), $subTypes[0]->getCollectionValueTypes())]; + } + if ($node instanceof ThisTypeNode) { + return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $nameScope->resolveRootClass())]; + } + if ($node instanceof IdentifierTypeNode) { + if (\in_array($node->name, Type::$builtinTypes)) { + return [new Type($node->name, false, null, \in_array($node->name, Type::$builtinCollectionTypes))]; + } + + switch ($node->name) { + case 'integer': + return [new Type(Type::BUILTIN_TYPE_INT)]; + case 'list': + case 'non-empty-list': + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT))]; + case 'non-empty-array': + return [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true)]; + case 'mixed': + return []; // mixed seems to be ignored in all other extractors + case 'parent': + return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $node->name)]; + case 'static': + case 'self': + return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $nameScope->resolveRootClass())]; + case 'void': + return [new Type(Type::BUILTIN_TYPE_NULL)]; + } + + return [new Type(Type::BUILTIN_TYPE_OBJECT, false, $nameScope->resolveStringName($node->name))]; + } + + return []; + } +} diff --git a/vendor/symfony/property-info/composer.json b/vendor/symfony/property-info/composer.json new file mode 100644 index 0000000..e6a29c0 --- /dev/null +++ b/vendor/symfony/property-info/composer.json @@ -0,0 +1,57 @@ +{ + "name": "symfony/property-info", + "type": "library", + "description": "Extracts information about PHP class' properties using metadata of popular sources", + "keywords": [ + "property", + "type", + "PHPDoc", + "symfony", + "validator", + "doctrine" + ], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/string": "^5.1|^6.0" + }, + "require-dev": { + "symfony/serializer": "^4.4|^5.0|^6.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpstan/phpdoc-parser": "^1.0", + "doctrine/annotations": "^1.10.4" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/dependency-injection": "<4.4" + }, + "suggest": { + "psr/cache-implementation": "To cache results", + "symfony/doctrine-bridge": "To use Doctrine metadata", + "phpdocumentor/reflection-docblock": "To use the PHPDoc", + "symfony/serializer": "To use Serializer metadata" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\PropertyInfo\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/security-bundle/CHANGELOG.md b/vendor/symfony/security-bundle/CHANGELOG.md new file mode 100644 index 0000000..4cb8093 --- /dev/null +++ b/vendor/symfony/security-bundle/CHANGELOG.md @@ -0,0 +1,287 @@ +CHANGELOG +========= + +5.4 +--- + + * Deprecate `FirewallConfig::getListeners()`, use `FirewallConfig::getAuthenticators()` instead + * Deprecate `security.authentication.basic_entry_point` and `security.authentication.retry_entry_point` services, the logic is moved into the + `HttpBasicAuthenticator` and `ChannelListener` respectively + * Deprecate `FirewallConfig::allowsAnonymous()` and the `allows_anonymous` from the data collector data, there will be no anonymous concept as of version 6. + * Deprecate not setting `$authenticatorManagerEnabled` to `true` in `SecurityDataCollector` and `DebugFirewallCommand` + * Deprecate `SecurityFactoryInterface` and `SecurityExtension::addSecurityListenerFactory()` in favor of + `AuthenticatorFactoryInterface` and `SecurityExtension::addAuthenticatorFactory()` + * Add `AuthenticatorFactoryInterface::getPriority()` which replaces `SecurityFactoryInterface::getPosition()` + * Deprecate passing an array of arrays as 1st argument to `MainConfiguration`, pass a sorted flat array of + factories instead. + * Deprecate the `always_authenticate_before_granting` option + * Display the roles of the logged-in user in the Web Debug Toolbar + * Add the `security.access_decision_manager.strategy_service` option + * Deprecate not configuring explicitly a provider for custom_authenticators when there is more than one registered provider + +5.3 +--- + + * The authenticator system is no longer experimental + * Login Link functionality is no longer experimental + * Add `required_badges` firewall config option + * [BC break] Add `login_throttling.lock_factory` setting defaulting to `null` (instead of `lock.factory`) + * Add a `login_throttling.interval` (in `security.firewalls`) option to change the default throttling interval. + * Add the `debug:firewall` command. + * Deprecate `UserPasswordEncoderCommand` class and the corresponding `user:encode-password` command, + use `UserPasswordHashCommand` and `user:hash-password` instead + * Deprecate the `security.encoder_factory.generic` service, the `security.encoder_factory` and `Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface` aliases, + use `security.password_hasher_factory` and `Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface` instead + * Deprecate the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases, + use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead + * Deprecate the public `security.authorization_checker` and `security.token_storage` services to private + * Not setting the `enable_authenticator_manager` config option to `true` is deprecated + * Deprecate the `security.authentication.provider.*` services, use the new authenticator system instead + * Deprecate the `security.authentication.listener.*` services, use the new authenticator system instead + * Deprecate the Guard component integration, use the new authenticator system instead + * Add `form_login.form_only` option + +5.2.0 +----- + + * Added `FirewallListenerFactoryInterface`, which can be implemented by security factories to add firewall listeners + * Added `SortFirewallListenersPass` to make the execution order of firewall listeners configurable by + leveraging `Symfony\Component\Security\Http\Firewall\FirewallListenerInterface` + * Added ability to use comma separated ip address list for `security.access_control` + * [BC break] Removed `EntryPointFactoryInterface`, authenticators must now implement `AuthenticationEntryPointInterface` if + they require autoregistration of a Security entry point. + +5.1.0 +----- + + * Added XSD for configuration + * Added security configuration for priority-based access decision strategy + * Marked the `AnonymousFactory`, `FormLoginFactory`, `FormLoginLdapFactory`, `GuardAuthenticationFactory`, `HttpBasicFactory`, `HttpBasicLdapFactory`, `JsonLoginFactory`, `JsonLoginLdapFactory`, `RememberMeFactory`, `RemoteUserFactory` and `X509Factory` as `@internal` + * Renamed method `AbstractFactory#createEntryPoint()` to `AbstractFactory#createDefaultEntryPoint()` + +5.0.0 +----- + + * The `switch_user.stateless` firewall option has been removed. + * Removed the ability to configure encoders using `argon2i` or `bcrypt` as algorithm, use `auto` instead + * The `simple_form` and `simple_preauth` authentication listeners have been removed, + use Guard instead. + * The `SimpleFormFactory` and `SimplePreAuthenticationFactory` classes have been removed, + use Guard instead. + * Removed `LogoutUrlHelper` and `SecurityHelper` templating helpers, use Twig instead + * Removed the `logout_on_user_change` firewall option + * Removed the `threads` encoder option + * Removed the `security.authentication.trust_resolver.anonymous_class` parameter + * Removed the `security.authentication.trust_resolver.rememberme_class` parameter + * Removed the `security.user.provider.in_memory.user` service. + +4.4.0 +----- + + * Added `anonymous: lazy` mode to firewalls to make them (not) start the session as late as possible + * Added `migrate_from` option to encoders configuration. + * Added new `argon2id` encoder, undeprecated the `bcrypt` and `argon2i` ones (using `auto` is still recommended by default.) + * Deprecated the usage of "query_string" without a "search_dn" and a "search_password" config key in Ldap factories. + * Marked the `SecurityDataCollector` class as `@final`. + +4.3.0 +----- + + * Added new encoder types: `auto` (recommended), `native` and `sodium` + * The normalization of the cookie names configured in the `logout.delete_cookies` + option is deprecated and will be disabled in Symfony 5.0. This affects to cookies + with dashes in their names. For example, starting from Symfony 5.0, the `my-cookie` + name will delete `my-cookie` (with a dash) instead of `my_cookie` (with an underscore). + +4.2.0 +----- + + * Using the `security.authentication.trust_resolver.anonymous_class` and + `security.authentication.trust_resolver.rememberme_class` parameters to define + the token classes is deprecated. To use custom tokens extend the existing + `Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`. + or `Symfony\Component\Security\Core\Authentication\Token\RememberMeToken`. + * Added `Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass` + * Added `json_login_ldap` authentication provider to use LDAP authentication with a REST API. + * Made remember-me cookies inherit their default config from `framework.session.cookie_*` + and added an "auto" mode to their "secure" config option to make them secure on HTTPS automatically. + * Deprecated the `simple_form` and `simple_preauth` authentication listeners, use Guard instead. + * Deprecated the `SimpleFormFactory` and `SimplePreAuthenticationFactory` classes, use Guard instead. + * Added `port` in access_control + * Added individual voter decisions to the profiler + +4.1.0 +----- + + * The `switch_user.stateless` firewall option is deprecated, use the `stateless` option instead. + * The `logout_on_user_change` firewall option is deprecated. + * deprecated `SecurityUserValueResolver`, use + `Symfony\Component\Security\Http\Controller\UserValueResolver` instead. + +4.0.0 +----- + + * removed `FirewallContext::getContext()` + * made `FirewallMap::$container` and `::$map` private + * made the first `UserPasswordEncoderCommand::_construct()` argument mandatory + * `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` anymore + * removed support for voters that don't implement the `VoterInterface` + * removed HTTP digest authentication + * removed command `acl:set` along with `SetAclCommand` class + * removed command `init:acl` along with `InitAclCommand` class + * removed `acl` configuration key and related services, use symfony/acl-bundle instead + * removed auto picking the first registered provider when no configured provider on a firewall and ambiguous + * the firewall option `logout_on_user_change` is now always true, which will trigger a logout if the user changes + between requests + * the `switch_user.stateless` firewall option is `true` for stateless firewalls + +3.4.0 +----- + + * Added new `security.helper` service that is an instance of `Symfony\Component\Security\Core\Security` + and provides shortcuts for common security tasks. + * Tagging voters with the `security.voter` tag without implementing the + `VoterInterface` on the class is now deprecated and will be removed in 4.0. + * [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array` + * added info about called security listeners in profiler + * Added `logout_on_user_change` to the firewall options. This config item will + trigger a logout when the user has changed. Should be set to true to avoid + deprecations in the configuration. + * deprecated HTTP digest authentication + * deprecated command `acl:set` along with `SetAclCommand` class + * deprecated command `init:acl` along with `InitAclCommand` class + * Added support for the new Argon2i password encoder + * added `stateless` option to the `switch_user` listener + * deprecated auto picking the first registered provider when no configured provider on a firewall and ambiguous + +3.3.0 +----- + + * Deprecated instantiating `UserPasswordEncoderCommand` without its constructor + arguments fully provided. + * Deprecated `UserPasswordEncoderCommand::getContainer()` and relying on the + `ContainerAwareCommand` sub class or `ContainerAwareInterface` implementation for this command. + * Deprecated the `FirewallMap::$map` and `$container` properties. + * [BC BREAK] Keys of the `users` node for `in_memory` user provider are no longer normalized. + * deprecated `FirewallContext::getListeners()` + +3.2.0 +----- + + * Added the `SecurityUserValueResolver` to inject the security users in actions via + `Symfony\Component\Security\Core\User\UserInterface` in the method signature. + +3.0.0 +----- + + * Removed the `security.context` service. + +2.8.0 +----- + + * deprecated the `key` setting of `anonymous`, `remember_me` and `http_digest` + in favor of the `secret` setting. + * deprecated the `intention` firewall listener setting in favor of the `csrf_token_id`. + +2.6.0 +----- + + * Added the possibility to override the default success/failure handler + to get the provider key and the options injected + * Deprecated the `security.context` service for the `security.token_storage` and + `security.authorization_checker` services. + +2.4.0 +----- + + * Added 'host' option to firewall configuration + * Added 'csrf_token_generator' and 'csrf_token_id' options to firewall logout + listener configuration to supersede/alias 'csrf_provider' and 'intention' + respectively + * Moved 'security.secure_random' service configuration to FrameworkBundle + +2.3.0 +----- + + * allowed for multiple IP address in security access_control rules + +2.2.0 +----- + + * Added PBKDF2 Password encoder + * Added BCrypt password encoder + +2.1.0 +----- + + * [BC BREAK] The custom factories for the firewall configuration are now + registered during the build method of bundles instead of being registered + by the end-user (you need to remove the 'factories' keys in your security + configuration). + + * [BC BREAK] The Firewall listener is now registered after the Router one. This + means that specific Firewall URLs (like /login_check and /logout must now + have proper route defined in your routing configuration) + + * [BC BREAK] refactored the user provider configuration. The configuration + changed for the chain provider and the memory provider: + + Before: + + ``` yaml + security: + providers: + my_chain_provider: + providers: [my_memory_provider, my_doctrine_provider] + my_memory_provider: + users: + toto: { password: foobar, roles: [ROLE_USER] } + foo: { password: bar, roles: [ROLE_USER, ROLE_ADMIN] } + ``` + + After: + + ``` yaml + security: + providers: + my_chain_provider: + chain: + providers: [my_memory_provider, my_doctrine_provider] + my_memory_provider: + memory: + users: + toto: { password: foobar, roles: [ROLE_USER] } + foo: { password: bar, roles: [ROLE_USER, ROLE_ADMIN] } + ``` + + * [BC BREAK] Method `equals` was removed from `UserInterface` to its own new + `EquatableInterface`. The user class can now implement this interface to override + the default implementation of users equality test. + + * added a validator for the user password + * added 'erase_credentials' as a configuration key (true by default) + * added new events: `security.authentication.success` and `security.authentication.failure` + fired on authentication success/failure, regardless of authentication method, + events are defined in new event class: `Symfony\Component\Security\Core\AuthenticationEvents`. + + * Added optional CSRF protection to LogoutListener: + + ``` yaml + security: + firewalls: + default: + logout: + path: /logout_path + target: / + csrf_parameter: _csrf_token # Optional (defaults to "_csrf_token") + csrf_provider: security.csrf.token_generator # Required to enable protection + intention: logout # Optional (defaults to "logout") + ``` + + If the LogoutListener has CSRF protection enabled but cannot validate a token, + then a LogoutException will be thrown. + + * Added `logout_url` templating helper and Twig extension, which may be used to + generate logout URL's within templates. The security firewall's config key + must be specified. If a firewall's logout listener has CSRF protection + enabled, a token will be automatically added to the generated URL. diff --git a/vendor/symfony/security-bundle/CacheWarmer/ExpressionCacheWarmer.php b/vendor/symfony/security-bundle/CacheWarmer/ExpressionCacheWarmer.php new file mode 100644 index 0000000..095286e --- /dev/null +++ b/vendor/symfony/security-bundle/CacheWarmer/ExpressionCacheWarmer.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\CacheWarmer; + +use Symfony\Component\ExpressionLanguage\Expression; +use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; +use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; + +class ExpressionCacheWarmer implements CacheWarmerInterface +{ + private $expressions; + private $expressionLanguage; + + /** + * @param iterable $expressions + */ + public function __construct(iterable $expressions, ExpressionLanguage $expressionLanguage) + { + $this->expressions = $expressions; + $this->expressionLanguage = $expressionLanguage; + } + + public function isOptional() + { + return true; + } + + /** + * @return string[] + */ + public function warmUp(string $cacheDir) + { + foreach ($this->expressions as $expression) { + $this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'role_names', 'request', 'trust_resolver']); + } + + return []; + } +} diff --git a/vendor/symfony/security-bundle/Command/DebugFirewallCommand.php b/vendor/symfony/security-bundle/Command/DebugFirewallCommand.php new file mode 100644 index 0000000..b5fe209 --- /dev/null +++ b/vendor/symfony/security-bundle/Command/DebugFirewallCommand.php @@ -0,0 +1,289 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Command; + +use Psr\Container\ContainerInterface; +use Symfony\Bundle\SecurityBundle\Security\FirewallContext; +use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; + +/** + * @author Timo Bakx + */ +final class DebugFirewallCommand extends Command +{ + protected static $defaultName = 'debug:firewall'; + protected static $defaultDescription = 'Display information about your security firewall(s)'; + + private $firewallNames; + private $contexts; + private $eventDispatchers; + private $authenticators; + private $authenticatorManagerEnabled; + + /** + * @param string[] $firewallNames + * @param AuthenticatorInterface[][] $authenticators + */ + public function __construct(array $firewallNames, ContainerInterface $contexts, ContainerInterface $eventDispatchers, array $authenticators, bool $authenticatorManagerEnabled) + { + if (!$authenticatorManagerEnabled) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Setting the $authenticatorManagerEnabled argument of "%s" to "false" is deprecated, use the new authenticator system instead.', __METHOD__); + } + + $this->firewallNames = $firewallNames; + $this->contexts = $contexts; + $this->eventDispatchers = $eventDispatchers; + $this->authenticators = $authenticators; + $this->authenticatorManagerEnabled = $authenticatorManagerEnabled; + + parent::__construct(); + } + + protected function configure(): void + { + $exampleName = $this->getExampleName(); + + $this + ->setDescription(self::$defaultDescription) + ->setHelp(<<%command.name% command displays the firewalls that are configured +in your application: + + php %command.full_name% + +You can pass a firewall name to display more detailed information about +a specific firewall: + + php %command.full_name% $exampleName + +To include all events and event listeners for a specific firewall, use the +events option: + + php %command.full_name% --events $exampleName + +EOF + ) + ->setDefinition([ + new InputArgument('name', InputArgument::OPTIONAL, sprintf('A firewall name (for example "%s")', $exampleName)), + new InputOption('events', null, InputOption::VALUE_NONE, 'Include a list of event listeners (only available in combination with the "name" argument)'), + ]); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + + $name = $input->getArgument('name'); + + if (null === $name) { + $this->displayFirewallList($io); + + return 0; + } + + $serviceId = sprintf('security.firewall.map.context.%s', $name); + + if (!$this->contexts->has($serviceId)) { + $io->error(sprintf('Firewall %s was not found. Available firewalls are: %s', $name, implode(', ', $this->firewallNames))); + + return 1; + } + + /** @var FirewallContext $context */ + $context = $this->contexts->get($serviceId); + + $io->title(sprintf('Firewall "%s"', $name)); + + $this->displayFirewallSummary($name, $context, $io); + + $this->displaySwitchUser($context, $io); + + if ($input->getOption('events')) { + $this->displayEventListeners($name, $context, $io); + } + + if ($this->authenticatorManagerEnabled) { + $this->displayAuthenticators($name, $io); + } + + return 0; + } + + protected function displayFirewallList(SymfonyStyle $io): void + { + $io->title('Firewalls'); + $io->text('The following firewalls are defined:'); + + $io->listing($this->firewallNames); + + $io->comment(sprintf('To view details of a specific firewall, re-run this command with a firewall name. (e.g. debug:firewall %s)', $this->getExampleName())); + } + + protected function displayFirewallSummary(string $name, FirewallContext $context, SymfonyStyle $io): void + { + if (null === $context->getConfig()) { + return; + } + + $rows = [ + ['Name', $name], + ['Context', $context->getConfig()->getContext()], + ['Lazy', $context instanceof LazyFirewallContext ? 'Yes' : 'No'], + ['Stateless', $context->getConfig()->isStateless() ? 'Yes' : 'No'], + ['User Checker', $context->getConfig()->getUserChecker()], + ['Provider', $context->getConfig()->getProvider()], + ['Entry Point', $context->getConfig()->getEntryPoint()], + ['Access Denied URL', $context->getConfig()->getAccessDeniedUrl()], + ['Access Denied Handler', $context->getConfig()->getAccessDeniedHandler()], + ]; + + $io->table( + ['Option', 'Value'], + $rows + ); + } + + private function displaySwitchUser(FirewallContext $context, SymfonyStyle $io) + { + if ((null === $config = $context->getConfig()) || (null === $switchUser = $config->getSwitchUser())) { + return; + } + + $io->section('User switching'); + + $io->table(['Option', 'Value'], [ + ['Parameter', $switchUser['parameter'] ?? ''], + ['Provider', $switchUser['provider'] ?? $config->getProvider()], + ['User Role', $switchUser['role'] ?? ''], + ]); + } + + protected function displayEventListeners(string $name, FirewallContext $context, SymfonyStyle $io): void + { + $io->title(sprintf('Event listeners for firewall "%s"', $name)); + + $dispatcherId = sprintf('security.event_dispatcher.%s', $name); + + if (!$this->eventDispatchers->has($dispatcherId)) { + $io->text('No event dispatcher has been registered for this firewall.'); + + return; + } + + /** @var EventDispatcherInterface $dispatcher */ + $dispatcher = $this->eventDispatchers->get($dispatcherId); + + foreach ($dispatcher->getListeners() as $event => $listeners) { + $io->section(sprintf('"%s" event', $event)); + + $rows = []; + foreach ($listeners as $order => $listener) { + $rows[] = [ + sprintf('#%d', $order + 1), + $this->formatCallable($listener), + $dispatcher->getListenerPriority($event, $listener), + ]; + } + + $io->table( + ['Order', 'Callable', 'Priority'], + $rows + ); + } + } + + private function displayAuthenticators(string $name, SymfonyStyle $io): void + { + $io->title(sprintf('Authenticators for firewall "%s"', $name)); + + $authenticators = $this->authenticators[$name] ?? []; + + if (0 === \count($authenticators)) { + $io->text('No authenticators have been registered for this firewall.'); + + return; + } + + $io->table( + ['Classname'], + array_map( + static function ($authenticator) { + return [ + \get_class($authenticator), + ]; + }, + $authenticators + ) + ); + } + + private function formatCallable($callable): string + { + if (\is_array($callable)) { + if (\is_object($callable[0])) { + return sprintf('%s::%s()', \get_class($callable[0]), $callable[1]); + } + + return sprintf('%s::%s()', $callable[0], $callable[1]); + } + + if (\is_string($callable)) { + return sprintf('%s()', $callable); + } + + if ($callable instanceof \Closure) { + $r = new \ReflectionFunction($callable); + if (false !== strpos($r->name, '{closure}')) { + return 'Closure()'; + } + if ($class = $r->getClosureScopeClass()) { + return sprintf('%s::%s()', $class->name, $r->name); + } + + return $r->name.'()'; + } + + if (method_exists($callable, '__invoke')) { + return sprintf('%s::__invoke()', \get_class($callable)); + } + + throw new \InvalidArgumentException('Callable is not describable.'); + } + + private function getExampleName(): string + { + $name = 'main'; + + if (!\in_array($name, $this->firewallNames, true)) { + $name = reset($this->firewallNames); + } + + return $name; + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestArgumentValuesFor('name')) { + $suggestions->suggestValues($this->firewallNames); + } + } +} diff --git a/vendor/symfony/security-bundle/Command/UserPasswordEncoderCommand.php b/vendor/symfony/security-bundle/Command/UserPasswordEncoderCommand.php new file mode 100644 index 0000000..09f4df8 --- /dev/null +++ b/vendor/symfony/security-bundle/Command/UserPasswordEncoderCommand.php @@ -0,0 +1,216 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\PasswordHasher\Command\UserPasswordHashCommand; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Encoder\SelfSaltingEncoderInterface; + +/** + * Encode a user's password. + * + * @author Sarah Khalil + * + * @final + * + * @deprecated since Symfony 5.3, use {@link UserPasswordHashCommand} instead + */ +class UserPasswordEncoderCommand extends Command +{ + protected static $defaultName = 'security:encode-password'; + protected static $defaultDescription = 'Encode a password'; + + private $encoderFactory; + private $userClasses; + + public function __construct(EncoderFactoryInterface $encoderFactory, array $userClasses = []) + { + $this->encoderFactory = $encoderFactory; + $this->userClasses = $userClasses; + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setDescription(self::$defaultDescription) + ->addArgument('password', InputArgument::OPTIONAL, 'The plain password to encode.') + ->addArgument('user-class', InputArgument::OPTIONAL, 'The User entity class path associated with the encoder used to encode the password.') + ->addOption('empty-salt', null, InputOption::VALUE_NONE, 'Do not generate a salt or let the encoder generate one.') + ->setHelp(<<%command.name% command encodes passwords according to your +security configuration. This command is mainly used to generate passwords for +the in_memory user provider type and for changing passwords +in the database while developing the application. + +Suppose that you have the following security configuration in your application: + + +# app/config/security.yml +security: + encoders: + Symfony\Component\Security\Core\User\InMemoryUser: plaintext + App\Entity\User: auto + + +If you execute the command non-interactively, the first available configured +user class under the security.encoders key is used and a random salt is +generated to encode the password: + + php %command.full_name% --no-interaction [password] + +Pass the full user class path as the second argument to encode passwords for +your own entities: + + php %command.full_name% --no-interaction [password] 'App\Entity\User' + +Executing the command interactively allows you to generate a random salt for +encoding the password: + + php %command.full_name% [password] 'App\Entity\User' + +In case your encoder doesn't require a salt, add the empty-salt option: + + php %command.full_name% --empty-salt [password] 'App\Entity\User' + +EOF + ) + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io; + + $errorIo->caution('The use of the "security:encode-password" command is deprecated since version 5.3 and will be removed in 6.0. Use "security:hash-password" instead.'); + + $input->isInteractive() ? $errorIo->title('Symfony Password Encoder Utility') : $errorIo->newLine(); + + $password = $input->getArgument('password'); + $userClass = $this->getUserClass($input, $io); + $emptySalt = $input->getOption('empty-salt'); + + $encoder = $this->encoderFactory->getEncoder($userClass); + $saltlessWithoutEmptySalt = !$emptySalt && $encoder instanceof SelfSaltingEncoderInterface; + + if ($saltlessWithoutEmptySalt) { + $emptySalt = true; + } + + if (!$password) { + if (!$input->isInteractive()) { + $errorIo->error('The password must not be empty.'); + + return 1; + } + $passwordQuestion = $this->createPasswordQuestion(); + $password = $errorIo->askQuestion($passwordQuestion); + } + + $salt = null; + + if ($input->isInteractive() && !$emptySalt) { + $emptySalt = true; + + $errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.'); + + if ($errorIo->confirm('Confirm salt generation ?')) { + $salt = $this->generateSalt(); + $emptySalt = false; + } + } elseif (!$emptySalt) { + $salt = $this->generateSalt(); + } + + $encodedPassword = $encoder->encodePassword($password, $salt); + + $rows = [ + ['Encoder used', \get_class($encoder)], + ['Encoded password', $encodedPassword], + ]; + if (!$emptySalt) { + $rows[] = ['Generated salt', $salt]; + } + $io->table(['Key', 'Value'], $rows); + + if (!$emptySalt) { + $errorIo->note(sprintf('Make sure that your salt storage field fits the salt length: %s chars', \strlen($salt))); + } elseif ($saltlessWithoutEmptySalt) { + $errorIo->note('Self-salting encoder used: the encoder generated its own built-in salt.'); + } + + $errorIo->success('Password encoding succeeded'); + + return 0; + } + + /** + * Create the password question to ask the user for the password to be encoded. + */ + private function createPasswordQuestion(): Question + { + $passwordQuestion = new Question('Type in your password to be encoded'); + + return $passwordQuestion->setValidator(function ($value) { + if ('' === trim($value)) { + throw new InvalidArgumentException('The password must not be empty.'); + } + + return $value; + })->setHidden(true)->setMaxAttempts(20); + } + + private function generateSalt(): string + { + return base64_encode(random_bytes(30)); + } + + private function getUserClass(InputInterface $input, SymfonyStyle $io): string + { + if (null !== $userClass = $input->getArgument('user-class')) { + return $userClass; + } + + if (empty($this->userClasses)) { + throw new RuntimeException('There are no configured encoders for the "security" extension.'); + } + + if (!$input->isInteractive() || 1 === \count($this->userClasses)) { + return reset($this->userClasses); + } + + $userClasses = $this->userClasses; + natcasesort($userClasses); + $userClasses = array_values($userClasses); + + return $io->choice('For which user class would you like to encode a password?', $userClasses, reset($userClasses)); + } +} diff --git a/vendor/symfony/security-bundle/DataCollector/SecurityDataCollector.php b/vendor/symfony/security-bundle/DataCollector/SecurityDataCollector.php new file mode 100644 index 0000000..1ed5129 --- /dev/null +++ b/vendor/symfony/security-bundle/DataCollector/SecurityDataCollector.php @@ -0,0 +1,400 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DataCollector; + +use Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener; +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; +use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; +use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter; +use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; +use Symfony\Component\Security\Http\Firewall\SwitchUserListener; +use Symfony\Component\Security\Http\FirewallMapInterface; +use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; +use Symfony\Component\VarDumper\Caster\ClassStub; +use Symfony\Component\VarDumper\Cloner\Data; + +/** + * @author Fabien Potencier + * + * @final + */ +class SecurityDataCollector extends DataCollector implements LateDataCollectorInterface +{ + private $tokenStorage; + private $roleHierarchy; + private $logoutUrlGenerator; + private $accessDecisionManager; + private $firewallMap; + private $firewall; + private $hasVarDumper; + private $authenticatorManagerEnabled; + + public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false) + { + if (!$authenticatorManagerEnabled) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Setting the $authenticatorManagerEnabled argument of "%s" to "false" is deprecated, use the new authenticator system instead.', __METHOD__); + } + + $this->tokenStorage = $tokenStorage; + $this->roleHierarchy = $roleHierarchy; + $this->logoutUrlGenerator = $logoutUrlGenerator; + $this->accessDecisionManager = $accessDecisionManager; + $this->firewallMap = $firewallMap; + $this->firewall = $firewall; + $this->hasVarDumper = class_exists(ClassStub::class); + $this->authenticatorManagerEnabled = $authenticatorManagerEnabled; + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + if (null === $this->tokenStorage) { + $this->data = [ + 'enabled' => false, + 'authenticated' => false, + 'impersonated' => false, + 'impersonator_user' => null, + 'impersonation_exit_path' => null, + 'token' => null, + 'token_class' => null, + 'logout_url' => null, + 'user' => '', + 'roles' => [], + 'inherited_roles' => [], + 'supports_role_hierarchy' => null !== $this->roleHierarchy, + ]; + } elseif (null === $token = $this->tokenStorage->getToken()) { + $this->data = [ + 'enabled' => true, + 'authenticated' => false, + 'impersonated' => false, + 'impersonator_user' => null, + 'impersonation_exit_path' => null, + 'token' => null, + 'token_class' => null, + 'logout_url' => null, + 'user' => '', + 'roles' => [], + 'inherited_roles' => [], + 'supports_role_hierarchy' => null !== $this->roleHierarchy, + ]; + } else { + $inheritedRoles = []; + $assignedRoles = $token->getRoleNames(); + + $impersonatorUser = null; + if ($token instanceof SwitchUserToken) { + $originalToken = $token->getOriginalToken(); + // @deprecated since Symfony 5.3, change to $originalToken->getUserIdentifier() in 6.0 + $impersonatorUser = method_exists($originalToken, 'getUserIdentifier') ? $originalToken->getUserIdentifier() : $originalToken->getUsername(); + } + + if (null !== $this->roleHierarchy) { + foreach ($this->roleHierarchy->getReachableRoleNames($assignedRoles) as $role) { + if (!\in_array($role, $assignedRoles, true)) { + $inheritedRoles[] = $role; + } + } + } + + $logoutUrl = null; + try { + if (null !== $this->logoutUrlGenerator && !$token instanceof AnonymousToken) { + $logoutUrl = $this->logoutUrlGenerator->getLogoutPath(); + } + } catch (\Exception $e) { + // fail silently when the logout URL cannot be generated + } + + $this->data = [ + 'enabled' => true, + 'authenticated' => method_exists($token, 'isAuthenticated') ? $token->isAuthenticated(false) : (bool) $token->getUser(), + 'impersonated' => null !== $impersonatorUser, + 'impersonator_user' => $impersonatorUser, + 'impersonation_exit_path' => null, + 'token' => $token, + 'token_class' => $this->hasVarDumper ? new ClassStub(\get_class($token)) : \get_class($token), + 'logout_url' => $logoutUrl, + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + 'user' => method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername(), + 'roles' => $assignedRoles, + 'inherited_roles' => array_unique($inheritedRoles), + 'supports_role_hierarchy' => null !== $this->roleHierarchy, + ]; + } + + // collect voters and access decision manager information + if ($this->accessDecisionManager instanceof TraceableAccessDecisionManager) { + $this->data['voter_strategy'] = $this->accessDecisionManager->getStrategy(); + + foreach ($this->accessDecisionManager->getVoters() as $voter) { + if ($voter instanceof TraceableVoter) { + $voter = $voter->getDecoratedVoter(); + } + + $this->data['voters'][] = $this->hasVarDumper ? new ClassStub(\get_class($voter)) : \get_class($voter); + } + + // collect voter details + $decisionLog = $this->accessDecisionManager->getDecisionLog(); + foreach ($decisionLog as $key => $log) { + $decisionLog[$key]['voter_details'] = []; + foreach ($log['voterDetails'] as $voterDetail) { + $voterClass = \get_class($voterDetail['voter']); + $classData = $this->hasVarDumper ? new ClassStub($voterClass) : $voterClass; + $decisionLog[$key]['voter_details'][] = [ + 'class' => $classData, + 'attributes' => $voterDetail['attributes'], // Only displayed for unanimous strategy + 'vote' => $voterDetail['vote'], + ]; + } + unset($decisionLog[$key]['voterDetails']); + } + + $this->data['access_decision_log'] = $decisionLog; + } else { + $this->data['access_decision_log'] = []; + $this->data['voter_strategy'] = 'unknown'; + $this->data['voters'] = []; + } + + // collect firewall context information + $this->data['firewall'] = null; + if ($this->firewallMap instanceof FirewallMap) { + $firewallConfig = $this->firewallMap->getFirewallConfig($request); + if (null !== $firewallConfig) { + $this->data['firewall'] = [ + 'name' => $firewallConfig->getName(), + 'allows_anonymous' => $this->authenticatorManagerEnabled ? false : $firewallConfig->allowsAnonymous(), + 'request_matcher' => $firewallConfig->getRequestMatcher(), + 'security_enabled' => $firewallConfig->isSecurityEnabled(), + 'stateless' => $firewallConfig->isStateless(), + 'provider' => $firewallConfig->getProvider(), + 'context' => $firewallConfig->getContext(), + 'entry_point' => $firewallConfig->getEntryPoint(), + 'access_denied_handler' => $firewallConfig->getAccessDeniedHandler(), + 'access_denied_url' => $firewallConfig->getAccessDeniedUrl(), + 'user_checker' => $firewallConfig->getUserChecker(), + ]; + + // in 6.0, always fill `$this->data['authenticators'] only + if ($this->authenticatorManagerEnabled) { + $this->data['firewall']['authenticators'] = $firewallConfig->getAuthenticators(); + } else { + $this->data['firewall']['listeners'] = $firewallConfig->getAuthenticators(); + } + + // generate exit impersonation path from current request + if ($this->data['impersonated'] && null !== $switchUserConfig = $firewallConfig->getSwitchUser()) { + $exitPath = $request->getRequestUri(); + $exitPath .= null === $request->getQueryString() ? '?' : '&'; + $exitPath .= sprintf('%s=%s', urlencode($switchUserConfig['parameter']), SwitchUserListener::EXIT_VALUE); + + $this->data['impersonation_exit_path'] = $exitPath; + } + } + } + + // collect firewall listeners information + $this->data['listeners'] = []; + if ($this->firewall) { + $this->data['listeners'] = $this->firewall->getWrappedListeners(); + } + + $this->data['authenticator_manager_enabled'] = $this->authenticatorManagerEnabled; + $this->data['authenticators'] = $this->firewall ? $this->firewall->getAuthenticatorsInfo() : []; + } + + /** + * {@inheritdoc} + */ + public function reset() + { + $this->data = []; + } + + public function lateCollect() + { + $this->data = $this->cloneVar($this->data); + } + + /** + * Checks if security is enabled. + */ + public function isEnabled(): bool + { + return $this->data['enabled']; + } + + /** + * Gets the user. + */ + public function getUser(): string + { + return $this->data['user']; + } + + /** + * Gets the roles of the user. + * + * @return array|Data + */ + public function getRoles() + { + return $this->data['roles']; + } + + /** + * Gets the inherited roles of the user. + * + * @return array|Data + */ + public function getInheritedRoles() + { + return $this->data['inherited_roles']; + } + + /** + * Checks if the data contains information about inherited roles. Still the inherited + * roles can be an empty array. + */ + public function supportsRoleHierarchy(): bool + { + return $this->data['supports_role_hierarchy']; + } + + /** + * Checks if the user is authenticated or not. + */ + public function isAuthenticated(): bool + { + return $this->data['authenticated']; + } + + public function isImpersonated(): bool + { + return $this->data['impersonated']; + } + + public function getImpersonatorUser(): ?string + { + return $this->data['impersonator_user']; + } + + public function getImpersonationExitPath(): ?string + { + return $this->data['impersonation_exit_path']; + } + + /** + * Get the class name of the security token. + * + * @return string|Data|null + */ + public function getTokenClass() + { + return $this->data['token_class']; + } + + /** + * Get the full security token class as Data object. + */ + public function getToken(): ?Data + { + return $this->data['token']; + } + + /** + * Get the logout URL. + */ + public function getLogoutUrl(): ?string + { + return $this->data['logout_url']; + } + + /** + * Returns the FQCN of the security voters enabled in the application. + * + * @return string[]|Data + */ + public function getVoters() + { + return $this->data['voters']; + } + + /** + * Returns the strategy configured for the security voters. + */ + public function getVoterStrategy(): string + { + return $this->data['voter_strategy']; + } + + /** + * Returns the log of the security decisions made by the access decision manager. + * + * @return array|Data + */ + public function getAccessDecisionLog() + { + return $this->data['access_decision_log']; + } + + /** + * Returns the configuration of the current firewall context. + * + * @return array|Data|null + */ + public function getFirewall() + { + return $this->data['firewall']; + } + + /** + * @return array|Data + */ + public function getListeners() + { + return $this->data['listeners']; + } + + /** + * @return array|Data + */ + public function getAuthenticators() + { + return $this->data['authenticators']; + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return 'security'; + } + + public function isAuthenticatorManagerEnabled(): bool + { + return $this->data['authenticator_manager_enabled']; + } +} diff --git a/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php b/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php new file mode 100644 index 0000000..e82b476 --- /dev/null +++ b/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Debug; + +use Symfony\Bundle\SecurityBundle\EventListener\FirewallListener; +use Symfony\Bundle\SecurityBundle\Security\FirewallContext; +use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; + +/** + * Firewall collecting called security listeners and authenticators. + * + * @author Robin Chalas + */ +final class TraceableFirewallListener extends FirewallListener +{ + private $wrappedListeners = []; + private $authenticatorsInfo = []; + + public function getWrappedListeners() + { + return $this->wrappedListeners; + } + + public function getAuthenticatorsInfo(): array + { + return $this->authenticatorsInfo; + } + + protected function callListeners(RequestEvent $event, iterable $listeners) + { + $wrappedListeners = []; + $wrappedLazyListeners = []; + $authenticatorManagerListener = null; + + foreach ($listeners as $listener) { + if ($listener instanceof LazyFirewallContext) { + \Closure::bind(function () use (&$wrappedLazyListeners, &$wrappedListeners, &$authenticatorManagerListener) { + $listeners = []; + foreach ($this->listeners as $listener) { + if (!$authenticatorManagerListener && $listener instanceof TraceableAuthenticatorManagerListener) { + $authenticatorManagerListener = $listener; + } + if ($listener instanceof FirewallListenerInterface) { + $listener = new WrappedLazyListener($listener); + $listeners[] = $listener; + $wrappedLazyListeners[] = $listener; + } else { + $listeners[] = function (RequestEvent $event) use ($listener, &$wrappedListeners) { + $wrappedListener = new WrappedListener($listener); + $wrappedListener($event); + $wrappedListeners[] = $wrappedListener->getInfo(); + }; + } + } + $this->listeners = $listeners; + }, $listener, FirewallContext::class)(); + + $listener($event); + } else { + $wrappedListener = $listener instanceof FirewallListenerInterface ? new WrappedLazyListener($listener) : new WrappedListener($listener); + $wrappedListener($event); + $wrappedListeners[] = $wrappedListener->getInfo(); + if (!$authenticatorManagerListener && $listener instanceof TraceableAuthenticatorManagerListener) { + $authenticatorManagerListener = $listener; + } + } + + if ($event->hasResponse()) { + break; + } + } + + if ($wrappedLazyListeners) { + foreach ($wrappedLazyListeners as $lazyListener) { + $this->wrappedListeners[] = $lazyListener->getInfo(); + } + } + + $this->wrappedListeners = array_merge($this->wrappedListeners, $wrappedListeners); + + if ($authenticatorManagerListener) { + $this->authenticatorsInfo = $authenticatorManagerListener->getAuthenticatorsInfo(); + } + } +} diff --git a/vendor/symfony/security-bundle/Debug/TraceableListenerTrait.php b/vendor/symfony/security-bundle/Debug/TraceableListenerTrait.php new file mode 100644 index 0000000..6581314 --- /dev/null +++ b/vendor/symfony/security-bundle/Debug/TraceableListenerTrait.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Debug; + +use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener; +use Symfony\Component\VarDumper\Caster\ClassStub; + +/** + * @author Robin Chalas + * + * @internal + */ +trait TraceableListenerTrait +{ + private $response; + private $listener; + private $time; + private $stub; + + /** + * Proxies all method calls to the original listener. + */ + public function __call(string $method, array $arguments) + { + return $this->listener->{$method}(...$arguments); + } + + public function getWrappedListener() + { + return $this->listener; + } + + public function getInfo(): array + { + return [ + 'response' => $this->response, + 'time' => $this->time, + 'stub' => $this->stub ?? $this->stub = ClassStub::wrapCallable($this->listener instanceof TraceableAuthenticatorManagerListener ? $this->listener->getAuthenticatorManagerListener() : $this->listener), + ]; + } +} diff --git a/vendor/symfony/security-bundle/Debug/WrappedLazyListener.php b/vendor/symfony/security-bundle/Debug/WrappedLazyListener.php new file mode 100644 index 0000000..5a3d0a1 --- /dev/null +++ b/vendor/symfony/security-bundle/Debug/WrappedLazyListener.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Debug; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Exception\LazyResponseException; +use Symfony\Component\Security\Http\Firewall\AbstractListener; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; + +/** + * Wraps a lazy security listener. + * + * @author Robin Chalas + * + * @internal + */ +final class WrappedLazyListener extends AbstractListener +{ + use TraceableListenerTrait; + + public function __construct(FirewallListenerInterface $listener) + { + $this->listener = $listener; + } + + public function supports(Request $request): ?bool + { + return $this->listener->supports($request); + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestEvent $event) + { + $startTime = microtime(true); + + try { + $ret = $this->listener->authenticate($event); + } catch (LazyResponseException $e) { + $this->response = $e->getResponse(); + + throw $e; + } finally { + $this->time = microtime(true) - $startTime; + } + + $this->response = $event->getResponse(); + + return $ret; + } +} diff --git a/vendor/symfony/security-bundle/Debug/WrappedListener.php b/vendor/symfony/security-bundle/Debug/WrappedListener.php new file mode 100644 index 0000000..bce3d26 --- /dev/null +++ b/vendor/symfony/security-bundle/Debug/WrappedListener.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Debug; + +use Symfony\Component\HttpKernel\Event\RequestEvent; + +/** + * Wraps a security listener for calls record. + * + * @author Robin Chalas + * + * @internal + */ +final class WrappedListener +{ + use TraceableListenerTrait; + + public function __construct(callable $listener) + { + $this->listener = $listener; + } + + public function __invoke(RequestEvent $event) + { + $startTime = microtime(true); + ($this->listener)($event); + $this->time = microtime(true) - $startTime; + $this->response = $event->getResponse(); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php new file mode 100644 index 0000000..0393e6c --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddExpressionLanguageProvidersPass.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Registers the expression language providers. + * + * @author Fabien Potencier + */ +class AddExpressionLanguageProvidersPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if ($container->has('security.expression_language')) { + $definition = $container->findDefinition('security.expression_language'); + foreach ($container->findTaggedServiceIds('security.expression_language_provider', true) as $id => $attributes) { + $definition->addMethodCall('registerProvider', [new Reference($id)]); + } + } + + if (!$container->hasDefinition('cache.system')) { + $container->removeDefinition('cache.security_expression_language'); + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSecurityVotersPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSecurityVotersPass.php new file mode 100644 index 0000000..c3c7b86 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSecurityVotersPass.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter; +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Adds all configured security voters to the access decision manager. + * + * @author Johannes M. Schmitt + */ +class AddSecurityVotersPass implements CompilerPassInterface +{ + use PriorityTaggedServiceTrait; + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('security.access.decision_manager')) { + return; + } + + $voters = $this->findAndSortTaggedServices('security.voter', $container); + if (!$voters) { + throw new LogicException('No security voters found. You need to tag at least one with "security.voter".'); + } + + $debug = $container->getParameter('kernel.debug'); + $voterServices = []; + foreach ($voters as $voter) { + $voterServiceId = (string) $voter; + $definition = $container->getDefinition($voterServiceId); + + $class = $container->getParameterBag()->resolveValue($definition->getClass()); + + if (!is_a($class, VoterInterface::class, true)) { + throw new LogicException(sprintf('"%s" must implement the "%s" when used as a voter.', $class, VoterInterface::class)); + } + + if ($debug) { + $voterServices[] = new Reference($debugVoterServiceId = 'debug.security.voter.'.$voterServiceId); + + $container + ->register($debugVoterServiceId, TraceableVoter::class) + ->addArgument($voter) + ->addArgument(new Reference('event_dispatcher')); + } else { + $voterServices[] = $voter; + } + } + + $container->getDefinition('security.access.decision_manager') + ->replaceArgument(0, new IteratorArgument($voterServices)); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php new file mode 100644 index 0000000..461a5ad --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/AddSessionDomainConstraintPass.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Uses the session domain to restrict allowed redirection targets. + * + * @author Nicolas Grekas + */ +class AddSessionDomainConstraintPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasParameter('session.storage.options') || !$container->has('security.http_utils')) { + return; + } + + $sessionOptions = $container->getParameter('session.storage.options'); + $domainRegexp = empty($sessionOptions['cookie_domain']) ? '%%s' : sprintf('(?:%%%%s|(?:.+\.)?%s)', preg_quote(trim($sessionOptions['cookie_domain'], '.'))); + + if ('auto' === ($sessionOptions['cookie_secure'] ?? null)) { + $secureDomainRegexp = sprintf('{^https://%s$}i', $domainRegexp); + $domainRegexp = 'https?://'.$domainRegexp; + } else { + $secureDomainRegexp = null; + $domainRegexp = (empty($sessionOptions['cookie_secure']) ? 'https?://' : 'https://').$domainRegexp; + } + + $container->findDefinition('security.http_utils') + ->addArgument(sprintf('{^%s$}i', $domainRegexp)) + ->addArgument($secureDomainRegexp); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/CleanRememberMeVerifierPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/CleanRememberMeVerifierPass.php new file mode 100644 index 0000000..d959d4b --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/CleanRememberMeVerifierPass.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Cleans up the remember me verifier cache if cache is missing. + * + * @author Jordi Boggiano + */ +class CleanRememberMeVerifierPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('cache.system')) { + $container->removeDefinition('cache.security_token_verifier'); + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php new file mode 100644 index 0000000..ccab766 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Http\EventListener\CsrfProtectionListener; +use Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener; + +/** + * @author Christian Flothmann + * @author Wouter de Jong + * + * @internal + */ +class RegisterCsrfFeaturesPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + $this->registerCsrfProtectionListener($container); + $this->registerLogoutHandler($container); + } + + private function registerCsrfProtectionListener(ContainerBuilder $container) + { + if (!$container->has('security.authenticator.manager') || !$container->has('security.csrf.token_manager')) { + return; + } + + $container->register('security.listener.csrf_protection', CsrfProtectionListener::class) + ->addArgument(new Reference('security.csrf.token_manager')) + ->addTag('kernel.event_subscriber') + ->setPublic(false); + } + + protected function registerLogoutHandler(ContainerBuilder $container) + { + if (!$container->has('security.logout_listener') || !$container->has('security.csrf.token_storage')) { + return; + } + + $csrfTokenStorage = $container->findDefinition('security.csrf.token_storage'); + $csrfTokenStorageClass = $container->getParameterBag()->resolveValue($csrfTokenStorage->getClass()); + + if (!is_subclass_of($csrfTokenStorageClass, 'Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface')) { + return; + } + + $container->register('security.logout.listener.csrf_token_clearing', CsrfTokenClearingLogoutListener::class) + ->addArgument(new Reference('security.csrf.token_storage')) + ->addTag('kernel.event_subscriber') + ->setPublic(false); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php new file mode 100644 index 0000000..8cabb9d --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\ContainerBuilder; + +trigger_deprecation('symfony/security-bundle', '5.1', 'The "%s" class is deprecated.', RegisterCsrfTokenClearingLogoutHandlerPass::class); + +/** + * @deprecated since symfony/security-bundle 5.1 + */ +class RegisterCsrfTokenClearingLogoutHandlerPass extends RegisterCsrfFeaturesPass +{ + public function process(ContainerBuilder $container) + { + if (!$container->has('security.csrf.token_storage')) { + return; + } + + $this->registerLogoutHandler($container); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterEntryPointPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterEntryPointPass.php new file mode 100644 index 0000000..6de4951 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterEntryPointPass.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +/** + * @author Wouter de Jong + */ +class RegisterEntryPointPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (!$container->hasParameter('security.firewalls')) { + return; + } + + $firewalls = $container->getParameter('security.firewalls'); + foreach ($firewalls as $firewallName) { + if (!$container->hasDefinition('security.authenticator.manager.'.$firewallName) || !$container->hasParameter('security.'.$firewallName.'._indexed_authenticators')) { + continue; + } + + $entryPoints = []; + $indexedAuthenticators = $container->getParameter('security.'.$firewallName.'._indexed_authenticators'); + // this is a compile-only parameter, removing it cleans up space and avoids unintended usage + $container->getParameterBag()->remove('security.'.$firewallName.'._indexed_authenticators'); + foreach ($indexedAuthenticators as $key => $authenticatorId) { + if (!$container->has($authenticatorId)) { + continue; + } + + // because this pass runs before ResolveChildDefinitionPass, child definitions didn't inherit the parent class yet + $definition = $container->findDefinition($authenticatorId); + while (!($authenticatorClass = $definition->getClass()) && $definition instanceof ChildDefinition) { + $definition = $container->findDefinition($definition->getParent()); + } + + if (is_a($authenticatorClass, AuthenticationEntryPointInterface::class, true)) { + $entryPoints[$key] = $authenticatorId; + } + } + + if (!$entryPoints) { + continue; + } + + $config = $container->getDefinition('security.firewall.map.config.'.$firewallName); + $configuredEntryPoint = $config->getArgument(7); + + if (null !== $configuredEntryPoint) { + // allow entry points to be configured by authenticator key (e.g. "http_basic") + $entryPoint = $entryPoints[$configuredEntryPoint] ?? $configuredEntryPoint; + } elseif (1 === \count($entryPoints)) { + $entryPoint = array_shift($entryPoints); + } else { + $entryPointNames = []; + foreach ($entryPoints as $key => $serviceId) { + $entryPointNames[] = is_numeric($key) ? $serviceId : $key; + } + + throw new InvalidConfigurationException(sprintf('Because you have multiple authenticators in firewall "%s", you need to set the "entry_point" key to one of your authenticators ("%s") or a service ID implementing "%s". The "entry_point" determines what should happen (e.g. redirect to "/login") when an anonymous user tries to access a protected page.', $firewallName, implode('", "', $entryPointNames), AuthenticationEntryPointInterface::class)); + } + + $config->replaceArgument(7, $entryPoint); + $container->getDefinition('security.exception_listener.'.$firewallName)->replaceArgument(4, new Reference($entryPoint)); + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php new file mode 100644 index 0000000..2009495 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPass.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Security\Core\AuthenticationEvents; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; +use Symfony\Component\Security\Http\Event\AuthenticationTokenCreatedEvent; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\Event\LoginFailureEvent; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\Event\TokenDeauthenticatedEvent; +use Symfony\Component\Security\Http\SecurityEvents; + +/** + * Makes sure all event listeners on the global dispatcher are also listening + * to events on the firewall-specific dispatchers. + * + * This compiler pass must be run after RegisterListenersPass of the + * EventDispatcher component. + * + * @author Wouter de Jong + * + * @internal + */ +class RegisterGlobalSecurityEventListenersPass implements CompilerPassInterface +{ + private const EVENT_BUBBLING_EVENTS = [ + CheckPassportEvent::class, + LoginFailureEvent::class, + LoginSuccessEvent::class, + LogoutEvent::class, + AuthenticationTokenCreatedEvent::class, + AuthenticationSuccessEvent::class, + InteractiveLoginEvent::class, + TokenDeauthenticatedEvent::class, + + // When events are registered by their name + AuthenticationEvents::AUTHENTICATION_SUCCESS, + SecurityEvents::INTERACTIVE_LOGIN, + ]; + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->has('event_dispatcher') || !$container->hasParameter('security.firewalls')) { + return; + } + + $firewallDispatchers = []; + foreach ($container->getParameter('security.firewalls') as $firewallName) { + if (!$container->has('security.event_dispatcher.'.$firewallName)) { + continue; + } + + $firewallDispatchers[] = $container->findDefinition('security.event_dispatcher.'.$firewallName); + } + + $globalDispatcher = $container->findDefinition('event_dispatcher'); + foreach ($globalDispatcher->getMethodCalls() as $methodCall) { + if ('addListener' !== $methodCall[0]) { + continue; + } + + $methodCallArguments = $methodCall[1]; + if (!\in_array($methodCallArguments[0], self::EVENT_BUBBLING_EVENTS, true)) { + continue; + } + + foreach ($firewallDispatchers as $firewallDispatcher) { + $firewallDispatcher->addMethodCall('addListener', $methodCallArguments); + } + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterLdapLocatorPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterLdapLocatorPass.php new file mode 100644 index 0000000..295f363 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterLdapLocatorPass.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ServiceLocator; + +/** + * @author Wouter de Jong + * + * @internal + */ +class RegisterLdapLocatorPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + $definition = $container->setDefinition('security.ldap_locator', new Definition(ServiceLocator::class)); + + $locators = []; + foreach ($container->findTaggedServiceIds('ldap') as $serviceId => $tags) { + $locators[$serviceId] = new ServiceClosureArgument(new Reference($serviceId)); + } + + $definition->addArgument($locators); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php new file mode 100644 index 0000000..a556ec4 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/RegisterTokenUsageTrackingPass.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Monolog\Processor\ProcessorInterface; +use Symfony\Component\DependencyInjection\Argument\BoundArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; + +/** + * Injects the session tracker enabler in "security.context_listener" + binds "security.untracked_token_storage" to ProcessorInterface instances. + * + * @author Nicolas Grekas + * + * @internal + */ +class RegisterTokenUsageTrackingPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->has('security.untracked_token_storage')) { + return; + } + + $processorAutoconfiguration = $container->registerForAutoconfiguration(ProcessorInterface::class); + $processorAutoconfiguration->setBindings($processorAutoconfiguration->getBindings() + [ + TokenStorageInterface::class => new BoundArgument(new Reference('security.untracked_token_storage'), false), + ]); + + if (!$container->has('session.factory') && !$container->has('session.storage')) { + $container->setAlias('security.token_storage', 'security.untracked_token_storage')->setPublic(true); + $container->getDefinition('security.untracked_token_storage')->addTag('kernel.reset', ['method' => 'reset']); + } elseif ($container->hasDefinition('security.context_listener')) { + $tokenStorageClass = $container->getParameterBag()->resolveValue($container->findDefinition('security.token_storage')->getClass()); + + if (method_exists($tokenStorageClass, 'enableUsageTracking')) { + $container->getDefinition('security.context_listener') + ->setArgument(6, [new Reference('security.token_storage'), 'enableUsageTracking']); + } + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php new file mode 100644 index 0000000..5de431c --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Bundle\SecurityBundle\RememberMe\DecoratedRememberMeHandler; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Replaces the DecoratedRememberMeHandler services with the real definition. + * + * @author Wouter de Jong + * + * @internal + */ +final class ReplaceDecoratedRememberMeHandlerPass implements CompilerPassInterface +{ + private const HANDLER_TAG = 'security.remember_me_handler'; + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container): void + { + $handledFirewalls = []; + foreach ($container->findTaggedServiceIds(self::HANDLER_TAG) as $definitionId => $rememberMeHandlerTags) { + $definition = $container->findDefinition($definitionId); + if (DecoratedRememberMeHandler::class !== $definition->getClass()) { + continue; + } + + // get the actual custom remember me handler definition (passed to the decorator) + $realRememberMeHandler = $container->findDefinition((string) $definition->getArgument(0)); + if (null === $realRememberMeHandler) { + throw new \LogicException(sprintf('Invalid service definition for custom remember me handler; no service found with ID "%s".', (string) $definition->getArgument(0))); + } + + foreach ($rememberMeHandlerTags as $rememberMeHandlerTag) { + // some custom handlers may be used on multiple firewalls in the same application + if (\in_array($rememberMeHandlerTag['firewall'], $handledFirewalls, true)) { + continue; + } + + $rememberMeHandler = clone $realRememberMeHandler; + $rememberMeHandler->addTag(self::HANDLER_TAG, $rememberMeHandlerTag); + $container->setDefinition('security.authenticator.remember_me_handler.'.$rememberMeHandlerTag['firewall'], $rememberMeHandler); + + $handledFirewalls[] = $rememberMeHandlerTag['firewall']; + } + } + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Compiler/SortFirewallListenersPass.php b/vendor/symfony/security-bundle/DependencyInjection/Compiler/SortFirewallListenersPass.php new file mode 100644 index 0000000..6d49320 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Compiler/SortFirewallListenersPass.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; + +/** + * Sorts firewall listeners based on the execution order provided by FirewallListenerInterface::getPriority(). + * + * @author Christian Scheb + */ +class SortFirewallListenersPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container): void + { + if (!$container->hasParameter('security.firewalls')) { + return; + } + + foreach ($container->getParameter('security.firewalls') as $firewallName) { + $firewallContextDefinition = $container->getDefinition('security.firewall.map.context.'.$firewallName); + $this->sortFirewallContextListeners($firewallContextDefinition, $container); + } + } + + private function sortFirewallContextListeners(Definition $definition, ContainerBuilder $container): void + { + /** @var IteratorArgument $listenerIteratorArgument */ + $listenerIteratorArgument = $definition->getArgument(0); + $prioritiesByServiceId = $this->getListenerPriorities($listenerIteratorArgument, $container); + + $listeners = $listenerIteratorArgument->getValues(); + usort($listeners, function (Reference $a, Reference $b) use ($prioritiesByServiceId) { + return $prioritiesByServiceId[(string) $b] <=> $prioritiesByServiceId[(string) $a]; + }); + + $listenerIteratorArgument->setValues(array_values($listeners)); + } + + private function getListenerPriorities(IteratorArgument $listeners, ContainerBuilder $container): array + { + $priorities = []; + + foreach ($listeners->getValues() as $reference) { + $id = (string) $reference; + $def = $container->getDefinition($id); + + // We must assume that the class value has been correctly filled, even if the service is created by a factory + $class = $def->getClass(); + + if (!$r = $container->getReflectionClass($class)) { + throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + } + + $priority = 0; + if ($r->isSubclassOf(FirewallListenerInterface::class)) { + $priority = $r->getMethod('getPriority')->invoke(null); + } + + $priorities[$id] = $priority; + } + + return $priorities; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/MainConfiguration.php b/vendor/symfony/security-bundle/DependencyInjection/MainConfiguration.php new file mode 100644 index 0000000..20e6832 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/MainConfiguration.php @@ -0,0 +1,521 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection; + +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; + +/** + * SecurityExtension configuration structure. + * + * @author Johannes M. Schmitt + */ +class MainConfiguration implements ConfigurationInterface +{ + /** @internal */ + public const STRATEGY_AFFIRMATIVE = 'affirmative'; + /** @internal */ + public const STRATEGY_CONSENSUS = 'consensus'; + /** @internal */ + public const STRATEGY_UNANIMOUS = 'unanimous'; + /** @internal */ + public const STRATEGY_PRIORITY = 'priority'; + + private $factories; + private $userProviderFactories; + + /** + * @param array $factories + */ + public function __construct(array $factories, array $userProviderFactories) + { + if (\is_array(current($factories))) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Passing an array of arrays as 1st argument to "%s" is deprecated, pass a sorted array of factories instead.', __METHOD__); + + $factories = array_merge(...array_values($factories)); + } + + $this->factories = $factories; + $this->userProviderFactories = $userProviderFactories; + } + + /** + * Generates the configuration tree builder. + * + * @return TreeBuilder + */ + public function getConfigTreeBuilder() + { + $tb = new TreeBuilder('security'); + $rootNode = $tb->getRootNode(); + + $rootNode + ->beforeNormalization() + ->ifTrue(function ($v) { + if ($v['encoders'] ?? false) { + trigger_deprecation('symfony/security-bundle', '5.3', 'The child node "encoders" at path "security" is deprecated, use "password_hashers" instead.'); + + return true; + } + + return $v['password_hashers'] ?? false; + }) + ->then(function ($v) { + $v['password_hashers'] = array_merge($v['password_hashers'] ?? [], $v['encoders'] ?? []); + $v['encoders'] = $v['password_hashers']; + + return $v; + }) + ->end() + ->children() + ->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end() + ->enumNode('session_fixation_strategy') + ->values([SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE]) + ->defaultValue(SessionAuthenticationStrategy::MIGRATE) + ->end() + ->booleanNode('hide_user_not_found')->defaultTrue()->end() + ->booleanNode('always_authenticate_before_granting') + ->defaultFalse() + ->setDeprecated('symfony/security-bundle', '5.4') + ->end() + ->booleanNode('erase_credentials')->defaultTrue()->end() + ->booleanNode('enable_authenticator_manager')->defaultFalse()->info('Enables the new Symfony Security system based on Authenticators, all used authenticators must support this before enabling this.')->end() + ->arrayNode('access_decision_manager') + ->addDefaultsIfNotSet() + ->children() + ->enumNode('strategy') + ->values($this->getAccessDecisionStrategies()) + ->end() + ->scalarNode('service')->end() + ->scalarNode('strategy_service')->end() + ->booleanNode('allow_if_all_abstain')->defaultFalse()->end() + ->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end() + ->end() + ->validate() + ->ifTrue(function ($v) { return isset($v['strategy'], $v['service']); }) + ->thenInvalid('"strategy" and "service" cannot be used together.') + ->end() + ->validate() + ->ifTrue(function ($v) { return isset($v['strategy'], $v['strategy_service']); }) + ->thenInvalid('"strategy" and "strategy_service" cannot be used together.') + ->end() + ->validate() + ->ifTrue(function ($v) { return isset($v['service'], $v['strategy_service']); }) + ->thenInvalid('"service" and "strategy_service" cannot be used together.') + ->end() + ->end() + ->end() + ; + + $this->addEncodersSection($rootNode); + $this->addPasswordHashersSection($rootNode); + $this->addProvidersSection($rootNode); + $this->addFirewallsSection($rootNode, $this->factories); + $this->addAccessControlSection($rootNode); + $this->addRoleHierarchySection($rootNode); + + return $tb; + } + + private function addRoleHierarchySection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('role', 'role_hierarchy') + ->children() + ->arrayNode('role_hierarchy') + ->useAttributeAsKey('id') + ->prototype('array') + ->performNoDeepMerging() + ->beforeNormalization()->ifString()->then(function ($v) { return ['value' => $v]; })->end() + ->beforeNormalization() + ->ifTrue(function ($v) { return \is_array($v) && isset($v['value']); }) + ->then(function ($v) { return preg_split('/\s*,\s*/', $v['value']); }) + ->end() + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ; + } + + private function addAccessControlSection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('rule', 'access_control') + ->children() + ->arrayNode('access_control') + ->cannotBeOverwritten() + ->prototype('array') + ->fixXmlConfig('ip') + ->fixXmlConfig('method') + ->children() + ->scalarNode('requires_channel')->defaultNull()->end() + ->scalarNode('path') + ->defaultNull() + ->info('use the urldecoded format') + ->example('^/path to resource/') + ->end() + ->scalarNode('host')->defaultNull()->end() + ->integerNode('port')->defaultNull()->end() + ->arrayNode('ips') + ->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end() + ->prototype('scalar')->end() + ->end() + ->arrayNode('methods') + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->prototype('scalar')->end() + ->end() + ->scalarNode('allow_if')->defaultNull()->end() + ->end() + ->fixXmlConfig('role') + ->children() + ->arrayNode('roles') + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ; + } + + /** + * @param array $factories + */ + private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $factories) + { + $firewallNodeBuilder = $rootNode + ->fixXmlConfig('firewall') + ->children() + ->arrayNode('firewalls') + ->isRequired() + ->requiresAtLeastOneElement() + ->disallowNewKeysInSubsequentConfigs() + ->useAttributeAsKey('name') + ->prototype('array') + ->fixXmlConfig('required_badge') + ->children() + ; + + $firewallNodeBuilder + ->scalarNode('pattern')->end() + ->scalarNode('host')->end() + ->arrayNode('methods') + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->prototype('scalar')->end() + ->end() + ->booleanNode('security')->defaultTrue()->end() + ->scalarNode('user_checker') + ->defaultValue('security.user_checker') + ->treatNullLike('security.user_checker') + ->info('The UserChecker to use when authenticating users in this firewall.') + ->end() + ->scalarNode('request_matcher')->end() + ->scalarNode('access_denied_url')->end() + ->scalarNode('access_denied_handler')->end() + ->scalarNode('entry_point') + ->info(sprintf('An enabled authenticator name or a service id that implements "%s"', AuthenticationEntryPointInterface::class)) + ->end() + ->scalarNode('provider')->end() + ->booleanNode('stateless')->defaultFalse()->end() + ->booleanNode('lazy')->defaultFalse()->end() + ->scalarNode('context')->cannotBeEmpty()->end() + ->arrayNode('logout') + ->treatTrueLike([]) + ->canBeUnset() + ->children() + ->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end() + ->scalarNode('csrf_token_generator')->cannotBeEmpty()->end() + ->scalarNode('csrf_token_id')->defaultValue('logout')->end() + ->scalarNode('path')->defaultValue('/logout')->end() + ->scalarNode('target')->defaultValue('/')->end() + ->scalarNode('success_handler')->setDeprecated('symfony/security-bundle', '5.1', sprintf('The "%%node%%" at path "%%path%%" is deprecated, register a listener on the "%s" event instead.', LogoutEvent::class))->end() + ->booleanNode('invalidate_session')->defaultTrue()->end() + ->end() + ->fixXmlConfig('delete_cookie') + ->children() + ->arrayNode('delete_cookies') + ->normalizeKeys(false) + ->beforeNormalization() + ->ifTrue(function ($v) { return \is_array($v) && \is_int(key($v)); }) + ->then(function ($v) { return array_map(function ($v) { return ['name' => $v]; }, $v); }) + ->end() + ->useAttributeAsKey('name') + ->prototype('array') + ->children() + ->scalarNode('path')->defaultNull()->end() + ->scalarNode('domain')->defaultNull()->end() + ->scalarNode('secure')->defaultFalse()->end() + ->scalarNode('samesite')->defaultNull()->end() + ->end() + ->end() + ->end() + ->end() + ->fixXmlConfig('handler') + ->children() + ->arrayNode('handlers') + ->prototype('scalar')->setDeprecated('symfony/security-bundle', '5.1', sprintf('The "%%node%%" at path "%%path%%" is deprecated, register a listener on the "%s" event instead.', LogoutEvent::class))->end() + ->end() + ->end() + ->end() + ->arrayNode('switch_user') + ->canBeUnset() + ->children() + ->scalarNode('provider')->end() + ->scalarNode('parameter')->defaultValue('_switch_user')->end() + ->scalarNode('role')->defaultValue('ROLE_ALLOWED_TO_SWITCH')->end() + ->end() + ->end() + ->arrayNode('required_badges') + ->info('A list of badges that must be present on the authenticated passport.') + ->validate() + ->always() + ->then(function ($requiredBadges) { + return array_map(function ($requiredBadge) { + if (class_exists($requiredBadge)) { + return $requiredBadge; + } + + if (false === strpos($requiredBadge, '\\')) { + $fqcn = 'Symfony\Component\Security\Http\Authenticator\Passport\Badge\\'.$requiredBadge; + if (class_exists($fqcn)) { + return $fqcn; + } + } + + throw new InvalidConfigurationException(sprintf('Undefined security Badge class "%s" set in "security.firewall.required_badges".', $requiredBadge)); + }, $requiredBadges); + }) + ->end() + ->prototype('scalar')->end() + ->end() + ; + + $abstractFactoryKeys = []; + foreach ($factories as $factory) { + $name = str_replace('-', '_', $factory->getKey()); + $factoryNode = $firewallNodeBuilder->arrayNode($name) + ->canBeUnset() + ; + + if ($factory instanceof AbstractFactory) { + $abstractFactoryKeys[] = $name; + } + + $factory->addConfiguration($factoryNode); + } + + // check for unreachable check paths + $firewallNodeBuilder + ->end() + ->validate() + ->ifTrue(function ($v) { + return true === $v['security'] && isset($v['pattern']) && !isset($v['request_matcher']); + }) + ->then(function ($firewall) use ($abstractFactoryKeys) { + foreach ($abstractFactoryKeys as $k) { + if (!isset($firewall[$k]['check_path'])) { + continue; + } + + if (str_contains($firewall[$k]['check_path'], '/') && !preg_match('#'.$firewall['pattern'].'#', $firewall[$k]['check_path'])) { + throw new \LogicException(sprintf('The check_path "%s" for login method "%s" is not matched by the firewall pattern "%s".', $firewall[$k]['check_path'], $k, $firewall['pattern'])); + } + } + + return $firewall; + }) + ->end() + ; + } + + private function addProvidersSection(ArrayNodeDefinition $rootNode) + { + $providerNodeBuilder = $rootNode + ->fixXmlConfig('provider') + ->children() + ->arrayNode('providers') + ->example([ + 'my_memory_provider' => [ + 'memory' => [ + 'users' => [ + 'foo' => ['password' => 'foo', 'roles' => 'ROLE_USER'], + 'bar' => ['password' => 'bar', 'roles' => '[ROLE_USER, ROLE_ADMIN]'], + ], + ], + ], + 'my_entity_provider' => ['entity' => ['class' => 'SecurityBundle:User', 'property' => 'username']], + ]) + ->requiresAtLeastOneElement() + ->useAttributeAsKey('name') + ->prototype('array') + ; + + $providerNodeBuilder + ->children() + ->scalarNode('id')->end() + ->arrayNode('chain') + ->fixXmlConfig('provider') + ->children() + ->arrayNode('providers') + ->beforeNormalization() + ->ifString() + ->then(function ($v) { return preg_split('/\s*,\s*/', $v); }) + ->end() + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->end() + ; + + foreach ($this->userProviderFactories as $factory) { + $name = str_replace('-', '_', $factory->getKey()); + $factoryNode = $providerNodeBuilder->children()->arrayNode($name)->canBeUnset(); + + $factory->addConfiguration($factoryNode); + } + + $providerNodeBuilder + ->validate() + ->ifTrue(function ($v) { return \count($v) > 1; }) + ->thenInvalid('You cannot set multiple provider types for the same provider') + ->end() + ->validate() + ->ifTrue(function ($v) { return 0 === \count($v); }) + ->thenInvalid('You must set a provider definition for the provider.') + ->end() + ; + } + + private function addEncodersSection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('encoder') + ->children() + ->arrayNode('encoders') + ->example([ + 'App\Entity\User1' => 'auto', + 'App\Entity\User2' => [ + 'algorithm' => 'auto', + 'time_cost' => 8, + 'cost' => 13, + ], + ]) + ->requiresAtLeastOneElement() + ->useAttributeAsKey('class') + ->prototype('array') + ->canBeUnset() + ->performNoDeepMerging() + ->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end() + ->children() + ->scalarNode('algorithm') + ->cannotBeEmpty() + ->validate() + ->ifTrue(function ($v) { return !\is_string($v); }) + ->thenInvalid('You must provide a string value.') + ->end() + ->end() + ->arrayNode('migrate_from') + ->prototype('scalar')->end() + ->beforeNormalization()->castToArray()->end() + ->end() + ->scalarNode('hash_algorithm')->info('Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms.')->defaultValue('sha512')->end() + ->scalarNode('key_length')->defaultValue(40)->end() + ->booleanNode('ignore_case')->defaultFalse()->end() + ->booleanNode('encode_as_base64')->defaultTrue()->end() + ->scalarNode('iterations')->defaultValue(5000)->end() + ->integerNode('cost') + ->min(4) + ->max(31) + ->defaultNull() + ->end() + ->scalarNode('memory_cost')->defaultNull()->end() + ->scalarNode('time_cost')->defaultNull()->end() + ->scalarNode('id')->end() + ->end() + ->end() + ->end() + ->end() + ; + } + + private function addPasswordHashersSection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('password_hasher') + ->children() + ->arrayNode('password_hashers') + ->example([ + 'App\Entity\User1' => 'auto', + 'App\Entity\User2' => [ + 'algorithm' => 'auto', + 'time_cost' => 8, + 'cost' => 13, + ], + ]) + ->requiresAtLeastOneElement() + ->useAttributeAsKey('class') + ->prototype('array') + ->canBeUnset() + ->performNoDeepMerging() + ->beforeNormalization()->ifString()->then(function ($v) { return ['algorithm' => $v]; })->end() + ->children() + ->scalarNode('algorithm') + ->cannotBeEmpty() + ->validate() + ->ifTrue(function ($v) { return !\is_string($v); }) + ->thenInvalid('You must provide a string value.') + ->end() + ->end() + ->arrayNode('migrate_from') + ->prototype('scalar')->end() + ->beforeNormalization()->castToArray()->end() + ->end() + ->scalarNode('hash_algorithm')->info('Name of hashing algorithm for PBKDF2 (i.e. sha256, sha512, etc..) See hash_algos() for a list of supported algorithms.')->defaultValue('sha512')->end() + ->scalarNode('key_length')->defaultValue(40)->end() + ->booleanNode('ignore_case')->defaultFalse()->end() + ->booleanNode('encode_as_base64')->defaultTrue()->end() + ->scalarNode('iterations')->defaultValue(5000)->end() + ->integerNode('cost') + ->min(4) + ->max(31) + ->defaultNull() + ->end() + ->scalarNode('memory_cost')->defaultNull()->end() + ->scalarNode('time_cost')->defaultNull()->end() + ->scalarNode('id')->end() + ->end() + ->end() + ->end() + ->end(); + } + + private function getAccessDecisionStrategies(): array + { + return [ + self::STRATEGY_AFFIRMATIVE, + self::STRATEGY_CONSENSUS, + self::STRATEGY_UNANIMOUS, + self::STRATEGY_PRIORITY, + ]; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AbstractFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AbstractFactory.php new file mode 100644 index 0000000..e8bfa94 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -0,0 +1,205 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * AbstractFactory is the base class for all classes inheriting from + * AbstractAuthenticationListener. + * + * @author Fabien Potencier + * @author Lukas Kahwe Smith + * @author Johannes M. Schmitt + */ +abstract class AbstractFactory implements SecurityFactoryInterface +{ + protected $options = [ + 'check_path' => '/login_check', + 'use_forward' => false, + 'require_previous_session' => false, + 'login_path' => '/login', + ]; + + protected $defaultSuccessHandlerOptions = [ + 'always_use_default_target_path' => false, + 'default_target_path' => '/', + 'login_path' => '/login', + 'target_path_parameter' => '_target_path', + 'use_referer' => false, + ]; + + protected $defaultFailureHandlerOptions = [ + 'failure_path' => null, + 'failure_forward' => false, + 'login_path' => '/login', + 'failure_path_parameter' => '_failure_path', + ]; + + public function create(ContainerBuilder $container, string $id, array $config, string $userProviderId, ?string $defaultEntryPointId) + { + // authentication provider + $authProviderId = $this->createAuthProvider($container, $id, $config, $userProviderId); + + // authentication listener + $listenerId = $this->createListener($container, $id, $config, $userProviderId); + + // add remember-me aware tag if requested + if ($this->isRememberMeAware($config)) { + $container + ->getDefinition($listenerId) + ->addTag('security.remember_me_aware', ['id' => $id, 'provider' => $userProviderId]) + ; + } + + // create entry point if applicable (optional) + $entryPointId = $this->createEntryPoint($container, $id, $config, $defaultEntryPointId); + + return [$authProviderId, $listenerId, $entryPointId]; + } + + public function addConfiguration(NodeDefinition $node) + { + $builder = $node->children(); + + $builder + ->scalarNode('provider')->end() + ->booleanNode('remember_me')->defaultTrue()->end() + ->scalarNode('success_handler')->end() + ->scalarNode('failure_handler')->end() + ; + + foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) { + if (\is_bool($default)) { + $builder->booleanNode($name)->defaultValue($default); + } else { + $builder->scalarNode($name)->defaultValue($default); + } + } + } + + final public function addOption(string $name, $default = null) + { + $this->options[$name] = $default; + } + + /** + * Subclasses must return the id of a service which implements the + * AuthenticationProviderInterface. + * + * @return string + */ + abstract protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId); + + /** + * Subclasses must return the id of the abstract listener template. + * + * Listener definitions should inherit from the AbstractAuthenticationListener + * like this: + * + * + * + * In the above case, this method would return "my.listener.id". + * + * @return string + */ + abstract protected function getListenerId(); + + /** + * Subclasses may create an entry point of their as they see fit. The + * default implementation does not change the default entry point. + * + * @return string|null the entry point id + */ + protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId) + { + return $defaultEntryPointId; + } + + /** + * Subclasses may disable remember-me features for the listener, by + * always returning false from this method. + * + * @return bool Whether a possibly configured RememberMeServices should be set for this listener + */ + protected function isRememberMeAware(array $config) + { + return $config['remember_me']; + } + + protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider) + { + $listenerId = $this->getListenerId(); + $listener = new ChildDefinition($listenerId); + $listener->replaceArgument(4, $id); + $listener->replaceArgument(5, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config))); + $listener->replaceArgument(6, new Reference($this->createAuthenticationFailureHandler($container, $id, $config))); + $listener->replaceArgument(7, array_intersect_key($config, $this->options)); + + $listenerId .= '.'.$id; + $container->setDefinition($listenerId, $listener); + + return $listenerId; + } + + protected function createAuthenticationSuccessHandler(ContainerBuilder $container, string $id, array $config) + { + $successHandlerId = $this->getSuccessHandlerId($id); + $options = array_intersect_key($config, $this->defaultSuccessHandlerOptions); + + if (isset($config['success_handler'])) { + $successHandler = $container->setDefinition($successHandlerId, new ChildDefinition('security.authentication.custom_success_handler')); + $successHandler->replaceArgument(0, new Reference($config['success_handler'])); + $successHandler->replaceArgument(1, $options); + $successHandler->replaceArgument(2, $id); + } else { + $successHandler = $container->setDefinition($successHandlerId, new ChildDefinition('security.authentication.success_handler')); + $successHandler->addMethodCall('setOptions', [$options]); + $successHandler->addMethodCall('setFirewallName', [$id]); + } + + return $successHandlerId; + } + + protected function createAuthenticationFailureHandler(ContainerBuilder $container, string $id, array $config) + { + $id = $this->getFailureHandlerId($id); + $options = array_intersect_key($config, $this->defaultFailureHandlerOptions); + + if (isset($config['failure_handler'])) { + $failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.custom_failure_handler')); + $failureHandler->replaceArgument(0, new Reference($config['failure_handler'])); + $failureHandler->replaceArgument(1, $options); + } else { + $failureHandler = $container->setDefinition($id, new ChildDefinition('security.authentication.failure_handler')); + $failureHandler->addMethodCall('setOptions', [$options]); + } + + return $id; + } + + protected function getSuccessHandlerId(string $id) + { + return 'security.authentication.success_handler.'.$id.'.'.str_replace('-', '_', $this->getKey()); + } + + protected function getFailureHandlerId(string $id) + { + return 'security.authentication.failure_handler.'.$id.'.'.str_replace('-', '_', $this->getKey()); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AnonymousFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AnonymousFactory.php new file mode 100644 index 0000000..13359ee --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AnonymousFactory.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Parameter; + +/** + * @author Wouter de Jong + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class AnonymousFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface +{ + public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint) + { + if (null === $config['secret']) { + $config['secret'] = new Parameter('container.build_hash'); + } + + $listenerId = 'security.authentication.listener.anonymous.'.$id; + $container + ->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.anonymous')) + ->replaceArgument(1, $config['secret']) + ; + + $providerId = 'security.authentication.provider.anonymous.'.$id; + $container + ->setDefinition($providerId, new ChildDefinition('security.authentication.provider.anonymous')) + ->replaceArgument(0, $config['secret']) + ; + + return [$providerId, $listenerId, $defaultEntryPoint]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + throw new InvalidConfigurationException(sprintf('The authenticator manager no longer has "anonymous" security. Please remove this option under the "%s" firewall'.($config['lazy'] ? ' and add "lazy: true"' : '').'.', $firewallName)); + } + + public function getPriority() + { + return -60; + } + + public function getPosition() + { + return 'anonymous'; + } + + public function getKey() + { + return 'anonymous'; + } + + public function addConfiguration(NodeDefinition $builder) + { + $builder + ->beforeNormalization() + ->ifTrue(function ($v) { return 'lazy' === $v; }) + ->then(function ($v) { return ['lazy' => true]; }) + ->end() + ->children() + ->booleanNode('lazy')->defaultFalse()->setDeprecated('symfony/security-bundle', '5.1', 'Using "anonymous: lazy" to make the firewall lazy is deprecated, use "anonymous: true" and "lazy: true" instead.')->end() + ->scalarNode('secret')->defaultNull()->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php new file mode 100644 index 0000000..6ecec3e --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/AuthenticatorFactoryInterface.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * @method int getPriority() defines the position at which the authenticator is called + * + * @author Wouter de Jong + */ +interface AuthenticatorFactoryInterface +{ + /** + * Creates the authenticator service(s) for the provided configuration. + * + * @return string|string[] The authenticator service ID(s) to be used by the firewall + */ + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId); + + /** + * Defines the configuration key used to reference the authenticator + * in the firewall configuration. + * + * @return string + */ + public function getKey(); + + public function addConfiguration(NodeDefinition $builder); +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php new file mode 100644 index 0000000..9476178 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/CustomAuthenticatorFactory.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * @author Wouter de Jong + * + * @internal + */ +class CustomAuthenticatorFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface +{ + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + throw new \LogicException('Custom authenticators are not supported when "security.enable_authenticator_manager" is not set to true.'); + } + + public function getPriority(): int + { + return 0; + } + + public function getPosition(): string + { + return 'pre_auth'; + } + + public function getKey(): string + { + return 'custom_authenticators'; + } + + /** + * @param ArrayNodeDefinition $builder + */ + public function addConfiguration(NodeDefinition $builder) + { + $builder + ->info('An array of service ids for all of your "authenticators"') + ->requiresAtLeastOneElement() + ->prototype('scalar')->end(); + + // get the parent array node builder ("firewalls") from inside the children builder + $factoryRootNode = $builder->end()->end(); + $factoryRootNode + ->fixXmlConfig('custom_authenticator') + ->validate() + ->ifTrue(function ($v) { return isset($v['custom_authenticators']) && empty($v['custom_authenticators']); }) + ->then(function ($v) { + unset($v['custom_authenticators']); + + return $v; + }) + ->end() + ; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): array + { + return $config; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FirewallListenerFactoryInterface.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FirewallListenerFactoryInterface.php new file mode 100644 index 0000000..c484201 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FirewallListenerFactoryInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Can be implemented by a security factory to add a listener to the firewall. + * + * @author Christian Scheb + */ +interface FirewallListenerFactoryInterface +{ + /** + * Creates the firewall listener services for the provided configuration. + * + * @return string[] The listener service IDs to be used by the firewall + */ + public function createListeners(ContainerBuilder $container, string $firewallName, array $config): array; +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginFactory.php new file mode 100644 index 0000000..137e8e5 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginFactory.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * FormLoginFactory creates services for form login authentication. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @internal + */ +class FormLoginFactory extends AbstractFactory implements AuthenticatorFactoryInterface +{ + public const PRIORITY = -30; + + public function __construct() + { + $this->addOption('username_parameter', '_username'); + $this->addOption('password_parameter', '_password'); + $this->addOption('csrf_parameter', '_csrf_token'); + $this->addOption('csrf_token_id', 'authenticate'); + $this->addOption('enable_csrf', false); + $this->addOption('post_only', true); + $this->addOption('form_only', false); + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getPosition(): string + { + return 'form'; + } + + public function getKey(): string + { + return 'form-login'; + } + + public function addConfiguration(NodeDefinition $node) + { + parent::addConfiguration($node); + + $node + ->children() + ->scalarNode('csrf_token_generator')->cannotBeEmpty()->end() + ->end() + ; + } + + protected function getListenerId(): string + { + return 'security.authentication.listener.form'; + } + + protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId): string + { + if ($config['enable_csrf'] ?? false) { + throw new InvalidConfigurationException('The "enable_csrf" option of "form_login" is only available when "security.enable_authenticator_manager" is set to "true", use "csrf_token_generator" instead.'); + } + + $provider = 'security.authentication.provider.dao.'.$id; + $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.dao')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ; + + return $provider; + } + + protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider) + { + $listenerId = parent::createListener($container, $id, $config, $userProvider); + + $container + ->getDefinition($listenerId) + ->addArgument(isset($config['csrf_token_generator']) ? new Reference($config['csrf_token_generator']) : null) + ; + + return $listenerId; + } + + protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId): ?string + { + $entryPointId = 'security.authentication.form_entry_point.'.$id; + $container + ->setDefinition($entryPointId, new ChildDefinition('security.authentication.form_entry_point')) + ->addArgument(new Reference('security.http_utils')) + ->addArgument($config['login_path']) + ->addArgument($config['use_forward']) + ; + + return $entryPointId; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + if (isset($config['csrf_token_generator'])) { + throw new InvalidConfigurationException('The "csrf_token_generator" option of "form_login" is only available when "security.enable_authenticator_manager" is set to "false", use "enable_csrf" instead.'); + } + + $authenticatorId = 'security.authenticator.form_login.'.$firewallName; + $options = array_intersect_key($config, $this->options); + $authenticator = $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.form_login')) + ->replaceArgument(1, new Reference($userProviderId)) + ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config))) + ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config))) + ->replaceArgument(4, $options); + + if ($options['use_forward'] ?? false) { + $authenticator->addMethodCall('setHttpKernel', [new Reference('http_kernel')]); + } + + return $authenticatorId; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php new file mode 100644 index 0000000..04c2bc9 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; + +/** + * FormLoginLdapFactory creates services for form login ldap authentication. + * + * @author Grégoire Pineau + * @author Charles Sarrazin + * + * @internal + */ +class FormLoginLdapFactory extends FormLoginFactory +{ + use LdapFactoryTrait; + + protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId): string + { + $provider = 'security.authentication.provider.ldap_bind.'.$id; + $definition = $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.ldap_bind')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ->replaceArgument(3, new Reference($config['service'])) + ->replaceArgument(4, $config['dn_string']) + ->replaceArgument(6, $config['search_dn']) + ->replaceArgument(7, $config['search_password']) + ; + + if (!empty($config['query_string'])) { + if ('' === $config['search_dn'] || '' === $config['search_password']) { + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); + } + $definition->addMethodCall('setQueryString', [$config['query_string']]); + } + + return $provider; + } + + public function addConfiguration(NodeDefinition $node) + { + parent::addConfiguration($node); + + $node + ->children() + ->scalarNode('service')->defaultValue('ldap')->end() + ->scalarNode('dn_string')->defaultValue('{username}')->end() + ->scalarNode('query_string')->end() + ->scalarNode('search_dn')->defaultValue('')->end() + ->scalarNode('search_password')->defaultValue('')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php new file mode 100644 index 0000000..a83a6d9 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php @@ -0,0 +1,151 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Guard\Authenticator\GuardBridgeAuthenticator; + +/** + * Configures the "guard" authentication provider key under a firewall. + * + * @author Ryan Weaver + * + * @internal + */ +class GuardAuthenticationFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface +{ + public function getPosition(): string + { + return 'pre_auth'; + } + + public function getPriority(): int + { + return 0; + } + + public function getKey(): string + { + return 'guard'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->fixXmlConfig('authenticator') + ->children() + ->scalarNode('provider') + ->info('A key from the "providers" section of your security config, in case your user provider is different than the firewall') + ->end() + ->scalarNode('entry_point') + ->info('A service id (of one of your authenticators) whose start() method should be called when an anonymous user hits a page that requires authentication') + ->defaultValue(null) + ->end() + ->arrayNode('authenticators') + ->info('An array of service ids for all of your "authenticators"') + ->requiresAtLeastOneElement() + ->prototype('scalar')->end() + ->end() + ->end() + ; + } + + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + $authenticatorIds = $config['authenticators']; + $authenticatorReferences = []; + foreach ($authenticatorIds as $authenticatorId) { + $authenticatorReferences[] = new Reference($authenticatorId); + } + + $authenticators = new IteratorArgument($authenticatorReferences); + + // configure the GuardAuthenticationFactory to have the dynamic constructor arguments + $providerId = 'security.authentication.provider.guard.'.$id; + $container + ->setDefinition($providerId, new ChildDefinition('security.authentication.provider.guard')) + ->replaceArgument(0, $authenticators) + ->replaceArgument(1, new Reference($userProvider)) + ->replaceArgument(2, $id) + ->replaceArgument(3, new Reference('security.user_checker.'.$id)) + ; + + // listener + $listenerId = 'security.authentication.listener.guard.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.guard')); + $listener->replaceArgument(2, $id); + $listener->replaceArgument(3, $authenticators); + + // determine the entryPointId to use + $entryPointId = $this->determineEntryPoint($defaultEntryPoint, $config); + + // this is always injected - then the listener decides if it should be used + $container + ->getDefinition($listenerId) + ->addTag('security.remember_me_aware', ['id' => $id, 'provider' => $userProvider]); + + return [$providerId, $listenerId, $entryPointId]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId) + { + $userProvider = new Reference($userProviderId); + $authenticatorIds = []; + + if (isset($config['entry_point'])) { + throw new InvalidConfigurationException('The "security.firewall.'.$firewallName.'.guard.entry_point" option has no effect in the new authenticator system, configure "security.firewall.'.$firewallName.'.entry_point" instead.'); + } + + $guardAuthenticatorIds = $config['authenticators']; + foreach ($guardAuthenticatorIds as $i => $guardAuthenticatorId) { + $container->setDefinition($authenticatorIds[] = 'security.authenticator.guard.'.$firewallName.'.'.$i, new Definition(GuardBridgeAuthenticator::class)) + ->setArguments([ + new Reference($guardAuthenticatorId), + $userProvider, + ]); + } + + return $authenticatorIds; + } + + private function determineEntryPoint(?string $defaultEntryPointId, array $config): string + { + if ($defaultEntryPointId) { + // explode if they've configured the entry_point, but there is already one + if ($config['entry_point']) { + throw new \LogicException(sprintf('The guard authentication provider cannot use the "%s" entry_point because another entry point is already configured by another provider! Either remove the other provider or move the entry_point configuration as a root key under your firewall (i.e. at the same level as "guard").', $config['entry_point'])); + } + + return $defaultEntryPointId; + } + + if ($config['entry_point']) { + // if it's configured explicitly, use it! + return $config['entry_point']; + } + + $authenticatorIds = $config['authenticators']; + if (1 == \count($authenticatorIds)) { + // if there is only one authenticator, use that as the entry point + return array_shift($authenticatorIds); + } + + // we have multiple entry points - we must ask them to configure one + throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s).', implode(', ', $authenticatorIds))); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicFactory.php new file mode 100644 index 0000000..e35b8a0 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicFactory.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * HttpBasicFactory creates services for HTTP basic authentication. + * + * @author Fabien Potencier + * + * @internal + */ +class HttpBasicFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface +{ + public const PRIORITY = -50; + + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + $provider = 'security.authentication.provider.dao.'.$id; + $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.dao')) + ->replaceArgument(0, new Reference($userProvider)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ; + + // entry point + $entryPointId = $defaultEntryPoint; + if (null === $entryPointId) { + $entryPointId = 'security.authentication.basic_entry_point.'.$id; + $container + ->setDefinition($entryPointId, new ChildDefinition('security.authentication.basic_entry_point')) + ->addArgument($config['realm']) + ; + } + + // listener + $listenerId = 'security.authentication.listener.basic.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.basic')); + $listener->replaceArgument(2, $id); + $listener->replaceArgument(3, new Reference($entryPointId)); + $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); + + return [$provider, $listenerId, $entryPointId]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + $authenticatorId = 'security.authenticator.http_basic.'.$firewallName; + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.http_basic')) + ->replaceArgument(0, $config['realm']) + ->replaceArgument(1, new Reference($userProviderId)); + + return $authenticatorId; + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getPosition(): string + { + return 'http'; + } + + public function getKey(): string + { + return 'http-basic'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('provider')->end() + ->scalarNode('realm')->defaultValue('Secured Area')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php new file mode 100644 index 0000000..0c63b21 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; + +/** + * HttpBasicFactory creates services for HTTP basic authentication. + * + * @author Fabien Potencier + * @author Grégoire Pineau + * @author Charles Sarrazin + * + * @internal + */ +class HttpBasicLdapFactory extends HttpBasicFactory +{ + use LdapFactoryTrait; + + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + $provider = 'security.authentication.provider.ldap_bind.'.$id; + $definition = $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.ldap_bind')) + ->replaceArgument(0, new Reference($userProvider)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ->replaceArgument(3, new Reference($config['service'])) + ->replaceArgument(4, $config['dn_string']) + ->replaceArgument(6, $config['search_dn']) + ->replaceArgument(7, $config['search_password']) + ; + + // entry point + $entryPointId = $defaultEntryPoint; + + if (null === $entryPointId) { + $entryPointId = 'security.authentication.basic_entry_point.'.$id; + $container + ->setDefinition($entryPointId, new ChildDefinition('security.authentication.basic_entry_point')) + ->addArgument($config['realm']); + } + + if (!empty($config['query_string'])) { + if ('' === $config['search_dn'] || '' === $config['search_password']) { + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); + } + $definition->addMethodCall('setQueryString', [$config['query_string']]); + } + + // listener + $listenerId = 'security.authentication.listener.basic.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.basic')); + $listener->replaceArgument(2, $id); + $listener->replaceArgument(3, new Reference($entryPointId)); + + return [$provider, $listenerId, $entryPointId]; + } + + public function addConfiguration(NodeDefinition $node) + { + parent::addConfiguration($node); + + $node + ->children() + ->scalarNode('service')->defaultValue('ldap')->end() + ->scalarNode('dn_string')->defaultValue('{username}')->end() + ->scalarNode('query_string')->end() + ->scalarNode('search_dn')->defaultValue('')->end() + ->scalarNode('search_password')->defaultValue('')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginFactory.php new file mode 100644 index 0000000..b19a696 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginFactory.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * JsonLoginFactory creates services for JSON login authentication. + * + * @author Kévin Dunglas + * + * @internal + */ +class JsonLoginFactory extends AbstractFactory implements AuthenticatorFactoryInterface +{ + public const PRIORITY = -40; + + public function __construct() + { + $this->addOption('username_path', 'username'); + $this->addOption('password_path', 'password'); + $this->defaultFailureHandlerOptions = []; + $this->defaultSuccessHandlerOptions = []; + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + /** + * {@inheritdoc} + */ + public function getPosition(): string + { + return 'form'; + } + + /** + * {@inheritdoc} + */ + public function getKey(): string + { + return 'json-login'; + } + + /** + * {@inheritdoc} + */ + protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId): string + { + $provider = 'security.authentication.provider.dao.'.$id; + $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.dao')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ; + + return $provider; + } + + /** + * {@inheritdoc} + */ + protected function getListenerId(): string + { + return 'security.authentication.listener.json'; + } + + /** + * {@inheritdoc} + */ + protected function isRememberMeAware(array $config): bool + { + return false; + } + + /** + * {@inheritdoc} + */ + protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider) + { + $listenerId = $this->getListenerId(); + $listener = new ChildDefinition($listenerId); + $listener->replaceArgument(3, $id); + $listener->replaceArgument(4, isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container, $id, $config)) : null); + $listener->replaceArgument(5, isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container, $id, $config)) : null); + $listener->replaceArgument(6, array_intersect_key($config, $this->options)); + $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); + + $listenerId .= '.'.$id; + $container->setDefinition($listenerId, $listener); + + return $listenerId; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId) + { + $authenticatorId = 'security.authenticator.json_login.'.$firewallName; + $options = array_intersect_key($config, $this->options); + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.json_login')) + ->replaceArgument(1, new Reference($userProviderId)) + ->replaceArgument(2, isset($config['success_handler']) ? new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config)) : null) + ->replaceArgument(3, isset($config['failure_handler']) ? new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config)) : null) + ->replaceArgument(4, $options); + + return $authenticatorId; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php new file mode 100644 index 0000000..c8b77fa --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Core\Exception\LogicException; + +/** + * JsonLoginLdapFactory creates services for json login ldap authentication. + * + * @internal + */ +class JsonLoginLdapFactory extends JsonLoginFactory +{ + use LdapFactoryTrait; + + protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId): string + { + $provider = 'security.authentication.provider.ldap_bind.'.$id; + $definition = $container + ->setDefinition($provider, new ChildDefinition('security.authentication.provider.ldap_bind')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, $id) + ->replaceArgument(3, new Reference($config['service'])) + ->replaceArgument(4, $config['dn_string']) + ->replaceArgument(6, $config['search_dn']) + ->replaceArgument(7, $config['search_password']) + ; + + if (!empty($config['query_string'])) { + if ('' === $config['search_dn'] || '' === $config['search_password']) { + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); + } + $definition->addMethodCall('setQueryString', [$config['query_string']]); + } + + return $provider; + } + + public function addConfiguration(NodeDefinition $node) + { + parent::addConfiguration($node); + + $node + ->children() + ->scalarNode('service')->defaultValue('ldap')->end() + ->scalarNode('dn_string')->defaultValue('{username}')->end() + ->scalarNode('query_string')->end() + ->scalarNode('search_dn')->defaultValue('')->end() + ->scalarNode('search_password')->defaultValue('')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php new file mode 100644 index 0000000..8af8e44 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Ldap\Security\CheckLdapCredentialsListener; +use Symfony\Component\Ldap\Security\LdapAuthenticator; + +/** + * A trait decorating the authenticator with LDAP functionality. + * + * @author Wouter de Jong + * + * @internal + */ +trait LdapFactoryTrait +{ + public function getKey(): string + { + return parent::getKey().'-ldap'; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + $key = str_replace('-', '_', $this->getKey()); + if (!class_exists(LdapAuthenticator::class)) { + throw new \LogicException(sprintf('The "%s" authenticator requires the "symfony/ldap" package version "5.1" or higher.', $key)); + } + + $authenticatorId = parent::createAuthenticator($container, $firewallName, $config, $userProviderId); + + $container->setDefinition('security.listener.'.$key.'.'.$firewallName, new Definition(CheckLdapCredentialsListener::class)) + ->addTag('kernel.event_subscriber', ['dispatcher' => 'security.event_dispatcher.'.$firewallName]) + ->addArgument(new Reference('security.ldap_locator')) + ; + + $ldapAuthenticatorId = 'security.authenticator.'.$key.'.'.$firewallName; + $definition = $container->setDefinition($ldapAuthenticatorId, new Definition(LdapAuthenticator::class)) + ->setArguments([ + new Reference($authenticatorId), + $config['service'], + $config['dn_string'], + $config['search_dn'], + $config['search_password'], + ]); + + if (!empty($config['query_string'])) { + if ('' === $config['search_dn'] || '' === $config['search_password']) { + throw new InvalidConfigurationException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); + } + + $definition->addArgument($config['query_string']); + } + + return $ldapAuthenticatorId; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginLinkFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginLinkFactory.php new file mode 100644 index 0000000..5badfb2 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginLinkFactory.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeBuilder; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\LoginLink\LoginLinkHandler; + +/** + * @internal + */ +class LoginLinkFactory extends AbstractFactory implements AuthenticatorFactoryInterface +{ + public const PRIORITY = -20; + + public function addConfiguration(NodeDefinition $node) + { + /** @var NodeBuilder $builder */ + $builder = $node->fixXmlConfig('signature_property', 'signature_properties')->children(); + + $builder + ->scalarNode('check_route') + ->isRequired() + ->info('Route that will validate the login link - e.g. "app_login_link_verify".') + ->end() + ->scalarNode('check_post_only') + ->defaultFalse() + ->info('If true, only HTTP POST requests to "check_route" will be handled by the authenticator.') + ->end() + ->arrayNode('signature_properties') + ->isRequired() + ->prototype('scalar')->end() + ->requiresAtLeastOneElement() + ->info('An array of properties on your User that are used to sign the link. If any of these change, all existing links will become invalid.') + ->example(['email', 'password']) + ->end() + ->integerNode('lifetime') + ->defaultValue(600) + ->info('The lifetime of the login link in seconds.') + ->end() + ->integerNode('max_uses') + ->defaultNull() + ->info('Max number of times a login link can be used - null means unlimited within lifetime.') + ->end() + ->scalarNode('used_link_cache') + ->info('Cache service id used to expired links of max_uses is set.') + ->end() + ->scalarNode('success_handler') + ->info(sprintf('A service id that implements %s.', AuthenticationSuccessHandlerInterface::class)) + ->end() + ->scalarNode('failure_handler') + ->info(sprintf('A service id that implements %s.', AuthenticationFailureHandlerInterface::class)) + ->end() + ->scalarNode('provider') + ->info('The user provider to load users from.') + ->end() + ; + + foreach (array_merge($this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) { + if (\is_bool($default)) { + $builder->booleanNode($name)->defaultValue($default); + } else { + $builder->scalarNode($name)->defaultValue($default); + } + } + } + + public function getKey(): string + { + return 'login-link'; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + if (!class_exists(LoginLinkHandler::class)) { + throw new \LogicException('Login login link requires symfony/security-http:^5.2.'); + } + + if (!$container->hasDefinition('security.authenticator.login_link')) { + $loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/../../Resources/config')); + $loader->load('security_authenticator_login_link.php'); + } + + if (null !== $config['max_uses'] && !isset($config['used_link_cache'])) { + $config['used_link_cache'] = 'security.authenticator.cache.expired_links'; + $defaultCacheDefinition = $container->getDefinition($config['used_link_cache']); + if (!$defaultCacheDefinition->hasTag('cache.pool')) { + $defaultCacheDefinition->addTag('cache.pool'); + } + } + + $expiredStorageId = null; + if (isset($config['used_link_cache'])) { + $expiredStorageId = 'security.authenticator.expired_login_link_storage.'.$firewallName; + $container + ->setDefinition($expiredStorageId, new ChildDefinition('security.authenticator.expired_login_link_storage')) + ->replaceArgument(0, new Reference($config['used_link_cache'])) + ->replaceArgument(1, $config['lifetime']); + } + + $signatureHasherId = 'security.authenticator.login_link_signature_hasher.'.$firewallName; + $container + ->setDefinition($signatureHasherId, new ChildDefinition('security.authenticator.abstract_login_link_signature_hasher')) + ->replaceArgument(1, $config['signature_properties']) + ->replaceArgument(3, $expiredStorageId ? new Reference($expiredStorageId) : null) + ->replaceArgument(4, $config['max_uses'] ?? null) + ; + + $linkerId = 'security.authenticator.login_link_handler.'.$firewallName; + $linkerOptions = [ + 'route_name' => $config['check_route'], + 'lifetime' => $config['lifetime'], + ]; + $container + ->setDefinition($linkerId, new ChildDefinition('security.authenticator.abstract_login_link_handler')) + ->replaceArgument(1, new Reference($userProviderId)) + ->replaceArgument(2, new Reference($signatureHasherId)) + ->replaceArgument(3, $linkerOptions) + ->addTag('security.authenticator.login_linker', ['firewall' => $firewallName]) + ; + + $authenticatorId = 'security.authenticator.login_link.'.$firewallName; + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.login_link')) + ->replaceArgument(0, new Reference($linkerId)) + ->replaceArgument(2, new Reference($this->createAuthenticationSuccessHandler($container, $firewallName, $config))) + ->replaceArgument(3, new Reference($this->createAuthenticationFailureHandler($container, $firewallName, $config))) + ->replaceArgument(4, [ + 'check_route' => $config['check_route'], + 'check_post_only' => $config['check_post_only'], + ]); + + return $authenticatorId; + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getPosition(): string + { + return 'form'; + } + + protected function createAuthProvider(ContainerBuilder $container, string $id, array $config, string $userProviderId): string + { + throw new \Exception('The old authentication system is not supported with login_link.'); + } + + protected function getListenerId(): string + { + throw new \Exception('The old authentication system is not supported with login_link.'); + } + + protected function createListener(ContainerBuilder $container, string $id, array $config, string $userProvider) + { + throw new \Exception('The old authentication system is not supported with login_link.'); + } + + protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId): ?string + { + throw new \Exception('The old authentication system is not supported with login_link.'); + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php new file mode 100644 index 0000000..dc829be --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\HttpFoundation\RateLimiter\RequestRateLimiterInterface; +use Symfony\Component\RateLimiter\RateLimiterFactory; +use Symfony\Component\Security\Http\EventListener\LoginThrottlingListener; +use Symfony\Component\Security\Http\RateLimiter\DefaultLoginRateLimiter; + +/** + * @author Wouter de Jong + * + * @internal + */ +class LoginThrottlingFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface +{ + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + throw new \LogicException('Login throttling is not supported when "security.enable_authenticator_manager" is not set to true.'); + } + + public function getPriority(): int + { + // this factory doesn't register any authenticators, this priority doesn't matter + return 0; + } + + public function getPosition(): string + { + // this factory doesn't register any authenticators, this position doesn't matter + return 'pre_auth'; + } + + public function getKey(): string + { + return 'login_throttling'; + } + + /** + * @param ArrayNodeDefinition $builder + */ + public function addConfiguration(NodeDefinition $builder) + { + $builder + ->children() + ->scalarNode('limiter')->info(sprintf('A service id implementing "%s".', RequestRateLimiterInterface::class))->end() + ->integerNode('max_attempts')->defaultValue(5)->end() + ->scalarNode('interval')->defaultValue('1 minute')->end() + ->scalarNode('lock_factory')->info('The service ID of the lock factory used by the login rate limiter (or null to disable locking)')->defaultNull()->end() + ->end(); + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): array + { + if (!class_exists(LoginThrottlingListener::class)) { + throw new \LogicException('Login throttling requires symfony/security-http:^5.2.'); + } + + if (!class_exists(RateLimiterFactory::class)) { + throw new \LogicException('Login throttling requires the Rate Limiter component. Try running "composer require symfony/rate-limiter".'); + } + + if (!isset($config['limiter'])) { + if (!class_exists(FrameworkExtension::class) || !method_exists(FrameworkExtension::class, 'registerRateLimiter')) { + throw new \LogicException('You must either configure a rate limiter for "security.firewalls.'.$firewallName.'.login_throttling" or install symfony/framework-bundle:^5.2.'); + } + + $limiterOptions = [ + 'policy' => 'fixed_window', + 'limit' => $config['max_attempts'], + 'interval' => $config['interval'], + 'lock_factory' => $config['lock_factory'], + ]; + FrameworkExtension::registerRateLimiter($container, $localId = '_login_local_'.$firewallName, $limiterOptions); + + $limiterOptions['limit'] = 5 * $config['max_attempts']; + FrameworkExtension::registerRateLimiter($container, $globalId = '_login_global_'.$firewallName, $limiterOptions); + + $container->register($config['limiter'] = 'security.login_throttling.'.$firewallName.'.limiter', DefaultLoginRateLimiter::class) + ->addArgument(new Reference('limiter.'.$globalId)) + ->addArgument(new Reference('limiter.'.$localId)) + ; + } + + $container + ->setDefinition('security.listener.login_throttling.'.$firewallName, new ChildDefinition('security.listener.login_throttling')) + ->replaceArgument(1, new Reference($config['limiter'])) + ->addTag('kernel.event_subscriber', ['dispatcher' => 'security.event_dispatcher.'.$firewallName]); + + return []; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RememberMeFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RememberMeFactory.php new file mode 100644 index 0000000..735b087 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RememberMeFactory.php @@ -0,0 +1,374 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider; +use Symfony\Bundle\SecurityBundle\RememberMe\DecoratedRememberMeHandler; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\Security\Core\Authentication\RememberMe\CacheTokenVerifier; +use Symfony\Component\Security\Http\EventListener\RememberMeLogoutListener; + +/** + * @internal + */ +class RememberMeFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface, PrependExtensionInterface +{ + public const PRIORITY = -50; + + protected $options = [ + 'name' => 'REMEMBERME', + 'lifetime' => 31536000, + 'path' => '/', + 'domain' => null, + 'secure' => false, + 'httponly' => true, + 'samesite' => null, + 'always_remember_me' => false, + 'remember_me_parameter' => '_remember_me', + ]; + + public function create(ContainerBuilder $container, string $id, array $config, ?string $userProvider, ?string $defaultEntryPoint): array + { + // authentication provider + $authProviderId = 'security.authentication.provider.rememberme.'.$id; + $container + ->setDefinition($authProviderId, new ChildDefinition('security.authentication.provider.rememberme')) + ->replaceArgument(0, new Reference('security.user_checker.'.$id)) + ->addArgument($config['secret']) + ->addArgument($id) + ; + + // remember me services + $templateId = $this->generateRememberMeServicesTemplateId($config, $id); + $rememberMeServicesId = $templateId.'.'.$id; + + // attach to remember-me aware listeners + $userProviders = []; + foreach ($container->findTaggedServiceIds('security.remember_me_aware') as $serviceId => $attributes) { + foreach ($attributes as $attribute) { + if (!isset($attribute['id']) || $attribute['id'] !== $id) { + continue; + } + + if (!isset($attribute['provider'])) { + throw new \RuntimeException('Each "security.remember_me_aware" tag must have a provider attribute.'); + } + + // context listeners don't need a provider + if ('none' !== $attribute['provider']) { + $userProviders[] = new Reference($attribute['provider']); + } + + $container + ->getDefinition($serviceId) + ->addMethodCall('setRememberMeServices', [new Reference($rememberMeServicesId)]) + ; + } + } + + $this->createRememberMeServices($container, $id, $templateId, $userProviders, $config); + + // remember-me listener + $listenerId = 'security.authentication.listener.rememberme.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.rememberme')); + $listener->replaceArgument(1, new Reference($rememberMeServicesId)); + $listener->replaceArgument(5, $config['catch_exceptions']); + + // remember-me logout listener + $container->setDefinition('security.logout.listener.remember_me.'.$id, new Definition(RememberMeLogoutListener::class)) + ->addArgument(new Reference($rememberMeServicesId)) + ->addTag('kernel.event_subscriber', ['dispatcher' => 'security.event_dispatcher.'.$id]); + + return [$authProviderId, $listenerId, $defaultEntryPoint]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string + { + if (!$container->hasDefinition('security.authenticator.remember_me')) { + $loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/../../Resources/config')); + $loader->load('security_authenticator_remember_me.php'); + } + + if ('auto' === $config['secure']) { + $config['secure'] = null; + } + + // create remember me handler (which manage the remember-me cookies) + $rememberMeHandlerId = 'security.authenticator.remember_me_handler.'.$firewallName; + if (isset($config['service']) && isset($config['token_provider'])) { + throw new InvalidConfigurationException(sprintf('You cannot use both "service" and "token_provider" in "security.firewalls.%s.remember_me".', $firewallName)); + } + + if (isset($config['service'])) { + $container->register($rememberMeHandlerId, DecoratedRememberMeHandler::class) + ->addArgument(new Reference($config['service'])) + ->addTag('security.remember_me_handler', ['firewall' => $firewallName]); + } elseif (isset($config['token_provider'])) { + $tokenProviderId = $this->createTokenProvider($container, $firewallName, $config['token_provider']); + $tokenVerifier = $this->createTokenVerifier($container, $firewallName, $config['token_verifier'] ?? null); + $container->setDefinition($rememberMeHandlerId, new ChildDefinition('security.authenticator.persistent_remember_me_handler')) + ->replaceArgument(0, new Reference($tokenProviderId)) + ->replaceArgument(1, $config['secret']) + ->replaceArgument(2, new Reference($userProviderId)) + ->replaceArgument(4, $config) + ->replaceArgument(6, $tokenVerifier) + ->addTag('security.remember_me_handler', ['firewall' => $firewallName]); + } else { + $signatureHasherId = 'security.authenticator.remember_me_signature_hasher.'.$firewallName; + $container->setDefinition($signatureHasherId, new ChildDefinition('security.authenticator.remember_me_signature_hasher')) + ->replaceArgument(1, $config['signature_properties']) + ->replaceArgument(2, $config['secret']) + ; + + $container->setDefinition($rememberMeHandlerId, new ChildDefinition('security.authenticator.signature_remember_me_handler')) + ->replaceArgument(0, new Reference($signatureHasherId)) + ->replaceArgument(1, new Reference($userProviderId)) + ->replaceArgument(3, $config) + ->addTag('security.remember_me_handler', ['firewall' => $firewallName]); + } + + // create check remember me conditions listener (which checks if a remember-me cookie is supported and requested) + $rememberMeConditionsListenerId = 'security.listener.check_remember_me_conditions.'.$firewallName; + $container->setDefinition($rememberMeConditionsListenerId, new ChildDefinition('security.listener.check_remember_me_conditions')) + ->replaceArgument(0, array_intersect_key($config, ['always_remember_me' => true, 'remember_me_parameter' => true])) + ->addTag('kernel.event_subscriber', ['dispatcher' => 'security.event_dispatcher.'.$firewallName]) + ; + + // create remember me listener (which executes the remember me services for other authenticators and logout) + $rememberMeListenerId = 'security.listener.remember_me.'.$firewallName; + $container->setDefinition($rememberMeListenerId, new ChildDefinition('security.listener.remember_me')) + ->replaceArgument(0, new Reference($rememberMeHandlerId)) + ->addTag('kernel.event_subscriber', ['dispatcher' => 'security.event_dispatcher.'.$firewallName]) + ; + + // create remember me authenticator (which re-authenticates the user based on the remember-me cookie) + $authenticatorId = 'security.authenticator.remember_me.'.$firewallName; + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.remember_me')) + ->replaceArgument(0, new Reference($rememberMeHandlerId)) + ->replaceArgument(3, $config['name'] ?? $this->options['name']) + ; + + foreach ($container->findTaggedServiceIds('security.remember_me_aware') as $serviceId => $attributes) { + // register ContextListener + if ('security.context_listener' === substr($serviceId, 0, 25)) { + continue; + } + + throw new \LogicException(sprintf('Symfony Authenticator Security dropped support for the "security.remember_me_aware" tag, service "%s" will no longer work as expected.', $serviceId)); + } + + return $authenticatorId; + } + + public function getPosition(): string + { + return 'remember_me'; + } + + /** + * {@inheritDoc} + */ + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getKey(): string + { + return 'remember-me'; + } + + public function addConfiguration(NodeDefinition $node) + { + $builder = $node + ->fixXmlConfig('user_provider') + ->children() + ; + + $builder + ->scalarNode('secret') + ->cannotBeEmpty() + ->defaultValue('%kernel.secret%') + ->end() + ->scalarNode('service')->end() + ->arrayNode('user_providers') + ->beforeNormalization() + ->ifString()->then(function ($v) { return [$v]; }) + ->end() + ->prototype('scalar')->end() + ->end() + ->booleanNode('catch_exceptions')->defaultTrue()->end() + ->arrayNode('signature_properties') + ->prototype('scalar')->end() + ->requiresAtLeastOneElement() + ->info('An array of properties on your User that are used to sign the remember-me cookie. If any of these change, all existing cookies will become invalid.') + ->example(['email', 'password']) + ->defaultValue(['password']) + ->end() + ->arrayNode('token_provider') + ->beforeNormalization() + ->ifString()->then(function ($v) { return ['service' => $v]; }) + ->end() + ->children() + ->scalarNode('service')->info('The service ID of a custom rememberme token provider.')->end() + ->arrayNode('doctrine') + ->canBeEnabled() + ->children() + ->scalarNode('connection')->defaultNull()->end() + ->end() + ->end() + ->end() + ->end() + ->scalarNode('token_verifier') + ->info('The service ID of a custom rememberme token verifier.') + ->end(); + + foreach ($this->options as $name => $value) { + if ('secure' === $name) { + $builder->enumNode($name)->values([true, false, 'auto'])->defaultValue('auto' === $value ? null : $value); + } elseif ('samesite' === $name) { + $builder->enumNode($name)->values([null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT, Cookie::SAMESITE_NONE])->defaultValue($value); + } elseif (\is_bool($value)) { + $builder->booleanNode($name)->defaultValue($value); + } elseif (\is_int($value)) { + $builder->integerNode($name)->defaultValue($value); + } else { + $builder->scalarNode($name)->defaultValue($value); + } + } + } + + private function generateRememberMeServicesTemplateId(array $config, string $id): string + { + if (isset($config['service'])) { + return $config['service']; + } + + if (isset($config['token_provider'])) { + return 'security.authentication.rememberme.services.persistent'; + } + + return 'security.authentication.rememberme.services.simplehash'; + } + + private function createRememberMeServices(ContainerBuilder $container, string $id, string $templateId, array $userProviders, array $config): void + { + $rememberMeServicesId = $templateId.'.'.$id; + + $rememberMeServices = $container->setDefinition($rememberMeServicesId, new ChildDefinition($templateId)); + $rememberMeServices->replaceArgument(1, $config['secret']); + $rememberMeServices->replaceArgument(2, $id); + + if (isset($config['token_provider'])) { + $tokenProviderId = $this->createTokenProvider($container, $id, $config['token_provider']); + $rememberMeServices->addMethodCall('setTokenProvider', [new Reference($tokenProviderId)]); + } + + // remember-me options + $mergedOptions = array_intersect_key($config, $this->options); + if ('auto' === $mergedOptions['secure']) { + $mergedOptions['secure'] = null; + } + + $rememberMeServices->replaceArgument(3, $mergedOptions); + + if ($config['user_providers']) { + $userProviders = []; + foreach ($config['user_providers'] as $providerName) { + $userProviders[] = new Reference('security.user.provider.concrete.'.$providerName); + } + } + + if (0 === \count($userProviders)) { + throw new \RuntimeException('You must configure at least one remember-me aware listener (such as form-login) for each firewall that has remember-me enabled.'); + } + + $rememberMeServices->replaceArgument(0, new IteratorArgument(array_unique($userProviders))); + } + + private function createTokenProvider(ContainerBuilder $container, string $firewallName, array $config): string + { + $tokenProviderId = $config['service'] ?? false; + if ($config['doctrine']['enabled'] ?? false) { + if (!class_exists(DoctrineTokenProvider::class)) { + throw new InvalidConfigurationException('Cannot use the "doctrine" token provider for "remember_me" because the Doctrine Bridge is not installed. Try running "composer require symfony/doctrine-bridge".'); + } + + if (null === $config['doctrine']['connection']) { + $connectionId = 'database_connection'; + } else { + $connectionId = 'doctrine.dbal.'.$config['doctrine']['connection'].'_connection'; + } + + $tokenProviderId = 'security.remember_me.doctrine_token_provider.'.$firewallName; + $container->register($tokenProviderId, DoctrineTokenProvider::class) + ->addArgument(new Reference($connectionId)); + } + + if (!$tokenProviderId) { + throw new InvalidConfigurationException(sprintf('No token provider was set for firewall "%s". Either configure a service ID or set "remember_me.token_provider.doctrine" to true.', $firewallName)); + } + + return $tokenProviderId; + } + + private function createTokenVerifier(ContainerBuilder $container, string $firewallName, ?string $serviceId): Reference + { + if ($serviceId) { + return new Reference($serviceId); + } + + $tokenVerifierId = 'security.remember_me.token_verifier.'.$firewallName; + + $container->register($tokenVerifierId, CacheTokenVerifier::class) + ->addArgument(new Reference('cache.security_token_verifier', ContainerInterface::NULL_ON_INVALID_REFERENCE)) + ->addArgument(60) + ->addArgument('rememberme-'.$firewallName.'-stale-'); + + return new Reference($tokenVerifierId, ContainerInterface::NULL_ON_INVALID_REFERENCE); + } + + /** + * {@inheritdoc} + */ + public function prepend(ContainerBuilder $container) + { + $rememberMeSecureDefault = false; + $rememberMeSameSiteDefault = null; + + if (!isset($container->getExtensions()['framework'])) { + return; + } + + foreach ($container->getExtensionConfig('framework') as $config) { + if (isset($config['session']) && \is_array($config['session'])) { + $rememberMeSecureDefault = $config['session']['cookie_secure'] ?? $rememberMeSecureDefault; + $rememberMeSameSiteDefault = \array_key_exists('cookie_samesite', $config['session']) ? $config['session']['cookie_samesite'] : $rememberMeSameSiteDefault; + } + } + + $this->options['secure'] = $rememberMeSecureDefault; + $this->options['samesite'] = $rememberMeSameSiteDefault; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RemoteUserFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RemoteUserFactory.php new file mode 100644 index 0000000..d32cffa --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/RemoteUserFactory.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * RemoteUserFactory creates services for REMOTE_USER based authentication. + * + * @author Fabien Potencier + * @author Maxime Douailin + * + * @internal + */ +class RemoteUserFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface +{ + public const PRIORITY = -10; + + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + $providerId = 'security.authentication.provider.pre_authenticated.'.$id; + $container + ->setDefinition($providerId, new ChildDefinition('security.authentication.provider.pre_authenticated')) + ->replaceArgument(0, new Reference($userProvider)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->addArgument($id) + ; + + $listenerId = 'security.authentication.listener.remote_user.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.remote_user')); + $listener->replaceArgument(2, $id); + $listener->replaceArgument(3, $config['user']); + $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); + + return [$providerId, $listenerId, $defaultEntryPoint]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId) + { + $authenticatorId = 'security.authenticator.remote_user.'.$firewallName; + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.remote_user')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(2, $firewallName) + ->replaceArgument(3, $config['user']) + ; + + return $authenticatorId; + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getPosition(): string + { + return 'pre_auth'; + } + + public function getKey(): string + { + return 'remote-user'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('provider')->end() + ->scalarNode('user')->defaultValue('REMOTE_USER')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php new file mode 100644 index 0000000..4551a6c --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * SecurityFactoryInterface is the interface for all security authentication listener. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use AuthenticatorFactoryInterface instead. + */ +interface SecurityFactoryInterface +{ + /** + * Configures the container services required to use the authentication listener. + * + * @return array containing three values: + * - the provider id + * - the listener id + * - the entry point id + */ + public function create(ContainerBuilder $container, string $id, array $config, string $userProviderId, ?string $defaultEntryPointId); + + /** + * Defines the position at which the provider is called. + * Possible values: pre_auth, form, http, and remember_me. + * + * @return string + */ + public function getPosition(); + + /** + * Defines the configuration key used to reference the provider + * in the firewall configuration. + * + * @return string + */ + public function getKey(); + + public function addConfiguration(NodeDefinition $builder); +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/X509Factory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/X509Factory.php new file mode 100644 index 0000000..269d369 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/Factory/X509Factory.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * X509Factory creates services for X509 certificate authentication. + * + * @author Fabien Potencier + * + * @internal + */ +class X509Factory implements SecurityFactoryInterface, AuthenticatorFactoryInterface +{ + public const PRIORITY = -10; + + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array + { + $providerId = 'security.authentication.provider.pre_authenticated.'.$id; + $container + ->setDefinition($providerId, new ChildDefinition('security.authentication.provider.pre_authenticated')) + ->replaceArgument(0, new Reference($userProvider)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->addArgument($id) + ; + + // listener + $listenerId = 'security.authentication.listener.x509.'.$id; + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.authentication.listener.x509')); + $listener->replaceArgument(2, $id); + $listener->replaceArgument(3, $config['user']); + $listener->replaceArgument(4, $config['credentials']); + $listener->addMethodCall('setSessionAuthenticationStrategy', [new Reference('security.authentication.session_strategy.'.$id)]); + + return [$providerId, $listenerId, $defaultEntryPoint]; + } + + public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId) + { + $authenticatorId = 'security.authenticator.x509.'.$firewallName; + $container + ->setDefinition($authenticatorId, new ChildDefinition('security.authenticator.x509')) + ->replaceArgument(0, new Reference($userProviderId)) + ->replaceArgument(2, $firewallName) + ->replaceArgument(3, $config['user']) + ->replaceArgument(4, $config['credentials']) + ; + + return $authenticatorId; + } + + public function getPriority(): int + { + return self::PRIORITY; + } + + public function getPosition(): string + { + return 'pre_auth'; + } + + public function getKey(): string + { + return 'x509'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('provider')->end() + ->scalarNode('user')->defaultValue('SSL_CLIENT_S_DN_Email')->end() + ->scalarNode('credentials')->defaultValue('SSL_CLIENT_S_DN')->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php new file mode 100644 index 0000000..ceb04e3 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Parameter; + +/** + * InMemoryFactory creates services for the memory provider. + * + * @author Fabien Potencier + * @author Christophe Coevoet + */ +class InMemoryFactory implements UserProviderFactoryInterface +{ + public function create(ContainerBuilder $container, string $id, array $config) + { + $definition = $container->setDefinition($id, new ChildDefinition('security.user.provider.in_memory')); + $defaultPassword = new Parameter('container.build_id'); + $users = []; + + foreach ($config['users'] as $username => $user) { + $users[$username] = ['password' => null !== $user['password'] ? (string) $user['password'] : $defaultPassword, 'roles' => $user['roles']]; + } + + $definition->addArgument($users); + } + + public function getKey() + { + return 'memory'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->fixXmlConfig('user') + ->children() + ->arrayNode('users') + ->useAttributeAsKey('identifier') + ->normalizeKeys(false) + ->beforeNormalization() + ->always() + ->then(function ($v) { + $deprecation = false; + foreach ($v as $i => $child) { + if (!isset($child['name'])) { + continue; + } + + $deprecation = true; + + $v[$i]['identifier'] = $child['name']; + unset($v[$i]['name']); + } + + if ($deprecation) { + trigger_deprecation('symfony/security-bundle', '5.3', 'The "in_memory.user.name" option is deprecated, use "identifier" instead.'); + } + + return $v; + }) + ->end() + ->prototype('array') + ->children() + ->scalarNode('password')->defaultNull()->end() + ->arrayNode('roles') + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/LdapFactory.php b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/LdapFactory.php new file mode 100644 index 0000000..c2a3343 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/LdapFactory.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * LdapFactory creates services for Ldap user provider. + * + * @author Grégoire Pineau + * @author Charles Sarrazin + */ +class LdapFactory implements UserProviderFactoryInterface +{ + public function create(ContainerBuilder $container, string $id, array $config) + { + $container + ->setDefinition($id, new ChildDefinition('security.user.provider.ldap')) + ->replaceArgument(0, new Reference($config['service'])) + ->replaceArgument(1, $config['base_dn']) + ->replaceArgument(2, $config['search_dn']) + ->replaceArgument(3, $config['search_password']) + ->replaceArgument(4, $config['default_roles']) + ->replaceArgument(5, $config['uid_key']) + ->replaceArgument(6, $config['filter']) + ->replaceArgument(7, $config['password_attribute']) + ->replaceArgument(8, $config['extra_fields']) + ; + } + + public function getKey() + { + return 'ldap'; + } + + public function addConfiguration(NodeDefinition $node) + { + $node + ->fixXmlConfig('extra_field') + ->fixXmlConfig('default_role') + ->children() + ->scalarNode('service')->isRequired()->cannotBeEmpty()->defaultValue('ldap')->end() + ->scalarNode('base_dn')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('search_dn')->defaultNull()->end() + ->scalarNode('search_password')->defaultNull()->end() + ->arrayNode('extra_fields') + ->prototype('scalar')->end() + ->end() + ->arrayNode('default_roles') + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->requiresAtLeastOneElement() + ->prototype('scalar')->end() + ->end() + ->scalarNode('uid_key')->defaultValue('sAMAccountName')->end() + ->scalarNode('filter')->defaultValue('({uid_key}={username})')->end() + ->scalarNode('password_attribute')->defaultNull()->end() + ->end() + ; + } +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php new file mode 100644 index 0000000..6d9481c --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * UserProviderFactoryInterface is the interface for all user provider factories. + * + * @author Fabien Potencier + * @author Christophe Coevoet + */ +interface UserProviderFactoryInterface +{ + public function create(ContainerBuilder $container, string $id, array $config); + + public function getKey(); + + public function addConfiguration(NodeDefinition $builder); +} diff --git a/vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php b/vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php new file mode 100644 index 0000000..d64b2c3 --- /dev/null +++ b/vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php @@ -0,0 +1,1210 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\DependencyInjection; + +use Composer\InstalledVersions; +use Symfony\Bridge\Twig\Extension\LogoutUrlExtension; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface; +use Symfony\Bundle\SecurityBundle\Security\LegacyLogoutHandlerListener; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Console\Application; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; +use Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher; +use Symfony\Component\PasswordHasher\Hasher\PlaintextPasswordHasher; +use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher; +use Symfony\Component\Security\Core\Authorization\Strategy\AffirmativeStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\ConsensusStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\PriorityStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\UnanimousStrategy; +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; +use Symfony\Component\Security\Core\Encoder\NativePasswordEncoder; +use Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder; +use Symfony\Component\Security\Core\User\ChainUserProvider; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; + +/** + * SecurityExtension. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class SecurityExtension extends Extension implements PrependExtensionInterface +{ + private $requestMatchers = []; + private $expressions = []; + private $contextListeners = []; + /** @var list */ + private $factories = []; + /** @var list */ + private $sortedFactories = []; + private $userProviderFactories = []; + private $statelessFirewallKeys = []; + + private $authenticatorManagerEnabled = false; + + public function prepend(ContainerBuilder $container) + { + foreach ($this->getSortedFactories() as $factory) { + if ($factory instanceof PrependExtensionInterface) { + $factory->prepend($container); + } + } + } + + public function load(array $configs, ContainerBuilder $container) + { + if (!class_exists(InstalledVersions::class)) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.1 or later.'); + } + + if (!array_filter($configs)) { + return; + } + + $mainConfig = $this->getConfiguration($configs, $container); + + $config = $this->processConfiguration($mainConfig, $configs); + + // load services + $loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config')); + + $loader->load('security.php'); + $loader->load('password_hasher.php'); + $loader->load('security_listeners.php'); + $loader->load('security_rememberme.php'); + + if ($this->authenticatorManagerEnabled = $config['enable_authenticator_manager']) { + if ($config['always_authenticate_before_granting']) { + throw new InvalidConfigurationException('The security option "always_authenticate_before_granting" cannot be used when "enable_authenticator_manager" is set to true. If you rely on this behavior, set it to false.'); + } + + $loader->load('security_authenticator.php'); + + // The authenticator system no longer has anonymous tokens. This makes sure AccessListener + // and AuthorizationChecker do not throw AuthenticationCredentialsNotFoundException when no + // token is available in the token storage. + $container->getDefinition('security.access_listener')->setArgument(3, false); + $container->getDefinition('security.authorization_checker')->setArgument(3, false); + $container->getDefinition('security.authorization_checker')->setArgument(4, false); + } else { + trigger_deprecation('symfony/security-bundle', '5.3', 'Not setting the "security.enable_authenticator_manager" config option to true is deprecated.'); + + if ($config['always_authenticate_before_granting']) { + $authorizationChecker = $container->getDefinition('security.authorization_checker'); + $authorizationCheckerArgs = $authorizationChecker->getArguments(); + array_splice($authorizationCheckerArgs, 1, 0, [new Reference('security.authentication.manager')]); + $authorizationChecker->setArguments($authorizationCheckerArgs); + } + + $loader->load('security_legacy.php'); + } + + if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'], true)) { + $loader->load('templating_twig.php'); + } + + $loader->load('collectors.php'); + $loader->load('guard.php'); + + $container->getDefinition('data_collector.security')->addArgument($this->authenticatorManagerEnabled); + + if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) { + $loader->load('security_debug.php'); + } + + if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) { + $container->removeDefinition('security.expression_language'); + $container->removeDefinition('security.access.expression_voter'); + } + + // set some global scalars + $container->setParameter('security.access.denied_url', $config['access_denied_url']); + $container->setParameter('security.authentication.manager.erase_credentials', $config['erase_credentials']); + $container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_strategy']); + + if (isset($config['access_decision_manager']['service'])) { + $container->setAlias('security.access.decision_manager', $config['access_decision_manager']['service']); + } elseif (isset($config['access_decision_manager']['strategy_service'])) { + $container + ->getDefinition('security.access.decision_manager') + ->addArgument(new Reference($config['access_decision_manager']['strategy_service'])); + } else { + $container + ->getDefinition('security.access.decision_manager') + ->addArgument($this->createStrategyDefinition( + $config['access_decision_manager']['strategy'] ?? MainConfiguration::STRATEGY_AFFIRMATIVE, + $config['access_decision_manager']['allow_if_all_abstain'], + $config['access_decision_manager']['allow_if_equal_granted_denied'] + )); + } + + $container->setParameter('security.access.always_authenticate_before_granting', $config['always_authenticate_before_granting']); + $container->setParameter('security.authentication.hide_user_not_found', $config['hide_user_not_found']); + + if (class_exists(Application::class)) { + $loader->load('debug_console.php'); + $debugCommand = $container->getDefinition('security.command.debug_firewall'); + $debugCommand->replaceArgument(4, $this->authenticatorManagerEnabled); + } + + $this->createFirewalls($config, $container); + $this->createAuthorization($config, $container); + $this->createRoleHierarchy($config, $container); + + $container->getDefinition('security.authentication.guard_handler') + ->replaceArgument(2, $this->statelessFirewallKeys); + + // @deprecated since Symfony 5.3 + if ($config['encoders']) { + $this->createEncoders($config['encoders'], $container); + } + + if ($config['password_hashers']) { + $this->createHashers($config['password_hashers'], $container); + } + + if (class_exists(Application::class)) { + $loader->load('console.php'); + + // @deprecated since Symfony 5.3 + $container->getDefinition('security.command.user_password_encoder')->replaceArgument(1, array_keys($config['encoders'])); + + $container->getDefinition('security.command.user_password_hash')->replaceArgument(1, array_keys($config['password_hashers'])); + } + + $container->registerForAutoconfiguration(VoterInterface::class) + ->addTag('security.voter'); + } + + /** + * @throws \InvalidArgumentException if the $strategy is invalid + */ + private function createStrategyDefinition(string $strategy, bool $allowIfAllAbstainDecisions, bool $allowIfEqualGrantedDeniedDecisions): Definition + { + switch ($strategy) { + case MainConfiguration::STRATEGY_AFFIRMATIVE: + return new Definition(AffirmativeStrategy::class, [$allowIfAllAbstainDecisions]); + case MainConfiguration::STRATEGY_CONSENSUS: + return new Definition(ConsensusStrategy::class, [$allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions]); + case MainConfiguration::STRATEGY_UNANIMOUS: + return new Definition(UnanimousStrategy::class, [$allowIfAllAbstainDecisions]); + case MainConfiguration::STRATEGY_PRIORITY: + return new Definition(PriorityStrategy::class, [$allowIfAllAbstainDecisions]); + } + + throw new \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy)); + } + + private function createRoleHierarchy(array $config, ContainerBuilder $container) + { + if (!isset($config['role_hierarchy']) || 0 === \count($config['role_hierarchy'])) { + $container->removeDefinition('security.access.role_hierarchy_voter'); + + return; + } + + $container->setParameter('security.role_hierarchy.roles', $config['role_hierarchy']); + $container->removeDefinition('security.access.simple_role_voter'); + } + + private function createAuthorization(array $config, ContainerBuilder $container) + { + foreach ($config['access_control'] as $access) { + $matcher = $this->createRequestMatcher( + $container, + $access['path'], + $access['host'], + $access['port'], + $access['methods'], + $access['ips'] + ); + + $attributes = $access['roles']; + if ($access['allow_if']) { + $attributes[] = $this->createExpression($container, $access['allow_if']); + } + + $emptyAccess = 0 === \count(array_filter($access)); + + if ($emptyAccess) { + throw new InvalidConfigurationException('One or more access control items are empty. Did you accidentally add lines only containing a "-" under "security.access_control"?'); + } + + $container->getDefinition('security.access_map') + ->addMethodCall('add', [$matcher, $attributes, $access['requires_channel']]); + } + + // allow cache warm-up for expressions + if (\count($this->expressions)) { + $container->getDefinition('security.cache_warmer.expression') + ->replaceArgument(0, new IteratorArgument(array_values($this->expressions))); + } else { + $container->removeDefinition('security.cache_warmer.expression'); + } + } + + private function createFirewalls(array $config, ContainerBuilder $container) + { + if (!isset($config['firewalls'])) { + return; + } + + $firewalls = $config['firewalls']; + $providerIds = $this->createUserProviders($config, $container); + + $container->setParameter('security.firewalls', array_keys($firewalls)); + + // make the ContextListener aware of the configured user providers + $contextListenerDefinition = $container->getDefinition('security.context_listener'); + $arguments = $contextListenerDefinition->getArguments(); + $userProviders = []; + foreach ($providerIds as $userProviderId) { + $userProviders[] = new Reference($userProviderId); + } + $arguments[1] = $userProviderIteratorsArgument = new IteratorArgument($userProviders); + $contextListenerDefinition->setArguments($arguments); + $nbUserProviders = \count($userProviders); + + if ($nbUserProviders > 1) { + $container->setDefinition('security.user_providers', new Definition(ChainUserProvider::class, [$userProviderIteratorsArgument])) + ->setPublic(false); + } elseif (0 === $nbUserProviders) { + $container->removeDefinition('security.listener.user_provider'); + } else { + $container->setAlias('security.user_providers', new Alias(current($providerIds)))->setPublic(false); + } + + if (1 === \count($providerIds)) { + $container->setAlias(UserProviderInterface::class, current($providerIds)); + } + + $customUserChecker = false; + + // load firewall map + $mapDef = $container->getDefinition('security.firewall.map'); + $map = $authenticationProviders = $contextRefs = []; + foreach ($firewalls as $name => $firewall) { + if (isset($firewall['user_checker']) && 'security.user_checker' !== $firewall['user_checker']) { + $customUserChecker = true; + } + + $configId = 'security.firewall.map.config.'.$name; + + [$matcher, $listeners, $exceptionListener, $logoutListener] = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId); + + $contextId = 'security.firewall.map.context.'.$name; + $isLazy = !$firewall['stateless'] && (!empty($firewall['anonymous']['lazy']) || $firewall['lazy']); + $context = new ChildDefinition($isLazy ? 'security.firewall.lazy_context' : 'security.firewall.context'); + $context = $container->setDefinition($contextId, $context); + $context + ->replaceArgument(0, new IteratorArgument($listeners)) + ->replaceArgument(1, $exceptionListener) + ->replaceArgument(2, $logoutListener) + ->replaceArgument(3, new Reference($configId)) + ; + + $contextRefs[$contextId] = new Reference($contextId); + $map[$contextId] = $matcher; + } + + $container->setAlias('security.firewall.context_locator', (string) ServiceLocatorTagPass::register($container, $contextRefs)); + + $mapDef->replaceArgument(0, new Reference('security.firewall.context_locator')); + $mapDef->replaceArgument(1, new IteratorArgument($map)); + + if (!$this->authenticatorManagerEnabled) { + // add authentication providers to authentication manager + $authenticationProviders = array_map(function ($id) { + return new Reference($id); + }, array_values(array_unique($authenticationProviders))); + + $container + ->getDefinition('security.authentication.manager') + ->replaceArgument(0, new IteratorArgument($authenticationProviders)); + } + + // register an autowire alias for the UserCheckerInterface if no custom user checker service is configured + if (!$customUserChecker) { + $container->setAlias('Symfony\Component\Security\Core\User\UserCheckerInterface', new Alias('security.user_checker', false)); + } + } + + private function createFirewall(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, array $providerIds, string $configId) + { + $config = $container->setDefinition($configId, new ChildDefinition('security.firewall.config')); + $config->replaceArgument(0, $id); + $config->replaceArgument(1, $firewall['user_checker']); + + // Matcher + $matcher = null; + if (isset($firewall['request_matcher'])) { + $matcher = new Reference($firewall['request_matcher']); + } elseif (isset($firewall['pattern']) || isset($firewall['host'])) { + $pattern = $firewall['pattern'] ?? null; + $host = $firewall['host'] ?? null; + $methods = $firewall['methods'] ?? []; + $matcher = $this->createRequestMatcher($container, $pattern, $host, null, $methods); + } + + $config->replaceArgument(2, $matcher ? (string) $matcher : null); + $config->replaceArgument(3, $firewall['security']); + + // Security disabled? + if (false === $firewall['security']) { + return [$matcher, [], null, null]; + } + + $config->replaceArgument(4, $firewall['stateless']); + + $firewallEventDispatcherId = 'security.event_dispatcher.'.$id; + + // Provider id (must be configured explicitly per firewall/authenticator if more than one provider is set) + $defaultProvider = null; + if (isset($firewall['provider'])) { + if (!isset($providerIds[$normalizedName = str_replace('-', '_', $firewall['provider'])])) { + throw new InvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall['provider'])); + } + $defaultProvider = $providerIds[$normalizedName]; + + if ($this->authenticatorManagerEnabled) { + $container->setDefinition('security.listener.'.$id.'.user_provider', new ChildDefinition('security.listener.user_provider.abstract')) + ->addTag('kernel.event_listener', ['dispatcher' => $firewallEventDispatcherId, 'event' => CheckPassportEvent::class, 'priority' => 2048, 'method' => 'checkPassport']) + ->replaceArgument(0, new Reference($defaultProvider)); + } + } elseif (1 === \count($providerIds)) { + $defaultProvider = reset($providerIds); + } + + $config->replaceArgument(5, $defaultProvider); + + // Register Firewall-specific event dispatcher + $container->register($firewallEventDispatcherId, EventDispatcher::class) + ->addTag('event_dispatcher.dispatcher', ['name' => $firewallEventDispatcherId]); + + // Register listeners + $listeners = []; + $listenerKeys = []; + + // Channel listener + $listeners[] = new Reference('security.channel_listener'); + + $contextKey = null; + $contextListenerId = null; + // Context serializer listener + if (false === $firewall['stateless']) { + $contextKey = $firewall['context'] ?? $id; + $listeners[] = new Reference($contextListenerId = $this->createContextListener($container, $contextKey, $this->authenticatorManagerEnabled ? $firewallEventDispatcherId : null)); + $sessionStrategyId = 'security.authentication.session_strategy'; + + if ($this->authenticatorManagerEnabled) { + $container + ->setDefinition('security.listener.session.'.$id, new ChildDefinition('security.listener.session')) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } + } else { + $this->statelessFirewallKeys[] = $id; + $sessionStrategyId = 'security.authentication.session_strategy_noop'; + } + $container->setAlias(new Alias('security.authentication.session_strategy.'.$id, false), $sessionStrategyId); + + $config->replaceArgument(6, $contextKey); + + // Logout listener + $logoutListenerId = null; + if (isset($firewall['logout'])) { + $logoutListenerId = 'security.logout_listener.'.$id; + $logoutListener = $container->setDefinition($logoutListenerId, new ChildDefinition('security.logout_listener')); + $logoutListener->replaceArgument(2, new Reference($firewallEventDispatcherId)); + $logoutListener->replaceArgument(3, [ + 'csrf_parameter' => $firewall['logout']['csrf_parameter'], + 'csrf_token_id' => $firewall['logout']['csrf_token_id'], + 'logout_path' => $firewall['logout']['path'], + ]); + + // add default logout listener + if (isset($firewall['logout']['success_handler'])) { + // deprecated, to be removed in Symfony 6.0 + $logoutSuccessHandlerId = $firewall['logout']['success_handler']; + $container->register('security.logout.listener.legacy_success_listener.'.$id, LegacyLogoutHandlerListener::class) + ->setArguments([new Reference($logoutSuccessHandlerId)]) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } else { + $logoutSuccessListenerId = 'security.logout.listener.default.'.$id; + $container->setDefinition($logoutSuccessListenerId, new ChildDefinition('security.logout.listener.default')) + ->replaceArgument(1, $firewall['logout']['target']) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } + + // add CSRF provider + if (isset($firewall['logout']['csrf_token_generator'])) { + $logoutListener->addArgument(new Reference($firewall['logout']['csrf_token_generator'])); + } + + // add session logout listener + if (true === $firewall['logout']['invalidate_session'] && false === $firewall['stateless']) { + $container->setDefinition('security.logout.listener.session.'.$id, new ChildDefinition('security.logout.listener.session')) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } + + // add cookie logout listener + if (\count($firewall['logout']['delete_cookies']) > 0) { + $container->setDefinition('security.logout.listener.cookie_clearing.'.$id, new ChildDefinition('security.logout.listener.cookie_clearing')) + ->addArgument($firewall['logout']['delete_cookies']) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } + + // add custom listeners (deprecated) + foreach ($firewall['logout']['handlers'] as $i => $handlerId) { + $container->register('security.logout.listener.legacy_handler.'.$i, LegacyLogoutHandlerListener::class) + ->addArgument(new Reference($handlerId)) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + } + + // register with LogoutUrlGenerator + $container + ->getDefinition('security.logout_url_generator') + ->addMethodCall('registerListener', [ + $id, + $firewall['logout']['path'], + $firewall['logout']['csrf_token_id'], + $firewall['logout']['csrf_parameter'], + isset($firewall['logout']['csrf_token_generator']) ? new Reference($firewall['logout']['csrf_token_generator']) : null, + false === $firewall['stateless'] && isset($firewall['context']) ? $firewall['context'] : null, + ]) + ; + } + + // Determine default entry point + $configuredEntryPoint = $firewall['entry_point'] ?? null; + + // Authentication listeners + $firewallAuthenticationProviders = []; + [$authListeners, $defaultEntryPoint] = $this->createAuthenticationListeners($container, $id, $firewall, $firewallAuthenticationProviders, $defaultProvider, $providerIds, $configuredEntryPoint, $contextListenerId); + + if (!$this->authenticatorManagerEnabled) { + $authenticationProviders = array_merge($authenticationProviders, $firewallAuthenticationProviders); + } else { + // $configuredEntryPoint is resolved into a service ID and stored in $defaultEntryPoint + $configuredEntryPoint = $defaultEntryPoint; + + // authenticator manager + $authenticators = array_map(function ($id) { + return new Reference($id); + }, $firewallAuthenticationProviders); + $container + ->setDefinition($managerId = 'security.authenticator.manager.'.$id, new ChildDefinition('security.authenticator.manager')) + ->replaceArgument(0, $authenticators) + ->replaceArgument(2, new Reference($firewallEventDispatcherId)) + ->replaceArgument(3, $id) + ->replaceArgument(7, $firewall['required_badges'] ?? []) + ->addTag('monolog.logger', ['channel' => 'security']) + ; + + $managerLocator = $container->getDefinition('security.authenticator.managers_locator'); + $managerLocator->replaceArgument(0, array_merge($managerLocator->getArgument(0), [$id => new ServiceClosureArgument(new Reference($managerId))])); + + // authenticator manager listener + $container + ->setDefinition('security.firewall.authenticator.'.$id, new ChildDefinition('security.firewall.authenticator')) + ->replaceArgument(0, new Reference($managerId)) + ; + + if ($container->hasDefinition('debug.security.firewall') && $this->authenticatorManagerEnabled) { + $container + ->register('debug.security.firewall.authenticator.'.$id, TraceableAuthenticatorManagerListener::class) + ->setDecoratedService('security.firewall.authenticator.'.$id) + ->setArguments([new Reference('debug.security.firewall.authenticator.'.$id.'.inner')]) + ; + } + + // user checker listener + $container + ->setDefinition('security.listener.user_checker.'.$id, new ChildDefinition('security.listener.user_checker')) + ->replaceArgument(0, new Reference('security.user_checker.'.$id)) + ->addTag('kernel.event_subscriber', ['dispatcher' => $firewallEventDispatcherId]); + + $listeners[] = new Reference('security.firewall.authenticator.'.$id); + + // Add authenticators to the debug:firewall command + if ($container->hasDefinition('security.command.debug_firewall')) { + $debugCommand = $container->getDefinition('security.command.debug_firewall'); + $debugCommand->replaceArgument(3, array_merge($debugCommand->getArgument(3), [$id => $authenticators])); + } + } + + $config->replaceArgument(7, $configuredEntryPoint ?: $defaultEntryPoint); + + $listeners = array_merge($listeners, $authListeners); + + // Switch user listener + if (isset($firewall['switch_user'])) { + $listenerKeys[] = 'switch_user'; + $listeners[] = new Reference($this->createSwitchUserListener($container, $id, $firewall['switch_user'], $defaultProvider, $firewall['stateless'])); + } + + // Access listener + $listeners[] = new Reference('security.access_listener'); + + // Exception listener + $exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless'])); + + $config->replaceArgument(8, $firewall['access_denied_handler'] ?? null); + $config->replaceArgument(9, $firewall['access_denied_url'] ?? null); + + $container->setAlias('security.user_checker.'.$id, new Alias($firewall['user_checker'], false)); + + foreach ($this->getSortedFactories() as $factory) { + $key = str_replace('-', '_', $factory->getKey()); + if ('custom_authenticators' !== $key && \array_key_exists($key, $firewall)) { + $listenerKeys[] = $key; + } + } + + if ($firewall['custom_authenticators'] ?? false) { + foreach ($firewall['custom_authenticators'] as $customAuthenticatorId) { + $listenerKeys[] = $customAuthenticatorId; + } + } + + $config->replaceArgument(10, $listenerKeys); + $config->replaceArgument(11, $firewall['switch_user'] ?? null); + + return [$matcher, $listeners, $exceptionListener, null !== $logoutListenerId ? new Reference($logoutListenerId) : null]; + } + + private function createContextListener(ContainerBuilder $container, string $contextKey, ?string $firewallEventDispatcherId) + { + if (isset($this->contextListeners[$contextKey])) { + return $this->contextListeners[$contextKey]; + } + + $listenerId = 'security.context_listener.'.\count($this->contextListeners); + $listener = $container->setDefinition($listenerId, new ChildDefinition('security.context_listener')); + $listener->replaceArgument(2, $contextKey); + if (null !== $firewallEventDispatcherId) { + $listener->replaceArgument(4, new Reference($firewallEventDispatcherId)); + $listener->addTag('kernel.event_listener', ['event' => KernelEvents::RESPONSE, 'method' => 'onKernelResponse']); + } + + return $this->contextListeners[$contextKey] = $listenerId; + } + + private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint, string $contextListenerId = null) + { + $listeners = []; + $hasListeners = false; + $entryPoints = []; + + foreach ($this->getSortedFactories() as $factory) { + $key = str_replace('-', '_', $factory->getKey()); + + if (isset($firewall[$key])) { + $userProvider = $this->getUserProvider($container, $id, $firewall, $key, $defaultProvider, $providerIds, $contextListenerId); + + if ($this->authenticatorManagerEnabled) { + if (!$factory instanceof AuthenticatorFactoryInterface) { + throw new InvalidConfigurationException(sprintf('Cannot configure AuthenticatorManager as "%s" authentication does not support it, set "security.enable_authenticator_manager" to `false`.', $key)); + } + + $authenticators = $factory->createAuthenticator($container, $id, $firewall[$key], $userProvider); + if (\is_array($authenticators)) { + foreach ($authenticators as $authenticator) { + $authenticationProviders[] = $authenticator; + $entryPoints[] = $authenticator; + } + } else { + $authenticationProviders[] = $authenticators; + $entryPoints[$key] = $authenticators; + } + } else { + [$provider, $listenerId, $defaultEntryPoint] = $factory->create($container, $id, $firewall[$key], $userProvider, $defaultEntryPoint); + + $listeners[] = new Reference($listenerId); + $authenticationProviders[] = $provider; + } + + if ($factory instanceof FirewallListenerFactoryInterface) { + $firewallListenerIds = $factory->createListeners($container, $id, $firewall[$key]); + foreach ($firewallListenerIds as $firewallListenerId) { + $listeners[] = new Reference($firewallListenerId); + } + } + + $hasListeners = true; + } + } + + // the actual entry point is configured by the RegisterEntryPointPass + $container->setParameter('security.'.$id.'._indexed_authenticators', $entryPoints); + + if (false === $hasListeners && !$this->authenticatorManagerEnabled) { + throw new InvalidConfigurationException(sprintf('No authentication listener registered for firewall "%s".', $id)); + } + + return [$listeners, $defaultEntryPoint]; + } + + private function getUserProvider(ContainerBuilder $container, string $id, array $firewall, string $factoryKey, ?string $defaultProvider, array $providerIds, ?string $contextListenerId): string + { + if (isset($firewall[$factoryKey]['provider'])) { + if (!isset($providerIds[$normalizedName = str_replace('-', '_', $firewall[$factoryKey]['provider'])])) { + throw new InvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall[$factoryKey]['provider'])); + } + + return $providerIds[$normalizedName]; + } + + if ('remember_me' === $factoryKey && $contextListenerId) { + $container->getDefinition($contextListenerId)->addTag('security.remember_me_aware', ['id' => $id, 'provider' => 'none']); + } + + if ($defaultProvider) { + return $defaultProvider; + } + + if (!$providerIds) { + $userProvider = sprintf('security.user.provider.missing.%s', $factoryKey); + $container->setDefinition( + $userProvider, + (new ChildDefinition('security.user.provider.missing'))->replaceArgument(0, $id) + ); + + return $userProvider; + } + + if ('remember_me' === $factoryKey || 'anonymous' === $factoryKey || 'custom_authenticators' === $factoryKey) { + if ('custom_authenticators' === $factoryKey) { + trigger_deprecation('symfony/security-bundle', '5.4', 'Not configuring explicitly the provider for the "%s" firewall is deprecated because it\'s ambiguous as there is more than one registered provider. Set the "provider" key to one of the configured providers, even if your custom authenticators don\'t use it.', $id); + } + + return 'security.user_providers'; + } + + throw new InvalidConfigurationException(sprintf('Not configuring explicitly the provider for the "%s" %s on "%s" firewall is ambiguous as there is more than one registered provider.', $factoryKey, $this->authenticatorManagerEnabled ? 'authenticator' : 'listener', $id)); + } + + private function createEncoders(array $encoders, ContainerBuilder $container) + { + $encoderMap = []; + foreach ($encoders as $class => $encoder) { + if (class_exists($class) && !is_a($class, PasswordAuthenticatedUserInterface::class, true)) { + trigger_deprecation('symfony/security-bundle', '5.3', 'Configuring an encoder for a user class that does not implement "%s" is deprecated, class "%s" should implement it.', PasswordAuthenticatedUserInterface::class, $class); + } + $encoderMap[$class] = $this->createEncoder($encoder); + } + + $container + ->getDefinition('security.encoder_factory.generic') + ->setArguments([$encoderMap]) + ; + } + + private function createEncoder(array $config) + { + // a custom encoder service + if (isset($config['id'])) { + return new Reference($config['id']); + } + + if ($config['migrate_from'] ?? false) { + return $config; + } + + // plaintext encoder + if ('plaintext' === $config['algorithm']) { + $arguments = [$config['ignore_case']]; + + return [ + 'class' => 'Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', + 'arguments' => $arguments, + ]; + } + + // pbkdf2 encoder + if ('pbkdf2' === $config['algorithm']) { + return [ + 'class' => 'Symfony\Component\Security\Core\Encoder\Pbkdf2PasswordEncoder', + 'arguments' => [ + $config['hash_algorithm'], + $config['encode_as_base64'], + $config['iterations'], + $config['key_length'], + ], + ]; + } + + // bcrypt encoder + if ('bcrypt' === $config['algorithm']) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_BCRYPT; + + return $this->createEncoder($config); + } + + // Argon2i encoder + if ('argon2i' === $config['algorithm']) { + if (SodiumPasswordHasher::isSupported() && !\defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2I')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2I; + } else { + throw new InvalidConfigurationException(sprintf('Algorithm "argon2i" is not available. Use "%s" instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? 'argon2id", "auto' : 'auto')); + } + + return $this->createEncoder($config); + } + + if ('argon2id' === $config['algorithm']) { + if (($hasSodium = SodiumPasswordHasher::isSupported()) && \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2ID')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2ID; + } else { + throw new InvalidConfigurationException(sprintf('Algorithm "argon2id" is not available. Either use "%s", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? 'argon2i", "auto' : 'auto')); + } + + return $this->createEncoder($config); + } + + if ('native' === $config['algorithm']) { + return [ + 'class' => NativePasswordEncoder::class, + 'arguments' => [ + $config['time_cost'], + (($config['memory_cost'] ?? 0) << 10) ?: null, + $config['cost'], + ] + (isset($config['native_algorithm']) ? [3 => $config['native_algorithm']] : []), + ]; + } + + if ('sodium' === $config['algorithm']) { + if (!SodiumPasswordHasher::isSupported()) { + throw new InvalidConfigurationException('Libsodium is not available. Install the sodium extension or use "auto" instead.'); + } + + return [ + 'class' => SodiumPasswordEncoder::class, + 'arguments' => [ + $config['time_cost'], + (($config['memory_cost'] ?? 0) << 10) ?: null, + ], + ]; + } + + // run-time configured encoder + return $config; + } + + private function createHashers(array $hashers, ContainerBuilder $container) + { + $hasherMap = []; + foreach ($hashers as $class => $hasher) { + // @deprecated since Symfony 5.3, remove the check in 6.0 + if (class_exists($class) && !is_a($class, PasswordAuthenticatedUserInterface::class, true)) { + trigger_deprecation('symfony/security-bundle', '5.3', 'Configuring a password hasher for a user class that does not implement "%s" is deprecated, class "%s" should implement it.', PasswordAuthenticatedUserInterface::class, $class); + } + $hasherMap[$class] = $this->createHasher($hasher); + } + + $container + ->getDefinition('security.password_hasher_factory') + ->setArguments([$hasherMap]) + ; + } + + private function createHasher(array $config) + { + // a custom hasher service + if (isset($config['id'])) { + return new Reference($config['id']); + } + + if ($config['migrate_from'] ?? false) { + return $config; + } + + // plaintext hasher + if ('plaintext' === $config['algorithm']) { + $arguments = [$config['ignore_case']]; + + return [ + 'class' => PlaintextPasswordHasher::class, + 'arguments' => $arguments, + ]; + } + + // pbkdf2 hasher + if ('pbkdf2' === $config['algorithm']) { + return [ + 'class' => Pbkdf2PasswordHasher::class, + 'arguments' => [ + $config['hash_algorithm'], + $config['encode_as_base64'], + $config['iterations'], + $config['key_length'], + ], + ]; + } + + // bcrypt hasher + if ('bcrypt' === $config['algorithm']) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_BCRYPT; + + return $this->createHasher($config); + } + + // Argon2i hasher + if ('argon2i' === $config['algorithm']) { + if (SodiumPasswordHasher::isSupported() && !\defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2I')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2I; + } else { + throw new InvalidConfigurationException(sprintf('Algorithm "argon2i" is not available. Either use "%s" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? 'argon2id", "auto' : 'auto')); + } + + return $this->createHasher($config); + } + + if ('argon2id' === $config['algorithm']) { + if (($hasSodium = SodiumPasswordHasher::isSupported()) && \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2ID')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2ID; + } else { + throw new InvalidConfigurationException(sprintf('Algorithm "argon2id" is not available. Either use "%s", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? 'argon2i", "auto' : 'auto')); + } + + return $this->createHasher($config); + } + + if ('native' === $config['algorithm']) { + return [ + 'class' => NativePasswordHasher::class, + 'arguments' => [ + $config['time_cost'], + (($config['memory_cost'] ?? 0) << 10) ?: null, + $config['cost'], + ] + (isset($config['native_algorithm']) ? [3 => $config['native_algorithm']] : []), + ]; + } + + if ('sodium' === $config['algorithm']) { + if (!SodiumPasswordHasher::isSupported()) { + throw new InvalidConfigurationException('Libsodium is not available. Install the sodium extension or use "auto" instead.'); + } + + return [ + 'class' => SodiumPasswordHasher::class, + 'arguments' => [ + $config['time_cost'], + (($config['memory_cost'] ?? 0) << 10) ?: null, + ], + ]; + } + + // run-time configured hasher + return $config; + } + + // Parses user providers and returns an array of their ids + private function createUserProviders(array $config, ContainerBuilder $container): array + { + $providerIds = []; + foreach ($config['providers'] as $name => $provider) { + $id = $this->createUserDaoProvider($name, $provider, $container); + $providerIds[str_replace('-', '_', $name)] = $id; + } + + return $providerIds; + } + + // Parses a tag and returns the id for the related user provider service + private function createUserDaoProvider(string $name, array $provider, ContainerBuilder $container): string + { + $name = $this->getUserProviderId($name); + + // Doctrine Entity and In-memory DAO provider are managed by factories + foreach ($this->userProviderFactories as $factory) { + $key = str_replace('-', '_', $factory->getKey()); + + if (!empty($provider[$key])) { + $factory->create($container, $name, $provider[$key]); + + return $name; + } + } + + // Existing DAO service provider + if (isset($provider['id'])) { + $container->setAlias($name, new Alias($provider['id'], false)); + + return $provider['id']; + } + + // Chain provider + if (isset($provider['chain'])) { + $providers = []; + foreach ($provider['chain']['providers'] as $providerName) { + $providers[] = new Reference($this->getUserProviderId($providerName)); + } + + $container + ->setDefinition($name, new ChildDefinition('security.user.provider.chain')) + ->addArgument(new IteratorArgument($providers)); + + return $name; + } + + throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider.', $name)); + } + + private function getUserProviderId(string $name): string + { + return 'security.user.provider.concrete.'.strtolower($name); + } + + private function createExceptionListener(ContainerBuilder $container, array $config, string $id, ?string $defaultEntryPoint, bool $stateless): string + { + $exceptionListenerId = 'security.exception_listener.'.$id; + $listener = $container->setDefinition($exceptionListenerId, new ChildDefinition('security.exception_listener')); + $listener->replaceArgument(3, $id); + $listener->replaceArgument(4, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint)); + $listener->replaceArgument(8, $stateless); + + // access denied handler setup + if (isset($config['access_denied_handler'])) { + $listener->replaceArgument(6, new Reference($config['access_denied_handler'])); + } elseif (isset($config['access_denied_url'])) { + $listener->replaceArgument(5, $config['access_denied_url']); + } + + return $exceptionListenerId; + } + + private function createSwitchUserListener(ContainerBuilder $container, string $id, array $config, ?string $defaultProvider, bool $stateless): string + { + $userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : $defaultProvider; + + if (!$userProvider) { + throw new InvalidConfigurationException(sprintf('Not configuring explicitly the provider for the "switch_user" listener on "%s" firewall is ambiguous as there is more than one registered provider.', $id)); + } + + $switchUserListenerId = 'security.authentication.switchuser_listener.'.$id; + $listener = $container->setDefinition($switchUserListenerId, new ChildDefinition('security.authentication.switchuser_listener')); + $listener->replaceArgument(1, new Reference($userProvider)); + $listener->replaceArgument(2, new Reference('security.user_checker.'.$id)); + $listener->replaceArgument(3, $id); + $listener->replaceArgument(6, $config['parameter']); + $listener->replaceArgument(7, $config['role']); + $listener->replaceArgument(9, $stateless); + + return $switchUserListenerId; + } + + private function createExpression(ContainerBuilder $container, string $expression): Reference + { + if (isset($this->expressions[$id = '.security.expression.'.ContainerBuilder::hash($expression)])) { + return $this->expressions[$id]; + } + + if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) { + throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".'); + } + + $container + ->register($id, 'Symfony\Component\ExpressionLanguage\Expression') + ->setPublic(false) + ->addArgument($expression) + ; + + return $this->expressions[$id] = new Reference($id); + } + + private function createRequestMatcher(ContainerBuilder $container, string $path = null, string $host = null, int $port = null, array $methods = [], array $ips = null, array $attributes = []): Reference + { + if ($methods) { + $methods = array_map('strtoupper', $methods); + } + + if (null !== $ips) { + foreach ($ips as $ip) { + $container->resolveEnvPlaceholders($ip, null, $usedEnvs); + + if (!$usedEnvs && !$this->isValidIps($ip)) { + throw new \LogicException(sprintf('The given value "%s" in the "security.access_control" config option is not a valid IP address.', $ip)); + } + + $usedEnvs = null; + } + } + + $id = '.security.request_matcher.'.ContainerBuilder::hash([$path, $host, $port, $methods, $ips, $attributes]); + + if (isset($this->requestMatchers[$id])) { + return $this->requestMatchers[$id]; + } + + // only add arguments that are necessary + $arguments = [$path, $host, $methods, $ips, $attributes, null, $port]; + while (\count($arguments) > 0 && !end($arguments)) { + array_pop($arguments); + } + + $container + ->register($id, 'Symfony\Component\HttpFoundation\RequestMatcher') + ->setPublic(false) + ->setArguments($arguments) + ; + + return $this->requestMatchers[$id] = new Reference($id); + } + + /** + * @deprecated since Symfony 5.4, use "addAuthenticatorFactory()" instead + */ + public function addSecurityListenerFactory(SecurityFactoryInterface $factory) + { + trigger_deprecation('symfony/security-bundle', '5.4', 'Method "%s()" is deprecated, use "addAuthenticatorFactory()" instead.', __METHOD__); + + $this->factories[] = [[ + 'pre_auth' => -10, + 'form' => -30, + 'http' => -40, + 'remember_me' => -50, + 'anonymous' => -60, + ][$factory->getPosition()], $factory]; + $this->sortedFactories = []; + } + + public function addAuthenticatorFactory(AuthenticatorFactoryInterface $factory) + { + $this->factories[] = [method_exists($factory, 'getPriority') ? $factory->getPriority() : 0, $factory]; + $this->sortedFactories = []; + } + + public function addUserProviderFactory(UserProviderFactoryInterface $factory) + { + $this->userProviderFactories[] = $factory; + } + + /** + * {@inheritdoc} + */ + public function getXsdValidationBasePath() + { + return __DIR__.'/../Resources/config/schema'; + } + + public function getNamespace() + { + return 'http://symfony.com/schema/dic/security'; + } + + public function getConfiguration(array $config, ContainerBuilder $container) + { + // first assemble the factories + return new MainConfiguration($this->getSortedFactories(), $this->userProviderFactories); + } + + private function isValidIps($ips): bool + { + $ipsList = array_reduce((array) $ips, static function (array $ips, string $ip) { + return array_merge($ips, preg_split('/\s*,\s*/', $ip)); + }, []); + + if (!$ipsList) { + return false; + } + + foreach ($ipsList as $cidr) { + if (!$this->isValidIp($cidr)) { + return false; + } + } + + return true; + } + + private function isValidIp(string $cidr): bool + { + $cidrParts = explode('/', $cidr); + + if (1 === \count($cidrParts)) { + return false !== filter_var($cidrParts[0], \FILTER_VALIDATE_IP); + } + + $ip = $cidrParts[0]; + $netmask = $cidrParts[1]; + + if (!ctype_digit($netmask)) { + return false; + } + + if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) { + return $netmask <= 32; + } + + if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { + return $netmask <= 128; + } + + return false; + } + + /** + * @return array + */ + private function getSortedFactories(): array + { + if (!$this->sortedFactories) { + $factories = []; + foreach ($this->factories as $i => $factory) { + $factories[] = array_merge($factory, [$i]); + } + + usort($factories, function ($a, $b) { + return $b[0] <=> $a[0] ?: $a[2] <=> $b[2]; + }); + + $this->sortedFactories = array_column($factories, 1); + } + + return $this->sortedFactories; + } +} diff --git a/vendor/symfony/security-bundle/EventListener/FirewallListener.php b/vendor/symfony/security-bundle/EventListener/FirewallListener.php new file mode 100644 index 0000000..ca3931a --- /dev/null +++ b/vendor/symfony/security-bundle/EventListener/FirewallListener.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\EventListener; + +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Security\Http\Firewall; +use Symfony\Component\Security\Http\FirewallMapInterface; +use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * @author Maxime Steinhausser + */ +class FirewallListener extends Firewall +{ + private $map; + private $logoutUrlGenerator; + + public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher, LogoutUrlGenerator $logoutUrlGenerator) + { + $this->map = $map; + $this->logoutUrlGenerator = $logoutUrlGenerator; + + parent::__construct($map, $dispatcher); + } + + public function configureLogoutUrlGenerator(RequestEvent $event) + { + if (!$event->isMainRequest()) { + return; + } + + if ($this->map instanceof FirewallMap && $config = $this->map->getFirewallConfig($event->getRequest())) { + $this->logoutUrlGenerator->setCurrentFirewall($config->getName(), $config->getContext()); + } + } + + public function onKernelFinishRequest(FinishRequestEvent $event) + { + if ($event->isMainRequest()) { + $this->logoutUrlGenerator->setCurrentFirewall(null); + } + + parent::onKernelFinishRequest($event); + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [ + KernelEvents::REQUEST => [ + ['configureLogoutUrlGenerator', 8], + ['onKernelRequest', 8], + ], + KernelEvents::FINISH_REQUEST => 'onKernelFinishRequest', + ]; + } +} diff --git a/vendor/symfony/security-bundle/EventListener/VoteListener.php b/vendor/symfony/security-bundle/EventListener/VoteListener.php new file mode 100644 index 0000000..1b37d92 --- /dev/null +++ b/vendor/symfony/security-bundle/EventListener/VoteListener.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; +use Symfony\Component\Security\Core\Event\VoteEvent; + +/** + * Listen to vote events from traceable voters. + * + * @author Laurent VOULLEMIER + * + * @internal + */ +class VoteListener implements EventSubscriberInterface +{ + private $traceableAccessDecisionManager; + + public function __construct(TraceableAccessDecisionManager $traceableAccessDecisionManager) + { + $this->traceableAccessDecisionManager = $traceableAccessDecisionManager; + } + + /** + * Event dispatched by a voter during access manager decision. + */ + public function onVoterVote(VoteEvent $event) + { + $this->traceableAccessDecisionManager->addVoterVote($event->getVoter(), $event->getAttributes(), $event->getVote()); + } + + public static function getSubscribedEvents(): array + { + return ['debug.security.authorization.vote' => 'onVoterVote']; + } +} diff --git a/vendor/symfony/security-bundle/LICENSE b/vendor/symfony/security-bundle/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/security-bundle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/security-bundle/LoginLink/FirewallAwareLoginLinkHandler.php b/vendor/symfony/security-bundle/LoginLink/FirewallAwareLoginLinkHandler.php new file mode 100644 index 0000000..5c61cfc --- /dev/null +++ b/vendor/symfony/security-bundle/LoginLink/FirewallAwareLoginLinkHandler.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\LoginLink; + +use Psr\Container\ContainerInterface; +use Symfony\Bundle\SecurityBundle\Security\FirewallAwareTrait; +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\LoginLink\LoginLinkDetails; +use Symfony\Component\Security\Http\LoginLink\LoginLinkHandlerInterface; + +/** + * Decorates the login link handler for the current firewall. + * + * @author Ryan Weaver + */ +class FirewallAwareLoginLinkHandler implements LoginLinkHandlerInterface +{ + use FirewallAwareTrait; + + private const FIREWALL_OPTION = 'login_link'; + + public function __construct(FirewallMap $firewallMap, ContainerInterface $loginLinkHandlerLocator, RequestStack $requestStack) + { + $this->firewallMap = $firewallMap; + $this->locator = $loginLinkHandlerLocator; + $this->requestStack = $requestStack; + } + + public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails + { + return $this->getForFirewall()->createLoginLink($user, $request); + } + + public function consumeLoginLink(Request $request): UserInterface + { + return $this->getForFirewall()->consumeLoginLink($request); + } +} diff --git a/vendor/symfony/security-bundle/README.md b/vendor/symfony/security-bundle/README.md new file mode 100644 index 0000000..63b502f --- /dev/null +++ b/vendor/symfony/security-bundle/README.md @@ -0,0 +1,13 @@ +SecurityBundle +============== + +SecurityBundle provides a tight integration of the Security component into the +Symfony full-stack framework. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/security-bundle/RememberMe/DecoratedRememberMeHandler.php b/vendor/symfony/security-bundle/RememberMe/DecoratedRememberMeHandler.php new file mode 100644 index 0000000..a060fb5 --- /dev/null +++ b/vendor/symfony/security-bundle/RememberMe/DecoratedRememberMeHandler.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\RememberMe; + +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\RememberMe\RememberMeDetails; +use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface; + +/** + * Used as a "workaround" for tagging aliases in the RememberMeFactory. + * + * @author Wouter de Jong + * + * @internal + */ +final class DecoratedRememberMeHandler implements RememberMeHandlerInterface +{ + private $handler; + + public function __construct(RememberMeHandlerInterface $handler) + { + $this->handler = $handler; + } + + /** + * {@inheritDoc} + */ + public function createRememberMeCookie(UserInterface $user): void + { + $this->handler->createRememberMeCookie($user); + } + + /** + * {@inheritDoc} + */ + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface + { + return $this->handler->consumeRememberMeCookie($rememberMeDetails); + } + + /** + * {@inheritDoc} + */ + public function clearRememberMeCookie(): void + { + $this->handler->clearRememberMeCookie(); + } +} diff --git a/vendor/symfony/security-bundle/RememberMe/FirewallAwareRememberMeHandler.php b/vendor/symfony/security-bundle/RememberMe/FirewallAwareRememberMeHandler.php new file mode 100644 index 0000000..ca7450f --- /dev/null +++ b/vendor/symfony/security-bundle/RememberMe/FirewallAwareRememberMeHandler.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\RememberMe; + +use Psr\Container\ContainerInterface; +use Symfony\Bundle\SecurityBundle\Security\FirewallAwareTrait; +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\RememberMe\RememberMeDetails; +use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface; + +/** + * Decorates {@see RememberMeHandlerInterface} for the current firewall. + * + * @author Wouter de Jong + */ +final class FirewallAwareRememberMeHandler implements RememberMeHandlerInterface +{ + use FirewallAwareTrait; + + private const FIREWALL_OPTION = 'remember_me'; + + public function __construct(FirewallMap $firewallMap, ContainerInterface $rememberMeHandlerLocator, RequestStack $requestStack) + { + $this->firewallMap = $firewallMap; + $this->locator = $rememberMeHandlerLocator; + $this->requestStack = $requestStack; + } + + public function createRememberMeCookie(UserInterface $user): void + { + $this->getForFirewall()->createRememberMeCookie($user); + } + + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface + { + return $this->getForFirewall()->consumeRememberMeCookie($rememberMeDetails); + } + + public function clearRememberMeCookie(): void + { + $this->getForFirewall()->clearRememberMeCookie(); + } +} diff --git a/vendor/symfony/security-bundle/Resources/config/collectors.php b/vendor/symfony/security-bundle/Resources/config/collectors.php new file mode 100644 index 0000000..3619779 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/collectors.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('data_collector.security', SecurityDataCollector::class) + ->args([ + service('security.untracked_token_storage'), + service('security.role_hierarchy'), + service('security.logout_url_generator'), + service('security.access.decision_manager'), + service('security.firewall.map'), + service('debug.security.firewall')->nullOnInvalid(), + ]) + ->tag('data_collector', [ + 'template' => '@Security/Collector/security.html.twig', + 'id' => 'security', + 'priority' => 270, + ]) + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/console.php b/vendor/symfony/security-bundle/Resources/config/console.php new file mode 100644 index 0000000..5bfe8a2 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/console.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand; +use Symfony\Component\PasswordHasher\Command\UserPasswordHashCommand; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.command.user_password_encoder', UserPasswordEncoderCommand::class) + ->args([ + service('security.encoder_factory'), + abstract_arg('encoders user classes'), + ]) + ->tag('console.command', ['command' => 'security:encode-password']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use "security.command.user_password_hash" instead.') + ; + + $container->services() + ->set('security.command.user_password_hash', UserPasswordHashCommand::class) + ->args([ + service('security.password_hasher_factory'), + abstract_arg('list of user classes'), + ]) + ->tag('console.command') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/debug_console.php b/vendor/symfony/security-bundle/Resources/config/debug_console.php new file mode 100644 index 0000000..74fa434 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/debug_console.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\Command\DebugFirewallCommand; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.command.debug_firewall', DebugFirewallCommand::class) + ->args([ + param('security.firewalls'), + service('security.firewall.context_locator'), + tagged_locator('event_dispatcher.dispatcher', 'name'), + [], + false, + ]) + ->tag('console.command', ['command' => 'debug:firewall']) + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/guard.php b/vendor/symfony/security-bundle/Resources/config/guard.php new file mode 100644 index 0000000..a57add5 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/guard.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener; +use Symfony\Component\Security\Guard\GuardAuthenticatorHandler; +use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.authentication.guard_handler', GuardAuthenticatorHandler::class) + ->args([ + service('security.token_storage'), + service('event_dispatcher')->nullOnInvalid(), + abstract_arg('stateless firewall keys'), + ]) + ->call('setSessionAuthenticationStrategy', [service('security.authentication.session_strategy')]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->alias(GuardAuthenticatorHandler::class, 'security.authentication.guard_handler') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.guard', GuardAuthenticationProvider::class) + ->abstract() + ->args([ + abstract_arg('Authenticators'), + abstract_arg('User Provider'), + abstract_arg('Provider-shared Key'), + abstract_arg('User Checker'), + service('security.password_hasher'), + ]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.guard', GuardAuthenticationListener::class) + ->abstract() + ->args([ + service('security.authentication.guard_handler'), + service('security.authentication.manager'), + abstract_arg('Provider-shared Key'), + abstract_arg('Authenticators'), + service('logger')->nullOnInvalid(), + param('security.authentication.hide_user_not_found'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/password_hasher.php b/vendor/symfony/security-bundle/Resources/config/password_hasher.php new file mode 100644 index 0000000..50e1be8 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/password_hasher.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher; +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.password_hasher_factory', PasswordHasherFactory::class) + ->args([[]]) + ->alias(PasswordHasherFactoryInterface::class, 'security.password_hasher_factory') + + ->set('security.user_password_hasher', UserPasswordHasher::class) + ->args([service('security.password_hasher_factory')]) + ->alias('security.password_hasher', 'security.user_password_hasher') + ->alias(UserPasswordHasherInterface::class, 'security.password_hasher') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/schema/security-1.0.xsd b/vendor/symfony/security-bundle/Resources/config/schema/security-1.0.xsd new file mode 100644 index 0000000..8f0c1fa --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/schema/security-1.0.xsd @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/security-bundle/Resources/config/security.php b/vendor/symfony/security-bundle/Resources/config/security.php new file mode 100644 index 0000000..9c44adf --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security.php @@ -0,0 +1,293 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\CacheWarmer\ExpressionCacheWarmer; +use Symfony\Bundle\SecurityBundle\EventListener\FirewallListener; +use Symfony\Bundle\SecurityBundle\Security\FirewallConfig; +use Symfony\Bundle\SecurityBundle\Security\FirewallContext; +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Bundle\SecurityBundle\Security\LazyFirewallContext; +use Symfony\Component\Ldap\Security\LdapUserProvider; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; +use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; +use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; +use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; +use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; +use Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter; +use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter; +use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter; +use Symfony\Component\Security\Core\Encoder\EncoderFactory; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder; +use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Component\Security\Core\Role\RoleHierarchy; +use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Core\User\ChainUserProvider; +use Symfony\Component\Security\Core\User\InMemoryUserChecker; +use Symfony\Component\Security\Core\User\InMemoryUserProvider; +use Symfony\Component\Security\Core\User\MissingUserProvider; +use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator; +use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use Symfony\Component\Security\Http\Controller\UserValueResolver; +use Symfony\Component\Security\Http\Firewall; +use Symfony\Component\Security\Http\FirewallMapInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\Impersonate\ImpersonateUrlGenerator; +use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; + +return static function (ContainerConfigurator $container) { + $container->parameters() + ->set('security.role_hierarchy.roles', []) + ; + + $container->services() + ->set('security.authorization_checker', AuthorizationChecker::class) + ->public() + ->args([ + service('security.token_storage'), + service('security.access.decision_manager'), + param('security.access.always_authenticate_before_granting'), + ]) + ->tag('container.private', ['package' => 'symfony/security-bundle', 'version' => '5.3']) + ->alias(AuthorizationCheckerInterface::class, 'security.authorization_checker') + + ->set('security.token_storage', UsageTrackingTokenStorage::class) + ->public() + ->args([ + service('security.untracked_token_storage'), + service_locator([ + 'request_stack' => service('request_stack'), + ]), + ]) + ->tag('kernel.reset', ['method' => 'disableUsageTracking']) + ->tag('kernel.reset', ['method' => 'setToken']) + ->tag('container.private', ['package' => 'symfony/security-bundle', 'version' => '5.3']) + ->alias(TokenStorageInterface::class, 'security.token_storage') + + ->set('security.untracked_token_storage', TokenStorage::class) + + ->set('security.helper', Security::class) + ->args([service_locator([ + 'security.token_storage' => service('security.token_storage'), + 'security.authorization_checker' => service('security.authorization_checker'), + ])]) + ->alias(Security::class, 'security.helper') + + ->set('security.user_value_resolver', UserValueResolver::class) + ->args([ + service('security.token_storage'), + ]) + ->tag('controller.argument_value_resolver', ['priority' => 40]) + + // Authentication related services + ->set('security.authentication.trust_resolver', AuthenticationTrustResolver::class) + + ->set('security.authentication.session_strategy', SessionAuthenticationStrategy::class) + ->args([param('security.authentication.session_strategy.strategy')]) + ->alias(SessionAuthenticationStrategyInterface::class, 'security.authentication.session_strategy') + + ->set('security.authentication.session_strategy_noop', SessionAuthenticationStrategy::class) + ->args(['none']) + + ->set('security.encoder_factory.generic', EncoderFactory::class) + ->args([ + [], + ]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use "security.password_hasher_factory" instead.') + ->alias('security.encoder_factory', 'security.encoder_factory.generic') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" service is deprecated, use "security.password_hasher_factory" instead.') + ->alias(EncoderFactoryInterface::class, 'security.encoder_factory') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" service is deprecated, use "'.PasswordHasherFactoryInterface::class.'" instead.') + + ->set('security.user_password_encoder.generic', UserPasswordEncoder::class) + ->args([service('security.encoder_factory')]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use "security.user_password_hasher" instead.') + ->alias('security.password_encoder', 'security.user_password_encoder.generic') + ->public() + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" service is deprecated, use "security.password_hasher"" instead.') + ->alias(UserPasswordEncoderInterface::class, 'security.password_encoder') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" service is deprecated, use "'.UserPasswordHasherInterface::class.'" instead.') + + ->set('security.user_checker', InMemoryUserChecker::class) + + ->set('security.expression_language', ExpressionLanguage::class) + ->args([service('cache.security_expression_language')->nullOnInvalid()]) + + ->set('security.authentication_utils', AuthenticationUtils::class) + ->args([service('request_stack')]) + ->alias(AuthenticationUtils::class, 'security.authentication_utils') + + // Authorization related services + ->set('security.access.decision_manager', AccessDecisionManager::class) + ->args([[]]) + ->alias(AccessDecisionManagerInterface::class, 'security.access.decision_manager') + + ->set('security.role_hierarchy', RoleHierarchy::class) + ->args([param('security.role_hierarchy.roles')]) + ->alias(RoleHierarchyInterface::class, 'security.role_hierarchy') + + // Security Voters + ->set('security.access.simple_role_voter', RoleVoter::class) + ->tag('security.voter', ['priority' => 245]) + + ->set('security.access.authenticated_voter', AuthenticatedVoter::class) + ->args([service('security.authentication.trust_resolver')]) + ->tag('security.voter', ['priority' => 250]) + + ->set('security.access.role_hierarchy_voter', RoleHierarchyVoter::class) + ->args([service('security.role_hierarchy')]) + ->tag('security.voter', ['priority' => 245]) + + ->set('security.access.expression_voter', ExpressionVoter::class) + ->args([ + service('security.expression_language'), + service('security.authentication.trust_resolver'), + service('security.authorization_checker'), + service('security.role_hierarchy')->nullOnInvalid(), + ]) + ->tag('security.voter', ['priority' => 245]) + + ->set('security.impersonate_url_generator', ImpersonateUrlGenerator::class) + ->args([ + service('request_stack'), + service('security.firewall.map'), + service('security.token_storage'), + ]) + + // Firewall related services + ->set('security.firewall', FirewallListener::class) + ->args([ + service('security.firewall.map'), + service('event_dispatcher'), + service('security.logout_url_generator'), + ]) + ->tag('kernel.event_subscriber') + ->alias(Firewall::class, 'security.firewall') + + ->set('security.firewall.map', FirewallMap::class) + ->args([ + abstract_arg('Firewall context locator'), + abstract_arg('Request matchers'), + ]) + ->alias(FirewallMapInterface::class, 'security.firewall.map') + + ->set('security.firewall.context', FirewallContext::class) + ->abstract() + ->args([ + [], + service('security.exception_listener'), + abstract_arg('LogoutListener'), + abstract_arg('FirewallConfig'), + ]) + + ->set('security.firewall.lazy_context', LazyFirewallContext::class) + ->abstract() + ->args([ + [], + service('security.exception_listener'), + abstract_arg('LogoutListener'), + abstract_arg('FirewallConfig'), + service('security.untracked_token_storage'), + ]) + + ->set('security.firewall.config', FirewallConfig::class) + ->abstract() + ->args([ + abstract_arg('name'), + abstract_arg('user_checker'), + abstract_arg('request_matcher'), + false, // security enabled + false, // stateless + null, + null, + null, + null, + null, + [], // listeners + null, // switch_user + ]) + + ->set('security.logout_url_generator', LogoutUrlGenerator::class) + ->args([ + service('request_stack')->nullOnInvalid(), + service('router')->nullOnInvalid(), + service('security.token_storage')->nullOnInvalid(), + ]) + + // Provisioning + ->set('security.user.provider.missing', MissingUserProvider::class) + ->abstract() + ->args([ + abstract_arg('firewall'), + ]) + + ->set('security.user.provider.in_memory', InMemoryUserProvider::class) + ->abstract() + + ->set('security.user.provider.ldap', LdapUserProvider::class) + ->abstract() + ->args([ + abstract_arg('security.ldap.ldap'), + abstract_arg('base dn'), + abstract_arg('search dn'), + abstract_arg('search password'), + abstract_arg('default_roles'), + abstract_arg('uid key'), + abstract_arg('filter'), + abstract_arg('password_attribute'), + abstract_arg('extra_fields (email etc)'), + ]) + + ->set('security.user.provider.chain', ChainUserProvider::class) + ->abstract() + + ->set('security.http_utils', HttpUtils::class) + ->args([ + service('router')->nullOnInvalid(), + service('router')->nullOnInvalid(), + ]) + ->alias(HttpUtils::class, 'security.http_utils') + + // Validator + ->set('security.validator.user_password', UserPasswordValidator::class) + ->args([ + service('security.token_storage'), + service('security.password_hasher_factory'), + ]) + ->tag('validator.constraint_validator', ['alias' => 'security.validator.user_password']) + + // Cache + ->set('cache.security_expression_language') + ->parent('cache.system') + ->private() + ->tag('cache.pool') + + // Cache Warmers + ->set('security.cache_warmer.expression', ExpressionCacheWarmer::class) + ->args([ + [], + service('security.expression_language'), + ]) + ->tag('kernel.cache_warmer') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_authenticator.php b/vendor/symfony/security-bundle/Resources/config/security_authenticator.php new file mode 100644 index 0000000..fd83cd3 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_authenticator.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\Security\UserAuthenticator; +use Symfony\Component\DependencyInjection\ServiceLocator; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticatorManager; +use Symfony\Component\Security\Http\Authentication\NoopAuthenticationManager; +use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator; +use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator; +use Symfony\Component\Security\Http\Authenticator\JsonLoginAuthenticator; +use Symfony\Component\Security\Http\Authenticator\RemoteUserAuthenticator; +use Symfony\Component\Security\Http\Authenticator\X509Authenticator; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; +use Symfony\Component\Security\Http\EventListener\CheckCredentialsListener; +use Symfony\Component\Security\Http\EventListener\LoginThrottlingListener; +use Symfony\Component\Security\Http\EventListener\PasswordMigratingListener; +use Symfony\Component\Security\Http\EventListener\SessionStrategyListener; +use Symfony\Component\Security\Http\EventListener\UserCheckerListener; +use Symfony\Component\Security\Http\EventListener\UserProviderListener; +use Symfony\Component\Security\Http\Firewall\AuthenticatorManagerListener; + +return static function (ContainerConfigurator $container) { + $container->services() + + // Manager + ->set('security.authenticator.manager', AuthenticatorManager::class) + ->abstract() + ->args([ + abstract_arg('authenticators'), + service('security.token_storage'), + service('event_dispatcher'), + abstract_arg('provider key'), + service('logger')->nullOnInvalid(), + param('security.authentication.manager.erase_credentials'), + param('security.authentication.hide_user_not_found'), + abstract_arg('required badges'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.managers_locator', ServiceLocator::class) + ->args([[]]) + + ->set('security.user_authenticator', UserAuthenticator::class) + ->args([ + service('security.firewall.map'), + service('security.authenticator.managers_locator'), + service('request_stack'), + ]) + ->alias(UserAuthenticatorInterface::class, 'security.user_authenticator') + + ->set('security.authentication.manager', NoopAuthenticationManager::class) + ->alias(AuthenticationManagerInterface::class, 'security.authentication.manager') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use the new authenticator system instead.') + + ->set('security.firewall.authenticator', AuthenticatorManagerListener::class) + ->abstract() + ->args([ + abstract_arg('authenticator manager'), + ]) + + // Listeners + ->set('security.listener.check_authenticator_credentials', CheckCredentialsListener::class) + ->args([ + service('security.password_hasher_factory'), + ]) + ->tag('kernel.event_subscriber') + + ->set('security.listener.user_provider', UserProviderListener::class) + ->args([ + service('security.user_providers'), + ]) + ->tag('kernel.event_listener', ['event' => CheckPassportEvent::class, 'priority' => 1024, 'method' => 'checkPassport']) + + ->set('security.listener.user_provider.abstract', UserProviderListener::class) + ->abstract() + ->args([ + abstract_arg('user provider'), + ]) + + ->set('security.listener.password_migrating', PasswordMigratingListener::class) + ->args([ + service('security.password_hasher_factory'), + ]) + ->tag('kernel.event_subscriber') + + ->set('security.listener.user_checker', UserCheckerListener::class) + ->abstract() + ->args([ + abstract_arg('user checker'), + ]) + + ->set('security.listener.session', SessionStrategyListener::class) + ->abstract() + ->args([ + service('security.authentication.session_strategy'), + ]) + + ->set('security.listener.login_throttling', LoginThrottlingListener::class) + ->abstract() + ->args([ + service('request_stack'), + abstract_arg('request rate limiter'), + ]) + + // Authenticators + ->set('security.authenticator.http_basic', HttpBasicAuthenticator::class) + ->abstract() + ->args([ + abstract_arg('realm name'), + abstract_arg('user provider'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.form_login', FormLoginAuthenticator::class) + ->abstract() + ->args([ + service('security.http_utils'), + abstract_arg('user provider'), + abstract_arg('authentication success handler'), + abstract_arg('authentication failure handler'), + abstract_arg('options'), + ]) + + ->set('security.authenticator.json_login', JsonLoginAuthenticator::class) + ->abstract() + ->args([ + service('security.http_utils'), + abstract_arg('user provider'), + abstract_arg('authentication success handler'), + abstract_arg('authentication failure handler'), + abstract_arg('options'), + service('property_accessor')->nullOnInvalid(), + ]) + ->call('setTranslator', [service('translator')->ignoreOnInvalid()]) + + ->set('security.authenticator.x509', X509Authenticator::class) + ->abstract() + ->args([ + abstract_arg('user provider'), + service('security.token_storage'), + abstract_arg('firewall name'), + abstract_arg('user key'), + abstract_arg('credentials key'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.remote_user', RemoteUserAuthenticator::class) + ->abstract() + ->args([ + abstract_arg('user provider'), + service('security.token_storage'), + abstract_arg('firewall name'), + abstract_arg('user key'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_authenticator_login_link.php b/vendor/symfony/security-bundle/Resources/config/security_authenticator_login_link.php new file mode 100644 index 0000000..9a46a09 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_authenticator_login_link.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\LoginLink\FirewallAwareLoginLinkHandler; +use Symfony\Component\Security\Core\Signature\ExpiredSignatureStorage; +use Symfony\Component\Security\Core\Signature\SignatureHasher; +use Symfony\Component\Security\Http\Authenticator\LoginLinkAuthenticator; +use Symfony\Component\Security\Http\LoginLink\LoginLinkHandler; +use Symfony\Component\Security\Http\LoginLink\LoginLinkHandlerInterface; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.authenticator.login_link', LoginLinkAuthenticator::class) + ->abstract() + ->args([ + abstract_arg('the login link handler instance'), + service('security.http_utils'), + abstract_arg('authentication success handler'), + abstract_arg('authentication failure handler'), + abstract_arg('options'), + ]) + + ->set('security.authenticator.abstract_login_link_handler', LoginLinkHandler::class) + ->abstract() + ->args([ + service('router'), + abstract_arg('user provider'), + abstract_arg('signature hasher'), + abstract_arg('options'), + ]) + + ->set('security.authenticator.abstract_login_link_signature_hasher', SignatureHasher::class) + ->args([ + service('property_accessor'), + abstract_arg('signature properties'), + '%kernel.secret%', + abstract_arg('expired signature storage'), + abstract_arg('max signature uses'), + ]) + + ->set('security.authenticator.expired_login_link_storage', ExpiredSignatureStorage::class) + ->abstract() + ->args([ + abstract_arg('cache pool service'), + abstract_arg('expired login link storage'), + ]) + + ->set('security.authenticator.cache.expired_links') + ->parent('cache.app') + ->private() + + ->set('security.authenticator.firewall_aware_login_link_handler', FirewallAwareLoginLinkHandler::class) + ->args([ + service('security.firewall.map'), + tagged_locator('security.authenticator.login_linker', 'firewall'), + service('request_stack'), + ]) + ->alias(LoginLinkHandlerInterface::class, 'security.authenticator.firewall_aware_login_link_handler') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_authenticator_remember_me.php b/vendor/symfony/security-bundle/Resources/config/security_authenticator_remember_me.php new file mode 100644 index 0000000..13c8f5e --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_authenticator_remember_me.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\RememberMe\FirewallAwareRememberMeHandler; +use Symfony\Component\Security\Core\Signature\SignatureHasher; +use Symfony\Component\Security\Http\Authenticator\RememberMeAuthenticator; +use Symfony\Component\Security\Http\EventListener\CheckRememberMeConditionsListener; +use Symfony\Component\Security\Http\EventListener\RememberMeListener; +use Symfony\Component\Security\Http\RememberMe\PersistentRememberMeHandler; +use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface; +use Symfony\Component\Security\Http\RememberMe\SignatureRememberMeHandler; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.authenticator.remember_me_signature_hasher', SignatureHasher::class) + ->args([ + service('property_accessor'), + abstract_arg('signature properties'), + '%kernel.secret%', + null, + null, + ]) + + ->set('security.authenticator.signature_remember_me_handler', SignatureRememberMeHandler::class) + ->abstract() + ->args([ + abstract_arg('signature hasher'), + abstract_arg('user provider'), + service('request_stack'), + abstract_arg('options'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.persistent_remember_me_handler', PersistentRememberMeHandler::class) + ->abstract() + ->args([ + abstract_arg('token provider'), + param('kernel.secret'), + abstract_arg('user provider'), + service('request_stack'), + abstract_arg('options'), + service('logger')->nullOnInvalid(), + abstract_arg('token verifier'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.firewall_aware_remember_me_handler', FirewallAwareRememberMeHandler::class) + ->args([ + service('security.firewall.map'), + tagged_locator('security.remember_me_handler', 'firewall'), + service('request_stack'), + ]) + ->alias(RememberMeHandlerInterface::class, 'security.authenticator.firewall_aware_remember_me_handler') + + ->set('security.listener.check_remember_me_conditions', CheckRememberMeConditionsListener::class) + ->abstract() + ->args([ + abstract_arg('options'), + service('logger')->nullOnInvalid(), + ]) + + ->set('security.listener.remember_me', RememberMeListener::class) + ->abstract() + ->args([ + abstract_arg('remember me handler'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authenticator.remember_me', RememberMeAuthenticator::class) + ->abstract() + ->args([ + abstract_arg('remember me handler'), + param('kernel.secret'), + service('security.token_storage'), + abstract_arg('options'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + // Cache + ->set('cache.security_token_verifier') + ->parent('cache.system') + ->private() + ->tag('cache.pool') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_debug.php b/vendor/symfony/security-bundle/Resources/config/security_debug.php new file mode 100644 index 0000000..dc668b1 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_debug.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener; +use Symfony\Bundle\SecurityBundle\EventListener\VoteListener; +use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('debug.security.access.decision_manager', TraceableAccessDecisionManager::class) + ->decorate('security.access.decision_manager') + ->args([ + service('debug.security.access.decision_manager.inner'), + ]) + + ->set('debug.security.voter.vote_listener', VoteListener::class) + ->args([ + service('debug.security.access.decision_manager'), + ]) + ->tag('kernel.event_subscriber') + + ->set('debug.security.firewall', TraceableFirewallListener::class) + ->args([ + service('security.firewall.map'), + service('event_dispatcher'), + service('security.logout_url_generator'), + ]) + ->tag('kernel.event_subscriber') + ->alias('security.firewall', 'debug.security.firewall') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_legacy.php b/vendor/symfony/security-bundle/Resources/config/security_legacy.php new file mode 100644 index 0000000..ec829ea --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_legacy.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager; +use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider; +use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider; +use Symfony\Component\Security\Core\Authentication\Provider\LdapBindAuthenticationProvider; +use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider; +use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener; +use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener; +use Symfony\Component\Security\Http\Firewall\RemoteUserAuthenticationListener; +use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener; +use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener; +use Symfony\Component\Security\Http\Firewall\X509AuthenticationListener; + +return static function (ContainerConfigurator $container) { + $container->services() + + // Authentication related services + ->set('security.authentication.manager', AuthenticationProviderManager::class) + ->args([ + abstract_arg('providers'), + param('security.authentication.manager.erase_credentials'), + ]) + ->call('setEventDispatcher', [service('event_dispatcher')]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + ->alias(AuthenticationManagerInterface::class, 'security.authentication.manager') + ->deprecate('symfony/security-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.anonymous', AnonymousAuthenticationListener::class) + ->args([ + service('security.untracked_token_storage'), + abstract_arg('Key'), + service('logger')->nullOnInvalid(), + service('security.authentication.manager'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.anonymous', AnonymousAuthenticationProvider::class) + ->args([abstract_arg('Key')]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.form', UsernamePasswordFormAuthenticationListener::class) + ->parent('security.authentication.listener.abstract') + ->abstract() + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.x509', X509AuthenticationListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.manager'), + abstract_arg('Provider-shared Key'), + abstract_arg('x509 user'), + abstract_arg('x509 credentials'), + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.json', UsernamePasswordJsonAuthenticationListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.manager'), + service('security.http_utils'), + abstract_arg('Provider-shared Key'), + abstract_arg('Failure handler'), + abstract_arg('Success Handler'), + [], // Options + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + service('property_accessor')->nullOnInvalid(), + ]) + ->call('setTranslator', [service('translator')->ignoreOnInvalid()]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.remote_user', RemoteUserAuthenticationListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.manager'), + abstract_arg('Provider-shared Key'), + abstract_arg('REMOTE_USER server env var'), + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.listener.basic', BasicAuthenticationListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.manager'), + abstract_arg('Provider-shared Key'), + abstract_arg('Entry Point'), + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.dao', DaoAuthenticationProvider::class) + ->abstract() + ->args([ + abstract_arg('User Provider'), + abstract_arg('User Checker'), + abstract_arg('Provider-shared Key'), + service('security.password_hasher_factory'), + param('security.authentication.hide_user_not_found'), + ]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.ldap_bind', LdapBindAuthenticationProvider::class) + ->abstract() + ->args([ + abstract_arg('User Provider'), + abstract_arg('UserChecker'), + abstract_arg('Provider-shared Key'), + abstract_arg('LDAP'), + abstract_arg('Base DN'), + param('security.authentication.hide_user_not_found'), + abstract_arg('search dn'), + abstract_arg('search password'), + ]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.pre_authenticated', PreAuthenticatedAuthenticationProvider::class) + ->abstract() + ->args([ + abstract_arg('User Provider'), + abstract_arg('UserChecker'), + ]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_listeners.php b/vendor/symfony/security-bundle/Resources/config/security_listeners.php new file mode 100644 index 0000000..72129d1 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_listeners.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\Security\Http\AccessMap; +use Symfony\Component\Security\Http\Authentication\CustomAuthenticationFailureHandler; +use Symfony\Component\Security\Http\Authentication\CustomAuthenticationSuccessHandler; +use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler; +use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; +use Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint; +use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint; +use Symfony\Component\Security\Http\EntryPoint\RetryAuthenticationEntryPoint; +use Symfony\Component\Security\Http\EventListener\CookieClearingLogoutListener; +use Symfony\Component\Security\Http\EventListener\DefaultLogoutListener; +use Symfony\Component\Security\Http\EventListener\SessionLogoutListener; +use Symfony\Component\Security\Http\Firewall\AccessListener; +use Symfony\Component\Security\Http\Firewall\ChannelListener; +use Symfony\Component\Security\Http\Firewall\ContextListener; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\LogoutListener; +use Symfony\Component\Security\Http\Firewall\SwitchUserListener; + +return static function (ContainerConfigurator $container) { + $container->services() + + ->set('security.authentication.basic_entry_point', BasicAuthenticationEntryPoint::class) + ->deprecate('symfony/security-bundle', '5.4', 'The "%service_id%" service is deprecated, the logic is contained in the authenticators.') + + ->set('security.authentication.retry_entry_point', RetryAuthenticationEntryPoint::class) + ->deprecate('symfony/security-bundle', '5.4', 'The "%service_id%" service is deprecated, the logic is integrated directly in "security.channel_listener".') + ->args([ + inline_service('int')->factory([service('router.request_context'), 'getHttpPort']), + inline_service('int')->factory([service('router.request_context'), 'getHttpsPort']), + ]) + + ->set('security.channel_listener', ChannelListener::class) + ->args([ + service('security.access_map'), + service('logger')->nullOnInvalid(), + inline_service('int')->factory([service('router.request_context'), 'getHttpPort']), + inline_service('int')->factory([service('router.request_context'), 'getHttpsPort']), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.access_map', AccessMap::class) + + ->set('security.context_listener', ContextListener::class) + ->args([ + service('security.untracked_token_storage'), + [], + abstract_arg('Provider Key'), + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + service('security.authentication.trust_resolver'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.logout_listener', LogoutListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.http_utils'), + abstract_arg('event dispatcher'), + [], // Options + ]) + + ->set('security.logout.listener.session', SessionLogoutListener::class) + ->abstract() + + ->set('security.logout.listener.cookie_clearing', CookieClearingLogoutListener::class) + ->abstract() + + ->set('security.logout.listener.default', DefaultLogoutListener::class) + ->abstract() + ->args([ + service('security.http_utils'), + abstract_arg('target url'), + ]) + + ->set('security.authentication.form_entry_point', FormAuthenticationEntryPoint::class) + ->abstract() + ->args([ + service('http_kernel'), + ]) + + ->set('security.authentication.listener.abstract') + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.manager'), + service('security.authentication.session_strategy'), + service('security.http_utils'), + abstract_arg('Provider-shared Key'), + service('security.authentication.success_handler'), + service('security.authentication.failure_handler'), + [], + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authentication.custom_success_handler', CustomAuthenticationSuccessHandler::class) + ->abstract() + ->args([ + abstract_arg('The custom success handler service'), + [], // Options + abstract_arg('Provider-shared Key'), + ]) + + ->set('security.authentication.success_handler', DefaultAuthenticationSuccessHandler::class) + ->abstract() + ->args([ + service('security.http_utils'), + [], // Options + ]) + + ->set('security.authentication.custom_failure_handler', CustomAuthenticationFailureHandler::class) + ->abstract() + ->args([ + abstract_arg('The custom failure handler service'), + [], // Options + ]) + + ->set('security.authentication.failure_handler', DefaultAuthenticationFailureHandler::class) + ->abstract() + ->args([ + service('http_kernel'), + service('security.http_utils'), + [], // Options + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.exception_listener', ExceptionListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + service('security.authentication.trust_resolver'), + service('security.http_utils'), + abstract_arg('Provider-shared Key'), + service('security.authentication.entry_point')->nullOnInvalid(), + param('security.access.denied_url'), + service('security.access.denied_handler')->nullOnInvalid(), + service('logger')->nullOnInvalid(), + false, // Stateless + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authentication.switchuser_listener', SwitchUserListener::class) + ->abstract() + ->args([ + service('security.token_storage'), + abstract_arg('User Provider'), + abstract_arg('User Checker'), + abstract_arg('Provider Key'), + service('security.access.decision_manager'), + service('logger')->nullOnInvalid(), + '_switch_user', + 'ROLE_ALLOWED_TO_SWITCH', + service('event_dispatcher')->nullOnInvalid(), + false, // Stateless + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.access_listener', AccessListener::class) + ->args([ + service('security.token_storage'), + service('security.access.decision_manager'), + service('security.access_map'), + service('security.authentication.manager'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/security_rememberme.php b/vendor/symfony/security-bundle/Resources/config/security_rememberme.php new file mode 100644 index 0000000..1c0e355 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/security_rememberme.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider; +use Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider; +use Symfony\Component\Security\Http\Firewall\RememberMeListener; +use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices; +use Symfony\Component\Security\Http\RememberMe\ResponseListener; +use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('security.authentication.listener.rememberme', RememberMeListener::class) + ->abstract() + ->args([ + service('security.untracked_token_storage'), + service('security.authentication.rememberme'), + service('security.authentication.manager'), + service('logger')->nullOnInvalid(), + service('event_dispatcher')->nullOnInvalid(), + abstract_arg('Catch exception flag set in RememberMeFactory'), + service('security.authentication.session_strategy'), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.authentication.provider.rememberme', RememberMeAuthenticationProvider::class) + ->abstract() + ->args([abstract_arg('User Checker')]) + ->deprecate('symfony/security-bundle', '5.3', 'The "%service_id%" service is deprecated, use the new authenticator system instead.') + + ->set('security.rememberme.token.provider.in_memory', InMemoryTokenProvider::class) + + ->set('security.authentication.rememberme.services.abstract') + ->abstract() + ->args([ + [], // User Providers + abstract_arg('Shared Token Key'), + abstract_arg('Shared Provider Key'), + [], // Options + service('logger')->nullOnInvalid(), + ]) + ->tag('monolog.logger', ['channel' => 'security']) + + ->set('security.authentication.rememberme.services.persistent', PersistentTokenBasedRememberMeServices::class) + ->parent('security.authentication.rememberme.services.abstract') + ->abstract() + + ->set('security.authentication.rememberme.services.simplehash', TokenBasedRememberMeServices::class) + ->parent('security.authentication.rememberme.services.abstract') + ->abstract() + + ->set('security.rememberme.response_listener', ResponseListener::class) + ->tag('kernel.event_subscriber') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/config/templating_twig.php b/vendor/symfony/security-bundle/Resources/config/templating_twig.php new file mode 100644 index 0000000..05a74d0 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/config/templating_twig.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bridge\Twig\Extension\LogoutUrlExtension; +use Symfony\Bridge\Twig\Extension\SecurityExtension; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('twig.extension.logout_url', LogoutUrlExtension::class) + ->args([ + service('security.logout_url_generator'), + ]) + ->tag('twig.extension') + + ->set('twig.extension.security', SecurityExtension::class) + ->args([ + service('security.authorization_checker')->ignoreOnInvalid(), + service('security.impersonate_url_generator')->ignoreOnInvalid(), + ]) + ->tag('twig.extension') + ; +}; diff --git a/vendor/symfony/security-bundle/Resources/views/Collector/icon.svg b/vendor/symfony/security-bundle/Resources/views/Collector/icon.svg new file mode 100644 index 0000000..1110c10 --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/views/Collector/icon.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/security-bundle/Resources/views/Collector/security.html.twig b/vendor/symfony/security-bundle/Resources/views/Collector/security.html.twig new file mode 100644 index 0000000..91e75ce --- /dev/null +++ b/vendor/symfony/security-bundle/Resources/views/Collector/security.html.twig @@ -0,0 +1,441 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block page_title 'Security' %} + +{% block toolbar %} + {% if collector.firewall %} + {% set color_code = collector.enabled and not collector.authenticatorManagerEnabled ? 'yellow' %} + {% set icon %} + {{ include('@Security/Collector/icon.svg') }} + {{ collector.user|default('n/a') }} + {% endset %} + + {% set text %} + {% if collector.impersonated %} +
+
+ Impersonator + {{ collector.impersonatorUser }} +
+
+ {% endif %} + +
+ {% if collector.enabled %} + {% if collector.token %} +
+ Logged in as + {{ collector.user }} +
+ +
+ Authenticated + {{ collector.authenticated ? 'Yes' : 'No' }} +
+ +
+ Roles + + {% set remainingRoles = collector.roles|slice(1) %} + {{ collector.roles|first }} + {% if remainingRoles is not empty %} + + + + {{ remainingRoles|length }} more + + {% endif %} + +
+ +
+ Token class + {{ collector.tokenClass|abbr_class }} +
+ {% else %} +
+ Authenticated + No +
+ {% endif %} + + {% if collector.firewall %} +
+ Firewall name + {{ collector.firewall.name }} +
+ {% endif %} + + {% if collector.token and collector.logoutUrl %} +
+ Actions + + Logout + {% if collector.impersonated and collector.impersonationExitPath %} + | Exit impersonation + {% endif %} + +
+ {% endif %} + {% else %} +
+ The security is disabled. +
+ {% endif %} +
+ {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: color_code }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@Security/Collector/icon.svg') }} + Security + +{% endblock %} + +{% block panel %} +

Security

+ {% if collector.enabled %} +
+
+

Token

+ +
+ {% if collector.token %} +
+
+ {{ collector.user == 'anon.' ? 'Anonymous' : collector.user }} + Username +
+ +
+ {{ include('@WebProfiler/Icon/' ~ (collector.authenticated ? 'yes' : 'no') ~ '.svg') }} + Authenticated +
+
+ + + + + + + + + + + + + + + {% if collector.supportsRoleHierarchy %} + + + + + {% endif %} + + {% if collector.token %} + + + + + {% endif %} + +
PropertyValue
Roles + {{ collector.roles is empty ? 'none' : profiler_dump(collector.roles, maxDepth=1) }} + + {% if not collector.authenticated and collector.roles is empty %} +

User is not authenticated probably because they have no roles.

+ {% endif %} +
Inherited Roles{{ collector.inheritedRoles is empty ? 'none' : profiler_dump(collector.inheritedRoles, maxDepth=1) }}
Token{{ profiler_dump(collector.token) }}
+ {% elseif collector.enabled %} +
+

There is no security token.

+
+ {% endif %} +
+
+ +
+

Firewall

+
+ {% if collector.firewall %} +
+
+ {{ collector.firewall.name }} + Name +
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.firewall.security_enabled ? 'yes' : 'no') ~ '.svg') }} + Security enabled +
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.firewall.stateless ? 'yes' : 'no') ~ '.svg') }} + Stateless +
+ {% if collector.authenticatorManagerEnabled == false %} +
+ {{ include('@WebProfiler/Icon/' ~ (collector.firewall.allows_anonymous ? 'yes' : 'no') ~ '.svg') }} + Allows anonymous +
+ {% endif %} +
+ + {% if collector.firewall.security_enabled %} +

Configuration

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if collector.authenticatorManagerEnabled %} + + + + + {% else %} + + + + + {% endif %} + +
KeyValue
provider{{ collector.firewall.provider ?: '(none)' }}
context{{ collector.firewall.context ?: '(none)' }}
entry_point{{ collector.firewall.entry_point ?: '(none)' }}
user_checker{{ collector.firewall.user_checker ?: '(none)' }}
access_denied_handler{{ collector.firewall.access_denied_handler ?: '(none)' }}
access_denied_url{{ collector.firewall.access_denied_url ?: '(none)' }}
authenticators{{ collector.firewall.authenticators is empty ? '(none)' : profiler_dump(collector.firewall.authenticators, maxDepth=1) }}
listeners{{ collector.firewall.listeners is empty ? '(none)' : profiler_dump(collector.firewall.listeners, maxDepth=1) }}
+ {% endif %} + {% endif %} +
+
+ +
+

Listeners

+
+ {% if collector.listeners|default([]) is empty %} +
+

No security listeners have been recorded. Check that debugging is enabled in the kernel.

+
+ {% else %} + + + + + + + + + + {% set previous_event = (collector.listeners|first) %} + {% for listener in collector.listeners %} + {% if loop.first or listener != previous_event %} + {% if not loop.first %} + + {% endif %} + + + {% set previous_event = listener %} + {% endif %} + + + + + + + + {% if loop.last %} + + {% endif %} + {% endfor %} +
ListenerDurationResponse
{{ profiler_dump(listener.stub) }}{{ '%0.2f'|format(listener.time * 1000) }} ms{{ listener.response ? profiler_dump(listener.response) : '(none)' }}
+ {% endif %} +
+
+ +
+

Authenticators

+
+ {% if collector.authenticators|default([]) is not empty %} + + + + + + + + + + + {% set previous_event = (collector.listeners|first) %} + {% for authenticator in collector.authenticators %} + {% if loop.first or authenticator != previous_event %} + {% if not loop.first %} + + {% endif %} + + + {% set previous_event = authenticator %} + {% endif %} + + + + + + + + + {% if loop.last %} + + {% endif %} + {% endfor %} +
AuthenticatorSupportsDurationPassport
{{ profiler_dump(authenticator.stub) }}{{ include('@WebProfiler/Icon/' ~ (authenticator.supports ? 'yes' : 'no') ~ '.svg') }}{{ '%0.2f'|format(authenticator.duration * 1000) }} ms{{ authenticator.passport ? profiler_dump(authenticator.passport) : '(none)' }}
+ {% else %} +
+

No authenticators have been recorded. Check previous profiles on your authentication endpoint.

+
+ {% endif %} +
+
+ +
+

Access Decision

+
+ {% if collector.voters|default([]) is not empty %} +
+
+ {{ collector.voterStrategy|default('unknown') }} + Strategy +
+
+ + + + + + + + + + + {% for voter in collector.voters %} + + + + + {% endfor %} + +
#Voter class
{{ loop.index }}{{ profiler_dump(voter) }}
+ {% endif %} + {% if collector.accessDecisionLog|default([]) is not empty %} +

Access decision log

+ + + + + + + + + + + + + + + + + + {% for decision in collector.accessDecisionLog %} + + + + + + + + + + + {% endfor %} + +
#ResultAttributesObject
{{ loop.index }} + {{ decision.result + ? 'GRANTED' + : 'DENIED' + }} + + {% if decision.attributes|length == 1 %} + {% set attribute = decision.attributes|first %} + {% if attribute.expression is defined %} + Expression:
{{ attribute.expression }}
+ {% elseif attribute.type == 'string' %} + {{ attribute }} + {% else %} + {{ profiler_dump(attribute) }} + {% endif %} + {% else %} + {{ profiler_dump(decision.attributes) }} + {% endif %} +
{{ profiler_dump(decision.seek('object')) }}
+ {% if decision.voter_details is not empty %} + {% set voter_details_id = 'voter-details-' ~ loop.index %} +
+ + + {% for voter_detail in decision.voter_details %} + + + {% if collector.voterStrategy == 'unanimous' %} + + {% endif %} + + + {% endfor %} + +
{{ profiler_dump(voter_detail['class']) }}attribute {{ voter_detail['attributes'][0] }} + {% if voter_detail['vote'] == constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::ACCESS_GRANTED') %} + ACCESS GRANTED + {% elseif voter_detail['vote'] == constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::ACCESS_ABSTAIN') %} + ACCESS ABSTAIN + {% elseif voter_detail['vote'] == constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::ACCESS_DENIED') %} + ACCESS DENIED + {% else %} + unknown ({{ voter_detail['vote'] }}) + {% endif %} +
+
+ Show voter details + {% endif %} +
+
+ {% endif %} +
+
+ {% endif %} +{% endblock %} diff --git a/vendor/symfony/security-bundle/Security/FirewallAwareTrait.php b/vendor/symfony/security-bundle/Security/FirewallAwareTrait.php new file mode 100644 index 0000000..d79d0b7 --- /dev/null +++ b/vendor/symfony/security-bundle/Security/FirewallAwareTrait.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +/** + * Provides basic functionality for services mapped by the firewall name + * in a container locator. + * + * @author Wouter de Jong + * + * @internal + */ +trait FirewallAwareTrait +{ + private $locator; + private $requestStack; + private $firewallMap; + + private function getForFirewall(): object + { + $serviceIdentifier = str_replace('FirewallAware', '', static::class); + if (null === $request = $this->requestStack->getCurrentRequest()) { + throw new \LogicException('Cannot determine the correct '.$serviceIdentifier.' to use: there is no active Request and so, the firewall cannot be determined. Try using a specific '.$serviceIdentifier.' service.'); + } + + $firewall = $this->firewallMap->getFirewallConfig($request); + if (!$firewall) { + throw new \LogicException('No '.$serviceIdentifier.' found as the current route is not covered by a firewall.'); + } + + $firewallName = $firewall->getName(); + if (!$this->locator->has($firewallName)) { + $message = 'No '.$serviceIdentifier.' found for this firewall.'; + if (\defined(static::class.'::FIREWALL_OPTION')) { + $message .= sprintf('Did you forget to add a "'.static::FIREWALL_OPTION.'" key under your "%s" firewall?', $firewallName); + } + + throw new \LogicException($message); + } + + return $this->locator->get($firewallName); + } +} diff --git a/vendor/symfony/security-bundle/Security/FirewallConfig.php b/vendor/symfony/security-bundle/Security/FirewallConfig.php new file mode 100644 index 0000000..4b361ff --- /dev/null +++ b/vendor/symfony/security-bundle/Security/FirewallConfig.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +/** + * @author Robin Chalas + */ +final class FirewallConfig +{ + private $name; + private $userChecker; + private $requestMatcher; + private $securityEnabled; + private $stateless; + private $provider; + private $context; + private $entryPoint; + private $accessDeniedHandler; + private $accessDeniedUrl; + private $authenticators; + private $switchUser; + + public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $authenticators = [], array $switchUser = null) + { + $this->name = $name; + $this->userChecker = $userChecker; + $this->requestMatcher = $requestMatcher; + $this->securityEnabled = $securityEnabled; + $this->stateless = $stateless; + $this->provider = $provider; + $this->context = $context; + $this->entryPoint = $entryPoint; + $this->accessDeniedHandler = $accessDeniedHandler; + $this->accessDeniedUrl = $accessDeniedUrl; + $this->authenticators = $authenticators; + $this->switchUser = $switchUser; + } + + public function getName(): string + { + return $this->name; + } + + /** + * @return string|null The request matcher service id or null if neither the request matcher, pattern or host + * options were provided + */ + public function getRequestMatcher(): ?string + { + return $this->requestMatcher; + } + + public function isSecurityEnabled(): bool + { + return $this->securityEnabled; + } + + /** + * @deprecated since Symfony 5.4 + */ + public function allowsAnonymous(): bool + { + trigger_deprecation('symfony/security-bundle', '5.4', 'The "%s()" method is deprecated.', __METHOD__); + + return \in_array('anonymous', $this->authenticators, true); + } + + public function isStateless(): bool + { + return $this->stateless; + } + + public function getProvider(): ?string + { + return $this->provider; + } + + /** + * @return string|null The context key (will be null if the firewall is stateless) + */ + public function getContext(): ?string + { + return $this->context; + } + + public function getEntryPoint(): ?string + { + return $this->entryPoint; + } + + public function getUserChecker(): string + { + return $this->userChecker; + } + + public function getAccessDeniedHandler(): ?string + { + return $this->accessDeniedHandler; + } + + public function getAccessDeniedUrl(): ?string + { + return $this->accessDeniedUrl; + } + + /** + * @deprecated since Symfony 5.4, use {@see getAuthenticators()} instead + */ + public function getListeners(): array + { + trigger_deprecation('symfony/security-bundle', '5.4', 'Method "%s()" is deprecated, use "%s::getAuthenticators()" instead.', __METHOD__, __CLASS__); + + return $this->getAuthenticators(); + } + + public function getAuthenticators(): array + { + return $this->authenticators; + } + + public function getSwitchUser(): ?array + { + return $this->switchUser; + } +} diff --git a/vendor/symfony/security-bundle/Security/FirewallContext.php b/vendor/symfony/security-bundle/Security/FirewallContext.php new file mode 100644 index 0000000..4ebc9c7 --- /dev/null +++ b/vendor/symfony/security-bundle/Security/FirewallContext.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\LogoutListener; + +/** + * This is a wrapper around the actual firewall configuration which allows us + * to lazy load the context for one specific firewall only when we need it. + * + * @author Johannes M. Schmitt + */ +class FirewallContext +{ + private $listeners; + private $exceptionListener; + private $logoutListener; + private $config; + + /** + * @param iterable $listeners + */ + public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null, FirewallConfig $config = null) + { + $this->listeners = $listeners; + $this->exceptionListener = $exceptionListener; + $this->logoutListener = $logoutListener; + $this->config = $config; + } + + public function getConfig() + { + return $this->config; + } + + /** + * @return iterable + */ + public function getListeners(): iterable + { + return $this->listeners; + } + + public function getExceptionListener() + { + return $this->exceptionListener; + } + + public function getLogoutListener() + { + return $this->logoutListener; + } +} diff --git a/vendor/symfony/security-bundle/Security/FirewallMap.php b/vendor/symfony/security-bundle/Security/FirewallMap.php new file mode 100644 index 0000000..06cbc64 --- /dev/null +++ b/vendor/symfony/security-bundle/Security/FirewallMap.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +use Psr\Container\ContainerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\FirewallMapInterface; + +/** + * This is a lazy-loading firewall map implementation. + * + * Listeners will only be initialized if we really need them. + * + * @author Johannes M. Schmitt + */ +class FirewallMap implements FirewallMapInterface +{ + private $container; + private $map; + + public function __construct(ContainerInterface $container, iterable $map) + { + $this->container = $container; + $this->map = $map; + } + + public function getListeners(Request $request) + { + $context = $this->getFirewallContext($request); + + if (null === $context) { + return [[], null, null]; + } + + return [$context->getListeners(), $context->getExceptionListener(), $context->getLogoutListener()]; + } + + /** + * @return FirewallConfig|null + */ + public function getFirewallConfig(Request $request) + { + $context = $this->getFirewallContext($request); + + if (null === $context) { + return null; + } + + return $context->getConfig(); + } + + private function getFirewallContext(Request $request): ?FirewallContext + { + if ($request->attributes->has('_firewall_context')) { + $storedContextId = $request->attributes->get('_firewall_context'); + foreach ($this->map as $contextId => $requestMatcher) { + if ($contextId === $storedContextId) { + return $this->container->get($contextId); + } + } + + $request->attributes->remove('_firewall_context'); + } + + foreach ($this->map as $contextId => $requestMatcher) { + if (null === $requestMatcher || $requestMatcher->matches($request)) { + $request->attributes->set('_firewall_context', $contextId); + + return $this->container->get($contextId); + } + } + + return null; + } +} diff --git a/vendor/symfony/security-bundle/Security/LazyFirewallContext.php b/vendor/symfony/security-bundle/Security/LazyFirewallContext.php new file mode 100644 index 0000000..9d8396a --- /dev/null +++ b/vendor/symfony/security-bundle/Security/LazyFirewallContext.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Http\Event\LazyResponseEvent; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; +use Symfony\Component\Security\Http\Firewall\LogoutListener; + +/** + * Lazily calls authentication listeners when actually required by the access listener. + * + * @author Nicolas Grekas + */ +class LazyFirewallContext extends FirewallContext +{ + private $tokenStorage; + + public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener, ?LogoutListener $logoutListener, ?FirewallConfig $config, TokenStorage $tokenStorage) + { + parent::__construct($listeners, $exceptionListener, $logoutListener, $config); + + $this->tokenStorage = $tokenStorage; + } + + public function getListeners(): iterable + { + return [$this]; + } + + public function __invoke(RequestEvent $event) + { + $listeners = []; + $request = $event->getRequest(); + $lazy = $request->isMethodCacheable(); + + foreach (parent::getListeners() as $listener) { + if (!$lazy || !$listener instanceof FirewallListenerInterface) { + $listeners[] = $listener; + $lazy = $lazy && $listener instanceof FirewallListenerInterface; + } elseif (false !== $supports = $listener->supports($request)) { + $listeners[] = [$listener, 'authenticate']; + $lazy = null === $supports; + } + } + + if (!$lazy) { + foreach ($listeners as $listener) { + $listener($event); + + if ($event->hasResponse()) { + return; + } + } + + return; + } + + $this->tokenStorage->setInitializer(function () use ($event, $listeners) { + $event = new LazyResponseEvent($event); + foreach ($listeners as $listener) { + $listener($event); + } + }); + } +} diff --git a/vendor/symfony/security-bundle/Security/LegacyLogoutHandlerListener.php b/vendor/symfony/security-bundle/Security/LegacyLogoutHandlerListener.php new file mode 100644 index 0000000..cde7093 --- /dev/null +++ b/vendor/symfony/security-bundle/Security/LegacyLogoutHandlerListener.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface; +use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; + +/** + * @author Wouter de Jong + * + * @internal + */ +class LegacyLogoutHandlerListener implements EventSubscriberInterface +{ + private $logoutHandler; + + public function __construct(object $logoutHandler) + { + if (!$logoutHandler instanceof LogoutSuccessHandlerInterface && !$logoutHandler instanceof LogoutHandlerInterface) { + throw new \InvalidArgumentException(sprintf('An instance of "%s" or "%s" must be passed to "%s", "%s" given.', LogoutHandlerInterface::class, LogoutSuccessHandlerInterface::class, __METHOD__, get_debug_type($logoutHandler))); + } + + $this->logoutHandler = $logoutHandler; + } + + public function onLogout(LogoutEvent $event): void + { + if ($this->logoutHandler instanceof LogoutSuccessHandlerInterface) { + $event->setResponse($this->logoutHandler->onLogoutSuccess($event->getRequest())); + } elseif ($this->logoutHandler instanceof LogoutHandlerInterface) { + $this->logoutHandler->logout($event->getRequest(), $event->getResponse(), $event->getToken()); + } + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => 'onLogout', + ]; + } +} diff --git a/vendor/symfony/security-bundle/Security/UserAuthenticator.php b/vendor/symfony/security-bundle/Security/UserAuthenticator.php new file mode 100644 index 0000000..174f1d0 --- /dev/null +++ b/vendor/symfony/security-bundle/Security/UserAuthenticator.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Security; + +use Psr\Container\ContainerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; + +/** + * A decorator that delegates all method calls to the authenticator + * manager of the current firewall. + * + * @author Wouter de Jong + * + * @final + */ +class UserAuthenticator implements UserAuthenticatorInterface +{ + use FirewallAwareTrait; + + public function __construct(FirewallMap $firewallMap, ContainerInterface $userAuthenticators, RequestStack $requestStack) + { + $this->firewallMap = $firewallMap; + $this->locator = $userAuthenticators; + $this->requestStack = $requestStack; + } + + /** + * {@inheritdoc} + */ + public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response + { + return $this->getForFirewall()->authenticateUser($user, $authenticator, $request, $badges); + } +} diff --git a/vendor/symfony/security-bundle/SecurityBundle.php b/vendor/symfony/security-bundle/SecurityBundle.php new file mode 100644 index 0000000..4c2c304 --- /dev/null +++ b/vendor/symfony/security-bundle/SecurityBundle.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle; + +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSecurityVotersPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSessionDomainConstraintPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\CleanRememberMeVerifierPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterCsrfFeaturesPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterEntryPointPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterGlobalSecurityEventListenersPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterLdapLocatorPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterTokenUsageTrackingPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\ReplaceDecoratedRememberMeHandlerPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\SortFirewallListenersPass; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AnonymousFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\CustomAuthenticatorFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginLdapFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\GuardAuthenticationFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpBasicFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpBasicLdapFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\JsonLoginFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\JsonLoginLdapFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\LoginLinkFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\LoginThrottlingFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RememberMeFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RemoteUserFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\X509Factory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\InMemoryFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\LdapFactory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\EventDispatcher\DependencyInjection\AddEventAliasesPass; +use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\Security\Core\AuthenticationEvents; +use Symfony\Component\Security\Http\SecurityEvents; + +/** + * Bundle. + * + * @author Fabien Potencier + */ +class SecurityBundle extends Bundle +{ + public function build(ContainerBuilder $container) + { + parent::build($container); + + /** @var SecurityExtension $extension */ + $extension = $container->getExtension('security'); + $extension->addAuthenticatorFactory(new FormLoginFactory()); + $extension->addAuthenticatorFactory(new FormLoginLdapFactory()); + $extension->addAuthenticatorFactory(new JsonLoginFactory()); + $extension->addAuthenticatorFactory(new JsonLoginLdapFactory()); + $extension->addAuthenticatorFactory(new HttpBasicFactory()); + $extension->addAuthenticatorFactory(new HttpBasicLdapFactory()); + $extension->addAuthenticatorFactory(new RememberMeFactory()); + $extension->addAuthenticatorFactory(new X509Factory()); + $extension->addAuthenticatorFactory(new RemoteUserFactory()); + $extension->addAuthenticatorFactory(new GuardAuthenticationFactory()); + $extension->addAuthenticatorFactory(new AnonymousFactory()); + $extension->addAuthenticatorFactory(new CustomAuthenticatorFactory()); + $extension->addAuthenticatorFactory(new LoginThrottlingFactory()); + $extension->addAuthenticatorFactory(new LoginLinkFactory()); + + $extension->addUserProviderFactory(new InMemoryFactory()); + $extension->addUserProviderFactory(new LdapFactory()); + $container->addCompilerPass(new AddExpressionLanguageProvidersPass()); + $container->addCompilerPass(new AddSecurityVotersPass()); + $container->addCompilerPass(new AddSessionDomainConstraintPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new CleanRememberMeVerifierPass()); + $container->addCompilerPass(new RegisterCsrfFeaturesPass()); + $container->addCompilerPass(new RegisterTokenUsageTrackingPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 200); + $container->addCompilerPass(new RegisterLdapLocatorPass()); + $container->addCompilerPass(new RegisterEntryPointPass()); + // must be registered after RegisterListenersPass (in the FrameworkBundle) + $container->addCompilerPass(new RegisterGlobalSecurityEventListenersPass(), PassConfig::TYPE_BEFORE_REMOVING, -200); + // execute after ResolveChildDefinitionsPass optimization pass, to ensure class names are set + $container->addCompilerPass(new SortFirewallListenersPass(), PassConfig::TYPE_BEFORE_REMOVING); + $container->addCompilerPass(new ReplaceDecoratedRememberMeHandlerPass(), PassConfig::TYPE_OPTIMIZE); + + $container->addCompilerPass(new AddEventAliasesPass(array_merge( + AuthenticationEvents::ALIASES, + SecurityEvents::ALIASES + ))); + } +} diff --git a/vendor/symfony/security-bundle/composer.json b/vendor/symfony/security-bundle/composer.json new file mode 100644 index 0000000..ee3e6e3 --- /dev/null +++ b/vendor/symfony/security-bundle/composer.json @@ -0,0 +1,69 @@ +{ + "name": "symfony/security-bundle", + "type": "symfony-bundle", + "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "ext-xml": "*", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher": "^5.1|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/password-hasher": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^5.4|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-guard": "^5.3", + "symfony/security-http": "^5.4|^6.0" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/dom-crawler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/ldap": "^5.3|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "symfony/twig-bridge": "^4.4|^5.0|^6.0", + "symfony/validator": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/browser-kit": "<4.4", + "symfony/console": "<4.4", + "symfony/framework-bundle": "<4.4", + "symfony/ldap": "<5.1", + "symfony/twig-bundle": "<4.4" + }, + "autoload": { + "psr-4": { "Symfony\\Bundle\\SecurityBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/security-core/Authentication/AuthenticationManagerInterface.php b/vendor/symfony/security-core/Authentication/AuthenticationManagerInterface.php new file mode 100644 index 0000000..151b4f4 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/AuthenticationManagerInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * AuthenticationManagerInterface is the interface for authentication managers, + * which process Token authentication. + * + * @author Fabien Potencier + * + * @internal since Symfony 5.3 + */ +interface AuthenticationManagerInterface +{ + /** + * Attempts to authenticate a TokenInterface object. + * + * @return TokenInterface + * + * @throws AuthenticationException if the authentication fails + */ + public function authenticate(TokenInterface $token); +} diff --git a/vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php b/vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php new file mode 100644 index 0000000..f8da847 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\AuthenticationEvents; +use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\ProviderNotFoundException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AuthenticationProviderManager::class); + +// Help opcache.preload discover always-needed symbols +class_exists(AuthenticationEvents::class); +class_exists(AuthenticationFailureEvent::class); +class_exists(AuthenticationSuccessEvent::class); + +/** + * AuthenticationProviderManager uses a list of AuthenticationProviderInterface + * instances to authenticate a Token. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class AuthenticationProviderManager implements AuthenticationManagerInterface +{ + private $providers; + private $eraseCredentials; + private $eventDispatcher; + + /** + * @param iterable $providers An iterable with AuthenticationProviderInterface instances as values + * @param bool $eraseCredentials Whether to erase credentials after authentication or not + * + * @throws \InvalidArgumentException + */ + public function __construct(iterable $providers, bool $eraseCredentials = true) + { + if (!$providers) { + throw new \InvalidArgumentException('You must at least add one authentication provider.'); + } + + $this->providers = $providers; + $this->eraseCredentials = $eraseCredentials; + } + + public function setEventDispatcher(EventDispatcherInterface $dispatcher) + { + $this->eventDispatcher = $dispatcher; + } + + /** + * {@inheritdoc} + */ + public function authenticate(TokenInterface $token) + { + $lastException = null; + $result = null; + + foreach ($this->providers as $provider) { + if (!$provider instanceof AuthenticationProviderInterface) { + throw new \InvalidArgumentException(sprintf('Provider "%s" must implement the AuthenticationProviderInterface.', get_debug_type($provider))); + } + + if (!$provider->supports($token)) { + continue; + } + + try { + $result = $provider->authenticate($token); + + if (null !== $result) { + break; + } + } catch (AccountStatusException $e) { + $lastException = $e; + + break; + } catch (AuthenticationException $e) { + $lastException = $e; + } catch (InvalidPasswordException $e) { + $lastException = new BadCredentialsException('Bad credentials.', 0, $e); + } + } + + if (null !== $result) { + if (true === $this->eraseCredentials) { + $result->eraseCredentials(); + } + + if (null !== $this->eventDispatcher) { + $this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($result), AuthenticationEvents::AUTHENTICATION_SUCCESS); + } + + // @deprecated since Symfony 5.3 + if ($result->getUser() instanceof UserInterface && !method_exists($result->getUser(), 'getUserIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "getUserIdentifier(): string" in user class "%s" is deprecated. This method will replace "getUsername()" in Symfony 6.0.', get_debug_type($result->getUser())); + } + + return $result; + } + + if (null === $lastException) { + $lastException = new ProviderNotFoundException(sprintf('No Authentication Provider found for token of class "%s".', \get_class($token))); + } + + if (null !== $this->eventDispatcher) { + $this->eventDispatcher->dispatch(new AuthenticationFailureEvent($token, $lastException), AuthenticationEvents::AUTHENTICATION_FAILURE); + } + + $lastException->setToken($token); + + throw $lastException; + } +} diff --git a/vendor/symfony/security-core/Authentication/AuthenticationTrustResolver.php b/vendor/symfony/security-core/Authentication/AuthenticationTrustResolver.php new file mode 100644 index 0000000..33f39d5 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/AuthenticationTrustResolver.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication; + +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * The default implementation of the authentication trust resolver. + * + * @author Johannes M. Schmitt + */ +class AuthenticationTrustResolver implements AuthenticationTrustResolverInterface +{ + public function isAuthenticated(TokenInterface $token = null): bool + { + return $token && $token->getUser() + // @deprecated since Symfony 5.4, TokenInterface::isAuthenticated() and AnonymousToken no longer exists in 6.0 + && !$token instanceof AnonymousToken && (!method_exists($token, 'isAuthenticated') || $token->isAuthenticated(false)); + } + + /** + * {@inheritdoc} + */ + public function isAnonymous(TokenInterface $token = null/*, $deprecation = true*/) + { + if (1 === \func_num_args() || false !== func_get_arg(1)) { + trigger_deprecation('symfony/security-core', '5.4', 'The "%s()" method is deprecated, use "isAuthenticated()" or "isFullFledged()" if you want to check if the request is (fully) authenticated.', __METHOD__); + } + + return $token instanceof AnonymousToken || ($token && !$token->getUser()); + } + + /** + * {@inheritdoc} + */ + public function isRememberMe(TokenInterface $token = null) + { + return $token && $token instanceof RememberMeToken; + } + + /** + * {@inheritdoc} + */ + public function isFullFledged(TokenInterface $token = null) + { + return $token && !$this->isAnonymous($token, false) && !$this->isRememberMe($token); + } +} diff --git a/vendor/symfony/security-core/Authentication/AuthenticationTrustResolverInterface.php b/vendor/symfony/security-core/Authentication/AuthenticationTrustResolverInterface.php new file mode 100644 index 0000000..1122ffe --- /dev/null +++ b/vendor/symfony/security-core/Authentication/AuthenticationTrustResolverInterface.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * Interface for resolving the authentication status of a given token. + * + * @author Johannes M. Schmitt + * + * @method bool isAuthenticated(TokenInterface $token = null) + */ +interface AuthenticationTrustResolverInterface +{ + /** + * Resolves whether the passed token implementation is authenticated + * anonymously. + * + * If null is passed, the method must return false. + * + * @return bool + * + * @deprecated since Symfony 5.4, use !isAuthenticated() instead + */ + public function isAnonymous(TokenInterface $token = null); + + /** + * Resolves whether the passed token implementation is authenticated + * using remember-me capabilities. + * + * @return bool + */ + public function isRememberMe(TokenInterface $token = null); + + /** + * Resolves whether the passed token implementation is fully authenticated. + * + * @return bool + */ + public function isFullFledged(TokenInterface $token = null); +} diff --git a/vendor/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php new file mode 100644 index 0000000..53f8cf1 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AnonymousAuthenticationProvider::class); + +/** + * AnonymousAuthenticationProvider validates AnonymousToken instances. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class AnonymousAuthenticationProvider implements AuthenticationProviderInterface +{ + /** + * Used to determine if the token is created by the application + * instead of a malicious client. + * + * @var string + */ + private $secret; + + /** + * @param string $secret The secret shared with the AnonymousToken + */ + public function __construct(string $secret) + { + $this->secret = $secret; + } + + /** + * {@inheritdoc} + */ + public function authenticate(TokenInterface $token) + { + if (!$this->supports($token)) { + throw new AuthenticationException('The token is not supported by this authentication provider.'); + } + + if ($this->secret !== $token->getSecret()) { + throw new BadCredentialsException('The Token does not contain the expected key.'); + } + + return $token; + } + + /** + * {@inheritdoc} + */ + public function supports(TokenInterface $token) + { + return $token instanceof AnonymousToken; + } +} diff --git a/vendor/symfony/security-core/Authentication/Provider/AuthenticationProviderInterface.php b/vendor/symfony/security-core/Authentication/Provider/AuthenticationProviderInterface.php new file mode 100644 index 0000000..fb57ed8 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/AuthenticationProviderInterface.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" interface is deprecated, use the new authenticator system instead.', AuthenticationProviderInterface::class); + +/** + * AuthenticationProviderInterface is the interface for all authentication + * providers. + * + * Concrete implementations processes specific Token instances. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +interface AuthenticationProviderInterface extends AuthenticationManagerInterface +{ + /** + * Use this constant for not provided username. + * + * @var string + */ + public const USERNAME_NONE_PROVIDED = 'NONE_PROVIDED'; + + /** + * Checks whether this provider supports the given token. + * + * @return bool + */ + public function supports(TokenInterface $token); +} diff --git a/vendor/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php new file mode 100644 index 0000000..a0e01da --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php @@ -0,0 +1,146 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationServiceException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', DaoAuthenticationProvider::class); + +/** + * DaoAuthenticationProvider uses a UserProviderInterface to retrieve the user + * for a UsernamePasswordToken. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class DaoAuthenticationProvider extends UserAuthenticationProvider +{ + private $hasherFactory; + private $userProvider; + + /** + * @param PasswordHasherFactoryInterface $hasherFactory + */ + public function __construct(UserProviderInterface $userProvider, UserCheckerInterface $userChecker, string $providerKey, $hasherFactory, bool $hideUserNotFoundExceptions = true) + { + parent::__construct($userChecker, $providerKey, $hideUserNotFoundExceptions); + + if ($hasherFactory instanceof EncoderFactoryInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Passing a "%s" instance to the "%s" constructor is deprecated, use "%s" instead.', EncoderFactoryInterface::class, __CLASS__, PasswordHasherFactoryInterface::class); + } + + $this->hasherFactory = $hasherFactory; + $this->userProvider = $userProvider; + } + + /** + * {@inheritdoc} + */ + protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token) + { + $currentUser = $token->getUser(); + if ($currentUser instanceof UserInterface) { + if ($currentUser->getPassword() !== $user->getPassword()) { + throw new BadCredentialsException('The credentials were changed from another session.'); + } + } else { + if ('' === ($presentedPassword = $token->getCredentials())) { + throw new BadCredentialsException('The presented password cannot be empty.'); + } + + if (null === $user->getPassword()) { + throw new BadCredentialsException('The presented password is invalid.'); + } + + if (!$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Using password-based authentication listeners while not implementing "%s" interface from class "%s" is deprecated.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $salt = $user->getSalt(); + if ($salt && !$user instanceof LegacyPasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + // deprecated since Symfony 5.3 + if ($this->hasherFactory instanceof EncoderFactoryInterface) { + $encoder = $this->hasherFactory->getEncoder($user); + + if (!$encoder->isPasswordValid($user->getPassword(), $presentedPassword, $salt)) { + throw new BadCredentialsException('The presented password is invalid.'); + } + + if ($this->userProvider instanceof PasswordUpgraderInterface && method_exists($encoder, 'needsRehash') && $encoder->needsRehash($user->getPassword())) { + $this->userProvider->upgradePassword($user, $encoder->encodePassword($presentedPassword, $user->getSalt())); + } + + return; + } + + $hasher = $this->hasherFactory->getPasswordHasher($user); + + if (!$hasher->verify($user->getPassword(), $presentedPassword, $salt)) { + throw new BadCredentialsException('The presented password is invalid.'); + } + + if ($this->userProvider instanceof PasswordUpgraderInterface && $hasher->needsRehash($user->getPassword())) { + $this->userProvider->upgradePassword($user, $hasher->hash($presentedPassword, $salt)); + } + } + } + + /** + * {@inheritdoc} + */ + protected function retrieveUser(string $userIdentifier, UsernamePasswordToken $token) + { + $user = $token->getUser(); + if ($user instanceof UserInterface) { + return $user; + } + + try { + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($this->userProvider, 'loadUserByIdentifier')) { + $user = $this->userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $user = $this->userProvider->loadUserByUsername($userIdentifier); + } + + if (!$user instanceof UserInterface) { + throw new AuthenticationServiceException('The user provider must return a UserInterface object.'); + } + + return $user; + } catch (UserNotFoundException $e) { + $e->setUserIdentifier($userIdentifier); + throw $e; + } catch (\Exception $e) { + $e = new AuthenticationServiceException($e->getMessage(), 0, $e); + $e->setToken($token); + throw $e; + } + } +} diff --git a/vendor/symfony/security-core/Authentication/Provider/LdapBindAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/LdapBindAuthenticationProvider.php new file mode 100644 index 0000000..ec2bc56 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/LdapBindAuthenticationProvider.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Ldap\Exception\ConnectionException; +use Symfony\Component\Ldap\LdapInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', LdapBindAuthenticationProvider::class); + +/** + * LdapBindAuthenticationProvider authenticates a user against an LDAP server. + * + * The only way to check user credentials is to try to connect the user with its + * credentials to the ldap. + * + * @author Charles Sarrazin + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class LdapBindAuthenticationProvider extends UserAuthenticationProvider +{ + private $userProvider; + private $ldap; + private $dnString; + private $queryString; + private $searchDn; + private $searchPassword; + + public function __construct(UserProviderInterface $userProvider, UserCheckerInterface $userChecker, string $providerKey, LdapInterface $ldap, string $dnString = '{user_identifier}', bool $hideUserNotFoundExceptions = true, string $searchDn = '', string $searchPassword = '') + { + parent::__construct($userChecker, $providerKey, $hideUserNotFoundExceptions); + + $this->userProvider = $userProvider; + $this->ldap = $ldap; + $this->dnString = $dnString; + $this->searchDn = $searchDn; + $this->searchPassword = $searchPassword; + } + + /** + * Set a query string to use in order to find a DN for the user identifier. + */ + public function setQueryString(string $queryString) + { + $this->queryString = $queryString; + } + + /** + * {@inheritdoc} + */ + protected function retrieveUser(string $userIdentifier, UsernamePasswordToken $token) + { + if (AuthenticationProviderInterface::USERNAME_NONE_PROVIDED === $userIdentifier) { + throw new UserNotFoundException('User identifier cannot be null.'); + } + + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($this->userProvider, 'loadUserByIdentifier')) { + return $this->userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + return $this->userProvider->loadUserByUsername($userIdentifier); + } + } + + /** + * {@inheritdoc} + */ + protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token) + { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + $userIdentifier = method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername(); + $password = $token->getCredentials(); + + if ('' === (string) $password) { + throw new BadCredentialsException('The presented password must not be empty.'); + } + + try { + if ($this->queryString) { + if ('' !== $this->searchDn && '' !== $this->searchPassword) { + $this->ldap->bind($this->searchDn, $this->searchPassword); + } else { + throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.'); + } + $userIdentifier = $this->ldap->escape($userIdentifier, '', LdapInterface::ESCAPE_FILTER); + $query = str_replace(['{username}', '{user_identifier}'], $userIdentifier, $this->queryString); + $result = $this->ldap->query($this->dnString, $query)->execute(); + if (1 !== $result->count()) { + throw new BadCredentialsException('The presented username is invalid.'); + } + + $dn = $result[0]->getDn(); + } else { + $userIdentifier = $this->ldap->escape($userIdentifier, '', LdapInterface::ESCAPE_DN); + $dn = str_replace(['{username}', '{user_identifier}'], $userIdentifier, $this->dnString); + } + + $this->ldap->bind($dn, $password); + } catch (ConnectionException $e) { + throw new BadCredentialsException('The presented password is invalid.'); + } + } +} diff --git a/vendor/symfony/security-core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php new file mode 100644 index 0000000..d81e31b --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PreAuthenticatedAuthenticationProvider::class); + +/** + * Processes a pre-authenticated authentication request. + * + * This authentication provider will not perform any checks on authentication + * requests, as they should already be pre-authenticated. However, the + * UserProviderInterface implementation may still throw a + * UserNotFoundException, for example. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderInterface +{ + private $userProvider; + private $userChecker; + private $providerKey; + + public function __construct(UserProviderInterface $userProvider, UserCheckerInterface $userChecker, string $providerKey) + { + $this->userProvider = $userProvider; + $this->userChecker = $userChecker; + $this->providerKey = $providerKey; + } + + /** + * {@inheritdoc} + */ + public function authenticate(TokenInterface $token) + { + if (!$this->supports($token)) { + throw new AuthenticationException('The token is not supported by this authentication provider.'); + } + + if (!$user = $token->getUser()) { + throw new BadCredentialsException('No pre-authenticated principal found in request.'); + } + + $userIdentifier = method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername(); + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($this->userProvider, 'loadUserByIdentifier')) { + $user = $this->userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $user = $this->userProvider->loadUserByUsername($userIdentifier); + } + + $this->userChecker->checkPostAuth($user); + + $authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles()); + $authenticatedToken->setAttributes($token->getAttributes()); + + return $authenticatedToken; + } + + /** + * {@inheritdoc} + */ + public function supports(TokenInterface $token) + { + return $token instanceof PreAuthenticatedToken && $this->providerKey === $token->getFirewallName(); + } +} diff --git a/vendor/symfony/security-core/Authentication/Provider/RememberMeAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/RememberMeAuthenticationProvider.php new file mode 100644 index 0000000..2fd52f2 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/RememberMeAuthenticationProvider.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', RememberMeAuthenticationProvider::class); + +/** + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class RememberMeAuthenticationProvider implements AuthenticationProviderInterface +{ + private $userChecker; + private $secret; + private $providerKey; + + /** + * @param string $secret A secret + * @param string $providerKey A provider secret + */ + public function __construct(UserCheckerInterface $userChecker, string $secret, string $providerKey) + { + $this->userChecker = $userChecker; + $this->secret = $secret; + $this->providerKey = $providerKey; + } + + /** + * {@inheritdoc} + */ + public function authenticate(TokenInterface $token) + { + if (!$this->supports($token)) { + throw new AuthenticationException('The token is not supported by this authentication provider.'); + } + + if ($this->secret !== $token->getSecret()) { + throw new BadCredentialsException('The presented secret does not match.'); + } + + $user = $token->getUser(); + + if (!$user instanceof UserInterface) { + throw new LogicException(sprintf('Method "%s::getUser()" must return a "%s" instance, "%s" returned.', get_debug_type($token), UserInterface::class, get_debug_type($user))); + } + + $this->userChecker->checkPreAuth($user); + $this->userChecker->checkPostAuth($user); + + $authenticatedToken = new RememberMeToken($user, $this->providerKey, $this->secret); + $authenticatedToken->setAttributes($token->getAttributes()); + + return $authenticatedToken; + } + + /** + * {@inheritdoc} + */ + public function supports(TokenInterface $token) + { + return $token instanceof RememberMeToken && $token->getFirewallName() === $this->providerKey; + } +} diff --git a/vendor/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php b/vendor/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php new file mode 100644 index 0000000..c038c76 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Provider; + +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\AuthenticationServiceException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', UserAuthenticationProvider::class); + +/** + * UserProviderInterface retrieves users for UsernamePasswordToken tokens. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +abstract class UserAuthenticationProvider implements AuthenticationProviderInterface +{ + private $hideUserNotFoundExceptions; + private $userChecker; + private $providerKey; + + /** + * @throws \InvalidArgumentException + */ + public function __construct(UserCheckerInterface $userChecker, string $providerKey, bool $hideUserNotFoundExceptions = true) + { + if (empty($providerKey)) { + throw new \InvalidArgumentException('$providerKey must not be empty.'); + } + + $this->userChecker = $userChecker; + $this->providerKey = $providerKey; + $this->hideUserNotFoundExceptions = $hideUserNotFoundExceptions; + } + + /** + * {@inheritdoc} + */ + public function authenticate(TokenInterface $token) + { + if (!$this->supports($token)) { + throw new AuthenticationException('The token is not supported by this authentication provider.'); + } + + $username = method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername(); + if ('' === $username || null === $username) { + $username = AuthenticationProviderInterface::USERNAME_NONE_PROVIDED; + } + + try { + $user = $this->retrieveUser($username, $token); + } catch (UserNotFoundException $e) { + if ($this->hideUserNotFoundExceptions) { + throw new BadCredentialsException('Bad credentials.', 0, $e); + } + $e->setUserIdentifier($username); + + throw $e; + } + + if (!$user instanceof UserInterface) { + throw new AuthenticationServiceException('retrieveUser() must return a UserInterface.'); + } + + try { + $this->userChecker->checkPreAuth($user); + $this->checkAuthentication($user, $token); + $this->userChecker->checkPostAuth($user); + } catch (AccountStatusException|BadCredentialsException $e) { + if ($this->hideUserNotFoundExceptions && !$e instanceof CustomUserMessageAccountStatusException) { + throw new BadCredentialsException('Bad credentials.', 0, $e); + } + + throw $e; + } + + if ($token instanceof SwitchUserToken) { + $authenticatedToken = new SwitchUserToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles(), $token->getOriginalToken()); + } else { + $authenticatedToken = new UsernamePasswordToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles()); + } + + $authenticatedToken->setAttributes($token->getAttributes()); + + return $authenticatedToken; + } + + /** + * {@inheritdoc} + */ + public function supports(TokenInterface $token) + { + return $token instanceof UsernamePasswordToken && $this->providerKey === $token->getFirewallName(); + } + + /** + * Retrieves the user from an implementation-specific location. + * + * @return UserInterface + * + * @throws AuthenticationException if the credentials could not be validated + */ + abstract protected function retrieveUser(string $username, UsernamePasswordToken $token); + + /** + * Does additional checks on the user and token (like validating the + * credentials). + * + * @throws AuthenticationException if the credentials could not be validated + */ + abstract protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token); +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/CacheTokenVerifier.php b/vendor/symfony/security-core/Authentication/RememberMe/CacheTokenVerifier.php new file mode 100644 index 0000000..340bc87 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/CacheTokenVerifier.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +use Psr\Cache\CacheItemPoolInterface; + +/** + * @author Jordi Boggiano + */ +class CacheTokenVerifier implements TokenVerifierInterface +{ + private $cache; + private $outdatedTokenTtl; + private $cacheKeyPrefix; + + /** + * @param int $outdatedTokenTtl How long the outdated token should still be considered valid. Defaults + * to 60, which matches how often the PersistentRememberMeHandler will at + * most refresh tokens. Increasing to more than that is not recommended, + * but you may use a lower value. + */ + public function __construct(CacheItemPoolInterface $cache, int $outdatedTokenTtl = 60, string $cacheKeyPrefix = 'rememberme-stale-') + { + $this->cache = $cache; + $this->outdatedTokenTtl = $outdatedTokenTtl; + $this->cacheKeyPrefix = $cacheKeyPrefix; + } + + /** + * {@inheritdoc} + */ + public function verifyToken(PersistentTokenInterface $token, string $tokenValue): bool + { + if (hash_equals($token->getTokenValue(), $tokenValue)) { + return true; + } + + $cacheKey = $this->getCacheKey($token); + $item = $this->cache->getItem($cacheKey); + if (!$item->isHit()) { + return false; + } + + $outdatedToken = $item->get(); + + return hash_equals($outdatedToken, $tokenValue); + } + + /** + * {@inheritdoc} + */ + public function updateExistingToken(PersistentTokenInterface $token, string $tokenValue, \DateTimeInterface $lastUsed): void + { + // When a token gets updated, persist the outdated token for $outdatedTokenTtl seconds so we can + // still accept it as valid in verifyToken + $item = $this->cache->getItem($this->getCacheKey($token)); + $item->set($token->getTokenValue()); + $item->expiresAfter($this->outdatedTokenTtl); + $this->cache->save($item); + } + + private function getCacheKey(PersistentTokenInterface $token): string + { + return $this->cacheKeyPrefix.rawurlencode($token->getSeries()); + } +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/InMemoryTokenProvider.php b/vendor/symfony/security-core/Authentication/RememberMe/InMemoryTokenProvider.php new file mode 100644 index 0000000..571bbe0 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/InMemoryTokenProvider.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +use Symfony\Component\Security\Core\Exception\TokenNotFoundException; + +/** + * This class is used for testing purposes, and is not really suited for production. + * + * @author Johannes M. Schmitt + */ +class InMemoryTokenProvider implements TokenProviderInterface +{ + private $tokens = []; + + /** + * {@inheritdoc} + */ + public function loadTokenBySeries(string $series) + { + if (!isset($this->tokens[$series])) { + throw new TokenNotFoundException('No token found.'); + } + + return $this->tokens[$series]; + } + + /** + * {@inheritdoc} + */ + public function updateToken(string $series, string $tokenValue, \DateTime $lastUsed) + { + if (!isset($this->tokens[$series])) { + throw new TokenNotFoundException('No token found.'); + } + + $token = new PersistentToken( + $this->tokens[$series]->getClass(), + method_exists($this->tokens[$series], 'getUserIdentifier') ? $this->tokens[$series]->getUserIdentifier() : $this->tokens[$series]->getUsername(), + $series, + $tokenValue, + $lastUsed + ); + $this->tokens[$series] = $token; + } + + /** + * {@inheritdoc} + */ + public function deleteTokenBySeries(string $series) + { + unset($this->tokens[$series]); + } + + /** + * {@inheritdoc} + */ + public function createNewToken(PersistentTokenInterface $token) + { + $this->tokens[$token->getSeries()] = $token; + } +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/PersistentToken.php b/vendor/symfony/security-core/Authentication/RememberMe/PersistentToken.php new file mode 100644 index 0000000..b8337ad --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/PersistentToken.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +/** + * @author Johannes M. Schmitt + * + * @internal + */ +final class PersistentToken implements PersistentTokenInterface +{ + private $class; + private $userIdentifier; + private $series; + private $tokenValue; + private $lastUsed; + + public function __construct(string $class, string $userIdentifier, string $series, string $tokenValue, \DateTime $lastUsed) + { + if (empty($class)) { + throw new \InvalidArgumentException('$class must not be empty.'); + } + if ('' === $userIdentifier) { + throw new \InvalidArgumentException('$userIdentifier must not be empty.'); + } + if (empty($series)) { + throw new \InvalidArgumentException('$series must not be empty.'); + } + if (empty($tokenValue)) { + throw new \InvalidArgumentException('$tokenValue must not be empty.'); + } + + $this->class = $class; + $this->userIdentifier = $userIdentifier; + $this->series = $series; + $this->tokenValue = $tokenValue; + $this->lastUsed = $lastUsed; + } + + /** + * {@inheritdoc} + */ + public function getClass(): string + { + return $this->class; + } + + /** + * {@inheritdoc} + */ + public function getUsername(): string + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use getUserIdentifier() instead.', __METHOD__); + + return $this->userIdentifier; + } + + public function getUserIdentifier(): string + { + return $this->userIdentifier; + } + + /** + * {@inheritdoc} + */ + public function getSeries(): string + { + return $this->series; + } + + /** + * {@inheritdoc} + */ + public function getTokenValue(): string + { + return $this->tokenValue; + } + + /** + * {@inheritdoc} + */ + public function getLastUsed(): \DateTime + { + return $this->lastUsed; + } +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/PersistentTokenInterface.php b/vendor/symfony/security-core/Authentication/RememberMe/PersistentTokenInterface.php new file mode 100644 index 0000000..e2bf2fe --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/PersistentTokenInterface.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +/** + * Interface to be implemented by persistent token classes (such as + * Doctrine entities representing a remember-me token). + * + * @method string getUserIdentifier() returns the identifier used to authenticate (e.g. their email address or username) + * + * @author Johannes M. Schmitt + */ +interface PersistentTokenInterface +{ + /** + * Returns the class of the user. + * + * @return string + */ + public function getClass(); + + /** + * Returns the series. + * + * @return string + */ + public function getSeries(); + + /** + * Returns the token value. + * + * @return string + */ + public function getTokenValue(); + + /** + * Returns the time the token was last used. + * + * @return \DateTime + */ + public function getLastUsed(); + + /** + * @return string + * + * @deprecated since Symfony 5.3, use getUserIdentifier() instead + */ + public function getUsername(); +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/TokenProviderInterface.php b/vendor/symfony/security-core/Authentication/RememberMe/TokenProviderInterface.php new file mode 100644 index 0000000..eda4730 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/TokenProviderInterface.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +use Symfony\Component\Security\Core\Exception\TokenNotFoundException; + +/** + * Interface for TokenProviders. + * + * @author Johannes M. Schmitt + */ +interface TokenProviderInterface +{ + /** + * Loads the active token for the given series. + * + * @return PersistentTokenInterface + * + * @throws TokenNotFoundException if the token is not found + */ + public function loadTokenBySeries(string $series); + + /** + * Deletes all tokens belonging to series. + */ + public function deleteTokenBySeries(string $series); + + /** + * Updates the token according to this data. + * + * @throws TokenNotFoundException if the token is not found + */ + public function updateToken(string $series, string $tokenValue, \DateTime $lastUsed); + + /** + * Creates a new token. + */ + public function createNewToken(PersistentTokenInterface $token); +} diff --git a/vendor/symfony/security-core/Authentication/RememberMe/TokenVerifierInterface.php b/vendor/symfony/security-core/Authentication/RememberMe/TokenVerifierInterface.php new file mode 100644 index 0000000..57278d9 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/RememberMe/TokenVerifierInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\RememberMe; + +/** + * @author Jordi Boggiano + */ +interface TokenVerifierInterface +{ + /** + * Verifies that the given $token is valid. + * + * This lets you override the token check logic to for example accept slightly outdated tokens. + * + * Do not forget to implement token comparisons using hash_equals for a secure implementation. + */ + public function verifyToken(PersistentTokenInterface $token, string $tokenValue): bool; + + /** + * Updates an existing token with a new token value and lastUsed time. + */ + public function updateExistingToken(PersistentTokenInterface $token, string $tokenValue, \DateTimeInterface $lastUsed): void; +} diff --git a/vendor/symfony/security-core/Authentication/Token/AbstractToken.php b/vendor/symfony/security-core/Authentication/Token/AbstractToken.php new file mode 100644 index 0000000..efe3318 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/AbstractToken.php @@ -0,0 +1,332 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\EquatableInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Base class for Token instances. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +abstract class AbstractToken implements TokenInterface +{ + private $user; + private $roleNames = []; + private $authenticated = false; + private $attributes = []; + + /** + * @param string[] $roles An array of roles + * + * @throws \InvalidArgumentException + */ + public function __construct(array $roles = []) + { + foreach ($roles as $role) { + $this->roleNames[] = $role; + } + } + + /** + * {@inheritdoc} + */ + public function getRoleNames(): array + { + return $this->roleNames; + } + + /** + * {@inheritdoc} + */ + public function getUsername(/* $legacy = true */) + { + if (1 === \func_num_args() && false === func_get_arg(0)) { + return null; + } + + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use getUserIdentifier() instead.', __METHOD__); + + if ($this->user instanceof UserInterface) { + return method_exists($this->user, 'getUserIdentifier') ? $this->user->getUserIdentifier() : $this->user->getUsername(); + } + + return (string) $this->user; + } + + /** + * {@inheritdoc} + */ + public function getUserIdentifier(): string + { + // method returns "null" in non-legacy mode if not overridden + $username = $this->getUsername(false); + if (null !== $username) { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s::getUsername()" is deprecated, override "getUserIdentifier()" instead.', get_debug_type($this)); + } + + if ($this->user instanceof UserInterface) { + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + return method_exists($this->user, 'getUserIdentifier') ? $this->user->getUserIdentifier() : $this->user->getUsername(); + } + + return (string) $this->user; + } + + /** + * {@inheritdoc} + */ + public function getUser() + { + return $this->user; + } + + /** + * {@inheritdoc} + */ + public function setUser($user) + { + if (!($user instanceof UserInterface || (\is_object($user) && method_exists($user, '__toString')) || \is_string($user))) { + throw new \InvalidArgumentException('$user must be an instanceof UserInterface, an object implementing a __toString method, or a primitive string.'); + } + + if (!$user instanceof UserInterface) { + trigger_deprecation('symfony/security-core', '5.4', 'Using an object that is not an instance of "%s" as $user in "%s" is deprecated.', UserInterface::class, static::class); + } + + // @deprecated since Symfony 5.4, remove the whole block if/elseif/else block in 6.0 + if (1 < \func_num_args() && !func_get_arg(1)) { + // ContextListener checks if the user has changed on its own and calls `setAuthenticated()` subsequently, + // avoid doing the same checks twice + $changed = false; + } elseif (null === $this->user) { + $changed = false; + } elseif ($this->user instanceof UserInterface) { + if (!$user instanceof UserInterface) { + $changed = true; + } else { + $changed = $this->hasUserChanged($user); + } + } elseif ($user instanceof UserInterface) { + $changed = true; + } else { + $changed = (string) $this->user !== (string) $user; + } + + // @deprecated since Symfony 5.4 + if ($changed) { + $this->setAuthenticated(false, false); + } + + $this->user = $user; + } + + /** + * {@inheritdoc} + * + * @deprecated since Symfony 5.4 + */ + public function isAuthenticated() + { + if (1 > \func_num_args() || func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated, return null from "getUser()" instead when a token is not authenticated.', __METHOD__); + } + + return $this->authenticated; + } + + /** + * {@inheritdoc} + */ + public function setAuthenticated(bool $authenticated) + { + if (2 > \func_num_args() || func_get_arg(1)) { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated', __METHOD__); + } + + $this->authenticated = $authenticated; + } + + /** + * {@inheritdoc} + */ + public function eraseCredentials() + { + if ($this->getUser() instanceof UserInterface) { + $this->getUser()->eraseCredentials(); + } + } + + /** + * Returns all the necessary state of the object for serialization purposes. + * + * There is no need to serialize any entry, they should be returned as-is. + * If you extend this method, keep in mind you MUST guarantee parent data is present in the state. + * Here is an example of how to extend this method: + * + * public function __serialize(): array + * { + * return [$this->childAttribute, parent::__serialize()]; + * } + * + * + * @see __unserialize() + */ + public function __serialize(): array + { + return [$this->user, $this->authenticated, null, $this->attributes, $this->roleNames]; + } + + /** + * Restores the object state from an array given by __serialize(). + * + * There is no need to unserialize any entry in $data, they are already ready-to-use. + * If you extend this method, keep in mind you MUST pass the parent data to its respective class. + * Here is an example of how to extend this method: + * + * public function __unserialize(array $data): void + * { + * [$this->childAttribute, $parentData] = $data; + * parent::__unserialize($parentData); + * } + * + * + * @see __serialize() + */ + public function __unserialize(array $data): void + { + [$this->user, $this->authenticated, , $this->attributes, $this->roleNames] = $data; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function setAttributes(array $attributes) + { + $this->attributes = $attributes; + } + + /** + * {@inheritdoc} + */ + public function hasAttribute(string $name) + { + return \array_key_exists($name, $this->attributes); + } + + /** + * {@inheritdoc} + */ + public function getAttribute(string $name) + { + if (!\array_key_exists($name, $this->attributes)) { + throw new \InvalidArgumentException(sprintf('This token has no "%s" attribute.', $name)); + } + + return $this->attributes[$name]; + } + + /** + * {@inheritdoc} + */ + public function setAttribute(string $name, $value) + { + $this->attributes[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + $class = static::class; + $class = substr($class, strrpos($class, '\\') + 1); + + $roles = []; + foreach ($this->roleNames as $role) { + $roles[] = $role; + } + + return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUserIdentifier(), json_encode($this->authenticated), implode(', ', $roles)); + } + + /** + * @internal + */ + final public function serialize(): string + { + return serialize($this->__serialize()); + } + + /** + * @internal + */ + final public function unserialize($serialized) + { + $this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized)); + } + + /** + * @deprecated since Symfony 5.4 + */ + private function hasUserChanged(UserInterface $user): bool + { + if (!($this->user instanceof UserInterface)) { + throw new \BadMethodCallException('Method "hasUserChanged" should be called when current user class is instance of "UserInterface".'); + } + + if ($this->user instanceof EquatableInterface) { + return !(bool) $this->user->isEqualTo($user); + } + + // @deprecated since Symfony 5.3, check for PasswordAuthenticatedUserInterface on both user objects before comparing passwords + if ($this->user->getPassword() !== $user->getPassword()) { + return true; + } + + // @deprecated since Symfony 5.3, check for LegacyPasswordAuthenticatedUserInterface on both user objects before comparing salts + if ($this->user->getSalt() !== $user->getSalt()) { + return true; + } + + $userRoles = array_map('strval', (array) $user->getRoles()); + + if ($this instanceof SwitchUserToken) { + $userRoles[] = 'ROLE_PREVIOUS_ADMIN'; + } + + if (\count($userRoles) !== \count($this->getRoleNames()) || \count($userRoles) !== \count(array_intersect($userRoles, $this->getRoleNames()))) { + return true; + } + + // @deprecated since Symfony 5.3, drop getUsername() in 6.0 + $userIdentifier = function ($user) { + return method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(); + }; + if ($userIdentifier($this->user) !== $userIdentifier($user)) { + return true; + } + + return false; + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/AnonymousToken.php b/vendor/symfony/security-core/Authentication/Token/AnonymousToken.php new file mode 100644 index 0000000..5d585fe --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/AnonymousToken.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * AnonymousToken represents an anonymous token. + * + * @author Fabien Potencier + * + * @deprecated since 5.4, anonymous is now represented by the absence of a token + */ +class AnonymousToken extends AbstractToken +{ + private $secret; + + /** + * @param string $secret A secret used to make sure the token is created by the app and not by a malicious client + * @param string|\Stringable|UserInterface $user + * @param string[] $roles + */ + public function __construct(string $secret, $user, array $roles = []) + { + trigger_deprecation('symfony/security-core', '5.4', 'The "%s" class is deprecated.', __CLASS__); + + parent::__construct($roles); + + $this->secret = $secret; + $this->setUser($user); + // @deprecated since Symfony 5.4 + $this->setAuthenticated(true, false); + } + + /** + * {@inheritdoc} + */ + public function getCredentials() + { + return ''; + } + + /** + * Returns the secret. + * + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->secret, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->secret, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/NullToken.php b/vendor/symfony/security-core/Authentication/Token/NullToken.php new file mode 100644 index 0000000..1b30d5a --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/NullToken.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +/** + * @author Wouter de Jong + */ +class NullToken implements TokenInterface +{ + public function __toString(): string + { + return ''; + } + + public function getRoleNames(): array + { + return []; + } + + public function getCredentials() + { + return ''; + } + + public function getUser() + { + return null; + } + + public function setUser($user) + { + throw new \BadMethodCallException('Cannot set user on a NullToken.'); + } + + public function getUsername() + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use getUserIdentifier() instead.', __METHOD__); + + return ''; + } + + public function getUserIdentifier(): string + { + return ''; + } + + /** + * @deprecated since Symfony 5.4 + */ + public function isAuthenticated() + { + if (0 === \func_num_args() || func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated, return null from "getUser()" instead when a token is not authenticated.', __METHOD__); + } + + return true; + } + + /** + * @deprecated since Symfony 5.4 + */ + public function setAuthenticated(bool $isAuthenticated) + { + throw new \BadMethodCallException('Cannot change authentication state of NullToken.'); + } + + public function eraseCredentials() + { + } + + public function getAttributes() + { + return []; + } + + public function setAttributes(array $attributes) + { + throw new \BadMethodCallException('Cannot set attributes of NullToken.'); + } + + public function hasAttribute(string $name) + { + return false; + } + + public function getAttribute(string $name) + { + return null; + } + + public function setAttribute(string $name, $value) + { + throw new \BadMethodCallException('Cannot add attribute to NullToken.'); + } + + public function __serialize(): array + { + return []; + } + + public function __unserialize(array $data): void + { + } + + /** + * @return string + * + * @internal in 5.3 + * @final in 5.3 + */ + public function serialize() + { + return ''; + } + + /** + * @return void + * + * @internal in 5.3 + * @final in 5.3 + */ + public function unserialize($serialized) + { + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/PreAuthenticatedToken.php b/vendor/symfony/security-core/Authentication/Token/PreAuthenticatedToken.php new file mode 100644 index 0000000..ea5c534 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/PreAuthenticatedToken.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * PreAuthenticatedToken implements a pre-authenticated token. + * + * @author Fabien Potencier + */ +class PreAuthenticatedToken extends AbstractToken +{ + private $credentials; + private $firewallName; + + /** + * @param UserInterface $user + * @param string $firewallName + * @param string[] $roles + */ + public function __construct($user, /*string*/ $firewallName, /*array*/ $roles = []) + { + if (\is_string($roles)) { + trigger_deprecation('symfony/security-core', '5.4', 'Argument $credentials of "%s()" is deprecated.', __METHOD__); + + $credentials = $firewallName; + $firewallName = $roles; + $roles = \func_num_args() > 3 ? func_get_arg(3) : []; + } + + parent::__construct($roles); + + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + + $this->setUser($user); + $this->credentials = $credentials ?? null; + $this->firewallName = $firewallName; + + if ($roles) { + $this->setAuthenticated(true, false); + } + } + + /** + * Returns the provider key. + * + * @return string The provider key + * + * @deprecated since Symfony 5.2, use getFirewallName() instead + */ + public function getProviderKey() + { + if (1 !== \func_num_args() || true !== func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.2', 'Method "%s()" is deprecated, use "getFirewallName()" instead.', __METHOD__); + } + + return $this->firewallName; + } + + public function getFirewallName(): string + { + return $this->getProviderKey(true); + } + + /** + * {@inheritdoc} + */ + public function getCredentials() + { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated.', __METHOD__); + + return $this->credentials; + } + + /** + * {@inheritdoc} + */ + public function eraseCredentials() + { + parent::eraseCredentials(); + + $this->credentials = null; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->credentials, $this->firewallName, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->credentials, $this->firewallName, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/RememberMeToken.php b/vendor/symfony/security-core/Authentication/Token/RememberMeToken.php new file mode 100644 index 0000000..f74ef00 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/RememberMeToken.php @@ -0,0 +1,118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Authentication Token for "Remember-Me". + * + * @author Johannes M. Schmitt + */ +class RememberMeToken extends AbstractToken +{ + private $secret; + private $firewallName; + + /** + * @param string $secret A secret used to make sure the token is created by the app and not by a malicious client + * + * @throws \InvalidArgumentException + */ + public function __construct(UserInterface $user, string $firewallName, string $secret) + { + parent::__construct($user->getRoles()); + + if (empty($secret)) { + throw new \InvalidArgumentException('$secret must not be empty.'); + } + + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + + $this->firewallName = $firewallName; + $this->secret = $secret; + + $this->setUser($user); + parent::setAuthenticated(true, false); + } + + /** + * {@inheritdoc} + */ + public function setAuthenticated(bool $authenticated) + { + if ($authenticated) { + throw new \LogicException('You cannot set this token to authenticated after creation.'); + } + + parent::setAuthenticated(false, false); + } + + /** + * Returns the provider secret. + * + * @return string The provider secret + * + * @deprecated since Symfony 5.2, use getFirewallName() instead + */ + public function getProviderKey() + { + if (1 !== \func_num_args() || true !== func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.2', 'Method "%s()" is deprecated, use "getFirewallName()" instead.', __METHOD__); + } + + return $this->firewallName; + } + + public function getFirewallName(): string + { + return $this->getProviderKey(true); + } + + /** + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * {@inheritdoc} + */ + public function getCredentials() + { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s()" is deprecated.', __METHOD__); + + return ''; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->secret, $this->firewallName, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->secret, $this->firewallName, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorage.php b/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorage.php new file mode 100644 index 0000000..b479324 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorage.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token\Storage; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * TokenStorage contains a TokenInterface. + * + * It gives access to the token representing the current user authentication. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class TokenStorage implements TokenStorageInterface, ResetInterface +{ + private $token; + private $initializer; + + /** + * {@inheritdoc} + */ + public function getToken() + { + if ($initializer = $this->initializer) { + $this->initializer = null; + $initializer(); + } + + return $this->token; + } + + /** + * {@inheritdoc} + */ + public function setToken(TokenInterface $token = null) + { + if ($token) { + // ensure any initializer is called + $this->getToken(); + + // @deprecated since Symfony 5.3 + if (!method_exists($token, 'getUserIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "getUserIdentifier(): string" in token class "%s" is deprecated. This method will replace "getUsername()" in Symfony 6.0.', get_debug_type($token)); + } + } + + $this->initializer = null; + $this->token = $token; + } + + public function setInitializer(?callable $initializer): void + { + $this->initializer = $initializer; + } + + public function reset() + { + $this->setToken(null); + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorageInterface.php b/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorageInterface.php new file mode 100644 index 0000000..1077a9b --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/Storage/TokenStorageInterface.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token\Storage; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * The TokenStorageInterface. + * + * @author Johannes M. Schmitt + */ +interface TokenStorageInterface +{ + /** + * Returns the current security token. + * + * @return TokenInterface|null + */ + public function getToken(); + + /** + * Sets the authentication token. + * + * @param TokenInterface|null $token A TokenInterface token, or null if no further authentication information should be stored + */ + public function setToken(TokenInterface $token = null); +} diff --git a/vendor/symfony/security-core/Authentication/Token/Storage/UsageTrackingTokenStorage.php b/vendor/symfony/security-core/Authentication/Token/Storage/UsageTrackingTokenStorage.php new file mode 100644 index 0000000..2739805 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/Storage/UsageTrackingTokenStorage.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token\Storage; + +use Psr\Container\ContainerInterface; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; + +/** + * A token storage that increments the session usage index when the token is accessed. + * + * @author Nicolas Grekas + */ +final class UsageTrackingTokenStorage implements TokenStorageInterface, ServiceSubscriberInterface +{ + private $storage; + private $container; + private $enableUsageTracking = false; + + public function __construct(TokenStorageInterface $storage, ContainerInterface $container) + { + $this->storage = $storage; + $this->container = $container; + } + + /** + * {@inheritdoc} + */ + public function getToken(): ?TokenInterface + { + if ($this->shouldTrackUsage()) { + // increments the internal session usage index + $this->getSession()->getMetadataBag(); + } + + return $this->storage->getToken(); + } + + /** + * {@inheritdoc} + */ + public function setToken(TokenInterface $token = null): void + { + $this->storage->setToken($token); + + if ($token && $this->shouldTrackUsage()) { + // increments the internal session usage index + $this->getSession()->getMetadataBag(); + } + } + + public function enableUsageTracking(): void + { + $this->enableUsageTracking = true; + } + + public function disableUsageTracking(): void + { + $this->enableUsageTracking = false; + } + + public static function getSubscribedServices(): array + { + return [ + 'request_stack' => RequestStack::class, + ]; + } + + private function getSession(): SessionInterface + { + // BC for symfony/security-bundle < 5.3 + if ($this->container->has('session')) { + trigger_deprecation('symfony/security-core', '5.3', 'Injecting the "session" in "%s" is deprecated, inject the "request_stack" instead.', __CLASS__); + + return $this->container->get('session'); + } + + return $this->container->get('request_stack')->getSession(); + } + + private function shouldTrackUsage(): bool + { + if (!$this->enableUsageTracking) { + return false; + } + + // BC for symfony/security-bundle < 5.3 + if ($this->container->has('session')) { + return true; + } + + if (!$this->container->get('request_stack')->getMainRequest()) { + return false; + } + + return true; + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/SwitchUserToken.php b/vendor/symfony/security-core/Authentication/Token/SwitchUserToken.php new file mode 100644 index 0000000..2a54c9c --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/SwitchUserToken.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Token representing a user who temporarily impersonates another one. + * + * @author Christian Flothmann + */ +class SwitchUserToken extends UsernamePasswordToken +{ + private $originalToken; + private $originatedFromUri; + + /** + * @param UserInterface $user + * @param string|null $originatedFromUri The URI where was the user at the switch + * + * @throws \InvalidArgumentException + */ + public function __construct($user, /*string*/ $firewallName, /*array*/ $roles, /*TokenInterface*/ $originalToken, /*string*/ $originatedFromUri = null) + { + if (\is_string($roles)) { + // @deprecated since 5.4, deprecation is triggered by UsernamePasswordToken::__construct() + $credentials = $firewallName; + $firewallName = $roles; + $roles = $originalToken; + $originalToken = $originatedFromUri; + $originatedFromUri = \func_num_args() > 5 ? func_get_arg(5) : null; + + parent::__construct($user, $credentials, $firewallName, $roles); + } else { + parent::__construct($user, $firewallName, $roles); + } + + if (!$originalToken instanceof TokenInterface) { + throw new \TypeError(sprintf('Argument $originalToken of "%s" must be an instance of "%s", "%s" given.', __METHOD__, TokenInterface::class, get_debug_type($originalToken))); + } + + $this->originalToken = $originalToken; + $this->originatedFromUri = $originatedFromUri; + } + + public function getOriginalToken(): TokenInterface + { + return $this->originalToken; + } + + public function getOriginatedFromUri(): ?string + { + return $this->originatedFromUri; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->originalToken, $this->originatedFromUri, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + if (3 > \count($data)) { + // Support for tokens serialized with version 5.1 or lower of symfony/security-core. + [$this->originalToken, $parentData] = $data; + } else { + [$this->originalToken, $this->originatedFromUri, $parentData] = $data; + } + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Authentication/Token/TokenInterface.php b/vendor/symfony/security-core/Authentication/Token/TokenInterface.php new file mode 100644 index 0000000..ac4bab6 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/TokenInterface.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * TokenInterface is the interface for the user authentication information. + * + * @method string getUserIdentifier() returns the user identifier used during authentication (e.g. a user's email address or username) + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +interface TokenInterface extends \Serializable +{ + /** + * Returns a string representation of the Token. + * + * This is only to be used for debugging purposes. + * + * @return string + */ + public function __toString(); + + /** + * Returns the user roles. + * + * @return string[] + */ + public function getRoleNames(): array; + + /** + * Returns the user credentials. + * + * @return mixed + * + * @deprecated since Symfony 5.4 + */ + public function getCredentials(); + + /** + * Returns a user representation. + * + * @return UserInterface|null + * + * @see AbstractToken::setUser() + */ + public function getUser(); + + /** + * Sets the authenticated user in the token. + * + * @param UserInterface $user + * + * @throws \InvalidArgumentException + */ + public function setUser($user); + + /** + * Returns whether the user is authenticated or not. + * + * @return bool true if the token has been authenticated, false otherwise + * + * @deprecated since Symfony 5.4, return null from "getUser()" instead when a token is not authenticated + */ + public function isAuthenticated(); + + /** + * Sets the authenticated flag. + * + * @deprecated since Symfony 5.4 + */ + public function setAuthenticated(bool $isAuthenticated); + + /** + * Removes sensitive information from the token. + */ + public function eraseCredentials(); + + /** + * @return array + */ + public function getAttributes(); + + /** + * @param array $attributes The token attributes + */ + public function setAttributes(array $attributes); + + /** + * @return bool + */ + public function hasAttribute(string $name); + + /** + * @return mixed + * + * @throws \InvalidArgumentException When attribute doesn't exist for this token + */ + public function getAttribute(string $name); + + /** + * @param mixed $value The attribute value + */ + public function setAttribute(string $name, $value); + + /** + * Returns all the necessary state of the object for serialization purposes. + */ + public function __serialize(): array; + + /** + * Restores the object state from an array given by __serialize(). + */ + public function __unserialize(array $data): void; + + /** + * @return string + * + * @deprecated since Symfony 5.3, use getUserIdentifier() instead + */ + public function getUsername(); +} diff --git a/vendor/symfony/security-core/Authentication/Token/UsernamePasswordToken.php b/vendor/symfony/security-core/Authentication/Token/UsernamePasswordToken.php new file mode 100644 index 0000000..6bcde10 --- /dev/null +++ b/vendor/symfony/security-core/Authentication/Token/UsernamePasswordToken.php @@ -0,0 +1,125 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authentication\Token; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * UsernamePasswordToken implements a username and password token. + * + * @author Fabien Potencier + */ +class UsernamePasswordToken extends AbstractToken +{ + private $credentials; + private $firewallName; + + /** + * @param UserInterface $user + * @param string[] $roles + * + * @throws \InvalidArgumentException + */ + public function __construct($user, /*string*/ $firewallName, /*array*/ $roles = []) + { + if (\is_string($roles)) { + trigger_deprecation('symfony/security-core', '5.4', 'The $credentials argument of "%s" is deprecated.', static::class.'::__construct'); + + $credentials = $firewallName; + $firewallName = $roles; + $roles = \func_num_args() > 3 ? func_get_arg(3) : []; + } + + parent::__construct($roles); + + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + + $this->setUser($user); + $this->credentials = $credentials ?? null; + $this->firewallName = $firewallName; + + parent::setAuthenticated(\count($roles) > 0, false); + } + + /** + * {@inheritdoc} + */ + public function setAuthenticated(bool $isAuthenticated) + { + if ($isAuthenticated) { + throw new \LogicException('Cannot set this token to trusted after instantiation.'); + } + + parent::setAuthenticated(false, false); + } + + /** + * {@inheritdoc} + */ + public function getCredentials() + { + trigger_deprecation('symfony/security-core', '5.4', 'Method "%s" is deprecated.', __METHOD__); + + return $this->credentials; + } + + /** + * Returns the provider key. + * + * @return string The provider key + * + * @deprecated since Symfony 5.2, use getFirewallName() instead + */ + public function getProviderKey() + { + if (1 !== \func_num_args() || true !== func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.2', 'Method "%s" is deprecated, use "getFirewallName()" instead.', __METHOD__); + } + + return $this->firewallName; + } + + public function getFirewallName(): string + { + return $this->getProviderKey(true); + } + + /** + * {@inheritdoc} + */ + public function eraseCredentials() + { + parent::eraseCredentials(); + + $this->credentials = null; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->credentials, $this->firewallName, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->credentials, $this->firewallName, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/AuthenticationEvents.php b/vendor/symfony/security-core/AuthenticationEvents.php new file mode 100644 index 0000000..fc286d2 --- /dev/null +++ b/vendor/symfony/security-core/AuthenticationEvents.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core; + +use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; + +final class AuthenticationEvents +{ + /** + * The AUTHENTICATION_SUCCESS event occurs after a user is authenticated + * by one provider. + * + * @Event("Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent") + */ + public const AUTHENTICATION_SUCCESS = 'security.authentication.success'; + + /** + * The AUTHENTICATION_FAILURE event occurs after a user cannot be + * authenticated by any of the providers. + * + * @Event("Symfony\Component\Security\Core\Event\AuthenticationFailureEvent") + * + * @deprecated since Symfony 5.4, use {@see Event\LoginFailureEvent} instead + */ + public const AUTHENTICATION_FAILURE = 'security.authentication.failure'; + + /** + * Event aliases. + * + * These aliases can be consumed by RegisterListenersPass. + */ + public const ALIASES = [ + AuthenticationSuccessEvent::class => self::AUTHENTICATION_SUCCESS, + AuthenticationFailureEvent::class => self::AUTHENTICATION_FAILURE, + ]; +} diff --git a/vendor/symfony/security-core/Authorization/AccessDecisionManager.php b/vendor/symfony/security-core/Authorization/AccessDecisionManager.php new file mode 100644 index 0000000..0aa7ead --- /dev/null +++ b/vendor/symfony/security-core/Authorization/AccessDecisionManager.php @@ -0,0 +1,188 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface; +use Symfony\Component\Security\Core\Authorization\Strategy\AffirmativeStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\ConsensusStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\PriorityStrategy; +use Symfony\Component\Security\Core\Authorization\Strategy\UnanimousStrategy; +use Symfony\Component\Security\Core\Authorization\Voter\CacheableVoterInterface; +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; +use Symfony\Component\Security\Core\Exception\InvalidArgumentException; + +/** + * AccessDecisionManager is the base class for all access decision managers + * that use decision voters. + * + * @author Fabien Potencier + * + * @final since Symfony 5.4 + */ +class AccessDecisionManager implements AccessDecisionManagerInterface +{ + /** + * @deprecated use {@see AffirmativeStrategy} instead + */ + public const STRATEGY_AFFIRMATIVE = 'affirmative'; + + /** + * @deprecated use {@see ConsensusStrategy} instead + */ + public const STRATEGY_CONSENSUS = 'consensus'; + + /** + * @deprecated use {@see UnanimousStrategy} instead + */ + public const STRATEGY_UNANIMOUS = 'unanimous'; + + /** + * @deprecated use {@see PriorityStrategy} instead + */ + public const STRATEGY_PRIORITY = 'priority'; + + private const VALID_VOTES = [ + VoterInterface::ACCESS_GRANTED => true, + VoterInterface::ACCESS_DENIED => true, + VoterInterface::ACCESS_ABSTAIN => true, + ]; + + private $voters; + private $votersCacheAttributes; + private $votersCacheObject; + private $strategy; + + /** + * @param iterable $voters An array or an iterator of VoterInterface instances + * @param AccessDecisionStrategyInterface|null $strategy The vote strategy + * + * @throws \InvalidArgumentException + */ + public function __construct(iterable $voters = [], /* AccessDecisionStrategyInterface */ $strategy = null) + { + $this->voters = $voters; + if (\is_string($strategy)) { + trigger_deprecation('symfony/security-core', '5.4', 'Passing the access decision strategy as a string is deprecated, pass an instance of "%s" instead.', AccessDecisionStrategyInterface::class); + $allowIfAllAbstainDecisions = 3 <= \func_num_args() && func_get_arg(2); + $allowIfEqualGrantedDeniedDecisions = 4 > \func_num_args() || func_get_arg(3); + + $strategy = $this->createStrategy($strategy, $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions); + } elseif (null !== $strategy && !$strategy instanceof AccessDecisionStrategyInterface) { + throw new \TypeError(sprintf('"%s": Parameter #2 ($strategy) is expected to be an instance of "%s" or null, "%s" given.', __METHOD__, AccessDecisionStrategyInterface::class, get_debug_type($strategy))); + } + + $this->strategy = $strategy ?? new AffirmativeStrategy(); + } + + /** + * @param bool $allowMultipleAttributes Whether to allow passing multiple values to the $attributes array + * + * {@inheritdoc} + */ + public function decide(TokenInterface $token, array $attributes, $object = null/*, bool $allowMultipleAttributes = false*/) + { + $allowMultipleAttributes = 3 < \func_num_args() && func_get_arg(3); + + // Special case for AccessListener, do not remove the right side of the condition before 6.0 + if (\count($attributes) > 1 && !$allowMultipleAttributes) { + throw new InvalidArgumentException(sprintf('Passing more than one Security attribute to "%s()" is not supported.', __METHOD__)); + } + + return $this->strategy->decide( + $this->collectResults($token, $attributes, $object) + ); + } + + /** + * @param mixed $object + * + * @return \Traversable + */ + private function collectResults(TokenInterface $token, array $attributes, $object): \Traversable + { + foreach ($this->getVoters($attributes, $object) as $voter) { + $result = $voter->vote($token, $object, $attributes); + if (!\is_int($result) || !(self::VALID_VOTES[$result] ?? false)) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning "%s" in "%s::vote()" is deprecated, return one of "%s" constants: "ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN".', var_export($result, true), get_debug_type($voter), VoterInterface::class); + } + + yield $result; + } + } + + /** + * @throws \InvalidArgumentException if the $strategy is invalid + */ + private function createStrategy(string $strategy, bool $allowIfAllAbstainDecisions, bool $allowIfEqualGrantedDeniedDecisions): AccessDecisionStrategyInterface + { + switch ($strategy) { + case self::STRATEGY_AFFIRMATIVE: + return new AffirmativeStrategy($allowIfAllAbstainDecisions); + case self::STRATEGY_CONSENSUS: + return new ConsensusStrategy($allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions); + case self::STRATEGY_UNANIMOUS: + return new UnanimousStrategy($allowIfAllAbstainDecisions); + case self::STRATEGY_PRIORITY: + return new PriorityStrategy($allowIfAllAbstainDecisions); + } + + throw new \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy)); + } + + /** + * @return iterable + */ + private function getVoters(array $attributes, $object = null): iterable + { + $keyAttributes = []; + foreach ($attributes as $attribute) { + $keyAttributes[] = \is_string($attribute) ? $attribute : null; + } + // use `get_class` to handle anonymous classes + $keyObject = \is_object($object) ? \get_class($object) : get_debug_type($object); + foreach ($this->voters as $key => $voter) { + if (!$voter instanceof CacheableVoterInterface) { + yield $voter; + continue; + } + + $supports = true; + // The voter supports the attributes if it supports at least one attribute of the list + foreach ($keyAttributes as $keyAttribute) { + if (null === $keyAttribute) { + $supports = true; + } elseif (!isset($this->votersCacheAttributes[$keyAttribute][$key])) { + $this->votersCacheAttributes[$keyAttribute][$key] = $supports = $voter->supportsAttribute($keyAttribute); + } else { + $supports = $this->votersCacheAttributes[$keyAttribute][$key]; + } + if ($supports) { + break; + } + } + if (!$supports) { + continue; + } + + if (!isset($this->votersCacheObject[$keyObject][$key])) { + $this->votersCacheObject[$keyObject][$key] = $supports = $voter->supportsType($keyObject); + } else { + $supports = $this->votersCacheObject[$keyObject][$key]; + } + if (!$supports) { + continue; + } + yield $voter; + } + } +} diff --git a/vendor/symfony/security-core/Authorization/AccessDecisionManagerInterface.php b/vendor/symfony/security-core/Authorization/AccessDecisionManagerInterface.php new file mode 100644 index 0000000..b807861 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/AccessDecisionManagerInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * AccessDecisionManagerInterface makes authorization decisions. + * + * @author Fabien Potencier + */ +interface AccessDecisionManagerInterface +{ + /** + * Decides whether the access is possible or not. + * + * @param array $attributes An array of attributes associated with the method being invoked + * @param mixed $object The object to secure + * + * @return bool + */ + public function decide(TokenInterface $token, array $attributes, $object = null); +} diff --git a/vendor/symfony/security-core/Authorization/AuthorizationChecker.php b/vendor/symfony/security-core/Authorization/AuthorizationChecker.php new file mode 100644 index 0000000..2f26dff --- /dev/null +++ b/vendor/symfony/security-core/Authorization/AuthorizationChecker.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\NullToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; + +/** + * AuthorizationChecker is the main authorization point of the Security component. + * + * It gives access to the token representing the current user authentication. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class AuthorizationChecker implements AuthorizationCheckerInterface +{ + private $tokenStorage; + private $accessDecisionManager; + private $authenticationManager; + private $alwaysAuthenticate; + private $exceptionOnNoToken; + + public function __construct(TokenStorageInterface $tokenStorage, /*AccessDecisionManagerInterface*/ $accessDecisionManager, /*bool*/ $alwaysAuthenticate = false, /*bool*/ $exceptionOnNoToken = true) + { + if ($accessDecisionManager instanceof AuthenticationManagerInterface) { + trigger_deprecation('symfony/security-core', '5.4', 'The $autenticationManager argument of "%s" is deprecated.', __METHOD__); + + $this->authenticationManager = $accessDecisionManager; + $accessDecisionManager = $alwaysAuthenticate; + $alwaysAuthenticate = $exceptionOnNoToken; + $exceptionOnNoToken = \func_num_args() > 4 ? func_get_arg(4) : true; + } + + if (false !== $alwaysAuthenticate) { + trigger_deprecation('symfony/security-core', '5.4', 'Not setting the 4th argument of "%s" to "false" is deprecated.', __METHOD__); + } + if (false !== $exceptionOnNoToken) { + trigger_deprecation('symfony/security-core', '5.4', 'Not setting the 5th argument of "%s" to "false" is deprecated.', __METHOD__); + } + + if (!$accessDecisionManager instanceof AccessDecisionManagerInterface) { + throw new \TypeError(sprintf('Argument 2 of "%s" must be instance of "%s", "%s" given.', __METHOD__, AccessDecisionManagerInterface::class, get_debug_type($accessDecisionManager))); + } + + $this->tokenStorage = $tokenStorage; + $this->accessDecisionManager = $accessDecisionManager; + $this->alwaysAuthenticate = $alwaysAuthenticate; + $this->exceptionOnNoToken = $exceptionOnNoToken; + } + + /** + * {@inheritdoc} + * + * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token and $exceptionOnNoToken is set to true + */ + final public function isGranted($attribute, $subject = null): bool + { + $token = $this->tokenStorage->getToken(); + + if (!$token || !$token->getUser()) { + if ($this->exceptionOnNoToken) { + throw new AuthenticationCredentialsNotFoundException('The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.'); + } + + $token = new NullToken(); + } else { + $authenticated = true; + // @deprecated since Symfony 5.4 + if ($this->alwaysAuthenticate || !$authenticated = $token->isAuthenticated(false)) { + if (!($authenticated ?? true)) { + trigger_deprecation('symfony/core', '5.4', 'Returning false from "%s()" is deprecated, return null from "getUser()" instead.'); + } + $this->tokenStorage->setToken($token = $this->authenticationManager->authenticate($token)); + } + } + + return $this->accessDecisionManager->decide($token, [$attribute], $subject); + } +} diff --git a/vendor/symfony/security-core/Authorization/AuthorizationCheckerInterface.php b/vendor/symfony/security-core/Authorization/AuthorizationCheckerInterface.php new file mode 100644 index 0000000..f60c80b --- /dev/null +++ b/vendor/symfony/security-core/Authorization/AuthorizationCheckerInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +/** + * The AuthorizationCheckerInterface. + * + * @author Johannes M. Schmitt + */ +interface AuthorizationCheckerInterface +{ + /** + * Checks if the attribute is granted against the current authentication token and optionally supplied subject. + * + * @param mixed $attribute A single attribute to vote on (can be of any type, string and instance of Expression are supported by the core) + * @param mixed $subject + * + * @return bool + */ + public function isGranted($attribute, $subject = null); +} diff --git a/vendor/symfony/security-core/Authorization/ExpressionLanguage.php b/vendor/symfony/security-core/Authorization/ExpressionLanguage.php new file mode 100644 index 0000000..6d9ad0a --- /dev/null +++ b/vendor/symfony/security-core/Authorization/ExpressionLanguage.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; + +if (!class_exists(BaseExpressionLanguage::class)) { + throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', ExpressionLanguage::class)); +} else { + // Help opcache.preload discover always-needed symbols + class_exists(ExpressionLanguageProvider::class); + + /** + * Adds some function to the default ExpressionLanguage. + * + * @author Fabien Potencier + * + * @see ExpressionLanguageProvider + */ + class ExpressionLanguage extends BaseExpressionLanguage + { + /** + * {@inheritdoc} + */ + public function __construct(CacheItemPoolInterface $cache = null, array $providers = []) + { + // prepend the default provider to let users override it easily + array_unshift($providers, new ExpressionLanguageProvider()); + + parent::__construct($cache, $providers); + } + } +} diff --git a/vendor/symfony/security-core/Authorization/ExpressionLanguageProvider.php b/vendor/symfony/security-core/Authorization/ExpressionLanguageProvider.php new file mode 100644 index 0000000..ba2ba26 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/ExpressionLanguageProvider.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Symfony\Component\ExpressionLanguage\ExpressionFunction; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; + +/** + * Define some ExpressionLanguage functions. + * + * @author Fabien Potencier + */ +class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface +{ + public function getFunctions() + { + return [ + new ExpressionFunction('is_anonymous', function () { + return 'trigger_deprecation("symfony/security-core", "5.4", "The \"is_anonymous()\" expression function is deprecated.") || ($token && $auth_checker->isGranted("IS_ANONYMOUS"))'; + }, function (array $variables) { + trigger_deprecation('symfony/security-core', '5.4', 'The "is_anonymous()" expression function is deprecated.'); + + return $variables['token'] && $variables['auth_checker']->isGranted('IS_ANONYMOUS'); + }), + + // @deprecated remove the ternary and always use IS_AUTHENTICATED in 6.0 + new ExpressionFunction('is_authenticated', function () { + return 'defined("'.AuthenticatedVoter::class.'::IS_AUTHENTICATED") ? $auth_checker->isGranted("IS_AUTHENTICATED") : ($token && !$auth_checker->isGranted("IS_ANONYMOUS"))'; + }, function (array $variables) { + return \defined(AuthenticatedVoter::class.'::IS_AUTHENTICATED') ? $variables['auth_checker']->isGranted('IS_AUTHENTICATED') : ($variables['token'] && !$variables['auth_checker']->isGranted('IS_ANONYMOUS')); + }), + + new ExpressionFunction('is_fully_authenticated', function () { + return '$token && $auth_checker->isGranted("IS_AUTHENTICATED_FULLY")'; + }, function (array $variables) { + return $variables['token'] && $variables['auth_checker']->isGranted('IS_AUTHENTICATED_FULLY'); + }), + + new ExpressionFunction('is_granted', function ($attributes, $object = 'null') { + return sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object); + }, function (array $variables, $attributes, $object = null) { + return $variables['auth_checker']->isGranted($attributes, $object); + }), + + new ExpressionFunction('is_remember_me', function () { + return '$token && $auth_checker->isGranted("IS_REMEMBERED")'; + }, function (array $variables) { + return $variables['token'] && $variables['auth_checker']->isGranted('IS_REMEMBERED'); + }), + ]; + } +} diff --git a/vendor/symfony/security-core/Authorization/Strategy/AccessDecisionStrategyInterface.php b/vendor/symfony/security-core/Authorization/Strategy/AccessDecisionStrategyInterface.php new file mode 100644 index 0000000..0023837 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Strategy/AccessDecisionStrategyInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Strategy; + +/** + * A strategy for turning a stream of votes into a final decision. + * + * @author Alexander M. Turek + */ +interface AccessDecisionStrategyInterface +{ + /** + * @param \Traversable $results + */ + public function decide(\Traversable $results): bool; +} diff --git a/vendor/symfony/security-core/Authorization/Strategy/AffirmativeStrategy.php b/vendor/symfony/security-core/Authorization/Strategy/AffirmativeStrategy.php new file mode 100644 index 0000000..0901199 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Strategy/AffirmativeStrategy.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Strategy; + +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Grants access if any voter returns an affirmative response. + * + * If all voters abstained from voting, the decision will be based on the + * allowIfAllAbstainDecisions property value (defaults to false). + * + * @author Fabien Potencier + * @author Alexander M. Turek + */ +final class AffirmativeStrategy implements AccessDecisionStrategyInterface, \Stringable +{ + /** + * @var bool + */ + private $allowIfAllAbstainDecisions; + + public function __construct(bool $allowIfAllAbstainDecisions = false) + { + $this->allowIfAllAbstainDecisions = $allowIfAllAbstainDecisions; + } + + /** + * {@inheritdoc} + */ + public function decide(\Traversable $results): bool + { + $deny = 0; + foreach ($results as $result) { + if (VoterInterface::ACCESS_GRANTED === $result) { + return true; + } + + if (VoterInterface::ACCESS_DENIED === $result) { + ++$deny; + } + } + + if ($deny > 0) { + return false; + } + + return $this->allowIfAllAbstainDecisions; + } + + public function __toString(): string + { + return 'affirmative'; + } +} diff --git a/vendor/symfony/security-core/Authorization/Strategy/ConsensusStrategy.php b/vendor/symfony/security-core/Authorization/Strategy/ConsensusStrategy.php new file mode 100644 index 0000000..0f61780 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Strategy/ConsensusStrategy.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Strategy; + +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Grants access if there is consensus of granted against denied responses. + * + * Consensus means majority-rule (ignoring abstains) rather than unanimous + * agreement (ignoring abstains). If you require unanimity, see + * UnanimousBased. + * + * If there were an equal number of grant and deny votes, the decision will + * be based on the allowIfEqualGrantedDeniedDecisions property value + * (defaults to true). + * + * If all voters abstained from voting, the decision will be based on the + * allowIfAllAbstainDecisions property value (defaults to false). + * + * @author Fabien Potencier + * @author Alexander M. Turek + */ +final class ConsensusStrategy implements AccessDecisionStrategyInterface, \Stringable +{ + private $allowIfAllAbstainDecisions; + private $allowIfEqualGrantedDeniedDecisions; + + public function __construct(bool $allowIfAllAbstainDecisions = false, bool $allowIfEqualGrantedDeniedDecisions = true) + { + $this->allowIfAllAbstainDecisions = $allowIfAllAbstainDecisions; + $this->allowIfEqualGrantedDeniedDecisions = $allowIfEqualGrantedDeniedDecisions; + } + + public function decide(\Traversable $results): bool + { + $grant = 0; + $deny = 0; + foreach ($results as $result) { + if (VoterInterface::ACCESS_GRANTED === $result) { + ++$grant; + } elseif (VoterInterface::ACCESS_DENIED === $result) { + ++$deny; + } + } + + if ($grant > $deny) { + return true; + } + + if ($deny > $grant) { + return false; + } + + if ($grant > 0) { + return $this->allowIfEqualGrantedDeniedDecisions; + } + + return $this->allowIfAllAbstainDecisions; + } + + public function __toString(): string + { + return 'consensus'; + } +} diff --git a/vendor/symfony/security-core/Authorization/Strategy/PriorityStrategy.php b/vendor/symfony/security-core/Authorization/Strategy/PriorityStrategy.php new file mode 100644 index 0000000..b2b416d --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Strategy/PriorityStrategy.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Strategy; + +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Grant or deny access depending on the first voter that does not abstain. + * The priority of voters can be used to overrule a decision. + * + * If all voters abstained from voting, the decision will be based on the + * allowIfAllAbstainDecisions property value (defaults to false). + * + * @author Fabien Potencier + * @author Alexander M. Turek + */ +final class PriorityStrategy implements AccessDecisionStrategyInterface, \Stringable +{ + private $allowIfAllAbstainDecisions; + + public function __construct(bool $allowIfAllAbstainDecisions = false) + { + $this->allowIfAllAbstainDecisions = $allowIfAllAbstainDecisions; + } + + /** + * {@inheritdoc} + */ + public function decide(\Traversable $results): bool + { + foreach ($results as $result) { + if (VoterInterface::ACCESS_GRANTED === $result) { + return true; + } + + if (VoterInterface::ACCESS_DENIED === $result) { + return false; + } + } + + return $this->allowIfAllAbstainDecisions; + } + + public function __toString(): string + { + return 'priority'; + } +} diff --git a/vendor/symfony/security-core/Authorization/Strategy/UnanimousStrategy.php b/vendor/symfony/security-core/Authorization/Strategy/UnanimousStrategy.php new file mode 100644 index 0000000..b2289f9 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Strategy/UnanimousStrategy.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Strategy; + +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Grants access if only grant (or abstain) votes were received. + * + * If all voters abstained from voting, the decision will be based on the + * allowIfAllAbstainDecisions property value (defaults to false). + * + * @author Fabien Potencier + * @author Alexander M. Turek + */ +final class UnanimousStrategy implements AccessDecisionStrategyInterface, \Stringable +{ + private $allowIfAllAbstainDecisions; + + public function __construct(bool $allowIfAllAbstainDecisions = false) + { + $this->allowIfAllAbstainDecisions = $allowIfAllAbstainDecisions; + } + + /** + * {@inheritdoc} + */ + public function decide(\Traversable $results): bool + { + $grant = 0; + foreach ($results as $result) { + if (VoterInterface::ACCESS_DENIED === $result) { + return false; + } + + if (VoterInterface::ACCESS_GRANTED === $result) { + ++$grant; + } + } + + // no deny votes + if ($grant > 0) { + return true; + } + + return $this->allowIfAllAbstainDecisions; + } + + public function __toString(): string + { + return 'unanimous'; + } +} diff --git a/vendor/symfony/security-core/Authorization/TraceableAccessDecisionManager.php b/vendor/symfony/security-core/Authorization/TraceableAccessDecisionManager.php new file mode 100644 index 0000000..ab98420 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/TraceableAccessDecisionManager.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Decorates the original AccessDecisionManager class to log information + * about the security voters and the decisions made by them. + * + * @author Javier Eguiluz + * + * @internal + */ +class TraceableAccessDecisionManager implements AccessDecisionManagerInterface +{ + private $manager; + private $strategy; + /** @var iterable */ + private $voters = []; + private $decisionLog = []; // All decision logs + private $currentLog = []; // Logs being filled in + + public function __construct(AccessDecisionManagerInterface $manager) + { + $this->manager = $manager; + + if ($this->manager instanceof AccessDecisionManager) { + // The strategy and voters are stored in a private properties of the decorated service + $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'strategy'); + $reflection->setAccessible(true); + $this->strategy = $reflection->getValue($manager); + $reflection = new \ReflectionProperty(AccessDecisionManager::class, 'voters'); + $reflection->setAccessible(true); + $this->voters = $reflection->getValue($manager); + } + } + + /** + * {@inheritdoc} + * + * @param bool $allowMultipleAttributes Whether to allow passing multiple values to the $attributes array + */ + public function decide(TokenInterface $token, array $attributes, $object = null/*, bool $allowMultipleAttributes = false*/): bool + { + $currentDecisionLog = [ + 'attributes' => $attributes, + 'object' => $object, + 'voterDetails' => [], + ]; + + $this->currentLog[] = &$currentDecisionLog; + + $result = $this->manager->decide($token, $attributes, $object, 3 < \func_num_args() && func_get_arg(3)); + + $currentDecisionLog['result'] = $result; + + $this->decisionLog[] = array_pop($this->currentLog); // Using a stack since decide can be called by voters + + return $result; + } + + /** + * Adds voter vote and class to the voter details. + * + * @param array $attributes attributes used for the vote + * @param int $vote vote of the voter + */ + public function addVoterVote(VoterInterface $voter, array $attributes, int $vote) + { + $currentLogIndex = \count($this->currentLog) - 1; + $this->currentLog[$currentLogIndex]['voterDetails'][] = [ + 'voter' => $voter, + 'attributes' => $attributes, + 'vote' => $vote, + ]; + } + + public function getStrategy(): string + { + if (null === $this->strategy) { + return '-'; + } + if (method_exists($this->strategy, '__toString')) { + return (string) $this->strategy; + } + + return get_debug_type($this->strategy); + } + + /** + * @return iterable + */ + public function getVoters(): iterable + { + return $this->voters; + } + + public function getDecisionLog(): array + { + return $this->decisionLog; + } +} + +if (!class_exists(DebugAccessDecisionManager::class, false)) { + class_alias(TraceableAccessDecisionManager::class, DebugAccessDecisionManager::class); +} diff --git a/vendor/symfony/security-core/Authorization/Voter/AuthenticatedVoter.php b/vendor/symfony/security-core/Authorization/Voter/AuthenticatedVoter.php new file mode 100644 index 0000000..ae78927 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/AuthenticatedVoter.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * AuthenticatedVoter votes if an attribute like IS_AUTHENTICATED_FULLY, + * IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED is present. + * + * This list is most restrictive to least restrictive checking. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + */ +class AuthenticatedVoter implements CacheableVoterInterface +{ + public const IS_AUTHENTICATED_FULLY = 'IS_AUTHENTICATED_FULLY'; + public const IS_AUTHENTICATED_REMEMBERED = 'IS_AUTHENTICATED_REMEMBERED'; + /** + * @deprecated since Symfony 5.4 + */ + public const IS_AUTHENTICATED_ANONYMOUSLY = 'IS_AUTHENTICATED_ANONYMOUSLY'; + /** + * @deprecated since Symfony 5.4 + */ + public const IS_ANONYMOUS = 'IS_ANONYMOUS'; + public const IS_AUTHENTICATED = 'IS_AUTHENTICATED'; + public const IS_IMPERSONATOR = 'IS_IMPERSONATOR'; + public const IS_REMEMBERED = 'IS_REMEMBERED'; + public const PUBLIC_ACCESS = 'PUBLIC_ACCESS'; + + private $authenticationTrustResolver; + + public function __construct(AuthenticationTrustResolverInterface $authenticationTrustResolver) + { + $this->authenticationTrustResolver = $authenticationTrustResolver; + } + + /** + * {@inheritdoc} + */ + public function vote(TokenInterface $token, $subject, array $attributes) + { + if ($attributes === [self::PUBLIC_ACCESS]) { + return VoterInterface::ACCESS_GRANTED; + } + + $result = VoterInterface::ACCESS_ABSTAIN; + foreach ($attributes as $attribute) { + if (null === $attribute || (self::IS_AUTHENTICATED_FULLY !== $attribute + && self::IS_AUTHENTICATED_REMEMBERED !== $attribute + && self::IS_AUTHENTICATED_ANONYMOUSLY !== $attribute + && self::IS_AUTHENTICATED !== $attribute + && self::IS_ANONYMOUS !== $attribute + && self::IS_IMPERSONATOR !== $attribute + && self::IS_REMEMBERED !== $attribute)) { + continue; + } + + $result = VoterInterface::ACCESS_DENIED; + + if (self::IS_AUTHENTICATED_FULLY === $attribute + && $this->authenticationTrustResolver->isFullFledged($token)) { + return VoterInterface::ACCESS_GRANTED; + } + + if (self::IS_AUTHENTICATED_REMEMBERED === $attribute + && ($this->authenticationTrustResolver->isRememberMe($token) + || $this->authenticationTrustResolver->isFullFledged($token))) { + return VoterInterface::ACCESS_GRANTED; + } + + if (self::IS_AUTHENTICATED_ANONYMOUSLY === $attribute + && ($this->authenticationTrustResolver->isAnonymous($token) + || $this->authenticationTrustResolver->isRememberMe($token) + || $this->authenticationTrustResolver->isFullFledged($token))) { + trigger_deprecation('symfony/security-core', '5.4', 'The "IS_AUTHENTICATED_ANONYMOUSLY" security attribute is deprecated, use "PUBLIC_ACCESS" for public resources, otherwise use "IS_AUTHENTICATED" or "IS_AUTHENTICATED_FULLY" instead if you want to check if the request is (fully) authenticated.'); + + return VoterInterface::ACCESS_GRANTED; + } + + // @deprecated $this->authenticationTrustResolver must implement isAuthenticated() in 6.0 + if (self::IS_AUTHENTICATED === $attribute + && (method_exists($this->authenticationTrustResolver, 'isAuthenticated') + ? $this->authenticationTrustResolver->isAuthenticated($token) + : ($token && $token->getUser()))) { + return VoterInterface::ACCESS_GRANTED; + } + + if (self::IS_REMEMBERED === $attribute && $this->authenticationTrustResolver->isRememberMe($token)) { + return VoterInterface::ACCESS_GRANTED; + } + + if (self::IS_ANONYMOUS === $attribute && $this->authenticationTrustResolver->isAnonymous($token)) { + trigger_deprecation('symfony/security-core', '5.4', 'The "IS_ANONYMOUSLY" security attribute is deprecated, anonymous no longer exists in version 6.'); + + return VoterInterface::ACCESS_GRANTED; + } + + if (self::IS_IMPERSONATOR === $attribute && $token instanceof SwitchUserToken) { + return VoterInterface::ACCESS_GRANTED; + } + } + + return $result; + } + + public function supportsAttribute(string $attribute): bool + { + return \in_array($attribute, [ + self::IS_AUTHENTICATED_FULLY, + self::IS_AUTHENTICATED_REMEMBERED, + self::IS_AUTHENTICATED_ANONYMOUSLY, + self::IS_AUTHENTICATED, + self::IS_ANONYMOUS, + self::IS_IMPERSONATOR, + self::IS_REMEMBERED, + self::PUBLIC_ACCESS, + ], true); + } + + public function supportsType(string $subjectType): bool + { + return true; + } +} diff --git a/vendor/symfony/security-core/Authorization/Voter/CacheableVoterInterface.php b/vendor/symfony/security-core/Authorization/Voter/CacheableVoterInterface.php new file mode 100644 index 0000000..875aad6 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/CacheableVoterInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +/** + * Let voters expose the attributes and types they care about. + * + * By returning false to either `supportsAttribute` or `supportsType`, the + * voter will never be called for the specified attribute or subject. + * + * @author Jérémy Derussé + */ +interface CacheableVoterInterface extends VoterInterface +{ + public function supportsAttribute(string $attribute): bool; + + /** + * @param string $subjectType The type of the subject inferred by `get_class` or `get_debug_type` + */ + public function supportsType(string $subjectType): bool; +} diff --git a/vendor/symfony/security-core/Authorization/Voter/ExpressionVoter.php b/vendor/symfony/security-core/Authorization/Voter/ExpressionVoter.php new file mode 100644 index 0000000..1628072 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/ExpressionVoter.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\ExpressionLanguage\Expression; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; +use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; +use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; + +/** + * ExpressionVoter votes based on the evaluation of an expression. + * + * @author Fabien Potencier + */ +class ExpressionVoter implements CacheableVoterInterface +{ + private $expressionLanguage; + private $trustResolver; + private $authChecker; + private $roleHierarchy; + + public function __construct(ExpressionLanguage $expressionLanguage, AuthenticationTrustResolverInterface $trustResolver, AuthorizationCheckerInterface $authChecker, RoleHierarchyInterface $roleHierarchy = null) + { + $this->expressionLanguage = $expressionLanguage; + $this->trustResolver = $trustResolver; + $this->authChecker = $authChecker; + $this->roleHierarchy = $roleHierarchy; + } + + public function supportsAttribute(string $attribute): bool + { + return false; + } + + public function supportsType(string $subjectType): bool + { + return true; + } + + /** + * {@inheritdoc} + */ + public function vote(TokenInterface $token, $subject, array $attributes) + { + $result = VoterInterface::ACCESS_ABSTAIN; + $variables = null; + foreach ($attributes as $attribute) { + if (!$attribute instanceof Expression) { + continue; + } + + if (null === $variables) { + $variables = $this->getVariables($token, $subject); + } + + $result = VoterInterface::ACCESS_DENIED; + if ($this->expressionLanguage->evaluate($attribute, $variables)) { + return VoterInterface::ACCESS_GRANTED; + } + } + + return $result; + } + + private function getVariables(TokenInterface $token, $subject): array + { + $roleNames = $token->getRoleNames(); + + if (null !== $this->roleHierarchy) { + $roleNames = $this->roleHierarchy->getReachableRoleNames($roleNames); + } + + $variables = [ + 'token' => $token, + 'user' => $token->getUser(), + 'object' => $subject, + 'subject' => $subject, + 'role_names' => $roleNames, + 'trust_resolver' => $this->trustResolver, + 'auth_checker' => $this->authChecker, + ]; + + // this is mainly to propose a better experience when the expression is used + // in an access control rule, as the developer does not know that it's going + // to be handled by this voter + if ($subject instanceof Request) { + $variables['request'] = $subject; + } + + return $variables; + } +} diff --git a/vendor/symfony/security-core/Authorization/Voter/RoleHierarchyVoter.php b/vendor/symfony/security-core/Authorization/Voter/RoleHierarchyVoter.php new file mode 100644 index 0000000..d8f2b34 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/RoleHierarchyVoter.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Role\RoleHierarchyInterface; + +/** + * RoleHierarchyVoter uses a RoleHierarchy to determine the roles granted to + * the user before voting. + * + * @author Fabien Potencier + */ +class RoleHierarchyVoter extends RoleVoter +{ + private $roleHierarchy; + + public function __construct(RoleHierarchyInterface $roleHierarchy, string $prefix = 'ROLE_') + { + $this->roleHierarchy = $roleHierarchy; + + parent::__construct($prefix); + } + + /** + * {@inheritdoc} + */ + protected function extractRoles(TokenInterface $token) + { + return $this->roleHierarchy->getReachableRoleNames($token->getRoleNames()); + } +} diff --git a/vendor/symfony/security-core/Authorization/Voter/RoleVoter.php b/vendor/symfony/security-core/Authorization/Voter/RoleVoter.php new file mode 100644 index 0000000..f1d993a --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/RoleVoter.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * RoleVoter votes if any attribute starts with a given prefix. + * + * @author Fabien Potencier + */ +class RoleVoter implements CacheableVoterInterface +{ + private $prefix; + + public function __construct(string $prefix = 'ROLE_') + { + $this->prefix = $prefix; + } + + /** + * {@inheritdoc} + */ + public function vote(TokenInterface $token, $subject, array $attributes) + { + $result = VoterInterface::ACCESS_ABSTAIN; + $roles = $this->extractRoles($token); + + foreach ($attributes as $attribute) { + if (!\is_string($attribute) || !str_starts_with($attribute, $this->prefix)) { + continue; + } + + if ('ROLE_PREVIOUS_ADMIN' === $attribute) { + trigger_deprecation('symfony/security-core', '5.1', 'The ROLE_PREVIOUS_ADMIN role is deprecated and will be removed in version 6.0, use the IS_IMPERSONATOR attribute instead.'); + } + + $result = VoterInterface::ACCESS_DENIED; + foreach ($roles as $role) { + if ($attribute === $role) { + return VoterInterface::ACCESS_GRANTED; + } + } + } + + return $result; + } + + public function supportsAttribute(string $attribute): bool + { + return str_starts_with($attribute, $this->prefix); + } + + public function supportsType(string $subjectType): bool + { + return true; + } + + protected function extractRoles(TokenInterface $token) + { + return $token->getRoleNames(); + } +} diff --git a/vendor/symfony/security-core/Authorization/Voter/TraceableVoter.php b/vendor/symfony/security-core/Authorization/Voter/TraceableVoter.php new file mode 100644 index 0000000..f606f1d --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/TraceableVoter.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Event\VoteEvent; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * Decorates voter classes to send result events. + * + * @author Laurent VOULLEMIER + * + * @internal + */ +class TraceableVoter implements CacheableVoterInterface +{ + private $voter; + private $eventDispatcher; + + public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher) + { + $this->voter = $voter; + $this->eventDispatcher = $eventDispatcher; + } + + public function vote(TokenInterface $token, $subject, array $attributes): int + { + $result = $this->voter->vote($token, $subject, $attributes); + + $this->eventDispatcher->dispatch(new VoteEvent($this->voter, $subject, $attributes, $result), 'debug.security.authorization.vote'); + + return $result; + } + + public function getDecoratedVoter(): VoterInterface + { + return $this->voter; + } + + public function supportsAttribute(string $attribute): bool + { + return !$this->voter instanceof CacheableVoterInterface || $this->voter->supportsAttribute($attribute); + } + + public function supportsType(string $subjectType): bool + { + return !$this->voter instanceof CacheableVoterInterface || $this->voter->supportsType($subjectType); + } +} diff --git a/vendor/symfony/security-core/Authorization/Voter/Voter.php b/vendor/symfony/security-core/Authorization/Voter/Voter.php new file mode 100644 index 0000000..6ca76ec --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/Voter.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * Voter is an abstract default implementation of a voter. + * + * @author Roman Marintšenko + * @author Grégoire Pineau + */ +abstract class Voter implements VoterInterface, CacheableVoterInterface +{ + /** + * {@inheritdoc} + */ + public function vote(TokenInterface $token, $subject, array $attributes) + { + // abstain vote by default in case none of the attributes are supported + $vote = self::ACCESS_ABSTAIN; + + foreach ($attributes as $attribute) { + try { + if (!$this->supports($attribute, $subject)) { + continue; + } + } catch (\TypeError $e) { + if (\PHP_VERSION_ID < 80000) { + if (0 === strpos($e->getMessage(), 'Argument 1 passed to') + && false !== strpos($e->getMessage(), '::supports() must be of the type string')) { + continue; + } + } elseif (false !== strpos($e->getMessage(), 'supports(): Argument #1')) { + continue; + } + + throw $e; + } + + // as soon as at least one attribute is supported, default is to deny access + $vote = self::ACCESS_DENIED; + + if ($this->voteOnAttribute($attribute, $subject, $token)) { + // grant access as soon as at least one attribute returns a positive response + return self::ACCESS_GRANTED; + } + } + + return $vote; + } + + /** + * Return false if your voter doesn't support the given attribute. Symfony will cache + * that decision and won't call your voter again for that attribute. + */ + public function supportsAttribute(string $attribute): bool + { + return true; + } + + /** + * Return false if your voter doesn't support the given subject type. Symfony will cache + * that decision and won't call your voter again for that subject type. + * + * @param string $subjectType The type of the subject inferred by `get_class()` or `get_debug_type()` + */ + public function supportsType(string $subjectType): bool + { + return true; + } + + /** + * Determines if the attribute and subject are supported by this voter. + * + * @param string $attribute An attribute + * @param mixed $subject The subject to secure, e.g. an object the user wants to access or any other PHP type + * + * @return bool + */ + abstract protected function supports(string $attribute, $subject); + + /** + * Perform a single access check operation on a given attribute, subject and token. + * It is safe to assume that $attribute and $subject already passed the "supports()" method check. + * + * @param mixed $subject + * + * @return bool + */ + abstract protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token); +} diff --git a/vendor/symfony/security-core/Authorization/Voter/VoterInterface.php b/vendor/symfony/security-core/Authorization/Voter/VoterInterface.php new file mode 100644 index 0000000..a50af88 --- /dev/null +++ b/vendor/symfony/security-core/Authorization/Voter/VoterInterface.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Authorization\Voter; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * VoterInterface is the interface implemented by all voters. + * + * @author Fabien Potencier + */ +interface VoterInterface +{ + public const ACCESS_GRANTED = 1; + public const ACCESS_ABSTAIN = 0; + public const ACCESS_DENIED = -1; + + /** + * Returns the vote for the given parameters. + * + * This method must return one of the following constants: + * ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN. + * + * @param mixed $subject The subject to secure + * @param array $attributes An array of attributes associated with the method being invoked + * + * @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED + */ + public function vote(TokenInterface $token, $subject, array $attributes); +} diff --git a/vendor/symfony/security-core/CHANGELOG.md b/vendor/symfony/security-core/CHANGELOG.md new file mode 100644 index 0000000..2ee6d1a --- /dev/null +++ b/vendor/symfony/security-core/CHANGELOG.md @@ -0,0 +1,31 @@ +CHANGELOG +========= + +5.4 +--- + + * Add a `CacheableVoterInterface` for voters that vote only on identified attributes and subjects + * Deprecate `AuthenticationEvents::AUTHENTICATION_FAILURE`, use the `LoginFailureEvent` instead + * Deprecate `AnonymousToken`, as the related authenticator was deprecated in 5.3 + * Deprecate `Token::getCredentials()`, tokens should no longer contain credentials (as they represent authenticated sessions) + * Deprecate returning `string|\Stringable` from `Token::getUser()` (it must return a `UserInterface`) + * Deprecate `AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY` and `AuthenticatedVoter::IS_ANONYMOUS`, + use `AuthenticatedVoter::IS_AUTHENTICATED_FULLY` or `AuthenticatedVoter::IS_AUTHENTICATED` instead. + * Deprecate `AuthenticationTrustResolverInterface::isAnonymous()` and the `is_anonymous()` expression + function as anonymous no longer exists in version 6, use the `isFullFledged()` or the new + `isAuthenticated()` instead if you want to check if the request is (fully) authenticated. + * Deprecate the `$authenticationManager` argument of the `AuthorizationChecker` constructor + * Deprecate setting the `$alwaysAuthenticate` argument to `true` and not setting the + `$exceptionOnNoToken` argument to `false` of `AuthorizationChecker` + * Deprecate methods `TokenInterface::isAuthenticated()` and `setAuthenticated`, + return null from "getUser()" instead when a token is not authenticated + * Add `AccessDecisionStrategyInterface` to allow custom access decision strategies + * Add access decision strategies `AffirmativeStrategy`, `ConsensusStrategy`, `PriorityStrategy`, `UnanimousStrategy` + * Deprecate passing the strategy as string to `AccessDecisionManager`, + pass an instance of `AccessDecisionStrategyInterface` instead + * Flag `AccessDecisionManager` as `@final` + +5.3 +--- + +The CHANGELOG for version 5.3 and earlier can be found at https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Security/CHANGELOG.md diff --git a/vendor/symfony/security-core/Encoder/BasePasswordEncoder.php b/vendor/symfony/security-core/Encoder/BasePasswordEncoder.php new file mode 100644 index 0000000..9267ad9 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/BasePasswordEncoder.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\CheckPasswordLengthTrait; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', BasePasswordEncoder::class, CheckPasswordLengthTrait::class); + +/** + * BasePasswordEncoder is the base class for all password encoders. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use CheckPasswordLengthTrait instead + */ +abstract class BasePasswordEncoder implements PasswordEncoderInterface +{ + public const MAX_PASSWORD_LENGTH = 4096; + + /** + * {@inheritdoc} + */ + public function needsRehash(string $encoded): bool + { + return false; + } + + /** + * Demerges a merge password and salt string. + * + * @return array An array where the first element is the password and the second the salt + */ + protected function demergePasswordAndSalt(string $mergedPasswordSalt) + { + if (empty($mergedPasswordSalt)) { + return ['', '']; + } + + $password = $mergedPasswordSalt; + $salt = ''; + $saltBegins = strrpos($mergedPasswordSalt, '{'); + + if (false !== $saltBegins && $saltBegins + 1 < \strlen($mergedPasswordSalt)) { + $salt = substr($mergedPasswordSalt, $saltBegins + 1, -1); + $password = substr($mergedPasswordSalt, 0, $saltBegins); + } + + return [$password, $salt]; + } + + /** + * Merges a password and a salt. + * + * @return string + * + * @throws \InvalidArgumentException + */ + protected function mergePasswordAndSalt(string $password, ?string $salt) + { + if (empty($salt)) { + return $password; + } + + if (false !== strrpos($salt, '{') || false !== strrpos($salt, '}')) { + throw new \InvalidArgumentException('Cannot use { or } in salt.'); + } + + return $password.'{'.$salt.'}'; + } + + /** + * Compares two passwords. + * + * This method implements a constant-time algorithm to compare passwords to + * avoid (remote) timing attacks. + * + * @return bool + */ + protected function comparePasswords(string $password1, string $password2) + { + return hash_equals($password1, $password2); + } + + /** + * Checks if the password is too long. + * + * @return bool + */ + protected function isPasswordTooLong(string $password) + { + return \strlen($password) > static::MAX_PASSWORD_LENGTH; + } +} diff --git a/vendor/symfony/security-core/Encoder/EncoderAwareInterface.php b/vendor/symfony/security-core/Encoder/EncoderAwareInterface.php new file mode 100644 index 0000000..70231e2 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/EncoderAwareInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface; + +/** + * @author Christophe Coevoet + * + * @deprecated since Symfony 5.3, use {@link PasswordHasherAwareInterface} instead. + */ +interface EncoderAwareInterface +{ + /** + * Gets the name of the encoder used to encode the password. + * + * If the method returns null, the standard way to retrieve the encoder + * will be used instead. + * + * @return string|null + */ + public function getEncoderName(); +} diff --git a/vendor/symfony/security-core/Encoder/EncoderFactory.php b/vendor/symfony/security-core/Encoder/EncoderFactory.php new file mode 100644 index 0000000..526c461 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/EncoderFactory.php @@ -0,0 +1,227 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Exception\LogicException; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', EncoderFactory::class, PasswordHasherFactory::class); + +/** + * A generic encoder factory implementation. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.3, use {@link PasswordHasherFactory} instead + */ +class EncoderFactory implements EncoderFactoryInterface +{ + private $encoders; + + public function __construct(array $encoders) + { + $this->encoders = $encoders; + } + + /** + * {@inheritdoc} + */ + public function getEncoder($user) + { + $encoderKey = null; + + if (($user instanceof PasswordHasherAwareInterface && null !== $encoderName = $user->getPasswordHasherName()) || ($user instanceof EncoderAwareInterface && null !== $encoderName = $user->getEncoderName())) { + if (!\array_key_exists($encoderName, $this->encoders)) { + throw new \RuntimeException(sprintf('The encoder "%s" was not configured.', $encoderName)); + } + + $encoderKey = $encoderName; + } else { + foreach ($this->encoders as $class => $encoder) { + if ((\is_object($user) && $user instanceof $class) || (!\is_object($user) && (is_subclass_of($user, $class) || $user == $class))) { + $encoderKey = $class; + break; + } + } + } + + if (null === $encoderKey) { + throw new \RuntimeException(sprintf('No encoder has been configured for account "%s".', \is_object($user) ? get_debug_type($user) : $user)); + } + + if (!$this->encoders[$encoderKey] instanceof PasswordEncoderInterface) { + if ($this->encoders[$encoderKey] instanceof LegacyPasswordHasherInterface) { + $this->encoders[$encoderKey] = new LegacyPasswordHasherEncoder($this->encoders[$encoderKey]); + } elseif ($this->encoders[$encoderKey] instanceof PasswordHasherInterface) { + $this->encoders[$encoderKey] = new PasswordHasherEncoder($this->encoders[$encoderKey]); + } else { + $this->encoders[$encoderKey] = $this->createEncoder($this->encoders[$encoderKey]); + } + } + + return $this->encoders[$encoderKey]; + } + + /** + * Creates the actual encoder instance. + * + * @throws \InvalidArgumentException + */ + private function createEncoder(array $config, bool $isExtra = false): PasswordEncoderInterface + { + if (isset($config['algorithm'])) { + $rawConfig = $config; + $config = $this->getEncoderConfigFromAlgorithm($config); + } + if (!isset($config['class'])) { + throw new \InvalidArgumentException('"class" must be set in '.json_encode($config)); + } + if (!isset($config['arguments'])) { + throw new \InvalidArgumentException('"arguments" must be set in '.json_encode($config)); + } + + $encoder = new $config['class'](...$config['arguments']); + + if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) { + return $encoder; + } + + if ($rawConfig ?? null) { + $extraEncoders = array_map(function (string $algo) use ($rawConfig): PasswordEncoderInterface { + $rawConfig['algorithm'] = $algo; + + return $this->createEncoder($rawConfig); + }, ['pbkdf2', $rawConfig['hash_algorithm'] ?? 'sha512']); + } else { + $extraEncoders = [new Pbkdf2PasswordEncoder(), new MessageDigestPasswordEncoder()]; + } + + return new MigratingPasswordEncoder($encoder, ...$extraEncoders); + } + + private function getEncoderConfigFromAlgorithm(array $config): array + { + if ('auto' === $config['algorithm']) { + $encoderChain = []; + // "plaintext" is not listed as any leaked hashes could then be used to authenticate directly + foreach ([SodiumPasswordEncoder::isSupported() ? 'sodium' : 'native', 'pbkdf2', $config['hash_algorithm']] as $algo) { + $config['algorithm'] = $algo; + $encoderChain[] = $this->createEncoder($config, true); + } + + return [ + 'class' => MigratingPasswordEncoder::class, + 'arguments' => $encoderChain, + ]; + } + + if ($fromEncoders = ($config['migrate_from'] ?? false)) { + unset($config['migrate_from']); + $encoderChain = [$this->createEncoder($config, true)]; + + foreach ($fromEncoders as $name) { + if ($encoder = $this->encoders[$name] ?? false) { + $encoder = $encoder instanceof PasswordEncoderInterface ? $encoder : $this->createEncoder($encoder, true); + } else { + $encoder = $this->createEncoder(['algorithm' => $name], true); + } + + $encoderChain[] = $encoder; + } + + return [ + 'class' => MigratingPasswordEncoder::class, + 'arguments' => $encoderChain, + ]; + } + + switch ($config['algorithm']) { + case 'plaintext': + return [ + 'class' => PlaintextPasswordEncoder::class, + 'arguments' => [$config['ignore_case']], + ]; + + case 'pbkdf2': + return [ + 'class' => Pbkdf2PasswordEncoder::class, + 'arguments' => [ + $config['hash_algorithm'] ?? 'sha512', + $config['encode_as_base64'] ?? true, + $config['iterations'] ?? 1000, + $config['key_length'] ?? 40, + ], + ]; + + case 'bcrypt': + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_BCRYPT; + + return $this->getEncoderConfigFromAlgorithm($config); + + case 'native': + return [ + 'class' => NativePasswordEncoder::class, + 'arguments' => [ + $config['time_cost'] ?? null, + (($config['memory_cost'] ?? 0) << 10) ?: null, + $config['cost'] ?? null, + ] + (isset($config['native_algorithm']) ? [3 => $config['native_algorithm']] : []), + ]; + + case 'sodium': + return [ + 'class' => SodiumPasswordEncoder::class, + 'arguments' => [ + $config['time_cost'] ?? null, + (($config['memory_cost'] ?? 0) << 10) ?: null, + ], + ]; + + case 'argon2i': + if (SodiumPasswordEncoder::isSupported() && !\defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2I')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2I; + } else { + throw new LogicException(sprintf('Algorithm "argon2i" is not available. Either use %s"auto" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? '"argon2id", ' : '')); + } + + return $this->getEncoderConfigFromAlgorithm($config); + + case 'argon2id': + if (($hasSodium = SodiumPasswordEncoder::isSupported()) && \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13')) { + $config['algorithm'] = 'sodium'; + } elseif (\defined('PASSWORD_ARGON2ID')) { + $config['algorithm'] = 'native'; + $config['native_algorithm'] = \PASSWORD_ARGON2ID; + } else { + throw new LogicException(sprintf('Algorithm "argon2id" is not available. Either use %s"auto", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? '"argon2i", ' : '')); + } + + return $this->getEncoderConfigFromAlgorithm($config); + } + + return [ + 'class' => MessageDigestPasswordEncoder::class, + 'arguments' => [ + $config['algorithm'], + $config['encode_as_base64'] ?? true, + $config['iterations'] ?? 5000, + ], + ]; + } +} diff --git a/vendor/symfony/security-core/Encoder/EncoderFactoryInterface.php b/vendor/symfony/security-core/Encoder/EncoderFactoryInterface.php new file mode 100644 index 0000000..83dea6c --- /dev/null +++ b/vendor/symfony/security-core/Encoder/EncoderFactoryInterface.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', EncoderFactoryInterface::class, PasswordHasherFactoryInterface::class); + +/** + * EncoderFactoryInterface to support different encoders for different accounts. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.3, use {@link PasswordHasherFactoryInterface} instead + */ +interface EncoderFactoryInterface +{ + /** + * Returns the password encoder to use for the given account. + * + * @param UserInterface|string $user A UserInterface instance or a class name + * + * @return PasswordEncoderInterface + * + * @throws \RuntimeException when no password encoder could be found for the user + */ + public function getEncoder($user); +} diff --git a/vendor/symfony/security-core/Encoder/LegacyEncoderTrait.php b/vendor/symfony/security-core/Encoder/LegacyEncoderTrait.php new file mode 100644 index 0000000..d126321 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/LegacyEncoderTrait.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +/** + * @internal + */ +trait LegacyEncoderTrait +{ + /** + * @var PasswordHasherInterface|LegacyPasswordHasherInterface + */ + private $hasher; + + /** + * {@inheritdoc} + */ + public function encodePassword(string $raw, ?string $salt): string + { + try { + return $this->hasher->hash($raw, $salt); + } catch (InvalidPasswordException $e) { + throw new BadCredentialsException('Bad credentials.'); + } + } + + /** + * {@inheritdoc} + */ + public function isPasswordValid(string $encoded, string $raw, ?string $salt): bool + { + return $this->hasher->verify($encoded, $raw, $salt); + } + + /** + * {@inheritdoc} + */ + public function needsRehash(string $encoded): bool + { + return $this->hasher->needsRehash($encoded); + } +} diff --git a/vendor/symfony/security-core/Encoder/LegacyPasswordHasherEncoder.php b/vendor/symfony/security-core/Encoder/LegacyPasswordHasherEncoder.php new file mode 100644 index 0000000..7e57ff2 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/LegacyPasswordHasherEncoder.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +/** + * Forward compatibility for new new PasswordHasher component. + * + * @author Alexander M. Turek + * + * @internal To be removed in Symfony 6 + */ +final class LegacyPasswordHasherEncoder implements PasswordEncoderInterface +{ + private $passwordHasher; + + public function __construct(LegacyPasswordHasherInterface $passwordHasher) + { + $this->passwordHasher = $passwordHasher; + } + + public function encodePassword(string $raw, ?string $salt): string + { + try { + return $this->passwordHasher->hash($raw, $salt); + } catch (InvalidPasswordException $e) { + throw new BadCredentialsException($e->getMessage(), $e->getCode(), $e); + } + } + + public function isPasswordValid(string $encoded, string $raw, ?string $salt): bool + { + return $this->passwordHasher->verify($encoded, $raw, $salt); + } + + public function needsRehash(string $encoded): bool + { + return $this->passwordHasher->needsRehash($encoded); + } +} diff --git a/vendor/symfony/security-core/Encoder/MessageDigestPasswordEncoder.php b/vendor/symfony/security-core/Encoder/MessageDigestPasswordEncoder.php new file mode 100644 index 0000000..f98339f --- /dev/null +++ b/vendor/symfony/security-core/Encoder/MessageDigestPasswordEncoder.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', MessageDigestPasswordEncoder::class, MessageDigestPasswordHasher::class); + +/** + * MessageDigestPasswordEncoder uses a message digest algorithm. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link MessageDigestPasswordHasher} instead + */ +class MessageDigestPasswordEncoder extends BasePasswordEncoder +{ + private $algorithm; + private $encodeHashAsBase64; + private $iterations = 1; + private $encodedLength = -1; + + /** + * @param string $algorithm The digest algorithm to use + * @param bool $encodeHashAsBase64 Whether to base64 encode the password hash + * @param int $iterations The number of iterations to use to stretch the password hash + */ + public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 5000) + { + $this->algorithm = $algorithm; + $this->encodeHashAsBase64 = $encodeHashAsBase64; + + try { + $this->encodedLength = \strlen($this->encodePassword('', 'salt')); + } catch (\LogicException $e) { + // ignore algorithm not supported + } + + $this->iterations = $iterations; + } + + /** + * {@inheritdoc} + */ + public function encodePassword(string $raw, ?string $salt) + { + if ($this->isPasswordTooLong($raw)) { + throw new BadCredentialsException('Invalid password.'); + } + + if (!\in_array($this->algorithm, hash_algos(), true)) { + throw new \LogicException(sprintf('The algorithm "%s" is not supported.', $this->algorithm)); + } + + $salted = $this->mergePasswordAndSalt($raw, $salt); + $digest = hash($this->algorithm, $salted, true); + + // "stretch" hash + for ($i = 1; $i < $this->iterations; ++$i) { + $digest = hash($this->algorithm, $digest.$salted, true); + } + + return $this->encodeHashAsBase64 ? base64_encode($digest) : bin2hex($digest); + } + + /** + * {@inheritdoc} + */ + public function isPasswordValid(string $encoded, string $raw, ?string $salt) + { + if (\strlen($encoded) !== $this->encodedLength || str_contains($encoded, '$')) { + return false; + } + + return !$this->isPasswordTooLong($raw) && $this->comparePasswords($encoded, $this->encodePassword($raw, $salt)); + } +} diff --git a/vendor/symfony/security-core/Encoder/MigratingPasswordEncoder.php b/vendor/symfony/security-core/Encoder/MigratingPasswordEncoder.php new file mode 100644 index 0000000..53d3a58 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/MigratingPasswordEncoder.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\MigratingPasswordHasher; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', MigratingPasswordEncoder::class, MigratingPasswordHasher::class); + +/** + * Hashes passwords using the best available encoder. + * Validates them using a chain of encoders. + * + * /!\ Don't put a PlaintextPasswordEncoder in the list as that'd mean a leaked hash + * could be used to authenticate successfully without knowing the cleartext password. + * + * @author Nicolas Grekas + * + * @deprecated since Symfony 5.3, use {@link MigratingPasswordHasher} instead + */ +final class MigratingPasswordEncoder extends BasePasswordEncoder implements SelfSaltingEncoderInterface +{ + private $bestEncoder; + private $extraEncoders; + + public function __construct(PasswordEncoderInterface $bestEncoder, PasswordEncoderInterface ...$extraEncoders) + { + $this->bestEncoder = $bestEncoder; + $this->extraEncoders = $extraEncoders; + } + + /** + * {@inheritdoc} + */ + public function encodePassword(string $raw, ?string $salt): string + { + return $this->bestEncoder->encodePassword($raw, $salt); + } + + /** + * {@inheritdoc} + */ + public function isPasswordValid(string $encoded, string $raw, ?string $salt): bool + { + if ($this->bestEncoder->isPasswordValid($encoded, $raw, $salt)) { + return true; + } + + if (!$this->bestEncoder->needsRehash($encoded)) { + return false; + } + + foreach ($this->extraEncoders as $encoder) { + if ($encoder->isPasswordValid($encoded, $raw, $salt)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function needsRehash(string $encoded): bool + { + return $this->bestEncoder->needsRehash($encoded); + } +} diff --git a/vendor/symfony/security-core/Encoder/NativePasswordEncoder.php b/vendor/symfony/security-core/Encoder/NativePasswordEncoder.php new file mode 100644 index 0000000..bc135bb --- /dev/null +++ b/vendor/symfony/security-core/Encoder/NativePasswordEncoder.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', NativePasswordEncoder::class, NativePasswordHasher::class); + +/** + * Hashes passwords using password_hash(). + * + * @author Elnur Abdurrakhimov + * @author Terje Bråten + * @author Nicolas Grekas + * + * @deprecated since Symfony 5.3, use {@link NativePasswordHasher} instead + */ +final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSaltingEncoderInterface +{ + use LegacyEncoderTrait; + + /** + * @param string|null $algo An algorithm supported by password_hash() or null to use the stronger available algorithm + */ + public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algo = null) + { + $this->hasher = new NativePasswordHasher($opsLimit, $memLimit, $cost, $algo); + } +} diff --git a/vendor/symfony/security-core/Encoder/PasswordEncoderInterface.php b/vendor/symfony/security-core/Encoder/PasswordEncoderInterface.php new file mode 100644 index 0000000..9c1524d --- /dev/null +++ b/vendor/symfony/security-core/Encoder/PasswordEncoderInterface.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', PasswordEncoderInterface::class, PasswordHasherInterface::class); + +/** + * PasswordEncoderInterface is the interface for all encoders. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link PasswordHasherInterface} instead + */ +interface PasswordEncoderInterface +{ + /** + * Encodes the raw password. + * + * @return string + * + * @throws BadCredentialsException If the raw password is invalid, e.g. excessively long + * @throws \InvalidArgumentException If the salt is invalid + */ + public function encodePassword(string $raw, ?string $salt); + + /** + * Checks a raw password against an encoded password. + * + * @param string $encoded An encoded password + * @param string $raw A raw password + * @param string|null $salt The salt + * + * @return bool + * + * @throws \InvalidArgumentException If the salt is invalid + */ + public function isPasswordValid(string $encoded, string $raw, ?string $salt); + + /** + * Checks if an encoded password would benefit from rehashing. + */ + public function needsRehash(string $encoded): bool; +} diff --git a/vendor/symfony/security-core/Encoder/PasswordHasherAdapter.php b/vendor/symfony/security-core/Encoder/PasswordHasherAdapter.php new file mode 100644 index 0000000..a8546a4 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/PasswordHasherAdapter.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +/** + * Forward compatibility for new new PasswordHasher component. + * + * @author Alexander M. Turek + * + * @internal To be removed in Symfony 6 + */ +final class PasswordHasherAdapter implements LegacyPasswordHasherInterface +{ + private $passwordEncoder; + + public function __construct(PasswordEncoderInterface $passwordEncoder) + { + $this->passwordEncoder = $passwordEncoder; + } + + public function hash(string $plainPassword, string $salt = null): string + { + return $this->passwordEncoder->encodePassword($plainPassword, $salt); + } + + public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool + { + return $this->passwordEncoder->isPasswordValid($hashedPassword, $plainPassword, $salt); + } + + public function needsRehash(string $hashedPassword): bool + { + return $this->passwordEncoder->needsRehash($hashedPassword); + } +} diff --git a/vendor/symfony/security-core/Encoder/PasswordHasherEncoder.php b/vendor/symfony/security-core/Encoder/PasswordHasherEncoder.php new file mode 100644 index 0000000..d37875d --- /dev/null +++ b/vendor/symfony/security-core/Encoder/PasswordHasherEncoder.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; + +/** + * Forward compatibility for new new PasswordHasher component. + * + * @author Alexander M. Turek + * + * @internal To be removed in Symfony 6 + */ +final class PasswordHasherEncoder implements PasswordEncoderInterface, SelfSaltingEncoderInterface +{ + private $passwordHasher; + + public function __construct(PasswordHasherInterface $passwordHasher) + { + $this->passwordHasher = $passwordHasher; + } + + public function encodePassword(string $raw, ?string $salt): string + { + if (null !== $salt) { + throw new \InvalidArgumentException('This password hasher does not support passing a salt.'); + } + + try { + return $this->passwordHasher->hash($raw); + } catch (InvalidPasswordException $e) { + throw new BadCredentialsException($e->getMessage(), $e->getCode(), $e); + } + } + + public function isPasswordValid(string $encoded, string $raw, ?string $salt): bool + { + if (null !== $salt) { + throw new \InvalidArgumentException('This password hasher does not support passing a salt.'); + } + + return $this->passwordHasher->verify($encoded, $raw); + } + + public function needsRehash(string $encoded): bool + { + return $this->passwordHasher->needsRehash($encoded); + } +} diff --git a/vendor/symfony/security-core/Encoder/Pbkdf2PasswordEncoder.php b/vendor/symfony/security-core/Encoder/Pbkdf2PasswordEncoder.php new file mode 100644 index 0000000..d92c12f --- /dev/null +++ b/vendor/symfony/security-core/Encoder/Pbkdf2PasswordEncoder.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', Pbkdf2PasswordEncoder::class, Pbkdf2PasswordHasher::class); + +/** + * Pbkdf2PasswordEncoder uses the PBKDF2 (Password-Based Key Derivation Function 2). + * + * Providing a high level of Cryptographic security, + * PBKDF2 is recommended by the National Institute of Standards and Technology (NIST). + * + * But also warrants a warning, using PBKDF2 (with a high number of iterations) slows down the process. + * PBKDF2 should be used with caution and care. + * + * @author Sebastiaan Stok + * @author Andrew Johnson + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link Pbkdf2PasswordHasher} instead + */ +class Pbkdf2PasswordEncoder extends BasePasswordEncoder +{ + use LegacyEncoderTrait; + + /** + * @param string $algorithm The digest algorithm to use + * @param bool $encodeHashAsBase64 Whether to base64 encode the password hash + * @param int $iterations The number of iterations to use to stretch the password hash + * @param int $length Length of derived key to create + */ + public function __construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 1000, int $length = 40) + { + $this->hasher = new Pbkdf2PasswordHasher($algorithm, $encodeHashAsBase64, $iterations, $length); + } +} diff --git a/vendor/symfony/security-core/Encoder/PlaintextPasswordEncoder.php b/vendor/symfony/security-core/Encoder/PlaintextPasswordEncoder.php new file mode 100644 index 0000000..497e9f1 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/PlaintextPasswordEncoder.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\PlaintextPasswordHasher; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', PlaintextPasswordEncoder::class, PlaintextPasswordHasher::class); + +/** + * PlaintextPasswordEncoder does not do any encoding but is useful in testing environments. + * + * As this encoder is not cryptographically secure, usage of it in production environments is discouraged. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link PlaintextPasswordHasher} instead + */ +class PlaintextPasswordEncoder extends BasePasswordEncoder +{ + use LegacyEncoderTrait; + + /** + * @param bool $ignorePasswordCase Compare password case-insensitive + */ + public function __construct(bool $ignorePasswordCase = false) + { + $this->hasher = new PlaintextPasswordHasher($ignorePasswordCase); + } +} diff --git a/vendor/symfony/security-core/Encoder/SelfSaltingEncoderInterface.php b/vendor/symfony/security-core/Encoder/SelfSaltingEncoderInterface.php new file mode 100644 index 0000000..b8740bc --- /dev/null +++ b/vendor/symfony/security-core/Encoder/SelfSaltingEncoderInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" interface is deprecated, use "%s" on hasher implementations that deal with salts instead.', SelfSaltingEncoderInterface::class, LegacyPasswordHasherInterface::class); + +/** + * SelfSaltingEncoderInterface is a marker interface for encoders that do not + * require a user-generated salt. + * + * @author Zan Baldwin + * + * @deprecated since Symfony 5.3, use {@link LegacyPasswordHasherInterface} instead + */ +interface SelfSaltingEncoderInterface +{ +} diff --git a/vendor/symfony/security-core/Encoder/SodiumPasswordEncoder.php b/vendor/symfony/security-core/Encoder/SodiumPasswordEncoder.php new file mode 100644 index 0000000..d2d71f4 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/SodiumPasswordEncoder.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', SodiumPasswordEncoder::class, SodiumPasswordHasher::class); + +/** + * Hashes passwords using libsodium. + * + * @author Robin Chalas + * @author Zan Baldwin + * @author Dominik Müller + * + * @deprecated since Symfony 5.3, use {@link SodiumPasswordHasher} instead + */ +final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSaltingEncoderInterface +{ + use LegacyEncoderTrait; + + public function __construct(int $opsLimit = null, int $memLimit = null) + { + $this->hasher = new SodiumPasswordHasher($opsLimit, $memLimit); + } + + public static function isSupported(): bool + { + return SodiumPasswordHasher::isSupported(); + } +} diff --git a/vendor/symfony/security-core/Encoder/UserPasswordEncoder.php b/vendor/symfony/security-core/Encoder/UserPasswordEncoder.php new file mode 100644 index 0000000..7b29918 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/UserPasswordEncoder.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher; +use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', UserPasswordEncoder::class, UserPasswordHasher::class); + +/** + * A generic password encoder. + * + * @author Ariel Ferrandini + * + * @deprecated since Symfony 5.3, use {@link UserPasswordHasher} instead + */ +class UserPasswordEncoder implements UserPasswordEncoderInterface +{ + private $encoderFactory; + + public function __construct(EncoderFactoryInterface $encoderFactory) + { + $this->encoderFactory = $encoderFactory; + } + + /** + * {@inheritdoc} + */ + public function encodePassword(UserInterface $user, string $plainPassword) + { + $encoder = $this->encoderFactory->getEncoder($user); + + if (!$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/password-hasher', '5.3', 'Not implementing the "%s" interface while using "%s" is deprecated, the "%s" class should implement it.', PasswordAuthenticatedUserInterface::class, __CLASS__, get_debug_type($user)); + } + + $salt = $user->getSalt(); + if ($salt && !$user instanceof LegacyPasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + return $encoder->encodePassword($plainPassword, $user->getSalt()); + } + + /** + * {@inheritdoc} + */ + public function isPasswordValid(UserInterface $user, string $raw) + { + if (null === $user->getPassword()) { + return false; + } + + $encoder = $this->encoderFactory->getEncoder($user); + + return $encoder->isPasswordValid($user->getPassword(), $raw, $user->getSalt()); + } + + /** + * {@inheritdoc} + */ + public function needsRehash(UserInterface $user): bool + { + if (null === $user->getPassword()) { + return false; + } + + $encoder = $this->encoderFactory->getEncoder($user); + + return $encoder->needsRehash($user->getPassword()); + } +} diff --git a/vendor/symfony/security-core/Encoder/UserPasswordEncoderInterface.php b/vendor/symfony/security-core/Encoder/UserPasswordEncoderInterface.php new file mode 100644 index 0000000..894ba40 --- /dev/null +++ b/vendor/symfony/security-core/Encoder/UserPasswordEncoderInterface.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Encoder; + +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" interface is deprecated, use "%s" instead.', UserPasswordEncoderInterface::class, UserPasswordHasherInterface::class); + +/** + * UserPasswordEncoderInterface is the interface for the password encoder service. + * + * @author Ariel Ferrandini + * + * @deprecated since Symfony 5.3, use {@link UserPasswordHasherInterface} instead + */ +interface UserPasswordEncoderInterface +{ + /** + * Encodes the plain password. + * + * @return string + */ + public function encodePassword(UserInterface $user, string $plainPassword); + + /** + * @return bool + */ + public function isPasswordValid(UserInterface $user, string $raw); + + /** + * Checks if an encoded password would benefit from rehashing. + */ + public function needsRehash(UserInterface $user): bool; +} diff --git a/vendor/symfony/security-core/Event/AuthenticationEvent.php b/vendor/symfony/security-core/Event/AuthenticationEvent.php new file mode 100644 index 0000000..4fc1519 --- /dev/null +++ b/vendor/symfony/security-core/Event/AuthenticationEvent.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Event; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This is a general purpose authentication event. + * + * @author Johannes M. Schmitt + */ +class AuthenticationEvent extends Event +{ + private $authenticationToken; + + public function __construct(TokenInterface $token) + { + $this->authenticationToken = $token; + } + + public function getAuthenticationToken() + { + return $this->authenticationToken; + } +} diff --git a/vendor/symfony/security-core/Event/AuthenticationFailureEvent.php b/vendor/symfony/security-core/Event/AuthenticationFailureEvent.php new file mode 100644 index 0000000..4e9562c --- /dev/null +++ b/vendor/symfony/security-core/Event/AuthenticationFailureEvent.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Event; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Event\LoginFailureEvent; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" with the new authenticator system instead.', AuthenticationFailureEvent::class, LoginFailureEvent::class); + +/** + * This event is dispatched on authentication failure. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.3, use LoginFailureEvent with the new authenticator system instead + */ +final class AuthenticationFailureEvent extends AuthenticationEvent +{ + private $authenticationException; + + public function __construct(TokenInterface $token, AuthenticationException $ex) + { + parent::__construct($token); + + $this->authenticationException = $ex; + } + + public function getAuthenticationException(): AuthenticationException + { + return $this->authenticationException; + } +} diff --git a/vendor/symfony/security-core/Event/AuthenticationSuccessEvent.php b/vendor/symfony/security-core/Event/AuthenticationSuccessEvent.php new file mode 100644 index 0000000..50034d7 --- /dev/null +++ b/vendor/symfony/security-core/Event/AuthenticationSuccessEvent.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Event; + +final class AuthenticationSuccessEvent extends AuthenticationEvent +{ +} diff --git a/vendor/symfony/security-core/Event/VoteEvent.php b/vendor/symfony/security-core/Event/VoteEvent.php new file mode 100644 index 0000000..78ac2f9 --- /dev/null +++ b/vendor/symfony/security-core/Event/VoteEvent.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Event; + +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This event is dispatched on voter vote. + * + * @author Laurent VOULLEMIER + * + * @internal + */ +final class VoteEvent extends Event +{ + private $voter; + private $subject; + private $attributes; + private $vote; + + public function __construct(VoterInterface $voter, $subject, array $attributes, int $vote) + { + $this->voter = $voter; + $this->subject = $subject; + $this->attributes = $attributes; + $this->vote = $vote; + } + + public function getVoter(): VoterInterface + { + return $this->voter; + } + + public function getSubject() + { + return $this->subject; + } + + public function getAttributes(): array + { + return $this->attributes; + } + + public function getVote(): int + { + return $this->vote; + } +} diff --git a/vendor/symfony/security-core/Exception/AccessDeniedException.php b/vendor/symfony/security-core/Exception/AccessDeniedException.php new file mode 100644 index 0000000..0e59dc4 --- /dev/null +++ b/vendor/symfony/security-core/Exception/AccessDeniedException.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * AccessDeniedException is thrown when the account has not the required role. + * + * @author Fabien Potencier + */ +class AccessDeniedException extends RuntimeException +{ + private $attributes = []; + private $subject; + + public function __construct(string $message = 'Access Denied.', \Throwable $previous = null) + { + parent::__construct($message, 403, $previous); + } + + /** + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * @param array|string $attributes + */ + public function setAttributes($attributes) + { + $this->attributes = (array) $attributes; + } + + /** + * @return mixed + */ + public function getSubject() + { + return $this->subject; + } + + /** + * @param mixed $subject + */ + public function setSubject($subject) + { + $this->subject = $subject; + } +} diff --git a/vendor/symfony/security-core/Exception/AccountExpiredException.php b/vendor/symfony/security-core/Exception/AccountExpiredException.php new file mode 100644 index 0000000..4a71263 --- /dev/null +++ b/vendor/symfony/security-core/Exception/AccountExpiredException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * AccountExpiredException is thrown when the user account has expired. + * + * @author Fabien Potencier + * @author Alexander + */ +class AccountExpiredException extends AccountStatusException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Account has expired.'; + } +} diff --git a/vendor/symfony/security-core/Exception/AccountStatusException.php b/vendor/symfony/security-core/Exception/AccountStatusException.php new file mode 100644 index 0000000..880ad3d --- /dev/null +++ b/vendor/symfony/security-core/Exception/AccountStatusException.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * AccountStatusException is the base class for authentication exceptions + * caused by the user account status. + * + * @author Fabien Potencier + * @author Alexander + */ +abstract class AccountStatusException extends AuthenticationException +{ + private $user; + + /** + * Get the user. + * + * @return UserInterface|null + */ + public function getUser() + { + return $this->user; + } + + public function setUser(UserInterface $user) + { + $this->user = $user; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->user, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->user, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Exception/AuthenticationCredentialsNotFoundException.php b/vendor/symfony/security-core/Exception/AuthenticationCredentialsNotFoundException.php new file mode 100644 index 0000000..8595bed --- /dev/null +++ b/vendor/symfony/security-core/Exception/AuthenticationCredentialsNotFoundException.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * AuthenticationCredentialsNotFoundException is thrown when an authentication is rejected + * because no Token is available. + * + * @author Fabien Potencier + * @author Alexander + */ +class AuthenticationCredentialsNotFoundException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Authentication credentials could not be found.'; + } +} diff --git a/vendor/symfony/security-core/Exception/AuthenticationException.php b/vendor/symfony/security-core/Exception/AuthenticationException.php new file mode 100644 index 0000000..ad03f0d --- /dev/null +++ b/vendor/symfony/security-core/Exception/AuthenticationException.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * AuthenticationException is the base class for all authentication exceptions. + * + * @author Fabien Potencier + * @author Alexander + */ +class AuthenticationException extends RuntimeException +{ + /** @internal */ + protected $serialized; + + private $token; + + public function __construct(string $message = '', int $code = 0, \Throwable $previous = null) + { + unset($this->serialized); + parent::__construct($message, $code, $previous); + } + + /** + * @return TokenInterface|null + */ + public function getToken() + { + return $this->token; + } + + public function setToken(TokenInterface $token) + { + $this->token = $token; + } + + /** + * Returns all the necessary state of the object for serialization purposes. + * + * There is no need to serialize any entry, they should be returned as-is. + * If you extend this method, keep in mind you MUST guarantee parent data is present in the state. + * Here is an example of how to extend this method: + * + * public function __serialize(): array + * { + * return [$this->childAttribute, parent::__serialize()]; + * } + * + * + * @see __unserialize() + */ + public function __serialize(): array + { + return [$this->token, $this->code, $this->message, $this->file, $this->line]; + } + + /** + * Restores the object state from an array given by __serialize(). + * + * There is no need to unserialize any entry in $data, they are already ready-to-use. + * If you extend this method, keep in mind you MUST pass the parent data to its respective class. + * Here is an example of how to extend this method: + * + * public function __unserialize(array $data): void + * { + * [$this->childAttribute, $parentData] = $data; + * parent::__unserialize($parentData); + * } + * + * + * @see __serialize() + */ + public function __unserialize(array $data): void + { + [$this->token, $this->code, $this->message, $this->file, $this->line] = $data; + } + + /** + * Message key to be used by the translation component. + * + * @return string + */ + public function getMessageKey() + { + return 'An authentication exception occurred.'; + } + + /** + * Message data to be used by the translation component. + * + * @return array + */ + public function getMessageData() + { + return []; + } + + /** + * @internal + */ + public function __sleep(): array + { + $this->serialized = $this->__serialize(); + + return ['serialized']; + } + + /** + * @internal + */ + public function __wakeup(): void + { + $this->__unserialize($this->serialized); + unset($this->serialized); + } +} diff --git a/vendor/symfony/security-core/Exception/AuthenticationExpiredException.php b/vendor/symfony/security-core/Exception/AuthenticationExpiredException.php new file mode 100644 index 0000000..e3fce37 --- /dev/null +++ b/vendor/symfony/security-core/Exception/AuthenticationExpiredException.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * AuthenticationExpiredException is thrown when an authentication token becomes un-authenticated between requests. + * + * In practice, this is due to the User changing between requests (e.g. password changes), + * causes the token to become un-authenticated. + * + * @author Ryan Weaver + */ +class AuthenticationExpiredException extends AccountStatusException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Authentication expired because your account information has changed.'; + } +} diff --git a/vendor/symfony/security-core/Exception/AuthenticationServiceException.php b/vendor/symfony/security-core/Exception/AuthenticationServiceException.php new file mode 100644 index 0000000..66f051d --- /dev/null +++ b/vendor/symfony/security-core/Exception/AuthenticationServiceException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * AuthenticationServiceException is thrown when an authentication request could not be processed due to a system problem. + * + * @author Fabien Potencier + * @author Alexander + */ +class AuthenticationServiceException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Authentication request could not be processed due to a system problem.'; + } +} diff --git a/vendor/symfony/security-core/Exception/BadCredentialsException.php b/vendor/symfony/security-core/Exception/BadCredentialsException.php new file mode 100644 index 0000000..be061c7 --- /dev/null +++ b/vendor/symfony/security-core/Exception/BadCredentialsException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * BadCredentialsException is thrown when the user credentials are invalid. + * + * @author Fabien Potencier + * @author Alexander + */ +class BadCredentialsException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Invalid credentials.'; + } +} diff --git a/vendor/symfony/security-core/Exception/CookieTheftException.php b/vendor/symfony/security-core/Exception/CookieTheftException.php new file mode 100644 index 0000000..af97168 --- /dev/null +++ b/vendor/symfony/security-core/Exception/CookieTheftException.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * This exception is thrown when the RememberMeServices implementation + * detects that a presented cookie has already been used by someone else. + * + * @author Johannes M. Schmitt + * @author Alexander + */ +class CookieTheftException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Cookie has already been used by someone else.'; + } +} diff --git a/vendor/symfony/security-core/Exception/CredentialsExpiredException.php b/vendor/symfony/security-core/Exception/CredentialsExpiredException.php new file mode 100644 index 0000000..bcc1267 --- /dev/null +++ b/vendor/symfony/security-core/Exception/CredentialsExpiredException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * CredentialsExpiredException is thrown when the user account credentials have expired. + * + * @author Fabien Potencier + * @author Alexander + */ +class CredentialsExpiredException extends AccountStatusException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Credentials have expired.'; + } +} diff --git a/vendor/symfony/security-core/Exception/CustomUserMessageAccountStatusException.php b/vendor/symfony/security-core/Exception/CustomUserMessageAccountStatusException.php new file mode 100644 index 0000000..3594b9b --- /dev/null +++ b/vendor/symfony/security-core/Exception/CustomUserMessageAccountStatusException.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * An authentication exception caused by the user account status + * where you can control the message shown to the user. + * + * Be sure that the message passed to this exception is something that + * can be shown safely to your user. In other words, avoid catching + * other exceptions and passing their message directly to this class. + * + * @author Vincent Langlet + */ +class CustomUserMessageAccountStatusException extends AccountStatusException +{ + private $messageKey; + + private $messageData = []; + + public function __construct(string $message = '', array $messageData = [], int $code = 0, \Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + + $this->setSafeMessage($message, $messageData); + } + + /** + * Sets a message that will be shown to the user. + * + * @param string $messageKey The message or message key + * @param array $messageData Data to be passed into the translator + */ + public function setSafeMessage(string $messageKey, array $messageData = []) + { + $this->messageKey = $messageKey; + $this->messageData = $messageData; + } + + public function getMessageKey() + { + return $this->messageKey; + } + + public function getMessageData() + { + return $this->messageData; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [parent::__serialize(), $this->messageKey, $this->messageData]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$parentData, $this->messageKey, $this->messageData] = $data; + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Exception/CustomUserMessageAuthenticationException.php b/vendor/symfony/security-core/Exception/CustomUserMessageAuthenticationException.php new file mode 100644 index 0000000..799d7e0 --- /dev/null +++ b/vendor/symfony/security-core/Exception/CustomUserMessageAuthenticationException.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * An authentication exception where you can control the message shown to the user. + * + * Be sure that the message passed to this exception is something that + * can be shown safely to your user. In other words, avoid catching + * other exceptions and passing their message directly to this class. + * + * @author Ryan Weaver + */ +class CustomUserMessageAuthenticationException extends AuthenticationException +{ + private $messageKey; + + private $messageData = []; + + public function __construct(string $message = '', array $messageData = [], int $code = 0, \Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + + $this->setSafeMessage($message, $messageData); + } + + /** + * Set a message that will be shown to the user. + * + * @param string $messageKey The message or message key + * @param array $messageData Data to be passed into the translator + */ + public function setSafeMessage(string $messageKey, array $messageData = []) + { + $this->messageKey = $messageKey; + $this->messageData = $messageData; + } + + public function getMessageKey() + { + return $this->messageKey; + } + + public function getMessageData() + { + return $this->messageData; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [parent::__serialize(), $this->messageKey, $this->messageData]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$parentData, $this->messageKey, $this->messageData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Exception/DisabledException.php b/vendor/symfony/security-core/Exception/DisabledException.php new file mode 100644 index 0000000..e9b784f --- /dev/null +++ b/vendor/symfony/security-core/Exception/DisabledException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * DisabledException is thrown when the user account is disabled. + * + * @author Fabien Potencier + * @author Alexander + */ +class DisabledException extends AccountStatusException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Account is disabled.'; + } +} diff --git a/vendor/symfony/security-core/Exception/ExceptionInterface.php b/vendor/symfony/security-core/Exception/ExceptionInterface.php new file mode 100644 index 0000000..7bc2b91 --- /dev/null +++ b/vendor/symfony/security-core/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * Base ExceptionInterface for the Security component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/security-core/Exception/InsufficientAuthenticationException.php b/vendor/symfony/security-core/Exception/InsufficientAuthenticationException.php new file mode 100644 index 0000000..e33ef6a --- /dev/null +++ b/vendor/symfony/security-core/Exception/InsufficientAuthenticationException.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * InsufficientAuthenticationException is thrown if the user credentials are not sufficiently trusted. + * + * This is the case when a user is anonymous and the resource to be displayed has an access role. + * + * @author Fabien Potencier + * @author Alexander + */ +class InsufficientAuthenticationException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Not privileged to request the resource.'; + } +} diff --git a/vendor/symfony/security-core/Exception/InvalidArgumentException.php b/vendor/symfony/security-core/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..6f85e95 --- /dev/null +++ b/vendor/symfony/security-core/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * Base InvalidArgumentException for the Security component. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/security-core/Exception/InvalidCsrfTokenException.php b/vendor/symfony/security-core/Exception/InvalidCsrfTokenException.php new file mode 100644 index 0000000..84be855 --- /dev/null +++ b/vendor/symfony/security-core/Exception/InvalidCsrfTokenException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * This exception is thrown when the csrf token is invalid. + * + * @author Johannes M. Schmitt + * @author Alexander + */ +class InvalidCsrfTokenException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Invalid CSRF token.'; + } +} diff --git a/vendor/symfony/security-core/Exception/LazyResponseException.php b/vendor/symfony/security-core/Exception/LazyResponseException.php new file mode 100644 index 0000000..8edc248 --- /dev/null +++ b/vendor/symfony/security-core/Exception/LazyResponseException.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +use Symfony\Component\HttpFoundation\Response; + +/** + * A signaling exception that wraps a lazily computed response. + * + * @author Nicolas Grekas + */ +class LazyResponseException extends \Exception implements ExceptionInterface +{ + private $response; + + public function __construct(Response $response) + { + $this->response = $response; + } + + public function getResponse(): Response + { + return $this->response; + } +} diff --git a/vendor/symfony/security-core/Exception/LockedException.php b/vendor/symfony/security-core/Exception/LockedException.php new file mode 100644 index 0000000..fffae74 --- /dev/null +++ b/vendor/symfony/security-core/Exception/LockedException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * LockedException is thrown if the user account is locked. + * + * @author Fabien Potencier + * @author Alexander + */ +class LockedException extends AccountStatusException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Account is locked.'; + } +} diff --git a/vendor/symfony/security-core/Exception/LogicException.php b/vendor/symfony/security-core/Exception/LogicException.php new file mode 100644 index 0000000..b9c63e9 --- /dev/null +++ b/vendor/symfony/security-core/Exception/LogicException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * Base LogicException for the Security component. + * + * @author Iltar van der Berg + */ +class LogicException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/security-core/Exception/LogoutException.php b/vendor/symfony/security-core/Exception/LogoutException.php new file mode 100644 index 0000000..7058c62 --- /dev/null +++ b/vendor/symfony/security-core/Exception/LogoutException.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * LogoutException is thrown when the account cannot be logged out. + * + * @author Jeremy Mikola + */ +class LogoutException extends RuntimeException +{ + public function __construct(string $message = 'Logout Exception', \Throwable $previous = null) + { + parent::__construct($message, 403, $previous); + } +} diff --git a/vendor/symfony/security-core/Exception/ProviderNotFoundException.php b/vendor/symfony/security-core/Exception/ProviderNotFoundException.php new file mode 100644 index 0000000..af2e1b5 --- /dev/null +++ b/vendor/symfony/security-core/Exception/ProviderNotFoundException.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * ProviderNotFoundException is thrown when no AuthenticationProviderInterface instance + * supports an authentication Token. + * + * @author Fabien Potencier + * @author Alexander + */ +class ProviderNotFoundException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'No authentication provider found to support the authentication token.'; + } +} diff --git a/vendor/symfony/security-core/Exception/RuntimeException.php b/vendor/symfony/security-core/Exception/RuntimeException.php new file mode 100644 index 0000000..95edec8 --- /dev/null +++ b/vendor/symfony/security-core/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * Base RuntimeException for the Security component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/security-core/Exception/SessionUnavailableException.php b/vendor/symfony/security-core/Exception/SessionUnavailableException.php new file mode 100644 index 0000000..90b858a --- /dev/null +++ b/vendor/symfony/security-core/Exception/SessionUnavailableException.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * This exception is thrown when no session is available. + * + * Possible reasons for this are: + * + * a) The session timed out because the user waited too long. + * b) The user has disabled cookies, and a new session is started on each + * request. + * + * @author Johannes M. Schmitt + * @author Alexander + */ +class SessionUnavailableException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'No session available, it either timed out or cookies are not enabled.'; + } +} diff --git a/vendor/symfony/security-core/Exception/TokenNotFoundException.php b/vendor/symfony/security-core/Exception/TokenNotFoundException.php new file mode 100644 index 0000000..b050302 --- /dev/null +++ b/vendor/symfony/security-core/Exception/TokenNotFoundException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * TokenNotFoundException is thrown if a Token cannot be found. + * + * @author Johannes M. Schmitt + * @author Alexander + */ +class TokenNotFoundException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'No token could be found.'; + } +} diff --git a/vendor/symfony/security-core/Exception/TooManyLoginAttemptsAuthenticationException.php b/vendor/symfony/security-core/Exception/TooManyLoginAttemptsAuthenticationException.php new file mode 100644 index 0000000..0df80e5 --- /dev/null +++ b/vendor/symfony/security-core/Exception/TooManyLoginAttemptsAuthenticationException.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * This exception is thrown if there where too many failed login attempts in + * this session. + * + * @author Wouter de Jong + */ +class TooManyLoginAttemptsAuthenticationException extends AuthenticationException +{ + private $threshold; + + public function __construct(int $threshold = null) + { + $this->threshold = $threshold; + } + + /** + * {@inheritdoc} + */ + public function getMessageData(): array + { + return [ + '%minutes%' => $this->threshold, + '%count%' => (int) $this->threshold, + ]; + } + + /** + * {@inheritdoc} + */ + public function getMessageKey(): string + { + return 'Too many failed login attempts, please try again '.($this->threshold ? 'in %minutes% minute'.($this->threshold > 1 ? 's' : '').'.' : 'later.'); + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->threshold, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->threshold, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-core/Exception/UnsupportedUserException.php b/vendor/symfony/security-core/Exception/UnsupportedUserException.php new file mode 100644 index 0000000..6529fa9 --- /dev/null +++ b/vendor/symfony/security-core/Exception/UnsupportedUserException.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * This exception is thrown when an account is reloaded from a provider which + * doesn't support the passed implementation of UserInterface. + * + * @author Johannes M. Schmitt + */ +class UnsupportedUserException extends AuthenticationServiceException +{ +} diff --git a/vendor/symfony/security-core/Exception/UserNotFoundException.php b/vendor/symfony/security-core/Exception/UserNotFoundException.php new file mode 100644 index 0000000..6ed9a5c --- /dev/null +++ b/vendor/symfony/security-core/Exception/UserNotFoundException.php @@ -0,0 +1,99 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +/** + * UserNotFoundException is thrown if a User cannot be found for the given identifier. + * + * @author Fabien Potencier + * @author Alexander + */ +class UserNotFoundException extends AuthenticationException +{ + private $identifier; + + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Username could not be found.'; + } + + /** + * Get the user identifier (e.g. username or email address). + */ + public function getUserIdentifier(): ?string + { + return $this->identifier; + } + + /** + * @return string + * + * @deprecated + */ + public function getUsername() + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use getUserIdentifier() instead.', __METHOD__); + + return $this->identifier; + } + + /** + * Set the user identifier (e.g. username or email address). + */ + public function setUserIdentifier(string $identifier): void + { + $this->identifier = $identifier; + } + + /** + * @deprecated + */ + public function setUsername(string $username) + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use setUserIdentifier() instead.', __METHOD__); + + $this->identifier = $username; + } + + /** + * {@inheritdoc} + */ + public function getMessageData() + { + return ['{{ username }}' => $this->identifier, '{{ user_identifier }}' => $this->identifier]; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->identifier, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->identifier, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} + +if (!class_exists(UsernameNotFoundException::class, false)) { + class_alias(UserNotFoundException::class, UsernameNotFoundException::class); +} diff --git a/vendor/symfony/security-core/Exception/UsernameNotFoundException.php b/vendor/symfony/security-core/Exception/UsernameNotFoundException.php new file mode 100644 index 0000000..e0d2d4a --- /dev/null +++ b/vendor/symfony/security-core/Exception/UsernameNotFoundException.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Exception; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', UsernameNotFoundException::class, UserNotFoundException::class); + +class_exists(UserNotFoundException::class); + +if (false) { + /** + * @deprecated since Symfony 5.3 to be removed in 6.0, use UserNotFoundException instead. + */ + class UsernameNotFoundException extends AuthenticationException + { + } +} diff --git a/vendor/symfony/security-core/LICENSE b/vendor/symfony/security-core/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/security-core/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/security-core/README.md b/vendor/symfony/security-core/README.md new file mode 100644 index 0000000..6e31770 --- /dev/null +++ b/vendor/symfony/security-core/README.md @@ -0,0 +1,63 @@ +Security Component - Core +========================= + +Security provides an infrastructure for sophisticated authorization systems, +which makes it possible to easily separate the actual authorization logic from +so called user providers that hold the users credentials. + +Getting Started +--------------- + +``` +$ composer require symfony/security-core +``` + +```php +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; +use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; +use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter; +use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Symfony\Component\Security\Core\Role\RoleHierarchy; + +$accessDecisionManager = new AccessDecisionManager([ + new AuthenticatedVoter(new AuthenticationTrustResolver()), + new RoleVoter(), + new RoleHierarchyVoter(new RoleHierarchy([ + 'ROLE_ADMIN' => ['ROLE_USER'], + ])) +]); + +$user = new \App\Entity\User(...); +$token = new UsernamePasswordToken($user, 'main', $user->getRoles()); + +if (!$accessDecisionManager->decide($token, ['ROLE_ADMIN'])) { + throw new AccessDeniedException(); +} +``` + +Sponsor +------- + +The Security component for Symfony 5.4/6.0 is [backed][1] by [SymfonyCasts][2]. + +Learn Symfony faster by watching real projects being built and actively coding +along with them. SymfonyCasts bridges that learning gap, bringing you video +tutorials and coding challenges. Code on! + +Help Symfony by [sponsoring][3] its development! + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/security.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://symfonycasts.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/security-core/Resources/translations/security.af.xlf b/vendor/symfony/security-core/Resources/translations/security.af.xlf new file mode 100644 index 0000000..4fc8b14 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.af.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + 'n Verifikasie probleem het voorgekom. + + + Authentication credentials could not be found. + Verifikasiebewyse kon nie gevind word nie. + + + Authentication request could not be processed due to a system problem. + Verifikasieversoek kon weens 'n stelselprobleem nie verwerk word nie. + + + Invalid credentials. + Ongedige verifikasiebewyse. + + + Cookie has already been used by someone else. + Die koekie is alreeds deur iemand anders gebruik. + + + Not privileged to request the resource. + Nie bevoorreg om die hulpbron aan te vra nie. + + + Invalid CSRF token. + Ongeldige CSRF-teken. + + + No authentication provider found to support the authentication token. + Geen verifikasieverskaffer is gevind wat die verifikasietoken kan ondersteun nie. + + + No session available, it either timed out or cookies are not enabled. + Geen sessie is beskikbaar, die het verval of koekies is nie geaktiveer nie. + + + No token could be found. + Geen teken kon gevind word nie. + + + Username could not be found. + Gebruikersnaam kon nie gevind word nie. + + + Account has expired. + Rekening het verval. + + + Credentials have expired. + Verifikasiebewyse het verval. + + + Account is disabled. + Rekening is deaktiveer. + + + Account is locked. + Rekening is gesluit. + + + Too many failed login attempts, please try again later. + Te veel mislukte aanmeldpogings, probeer asseblief later weer. + + + Invalid or expired login link. + Ongeldige of vervalde aanmeldskakel. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.ar.xlf b/vendor/symfony/security-core/Resources/translations/security.ar.xlf new file mode 100644 index 0000000..11b2001 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.ar.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + حدث خطأ اثناء الدخول. + + + Authentication credentials could not be found. + لم استطع العثور على معلومات الدخول. + + + Authentication request could not be processed due to a system problem. + لم يكتمل طلب الدخول نتيجه عطل فى النظام. + + + Invalid credentials. + معلومات الدخول خاطئة. + + + Cookie has already been used by someone else. + ملفات تعريف الارتباط(cookies) تم استخدامها من قبل شخص اخر. + + + Not privileged to request the resource. + ليست لديك الصلاحيات الكافية لهذا الطلب. + + + Invalid CSRF token. + رمز الموقع غير صحيح. + + + No authentication provider found to support the authentication token. + لا يوجد معرف للدخول يدعم الرمز المستخدم للدخول. + + + No session available, it either timed out or cookies are not enabled. + لا يوجد صلة بينك و بين الموقع اما انها انتهت او ان متصفحك لا يدعم خاصية ملفات تعريف الارتباط (cookies). + + + No token could be found. + لم استطع العثور على الرمز. + + + Username could not be found. + لم استطع العثور على اسم الدخول. + + + Account has expired. + انتهت صلاحية الحساب. + + + Credentials have expired. + انتهت صلاحية معلومات الدخول. + + + Account is disabled. + الحساب موقوف. + + + Account is locked. + الحساب مغلق. + + + Too many failed login attempts, please try again later. + عدد كبير جدا من محاولات الدخول الفاشلة، يرجى المحاولة مرة أخرى في وقت لاحق. + + + Invalid or expired login link. + رابط تسجيل الدخول غير صالح أو منتهي الصلاحية. + + + Too many failed login attempts, please try again in %minutes% minute. + عدد كبير جدا من محاولات الدخول الفاشلة، يرجى اعادة المحاولة بعد %minutes% دقيقة. + + + Too many failed login attempts, please try again in %minutes% minutes. + عدد كبير جدا من محاولات الدخول الفاشلة، يرجى اعادة المحاولة بعد %minutes% دقيقة. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.az.xlf b/vendor/symfony/security-core/Resources/translations/security.az.xlf new file mode 100644 index 0000000..735de07 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.az.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + Doğrulama istisnası baş verdi. + + + Authentication credentials could not be found. + Doğrulama məlumatları tapılmadı. + + + Authentication request could not be processed due to a system problem. + Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi. + + + Invalid credentials. + Yanlış məlumat. + + + Cookie has already been used by someone else. + Kuki başqası tərəfindən istifadə edilib. + + + Not privileged to request the resource. + Resurs istəyi üçün imtiyaz yoxdur. + + + Invalid CSRF token. + Yanlış CSRF nişanı. + + + No authentication provider found to support the authentication token. + Doğrulama nişanını dəstəkləyəcək provayder tapılmadı. + + + No session available, it either timed out or cookies are not enabled. + Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil. + + + No token could be found. + Nişan tapılmadı. + + + Username could not be found. + İstifadəçi adı tapılmadı. + + + Account has expired. + Hesabın istifadə müddəti bitib. + + + Credentials have expired. + Məlumatların istifadə müddəti bitib. + + + Account is disabled. + Hesab qeyri-aktiv edilib. + + + Account is locked. + Hesab kilitlənib. + + + Too many failed login attempts, please try again later. + Çoxlu uğursuz giriş təşəbbüsü, zəhmət olmasa daha sonra yeniden yoxlayın. + + + Invalid or expired login link. + Yanlış və ya müddəti keçmiş giriş keçidi. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.be.xlf b/vendor/symfony/security-core/Resources/translations/security.be.xlf new file mode 100644 index 0000000..0647f45 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.be.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Памылка аўтэнтыфікацыі. + + + Authentication credentials could not be found. + Дадзеныя аўтэнтыфікацыі не знойдзены. + + + Authentication request could not be processed due to a system problem. + Запыт аўтэнтыфікацыі не можа быць апрацаваны ў сувязі з праблемай у сістэме. + + + Invalid credentials. + Несапраўдныя дадзеныя аўтэнтыфікацыі. + + + Cookie has already been used by someone else. + Нехта іншы ўжо выкарыстаў гэтыя кукі (cookie). + + + Not privileged to request the resource. + Адсутнічаюць правы на запыт гэтага рэсурсу. + + + Invalid CSRF token. + Несапраўдны CSRF-токен. + + + No authentication provider found to support the authentication token. + Не знойдзен правайдар аўтэнтыфікацыі, які можа падтрымліваць гэты токен аўтэнтыфікацыі. + + + No session available, it either timed out or cookies are not enabled. + Сесія не даступна, яе час скончыўся, або кукі (cookies) выключаны. + + + No token could be found. + Токен не знойдзен. + + + Username could not be found. + Імя карыстальніка не знойдзена. + + + Account has expired. + Скончыўся тэрмін дзеяння акаўнта. + + + Credentials have expired. + Скончыўся тэрмін дзеяння дадзеных аўтэнтыфікацыі. + + + Account is disabled. + Акаўнт адключан. + + + Account is locked. + Акаўнт заблакіраван. + + + Too many failed login attempts, please try again later. + Зашмат няўдалых спроб уваходу, калі ласка, паспрабуйце пазней. + + + Invalid or expired login link. + Спасылка для ўваходу несапраўдная або пратэрмінаваная. + + + Too many failed login attempts, please try again in %minutes% minute. + Занадта шмат няўдалых спроб уваходу ў сістэму, паспрабуйце спробу праз %minutes% хвіліну. + + + Too many failed login attempts, please try again in %minutes% minutes. + Занадта шмат няўдалых спроб уваходу ў сістэму, паспрабуйце спробу праз %minutes% хвілін. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.bg.xlf b/vendor/symfony/security-core/Resources/translations/security.bg.xlf new file mode 100644 index 0000000..1d45b28 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.bg.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Грешка при автентикация. + + + Authentication credentials could not be found. + Удостоверението за автентикация не е открито. + + + Authentication request could not be processed due to a system problem. + Заявката за автентикация не може да бъде обработената поради системна грешка. + + + Invalid credentials. + Невалидно удостоверение за автентикация. + + + Cookie has already been used by someone else. + Тази бисквитка вече се ползва от някой друг. + + + Not privileged to request the resource. + Нямате права за достъп до този ресурс. + + + Invalid CSRF token. + Невалиден CSRF токен. + + + No authentication provider found to support the authentication token. + Не е открит провайдър, който да поддържа този токен за автентикация. + + + No session available, it either timed out or cookies are not enabled. + Сесията не е достъпна, или времето за достъп е изтекло, или бисквитките не са разрешени. + + + No token could be found. + Токенът не е открит. + + + Username could not be found. + Потребителското име не е открито. + + + Account has expired. + Акаунтът е изтекъл. + + + Credentials have expired. + Удостоверението за автентикация е изтекло. + + + Account is disabled. + Акаунтът е деактивиран. + + + Account is locked. + Акаунтът е заключен. + + + Too many failed login attempts, please try again later. + Твърде много неуспешни опити за вход, моля опитайте по-късно. + + + Invalid or expired login link. + Невалиден или изтекъл линк за вход. + + + Too many failed login attempts, please try again in %minutes% minute. + Твърде много неуспешни опити за вход, моля опитайте отново след %minutes% минута. + + + Too many failed login attempts, please try again in %minutes% minutes. + Твърде много неуспешни опити за вход, моля опитайте отново след %minutes% минути. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.bs.xlf b/vendor/symfony/security-core/Resources/translations/security.bs.xlf new file mode 100644 index 0000000..15fe823 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.bs.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Došlo je do autentifikacijskog izuzetka (exception). + + + Authentication credentials could not be found. + Autentifikacijski podaci nisu pronađeni. + + + Authentication request could not be processed due to a system problem. + Autentifikacijski zahtjev ne može biti obrađen zbog sistemskog problema. + + + Invalid credentials. + Autentifikacijski podaci su neispravni. + + + Cookie has already been used by someone else. + Neko drugi je već iskoristio ovaj kolačić (cookie). + + + Not privileged to request the resource. + Nemate privilegije potrebne za pristup ovom resursu. + + + Invalid CSRF token. + CSRF žeton (token) je neispravan. + + + No authentication provider found to support the authentication token. + Nije pronađen autentifikacijski provajder koji bi podržao dati autentifikacijski žeton (token). + + + No session available, it either timed out or cookies are not enabled. + Nema dostupnih sesija; ili je istekla ili su kolačići (cookies) iksljučeni. + + + No token could be found. + Nije pronađen nijedan žeton (token). + + + Username could not be found. + Korisničko ime nije pronađeno. + + + Account has expired. + Nalog je istekao. + + + Credentials have expired. + Autentifikacijski podaci su istekli. + + + Account is disabled. + Nalog je onemogućen. + + + Account is locked. + Nalog je zaključan. + + + Too many failed login attempts, please try again later. + Previše neuspješnih pokušaja prijavljivanja, molim pokušajte ponovo kasnije. + + + Invalid or expired login link. + Link za prijavljivanje je istekao ili je neispravan. + + + Too many failed login attempts, please try again in %minutes% minute. + Previše neuspjelih pokušaja prijave, pokušajte ponovo za %minutes% minuta. + + + Too many failed login attempts, please try again in %minutes% minutes. + Previše neuspjelih pokušaja prijave, pokušajte ponovo za %minutes% minuta. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.ca.xlf b/vendor/symfony/security-core/Resources/translations/security.ca.xlf new file mode 100644 index 0000000..212ca70 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.ca.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ha succeït un error d'autenticació. + + + Authentication credentials could not be found. + No s'han trobat les credencials d'autenticació. + + + Authentication request could not be processed due to a system problem. + La solicitud d'autenticació no s'ha pogut processar per un problema del sistema. + + + Invalid credentials. + Credencials no vàlides. + + + Cookie has already been used by someone else. + La cookie ja ha estat utilitzada per una altra persona. + + + Not privileged to request the resource. + No té privilegis per solicitar el recurs. + + + Invalid CSRF token. + Token CSRF no vàlid. + + + No authentication provider found to support the authentication token. + No s'ha trobat un proveïdor d'autenticació que suporti el token d'autenticació. + + + No session available, it either timed out or cookies are not enabled. + No hi ha sessió disponible, ha expirat o les cookies no estan habilitades. + + + No token could be found. + No s'ha trobat cap token. + + + Username could not be found. + No s'ha trobat el nom d'usuari. + + + Account has expired. + El compte ha expirat. + + + Credentials have expired. + Les credencials han expirat. + + + Account is disabled. + El compte està deshabilitat. + + + Account is locked. + El compte està bloquejat. + + + Too many failed login attempts, please try again later. + Massa intents d'inici de sessió fallits, torneu-ho a provar més tard. + + + Invalid or expired login link. + Enllaç d'inici de sessió no vàlid o caducat. + + + Too many failed login attempts, please try again in %minutes% minute. + Massa intents d'inici de sessió fallits, torneu-ho a provar en %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + Massa intents d'inici de sessió fallits, torneu-ho a provar en %minutes% minuts. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.cs.xlf b/vendor/symfony/security-core/Resources/translations/security.cs.xlf new file mode 100644 index 0000000..13ace0d --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.cs.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Při ověřování došlo k chybě. + + + Authentication credentials could not be found. + Ověřovací údaje nebyly nalezeny. + + + Authentication request could not be processed due to a system problem. + Požadavek na ověření nemohl být zpracován kvůli systémové chybě. + + + Invalid credentials. + Neplatné přihlašovací údaje. + + + Cookie has already been used by someone else. + Cookie již bylo použité někým jiným. + + + Not privileged to request the resource. + Nemáte oprávnění přistupovat k prostředku. + + + Invalid CSRF token. + Neplatný CSRF token. + + + No authentication provider found to support the authentication token. + Poskytovatel pro ověřovací token nebyl nalezen. + + + No session available, it either timed out or cookies are not enabled. + Session není k dispozici, vypršela její platnost, nebo jsou zakázané cookies. + + + No token could be found. + Token nebyl nalezen. + + + Username could not be found. + Přihlašovací jméno nebylo nalezeno. + + + Account has expired. + Platnost účtu vypršela. + + + Credentials have expired. + Platnost přihlašovacích údajů vypršela. + + + Account is disabled. + Účet je zakázaný. + + + Account is locked. + Účet je zablokovaný. + + + Too many failed login attempts, please try again later. + Příliš mnoho nepovedených pokusů přihlášení. Zkuste to prosím později. + + + Invalid or expired login link. + Neplatný nebo expirovaný odkaz na přihlášení. + + + Too many failed login attempts, please try again in %minutes% minute. + Příliš mnoho neúspěšných pokusů o přihlášení, zkuste to prosím znovu za %minutes% minutu. + + + Too many failed login attempts, please try again in %minutes% minutes. + Příliš mnoho neúspěšných pokusů o přihlášení, zkuste to prosím znovu za %minutes% minut. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.da.xlf b/vendor/symfony/security-core/Resources/translations/security.da.xlf new file mode 100644 index 0000000..9b8ca4c --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.da.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + En fejl indtraf ved godkendelse. + + + Authentication credentials could not be found. + Loginoplysninger kan ikke findes. + + + Authentication request could not be processed due to a system problem. + Godkendelsesanmodning kan ikke behandles på grund af et systemfejl. + + + Invalid credentials. + Ugyldige loginoplysninger. + + + Cookie has already been used by someone else. + Cookie er allerede brugt af en anden. + + + Not privileged to request the resource. + Ingen adgang til at forespørge ressourcen. + + + Invalid CSRF token. + Ugyldig CSRF-token. + + + No authentication provider found to support the authentication token. + Ingen godkendelsesudbyder er fundet til understøttelsen af godkendelsestoken. + + + No session available, it either timed out or cookies are not enabled. + Ingen session tilgængelig, sessionen er enten udløbet eller cookies er ikke aktiveret. + + + No token could be found. + Ingen token kan findes. + + + Username could not be found. + Brugernavn kan ikke findes. + + + Account has expired. + Brugerkonto er udløbet. + + + Credentials have expired. + Loginoplysninger er udløbet. + + + Account is disabled. + Brugerkonto er deaktiveret. + + + Account is locked. + Brugerkonto er låst. + + + Too many failed login attempts, please try again later. + For mange fejlede login forsøg, prøv venligst senere. + + + Invalid or expired login link. + Ugyldigt eller udløbet login link. + + + Too many failed login attempts, please try again in %minutes% minute. + For mange fejlede login forsøg, prøv igen om %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + For mange fejlede login forsøg, prøv igen om %minutes% minutter. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.de.xlf b/vendor/symfony/security-core/Resources/translations/security.de.xlf new file mode 100644 index 0000000..dc7a875 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.de.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Es ist ein Fehler bei der Authentifikation aufgetreten. + + + Authentication credentials could not be found. + Es konnten keine Zugangsdaten gefunden werden. + + + Authentication request could not be processed due to a system problem. + Die Authentifikation konnte wegen eines Systemproblems nicht bearbeitet werden. + + + Invalid credentials. + Fehlerhafte Zugangsdaten. + + + Cookie has already been used by someone else. + Cookie wurde bereits von jemand anderem verwendet. + + + Not privileged to request the resource. + Keine Rechte, um die Ressource anzufragen. + + + Invalid CSRF token. + Ungültiges CSRF-Token. + + + No authentication provider found to support the authentication token. + Es wurde kein Authentifizierungs-Provider gefunden, der das Authentifizierungs-Token unterstützt. + + + No session available, it either timed out or cookies are not enabled. + Keine Session verfügbar, entweder ist diese abgelaufen oder Cookies sind nicht aktiviert. + + + No token could be found. + Es wurde kein Token gefunden. + + + Username could not be found. + Der Benutzername wurde nicht gefunden. + + + Account has expired. + Der Account ist abgelaufen. + + + Credentials have expired. + Die Zugangsdaten sind abgelaufen. + + + Account is disabled. + Der Account ist deaktiviert. + + + Account is locked. + Der Account ist gesperrt. + + + Too many failed login attempts, please try again later. + Zu viele fehlgeschlagene Anmeldeversuche, bitte versuchen Sie es später noch einmal. + + + Invalid or expired login link. + Ungültiger oder abgelaufener Anmelde-Link. + + + Too many failed login attempts, please try again in %minutes% minute. + Zu viele fehlgeschlagene Anmeldeversuche, bitte versuchen Sie es in einer Minute noch einmal. + + + Too many failed login attempts, please try again in %minutes% minutes. + Zu viele fehlgeschlagene Anmeldeversuche, bitte versuchen Sie es in %minutes% Minuten noch einmal. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.el.xlf b/vendor/symfony/security-core/Resources/translations/security.el.xlf new file mode 100644 index 0000000..1cf4fb2 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.el.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Συνέβη ένα σφάλμα πιστοποίησης. + + + Authentication credentials could not be found. + Τα στοιχεία πιστοποίησης δε βρέθηκαν. + + + Authentication request could not be processed due to a system problem. + Το αίτημα πιστοποίησης δε μπορεί να επεξεργαστεί λόγω σφάλματος του συστήματος. + + + Invalid credentials. + Λανθασμένα στοιχεία σύνδεσης. + + + Cookie has already been used by someone else. + Το Cookie έχει ήδη χρησιμοποιηθεί από κάποιον άλλο. + + + Not privileged to request the resource. + Δεν είστε εξουσιοδοτημένος για πρόσβαση στο συγκεκριμένο περιεχόμενο. + + + Invalid CSRF token. + Μη έγκυρο CSRF token. + + + No authentication provider found to support the authentication token. + Δε βρέθηκε κάποιος πάροχος πιστοποίησης που να υποστηρίζει το token πιστοποίησης. + + + No session available, it either timed out or cookies are not enabled. + Δεν υπάρχει ενεργή σύνοδος (session), είτε έχει λήξει ή τα cookies δεν είναι ενεργοποιημένα. + + + No token could be found. + Δεν ήταν δυνατόν να βρεθεί κάποιο token. + + + Username could not be found. + Το όνομα χρήστη δε βρέθηκε. + + + Account has expired. + Ο λογαριασμός έχει λήξει. + + + Credentials have expired. + Τα στοιχεία σύνδεσης έχουν λήξει. + + + Account is disabled. + Ο λογαριασμός είναι απενεργοποιημένος. + + + Account is locked. + Ο λογαριασμός είναι κλειδωμένος. + + + Too many failed login attempts, please try again later. + Πολλαπλές αποτυχημένες απόπειρες σύνδεσης, παρακαλούμε ξαναδοκιμάστε αργότερα. + + + Invalid or expired login link. + Μη έγκυρος ή ληγμένος σύνδεσμος σύνδεσης. + + + Too many failed login attempts, please try again in %minutes% minute. + Πολλαπλές αποτυχημένες απόπειρες σύνδεσης, παρακαλούμε ξαναδοκιμάστε σε %minutes% λεπτό. + + + Too many failed login attempts, please try again in %minutes% minutes. + Πολλαπλές αποτυχημένες απόπειρες σύνδεσης, παρακαλούμε ξαναδοκιμάστε σε %minutes% λεπτά. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.en.xlf b/vendor/symfony/security-core/Resources/translations/security.en.xlf new file mode 100644 index 0000000..e7bc7c7 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.en.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + An authentication exception occurred. + + + Authentication credentials could not be found. + Authentication credentials could not be found. + + + Authentication request could not be processed due to a system problem. + Authentication request could not be processed due to a system problem. + + + Invalid credentials. + Invalid credentials. + + + Cookie has already been used by someone else. + Cookie has already been used by someone else. + + + Not privileged to request the resource. + Not privileged to request the resource. + + + Invalid CSRF token. + Invalid CSRF token. + + + No authentication provider found to support the authentication token. + No authentication provider found to support the authentication token. + + + No session available, it either timed out or cookies are not enabled. + No session available, it either timed out or cookies are not enabled. + + + No token could be found. + No token could be found. + + + Username could not be found. + Username could not be found. + + + Account has expired. + Account has expired. + + + Credentials have expired. + Credentials have expired. + + + Account is disabled. + Account is disabled. + + + Account is locked. + Account is locked. + + + Too many failed login attempts, please try again later. + Too many failed login attempts, please try again later. + + + Invalid or expired login link. + Invalid or expired login link. + + + Too many failed login attempts, please try again in %minutes% minute. + Too many failed login attempts, please try again in %minutes% minute. + + + Too many failed login attempts, please try again in %minutes% minutes. + Too many failed login attempts, please try again in %minutes% minutes. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.es.xlf b/vendor/symfony/security-core/Resources/translations/security.es.xlf new file mode 100644 index 0000000..2aec105 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.es.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ocurrió un error de autenticación. + + + Authentication credentials could not be found. + No se encontraron las credenciales de autenticación. + + + Authentication request could not be processed due to a system problem. + La solicitud de autenticación no se pudo procesar debido a un problema del sistema. + + + Invalid credentials. + Credenciales no válidas. + + + Cookie has already been used by someone else. + La cookie ya ha sido usada por otra persona. + + + Not privileged to request the resource. + No tiene privilegios para solicitar el recurso. + + + Invalid CSRF token. + Token CSRF no válido. + + + No authentication provider found to support the authentication token. + No se encontró un proveedor de autenticación que soporte el token de autenticación. + + + No session available, it either timed out or cookies are not enabled. + No hay ninguna sesión disponible, ha expirado o las cookies no están habilitados. + + + No token could be found. + No se encontró ningún token. + + + Username could not be found. + No se encontró el nombre de usuario. + + + Account has expired. + La cuenta ha expirado. + + + Credentials have expired. + Las credenciales han expirado. + + + Account is disabled. + La cuenta está deshabilitada. + + + Account is locked. + La cuenta está bloqueada. + + + Too many failed login attempts, please try again later. + Demasiados intentos fallidos de inicio de sesión, inténtelo de nuevo más tarde. + + + Invalid or expired login link. + Enlace de inicio de sesión inválido o expirado. + + + Too many failed login attempts, please try again in %minutes% minute. + Demasiados intentos fallidos de inicio de sesión, inténtelo de nuevo en %minutes% minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Demasiados intentos fallidos de inicio de sesión, inténtelo de nuevo en %minutes% minutos. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.et.xlf b/vendor/symfony/security-core/Resources/translations/security.et.xlf new file mode 100644 index 0000000..cc2b16a --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.et.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Autentimisel juhtus ootamatu viga. + + + Authentication credentials could not be found. + Autentimisandmeid ei leitud. + + + Authentication request could not be processed due to a system problem. + Autentimispäring ei õnnestunud süsteemi probleemi tõttu. + + + Invalid credentials. + Vigased autentimisandmed. + + + Cookie has already been used by someone else. + Küpsis on juba kellegi teise poolt kasutuses. + + + Not privileged to request the resource. + Ressursi pärimiseks pole piisavalt õiguseid. + + + Invalid CSRF token. + Vigane CSRF märgis. + + + No authentication provider found to support the authentication token. + Ei leitud sobivat autentimismeetodit, mis toetaks autentimismärgist. + + + No session available, it either timed out or cookies are not enabled. + Seanss puudub, see on kas aegunud või pole küpsised lubatud. + + + No token could be found. + Identsustõendit ei leitud. + + + Username could not be found. + Kasutajanime ei leitud. + + + Account has expired. + Kasutajakonto on aegunud. + + + Credentials have expired. + Autentimistunnused on aegunud. + + + Account is disabled. + Kasutajakonto on keelatud. + + + Account is locked. + Kasutajakonto on lukustatud. + + + Too many failed login attempts, please try again later. + Liiga palju ebaõnnestunud autentimise katseid, palun proovi hiljem uuesti. + + + Invalid or expired login link. + Vigane või aegunud sisselogimise link. + + + Too many failed login attempts, please try again in %minutes% minute. + Liiga palju ebaõnnestunud autentimise katseid, palun proovi uuesti %minutes% minuti pärast. + + + Too many failed login attempts, please try again in %minutes% minutes. + Liiga palju ebaõnnestunud autentimise katseid, palun proovi uuesti %minutes% minuti pärast. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.eu.xlf b/vendor/symfony/security-core/Resources/translations/security.eu.xlf new file mode 100644 index 0000000..cfcdd1b --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.eu.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Autentifikazio-errorea gertatu da. + + + Authentication credentials could not be found. + Ez dira aurkitu autentifikazio-kredentzialak. + + + Authentication request could not be processed due to a system problem. + Ezin izan da autentifikazio-eskaera prozesatu, sistema-arazo bat gertatu da eta. + + + Invalid credentials. + Kredentzialak okerrak dira. + + + Cookie has already been used by someone else. + Dagoeneko beste pertsona batek erabili du cookiea. + + + Not privileged to request the resource. + Ez duzu baliabidea eskatzeko aukerarik. + + + Invalid CSRF token. + CSRF tokena okerra da. + + + No authentication provider found to support the authentication token. + Ez da aurkitu autentifikazio-tokena eutsi dezakeen autentifikazio-hornitzailerik. + + + No session available, it either timed out or cookies are not enabled. + Ez dago saiorik erabilgarri, iraungi egin da edo cookieak ez daude gaituta. + + + No token could be found. + Ez da tokenik aurkitu. + + + Username could not be found. + Ez da erabiltzaile-izena aurkitu. + + + Account has expired. + Kontua iraungi da. + + + Credentials have expired. + Kredentzialak iraungi dira. + + + Account is disabled. + Kontua desgaituta dago. + + + Account is locked. + Kontua blokeatuta dago. + + + Too many failed login attempts, please try again later. + Saioa hasteko saio huts gehiegi, saiatu berriro geroago. + + + Invalid or expired login link. + Sartzeko esteka baliogabea edo iraungia. + + + Too many failed login attempts, please try again in %minutes% minute. + Saioa hasteko huts gehiegi egin dira, saiatu berriro minutu %minutes% geroago. + + + Too many failed login attempts, please try again in %minutes% minutes. + Saioa hasteko huts gehiegi egin dira, saiatu berriro %minutes% minututan. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.fa.xlf b/vendor/symfony/security-core/Resources/translations/security.fa.xlf new file mode 100644 index 0000000..1127901 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.fa.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + خطایی هنگام احراز هویت رخ داده است. + + + Authentication credentials could not be found. + شرایط احراز هویت یافت نشد. + + + Authentication request could not be processed due to a system problem. + درخواست احراز هویت به دلیل وجود مشکل در سیستم قابل پردازش نمی باشد. + + + Invalid credentials. + احراز هویت نامعتبر می باشد. + + + Cookie has already been used by someone else. + Cookie قبلا توسط شخص دیگری استفاده گردیده است. + + + Not privileged to request the resource. + دسترسی لازم برای درخواست از این منبع را دارا نمی باشید. + + + Invalid CSRF token. + توکن CSRF معتبر نمی باشد. + + + No authentication provider found to support the authentication token. + هیچ ارائه دهنده احراز هویتی برای پشتیبانی از توکن احراز هویت پیدا نشد. + + + No session available, it either timed out or cookies are not enabled. + هیچ جلسه‌ای در دسترس نمی باشد. این میتواند به دلیل پایان یافتن زمان و یا فعال نبودن کوکی ها باشد. + + + No token could be found. + هیچ توکنی پیدا نشد. + + + Username could not be found. + نام ‌کاربری پیدا نشد. + + + Account has expired. + حساب کاربری منقضی گردیده است. + + + Credentials have expired. + مجوزهای احراز هویت منقضی گردیده‌اند. + + + Account is disabled. + حساب کاربری غیرفعال می باشد. + + + Account is locked. + حساب کاربری قفل گردیده است. + + + Too many failed login attempts, please try again later. + تلاش‌های ناموفق زیادی برای ورود صورت گرفته است، لطفاً بعداً دوباره امتحان کنید. + + + Invalid or expired login link. + لینک ورود نامعتبر یا تاریخ‌گذشته است. + + + Too many failed login attempts, please try again in %minutes% minute. + تلاش‌های ناموفق زیادی برای ورود صورت گرفته است، لطفاً %minutes% دقیقه دیگر دوباره امتحان کنید. + + + Too many failed login attempts, please try again in %minutes% minutes. + تلاش‌های ناموفق زیادی برای ورود صورت گرفته است، لطفاً %minutes% دقیقه دیگر دوباره امتحان کنید. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.fi.xlf b/vendor/symfony/security-core/Resources/translations/security.fi.xlf new file mode 100644 index 0000000..d0e9454 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.fi.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Autentikointi poikkeus tapahtui. + + + Authentication credentials could not be found. + Autentikoinnin tunnistetietoja ei löydetty. + + + Authentication request could not be processed due to a system problem. + Autentikointipyyntöä ei voitu käsitellä järjestelmäongelman vuoksi. + + + Invalid credentials. + Virheelliset tunnistetiedot. + + + Cookie has already been used by someone else. + Eväste on jo jonkin muun käytössä. + + + Not privileged to request the resource. + Ei oikeutta resurssiin. + + + Invalid CSRF token. + Virheellinen CSRF tunnus. + + + No authentication provider found to support the authentication token. + Autentikointi tunnukselle ei löydetty tuettua autentikointi tarjoajaa. + + + No session available, it either timed out or cookies are not enabled. + Sessio ei ole saatavilla, se on joko vanhentunut tai evästeet eivät ole käytössä. + + + No token could be found. + Tunnusta ei löytynyt. + + + Username could not be found. + Käyttäjätunnusta ei löydetty. + + + Account has expired. + Tili on vanhentunut. + + + Credentials have expired. + Tunnistetiedot ovat vanhentuneet. + + + Account is disabled. + Tili on poistettu käytöstä. + + + Account is locked. + Tili on lukittu. + + + Too many failed login attempts, please try again later. + Liian monta epäonnistunutta kirjautumisyritystä, yritä myöhemmin uudelleen. + + + Invalid or expired login link. + Virheellinen tai vanhentunut kirjautumislinkki. + + + Too many failed login attempts, please try again in %minutes% minute. + Liian monta epäonnistunutta kirjautumisyritystä, yritä uudelleen %minutes% minuutin kuluttua. + + + Too many failed login attempts, please try again in %minutes% minutes. + Liian monta epäonnistunutta kirjautumisyritystä, yritä uudelleen %minutes% minuutin kuluttua. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.fr.xlf b/vendor/symfony/security-core/Resources/translations/security.fr.xlf new file mode 100644 index 0000000..38fec55 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.fr.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Une exception d'authentification s'est produite. + + + Authentication credentials could not be found. + Les identifiants d'authentification n'ont pas pu être trouvés. + + + Authentication request could not be processed due to a system problem. + La requête d'authentification n'a pas pu être executée à cause d'un problème système. + + + Invalid credentials. + Identifiants invalides. + + + Cookie has already been used by someone else. + Le cookie a déjà été utilisé par quelqu'un d'autre. + + + Not privileged to request the resource. + Privilèges insuffisants pour accéder à la ressource. + + + Invalid CSRF token. + Jeton CSRF invalide. + + + No authentication provider found to support the authentication token. + Aucun fournisseur d'authentification n'a été trouvé pour supporter le jeton d'authentification. + + + No session available, it either timed out or cookies are not enabled. + Aucune session disponible, celle-ci a expiré ou les cookies ne sont pas activés. + + + No token could be found. + Aucun jeton n'a pu être trouvé. + + + Username could not be found. + Le nom d'utilisateur n'a pas pu être trouvé. + + + Account has expired. + Le compte a expiré. + + + Credentials have expired. + Les identifiants ont expiré. + + + Account is disabled. + Le compte est désactivé. + + + Account is locked. + Le compte est bloqué. + + + Too many failed login attempts, please try again later. + Plusieurs tentatives de connexion ont échoué, veuillez réessayer plus tard. + + + Invalid or expired login link. + Lien de connexion invalide ou expiré. + + + Too many failed login attempts, please try again in %minutes% minute. + Plusieurs tentatives de connexion ont échoué, veuillez réessayer dans %minutes% minute. + + + Too many failed login attempts, please try again in %minutes% minutes. + Plusieurs tentatives de connexion ont échoué, veuillez réessayer dans %minutes% minutes. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.gl.xlf b/vendor/symfony/security-core/Resources/translations/security.gl.xlf new file mode 100644 index 0000000..f552a68 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.gl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ocorreu un erro de autenticación. + + + Authentication credentials could not be found. + Non se atoparon as credenciais de autenticación. + + + Authentication request could not be processed due to a system problem. + A solicitude de autenticación no puido ser procesada debido a un problema do sistema. + + + Invalid credentials. + Credenciais non válidas. + + + Cookie has already been used by someone else. + A cookie xa foi empregado por outro usuario. + + + Not privileged to request the resource. + Non ten privilexios para solicitar o recurso. + + + Invalid CSRF token. + Token CSRF non válido. + + + No authentication provider found to support the authentication token. + Non se atopou un provedor de autenticación que soporte o token de autenticación. + + + No session available, it either timed out or cookies are not enabled. + Non hai ningunha sesión dispoñible, expirou ou as cookies non están habilitadas. + + + No token could be found. + Non se atopou ningún token. + + + Username could not be found. + Non se atopou o nome de usuario. + + + Account has expired. + A conta expirou. + + + Credentials have expired. + As credenciais expiraron. + + + Account is disabled. + A conta está deshabilitada. + + + Account is locked. + A conta está bloqueada. + + + Too many failed login attempts, please try again later. + Demasiados intentos de inicio de sesión fallados. Téntao de novo máis tarde. + + + Invalid or expired login link. + Ligazón de inicio de sesión non válida ou caducada. + + + Too many failed login attempts, please try again in %minutes% minute. + Demasiados intentos de inicio de sesión errados, por favor, ténteo de novo en %minutes% minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Demasiados intentos de inicio de sesión errados, por favor, ténteo de novo en %minutes% minutos. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.he.xlf b/vendor/symfony/security-core/Resources/translations/security.he.xlf new file mode 100644 index 0000000..facba0f --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.he.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + שגיאה באימות + + + Authentication credentials could not be found. + פרטי זיהוי לא נמצאו. + + + Authentication request could not be processed due to a system problem. + לא ניתן היה לעבד את בקשת אימות בגלל בעיית מערכת. + + + Invalid credentials. + שם משתמש או סיסמא שגויים. + + + Cookie has already been used by someone else. + עוגיה כבר שומשה. + + + Not privileged to request the resource. + אין הרשאה מתאימה. + + + Invalid CSRF token. + אסימון CSRF לא חוקי. + + + No authentication provider found to support the authentication token. + לא נמצא ספק אימות המתאימה לבקשה. + + + No session available, it either timed out or cookies are not enabled. + אין סיישן זמין, או שתם הזמן הקצוב או העוגיות אינן מופעלות. + + + No token could be found. + הטוקן לא נמצא. + + + Username could not be found. + שם משתמש לא נמצא. + + + Account has expired. + החשבון פג תוקף. + + + Credentials have expired. + פרטי התחברות פקעו תוקף. + + + Account is disabled. + החשבון מבוטל. + + + Account is locked. + החשבון נעול. + + + Too many failed login attempts, please try again later. + יותר מדי ניסיונות כניסה כושלים, אנא נסה שוב מאוחר יותר. + + + Invalid or expired login link. + קישור כניסה לא חוקי או שפג תוקפו. + + + Too many failed login attempts, please try again in %minutes% minute. + יותר מדי ניסיונות כניסה כושלים, אנא נסה שוב בוד %minutes% דקה. + + + Too many failed login attempts, please try again in %minutes% minutes. + יותר מדי ניסיונות כניסה כושלים, אנא נסה שוב בוד %minutes% דקות. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.hr.xlf b/vendor/symfony/security-core/Resources/translations/security.hr.xlf new file mode 100644 index 0000000..d46be51 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.hr.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Dogodila se autentifikacijske iznimka. + + + Authentication credentials could not be found. + Autentifikacijski podaci nisu pronađeni. + + + Authentication request could not be processed due to a system problem. + Autentifikacijski zahtjev nije moguće provesti uslijed sistemskog problema. + + + Invalid credentials. + Neispravni akreditacijski podaci. + + + Cookie has already been used by someone else. + Cookie je već netko drugi iskoristio. + + + Not privileged to request the resource. + Nemate privilegije zahtijevati resurs. + + + Invalid CSRF token. + Neispravan CSRF token. + + + No authentication provider found to support the authentication token. + Nije pronađen autentifikacijski provider koji bi podržao autentifikacijski token. + + + No session available, it either timed out or cookies are not enabled. + Sesija nije dostupna, ili je istekla ili cookies nisu omogućeni. + + + No token could be found. + Token nije pronađen. + + + Username could not be found. + Korisničko ime nije pronađeno. + + + Account has expired. + Račun je isteko. + + + Credentials have expired. + Akreditacijski podaci su istekli. + + + Account is disabled. + Račun je onemogućen. + + + Account is locked. + Račun je zaključan. + + + Too many failed login attempts, please try again later. + Previše neuspjelih pokušaja prijave, molim pokušajte ponovo kasnije. + + + Invalid or expired login link. + Link za prijavu je isteako ili je neispravan. + + + Too many failed login attempts, please try again in %minutes% minute. + Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minutu. + + + Too many failed login attempts, please try again in %minutes% minutes. + Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minutu.|Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minute.|Previše neuspjelih pokušaja prijave, molim pokušajte ponovo za %minutes% minuta. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.hu.xlf b/vendor/symfony/security-core/Resources/translations/security.hu.xlf new file mode 100644 index 0000000..4587e8a --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.hu.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Hitelesítési hiba lépett fel. + + + Authentication credentials could not be found. + Nem találhatók hitelesítési információk. + + + Authentication request could not be processed due to a system problem. + A hitelesítési kérést rendszerhiba miatt nem lehet feldolgozni. + + + Invalid credentials. + Érvénytelen hitelesítési információk. + + + Cookie has already been used by someone else. + Ezt a sütit valaki más már felhasználta. + + + Not privileged to request the resource. + Nem rendelkezik az erőforrás eléréséhez szükséges jogosultsággal. + + + Invalid CSRF token. + Érvénytelen CSRF token. + + + No authentication provider found to support the authentication token. + Nem található a hitelesítési tokent támogató hitelesítési szolgáltatás. + + + No session available, it either timed out or cookies are not enabled. + Munkamenet nem áll rendelkezésre, túllépte az időkeretet vagy a sütik le vannak tiltva. + + + No token could be found. + Nem található token. + + + Username could not be found. + A felhasználónév nem található. + + + Account has expired. + A fiók lejárt. + + + Credentials have expired. + A hitelesítési információk lejártak. + + + Account is disabled. + Felfüggesztett fiók. + + + Account is locked. + Zárolt fiók. + + + Too many failed login attempts, please try again later. + Túl sok sikertelen bejelentkezési kísérlet, kérjük próbálja újra később. + + + Invalid or expired login link. + Érvénytelen vagy lejárt bejelentkezési link. + + + Too many failed login attempts, please try again in %minutes% minute. + Túl sok sikertelen bejelentkezési kísérlet, kérjük próbálja újra %minutes% perc múlva. + + + Too many failed login attempts, please try again in %minutes% minutes. + Túl sok sikertelen bejelentkezési kísérlet, kérjük próbálja újra %minutes% perc múlva. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.hy.xlf b/vendor/symfony/security-core/Resources/translations/security.hy.xlf new file mode 100644 index 0000000..e7e3202 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.hy.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Նույնականացման սխալ։ + + + Authentication credentials could not be found. + Նույնականացման տվյալները չեն գտնվել։ + + + Authentication request could not be processed due to a system problem. + Համակարգային սխալ՝ նույնականացման հացրման պրոցեսինգի ժամանակ։ + + + Invalid credentials. + Սխալ մուտքային տվյալներ + + + Cookie has already been used by someone else. + Cookie-ն արդեն օգտագործվում է ուրիշի կողմից։ + + + Not privileged to request the resource. + Ռեսուրսի հարցման համար չկա թույլատվություն։ + + + Invalid CSRF token. + Անվավեր CSRF թոքեն։ + + + No authentication provider found to support the authentication token. + Նույնականացման ոչ մի մատակարար չի գտնվել, որ աջակցի նույնականացման թոքենը։ + + + No session available, it either timed out or cookies are not enabled. + Հասանելի սեսիա չկա, կամ այն սպառվել է կամ cookie-ները անջատված են: + + + No token could be found. + Թոքենը չի գտնվել։ + + + Username could not be found. + Օգտանունը չի գտնվել։ + + + Account has expired. + Հաշիվը ժամկետանց է։ + + + Credentials have expired. + Մուտքային տվյալները ժամկետանց են։ + + + Account is disabled. + Հաշիվը դեկատիվացված է։ + + + Account is locked. + Հաշիվն արգելափակված է։ + + + Too many failed login attempts, please try again later. + Չափից շատ մուտքի փորձեր, խնդրում ենք փորձել մի փոքր ուշ + + + Invalid or expired login link. + Անվավեր կամ ժամկետանց մուտքի հղում։ + + + Too many failed login attempts, please try again in %minutes% minute. + Մուտքի չափազանց շատ անհաջող փորձեր: Խնդրում ենք կրկին փորձել %minutes րոպե: + + + Too many failed login attempts, please try again in %minutes% minutes. + Մուտքի չափազանց շատ անհաջող փորձեր: Խնդրում ենք կրկին փորձել %minutes րոպե: + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.id.xlf b/vendor/symfony/security-core/Resources/translations/security.id.xlf new file mode 100644 index 0000000..119e2d0 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.id.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Terjadi sebuah pengecualian otentikasi. + + + Authentication credentials could not be found. + Kredensial otentikasi tidak bisa ditemukan. + + + Authentication request could not be processed due to a system problem. + Permintaan otentikasi tidak bisa diproses karena masalah sistem. + + + Invalid credentials. + Kredensial salah. + + + Cookie has already been used by someone else. + Cookie sudah digunakan oleh orang lain. + + + Not privileged to request the resource. + Tidak berhak untuk meminta sumber daya. + + + Invalid CSRF token. + Token CSRF salah. + + + No authentication provider found to support the authentication token. + Tidak ditemukan penyedia otentikasi untuk mendukung token otentikasi. + + + No session available, it either timed out or cookies are not enabled. + Tidak ada sesi yang tersedia, mungkin waktu sudah habis atau cookie tidak diaktifkan + + + No token could be found. + Tidak ada token yang bisa ditemukan. + + + Username could not be found. + Username tidak bisa ditemukan. + + + Account has expired. + Akun telah berakhir. + + + Credentials have expired. + Kredensial telah berakhir. + + + Account is disabled. + Akun dinonaktifkan. + + + Account is locked. + Akun terkunci. + + + Too many failed login attempts, please try again later. + Terlalu banyak percobaan login yang salah, silahkan coba lagi nanti. + + + Invalid or expired login link. + Link login salah atau sudah kedaluwarsa. + + + Too many failed login attempts, please try again in %minutes% minute. + Terlalu banyak percobaan login yang salah, silahkan coba lagi dalam %minutes% menit. + + + Too many failed login attempts, please try again in %minutes% minutes. + Terlalu banyak percobaan login yang salah, silahkan coba lagi dalam %minutes% menit. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.it.xlf b/vendor/symfony/security-core/Resources/translations/security.it.xlf new file mode 100644 index 0000000..d9d8799 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.it.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Si è verificato un errore di autenticazione. + + + Authentication credentials could not be found. + Impossibile trovare le credenziali di autenticazione. + + + Authentication request could not be processed due to a system problem. + La richiesta di autenticazione non può essere processata a causa di un errore di sistema. + + + Invalid credentials. + Credenziali non valide. + + + Cookie has already been used by someone else. + Il cookie è già stato usato da qualcun altro. + + + Not privileged to request the resource. + Non hai i privilegi per richiedere questa risorsa. + + + Invalid CSRF token. + CSRF token non valido. + + + No authentication provider found to support the authentication token. + Non è stato trovato un valido fornitore di autenticazione per supportare il token. + + + No session available, it either timed out or cookies are not enabled. + Nessuna sessione disponibile, può essere scaduta o i cookie non sono abilitati. + + + No token could be found. + Nessun token trovato. + + + Username could not be found. + Username non trovato. + + + Account has expired. + Account scaduto. + + + Credentials have expired. + Credenziali scadute. + + + Account is disabled. + L'account è disabilitato. + + + Account is locked. + L'account è bloccato. + + + Too many failed login attempts, please try again later. + Troppi tentativi di login falliti, riprova tra un po'. + + + Invalid or expired login link. + Link di login scaduto o non valido. + + + Too many failed login attempts, please try again in %minutes% minute. + Troppi tentativi di login falliti, riprova tra %minutes% minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Troppi tentativi di login falliti, riprova tra %minutes% minuti. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.ja.xlf b/vendor/symfony/security-core/Resources/translations/security.ja.xlf new file mode 100644 index 0000000..d283152 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.ja.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + 認証エラーが発生しました。 + + + Authentication credentials could not be found. + 認証資格がありません。 + + + Authentication request could not be processed due to a system problem. + システムの問題により認証要求を処理できませんでした。 + + + Invalid credentials. + 資格が無効です。 + + + Cookie has already been used by someone else. + Cookie が別のユーザーで使用されています。 + + + Not privileged to request the resource. + リソースをリクエストする権限がありません。 + + + Invalid CSRF token. + CSRF トークンが無効です。 + + + No authentication provider found to support the authentication token. + 認証トークンをサポートする認証プロバイダーが見つかりません。 + + + No session available, it either timed out or cookies are not enabled. + 利用可能なセッションがありません。タイムアウトしたか、Cookie が無効になっています。 + + + No token could be found. + トークンが見つかりません。 + + + Username could not be found. + ユーザー名が見つかりません。 + + + Account has expired. + アカウントが有効期限切れです。 + + + Credentials have expired. + 資格が有効期限切れです。 + + + Account is disabled. + アカウントが無効です。 + + + Account is locked. + アカウントはロックされています。 + + + Too many failed login attempts, please try again later. + ログイン試行回数を超えました。しばらくして再度お試しください。 + + + Invalid or expired login link. + ログインリンクが有効期限切れ、もしくは無効です。 + + + Too many failed login attempts, please try again in %minutes% minute. + ログイン試行回数が多すぎます。%minutes%分後に再度お試しください。 + + + Too many failed login attempts, please try again in %minutes% minutes. + ログイン試行回数が多すぎます。%minutes%分後に再度お試しください。 + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.lb.xlf b/vendor/symfony/security-core/Resources/translations/security.lb.xlf new file mode 100644 index 0000000..36987bc --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.lb.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + Bei der Authentifikatioun ass e Feeler opgetrueden. + + + Authentication credentials could not be found. + Et konnte keng Zouganksdate fonnt ginn. + + + Authentication request could not be processed due to a system problem. + D'Ufro fir eng Authentifikatioun konnt wéinst engem Problem vum System net beaarbecht ginn. + + + Invalid credentials. + Ongëlteg Zouganksdaten. + + + Cookie has already been used by someone else. + De Cookie gouf scho vun engem anere benotzt. + + + Not privileged to request the resource. + Keng Rechter fir d'Ressource unzefroen. + + + Invalid CSRF token. + Ongëltegen CSRF-Token. + + + No authentication provider found to support the authentication token. + Et gouf keen Authentifizéierungs-Provider fonnt deen den Authentifizéierungs-Token ënnerstëtzt. + + + No session available, it either timed out or cookies are not enabled. + Keng Sëtzung disponibel. Entweder ass se ofgelaf oder Cookies sinn net aktivéiert. + + + No token could be found. + Et konnt keen Token fonnt ginn. + + + Username could not be found. + De Benotzernumm konnt net fonnt ginn. + + + Account has expired. + Den Account ass ofgelaf. + + + Credentials have expired. + D'Zouganksdate sinn ofgelaf. + + + Account is disabled. + De Konto ass deaktivéiert. + + + Account is locked. + De Konto ass gespaart. + + + Too many failed login attempts, please try again later. + Ze vill mësslonge Login-Versich, w.e.g. méi spéit nach emol probéieren. + + + Invalid or expired login link. + Ongëltegen oder ofgelafene Login-Link. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.lt.xlf b/vendor/symfony/security-core/Resources/translations/security.lt.xlf new file mode 100644 index 0000000..b4daa08 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.lt.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Įvyko autentifikacijos klaida. + + + Authentication credentials could not be found. + Nepavyko rasti autentifikacijos duomenų. + + + Authentication request could not be processed due to a system problem. + Autentifikacijos užklausos nepavyko įvykdyti dėl sistemos klaidų. + + + Invalid credentials. + Klaidingi duomenys. + + + Cookie has already been used by someone else. + Slapukas buvo panaudotas kažkam kitam. + + + Not privileged to request the resource. + Neturite teisių pasiektį resursą. + + + Invalid CSRF token. + Neteisingas CSRF raktas. + + + No authentication provider found to support the authentication token. + Nerastas autentifikacijos tiekėjas, kuris palaikytų autentifikacijos raktą. + + + No session available, it either timed out or cookies are not enabled. + Sesija yra nepasiekiama, pasibaigė galiojimo laikas arba slapukai yra išjungti. + + + No token could be found. + Nepavyko rasti rakto. + + + Username could not be found. + Tokio naudotojo vardo nepavyko rasti. + + + Account has expired. + Paskyros galiojimo laikas baigėsi. + + + Credentials have expired. + Autentifikacijos duomenų galiojimo laikas baigėsi. + + + Account is disabled. + Paskyra yra išjungta. + + + Account is locked. + Paskyra yra užblokuota. + + + Too many failed login attempts, please try again later. + Per daug nepavykusių prisijungimo bandymų, pabandykite dar kartą vėliau. + + + Invalid or expired login link. + Netinkama arba pasibaigusio galiojimo laiko prisijungimo nuoroda. + + + Too many failed login attempts, please try again in %minutes% minute. + Per daug nepavykusių prisijungimo bandymų, pabandykite dar kartą po %minutes% minutės. + + + Too many failed login attempts, please try again in %minutes% minutes. + Per daug nepavykusių prisijungimo bandymų, pabandykite dar kartą po %minutes% minutės.|Per daug nepavykusių prisijungimo bandymų, pabandykite dar kartą po %minutes% minučių.|Per daug nepavykusių prisijungimo bandymų, pabandykite dar kartą po %minutes% minučių. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.lv.xlf b/vendor/symfony/security-core/Resources/translations/security.lv.xlf new file mode 100644 index 0000000..bdb4a22 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.lv.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Radās autentifikācijas kļūda. + + + Authentication credentials could not be found. + Autentifikācijas dati nav atrasti. + + + Authentication request could not be processed due to a system problem. + Autentifikācijas pieprasījums nevar tikt apstrādāts sistēmas problēmas dēļ. + + + Invalid credentials. + Nederīgi autentifikācijas dati. + + + Cookie has already been used by someone else. + Kāds cits jau izmantoja sīkdatni. + + + Not privileged to request the resource. + Nav tiesību ši resursa izsaukšanai. + + + Invalid CSRF token. + Nederīgs CSRF talons. + + + No authentication provider found to support the authentication token. + Nav atrasts, autentifikācijas talonu atbalstošs, autentifikācijas sniedzējs. + + + No session available, it either timed out or cookies are not enabled. + Sesija nav pieejama - vai nu tā beidzās, vai nu sīkdatnes nav iespējotas. + + + No token could be found. + Nevar atrast nevienu talonu. + + + Username could not be found. + Nevar atrast lietotājvārdu. + + + Account has expired. + Konta derīguma termiņš ir beidzies. + + + Credentials have expired. + Autentifikācijas datu derīguma termiņš ir beidzies. + + + Account is disabled. + Konts ir atspējots. + + + Account is locked. + Konts ir slēgts. + + + Too many failed login attempts, please try again later. + Pārāk daudz atteiktu ieejas mēģinājumu, lūdzu, mēģiniet vēlreiz vēlāk. + + + Invalid or expired login link. + Ieejas saite ir nederīga vai arī tai ir beidzies derīguma termiņš. + + + Too many failed login attempts, please try again in %minutes% minute. + Pārāk daudz nesekmīgu autentifikācijas mēģinājumu, lūdzu mēģiniet vēlreiz pēc %minutes% minūtes. + + + Too many failed login attempts, please try again in %minutes% minutes. + Pārāk daudz nesekmīgu autentifikācijas mēģinājumu, lūdzu mēģiniet vēlreiz pēc %minutes% minūtēm. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.mn.xlf b/vendor/symfony/security-core/Resources/translations/security.mn.xlf new file mode 100644 index 0000000..7310e66 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.mn.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + Нэвтрэх хүсэлтийн алдаа гарав. + + + Authentication credentials could not be found. + Нэвтрэх эрхийн мэдээлэл олдсонгүй. + + + Authentication request could not be processed due to a system problem. + Системийн алдаанаас болон нэвтрэх хүсэлтийг гүйцэтгэх боломжгүй байна. + + + Invalid credentials. + Буруу нэвтрэх эрхийн мэдээлэл. + + + Cookie has already been used by someone else. + Күүки файлыг аль хэдийн өөр хүн хэрэглэж байна. + + + Not privileged to request the resource. + Энэхүү мэдээллийг авах эрх хүрэхгүй байна. + + + Invalid CSRF token. + Тохиромжгүй CSRF токен. + + + No authentication provider found to support the authentication token. + Нэвтрэх токенг дэмжих нэвтрэх эрхийн хангагч олдсонгүй. + + + No available, it either timed out or cookies are not enabled. + Хэрэглэгчийн session олдсонгүй, хугацаа нь дууссан эсвэл күүки идэвхижүүлээгүй байна. + + + No token could be found. + Токен олдсонгүй. + + + Username could not be found. + Нэвтрэх нэр олсонгүй. + + + Account has expired. + Бүртгэлийн хугацаа дууссан байна. + + + Credentials have expired. + Нэвтрэх эрхийн хугацаа дууссан байна. + + + Account is disabled. + Бүртгэлийг хаасан байна. + + + Account is locked. + Бүртгэлийг цоожилсон байна. + + + Too many failed login attempts, please try again later. + Хэтэрхий олон амжилтгүй оролдлого, түр хүлээгээд дахин оролдоно уу. + + + Invalid or expired login link. + Буруу эсвэл хугацаа нь дууссан нэвтрэх зам. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.my.xlf b/vendor/symfony/security-core/Resources/translations/security.my.xlf new file mode 100644 index 0000000..df593f0 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.my.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + အသုံးပြုခွင့် ခြွင်းချက်တစ်ခုဖြစ်သွားသည်။ + + + Authentication credentials could not be found. + အသုံးပြုခွင့် အထောက်အထားများ ရှာမတွေ့ပါ။ + + + Authentication request could not be processed due to a system problem. + System ပြဿနာအခက်အခဲရှိ နေပါသဖြင့် အသုံးပြုခွင့်တောင်းဆိုချက်ကို ဆောင်ရွက်၍မရ နိုင်ပါ။ + + + Invalid credentials. + သင့်လျှော်သော် အထောက်အထားမဟုတ်ပါ။ + + + Cookie has already been used by someone else. + Cookie ကို တစ်စုံတစ်ယောက်မှ အသုံးပြုပြီးဖြစ်သည်။ + + + Not privileged to request the resource. + အရင်းအမြစ်ကိုတောင်းဆိုရန်အခွင့်ထူးမရပါ။ + + + Invalid CSRF token. + သင့်လျှော်သော် CSRF token မဟုတ်ပါ။ + + + No authentication provider found to support the authentication token. + အထောက်အထားစိစစ်ခြင်းသင်္ကေတကိုပံ့ပိုးရန် မည်သည့်အထောက်အထားစိစစ်ရေး ၀န်ဆောင်မှုမှမတွေ့ပါ။ + + + No session available, it either timed out or cookies are not enabled. + Session မအားလပ်ပါ။ Session အချိန်ကုန်သွားခြင်း (သို့မဟုတ်) cookies များကိုဖွင့်ထားခြင်းမရှိပါ။ + + + No token could be found. + Toke ရှာမတွေ့ပါ။ + + + Username could not be found. + အသုံးပြုသူအမည် ရှာဖွေတွေ့ရှိချင်းမရှိပါ။ + + + Account has expired. + အကောင့် သက်တမ်းကုန်လွန်သွားပါပြီ။ + + + Credentials have expired. + အထောက်အထားသက်တန်း ကုန်လွန်သွားပါပြီ။ + + + Account is disabled. + အကောင့်ပိတ်ထားပါသည်။ + + + Account is locked. + အကောင့် လောခ်ကျသွားပါပြီ။ + + + Too many failed login attempts, please try again later. + Login ၀င်ရန်ကြိုးစားမှုများလွန်းပါသည်၊ ကျေးဇူးပြု၍ နောက်မှထပ်ကြိုးစားပါ။ + + + Invalid or expired login link. + မသင့်လျှော်သော် (သို့မဟုတ်) သက်တန်းကုန်သော login link ဖြစ်ပါသည်။ + + + Too many failed login attempts, please try again in %minutes% minute. + Too many failed login attempts, please try again in %minutes% minute. + + + Too many failed login attempts, please try again in %minutes% minutes. + Login ၀င်ရန်ကြိုးစားမှုများလွန်းပါသည်၊ ကျေးဇူးပြု၍ နောက် %minutes% မှထပ်မံကြိုးစားပါ။ + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.nb.xlf b/vendor/symfony/security-core/Resources/translations/security.nb.xlf new file mode 100644 index 0000000..2d3a87c --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.nb.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + En autentiseringsfeil har skjedd. + + + Authentication credentials could not be found. + Påloggingsinformasjonen kunne ikke bli funnet. + + + Authentication request could not be processed due to a system problem. + Autentiserings forespørselen kunne ikke bli prosessert grunnet en system feil. + + + Invalid credentials. + Ugyldig påloggingsinformasjon. + + + Cookie has already been used by someone else. + Cookie har allerede blitt brukt av noen andre. + + + Not privileged to request the resource. + Ingen tilgang til å be om gitt ressurs. + + + Invalid CSRF token. + Ugyldig CSRF token. + + + No authentication provider found to support the authentication token. + Ingen autentiserings tilbyder funnet som støtter gitt autentiserings token. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengelig, sesjonen er enten utløpt eller cookies ikke skrudd på. + + + No token could be found. + Ingen token kunne bli funnet. + + + Username could not be found. + Brukernavn kunne ikke bli funnet. + + + Account has expired. + Brukerkonto har utgått. + + + Credentials have expired. + Påloggingsinformasjon har utløpt. + + + Account is disabled. + Brukerkonto er deaktivert. + + + Account is locked. + Brukerkonto er sperret. + + + Too many failed login attempts, please try again later. + For mange mislykkede påloggingsforsøk. Prøv igjen senere. + + + Invalid or expired login link. + Ugyldig eller utløpt påloggingskobling. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.nl.xlf b/vendor/symfony/security-core/Resources/translations/security.nl.xlf new file mode 100644 index 0000000..b07c785 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.nl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Er heeft zich een authenticatieprobleem voorgedaan. + + + Authentication credentials could not be found. + Authenticatiegegevens konden niet worden gevonden. + + + Authentication request could not be processed due to a system problem. + Authenticatieaanvraag kon niet worden verwerkt door een technisch probleem. + + + Invalid credentials. + Ongeldige inloggegevens. + + + Cookie has already been used by someone else. + Cookie is al door een ander persoon gebruikt. + + + Not privileged to request the resource. + Onvoldoende rechten om de aanvraag te verwerken. + + + Invalid CSRF token. + CSRF-code is ongeldig. + + + No authentication provider found to support the authentication token. + Geen authenticatieprovider gevonden die de authenticatietoken ondersteunt. + + + No session available, it either timed out or cookies are not enabled. + Geen sessie beschikbaar, mogelijk is deze verlopen of cookies zijn uitgeschakeld. + + + No token could be found. + Er kon geen authenticatietoken worden gevonden. + + + Username could not be found. + Gebruikersnaam kon niet worden gevonden. + + + Account has expired. + Account is verlopen. + + + Credentials have expired. + Authenticatiegegevens zijn verlopen. + + + Account is disabled. + Account is gedeactiveerd. + + + Account is locked. + Account is geblokkeerd. + + + Too many failed login attempts, please try again later. + Te veel onjuiste inlogpogingen, probeer het later nogmaals. + + + Invalid or expired login link. + Ongeldige of verlopen inloglink. + + + Too many failed login attempts, please try again in %minutes% minute. + Te veel onjuiste inlogpogingen, probeer het opnieuw over %minutes% minuut. + + + Too many failed login attempts, please try again in %minutes% minutes. + Te veel onjuiste inlogpogingen, probeer het opnieuw over %minutes% minuten. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.nn.xlf b/vendor/symfony/security-core/Resources/translations/security.nn.xlf new file mode 100644 index 0000000..89ca44f --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.nn.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + Innlogginga har feila. + + + Authentication credentials could not be found. + Innloggingsinformasjonen vart ikkje funnen. + + + Authentication request could not be processed due to a system problem. + Innlogginga vart ikkje fullført på grunn av ein systemfeil. + + + Invalid credentials. + Ugyldig innloggingsinformasjon. + + + Cookie has already been used by someone else. + Informasjonskapselen er allereie brukt av ein annan brukar. + + + Not privileged to request the resource. + Du har ikkje åtgang til å be om denne ressursen. + + + Invalid CSRF token. + Ugyldig CSRF-teikn. + + + No authentication provider found to support the authentication token. + Fann ingen innloggingstilbydar som støttar dette innloggingsteiknet. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengeleg. Sesjonen er anten ikkje lenger gyldig, eller informasjonskapslar er ikkje skrudd på i nettlesaren. + + + No token could be found. + Fann ingen innloggingsteikn. + + + Username could not be found. + Fann ikkje brukarnamnet. + + + Account has expired. + Brukarkontoen er utgjengen. + + + Credentials have expired. + Innloggingsinformasjonen er utgjengen. + + + Account is disabled. + Brukarkontoen er sperra. + + + Account is locked. + Brukarkontoen er sperra. + + + Too many failed login attempts, please try again later. + For mange innloggingsforsøk har feila, prøv igjen seinare. + + + Invalid or expired login link. + Innloggingslenka er ugyldig eller utgjengen. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.no.xlf b/vendor/symfony/security-core/Resources/translations/security.no.xlf new file mode 100644 index 0000000..2d3a87c --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.no.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + En autentiseringsfeil har skjedd. + + + Authentication credentials could not be found. + Påloggingsinformasjonen kunne ikke bli funnet. + + + Authentication request could not be processed due to a system problem. + Autentiserings forespørselen kunne ikke bli prosessert grunnet en system feil. + + + Invalid credentials. + Ugyldig påloggingsinformasjon. + + + Cookie has already been used by someone else. + Cookie har allerede blitt brukt av noen andre. + + + Not privileged to request the resource. + Ingen tilgang til å be om gitt ressurs. + + + Invalid CSRF token. + Ugyldig CSRF token. + + + No authentication provider found to support the authentication token. + Ingen autentiserings tilbyder funnet som støtter gitt autentiserings token. + + + No session available, it either timed out or cookies are not enabled. + Ingen sesjon tilgjengelig, sesjonen er enten utløpt eller cookies ikke skrudd på. + + + No token could be found. + Ingen token kunne bli funnet. + + + Username could not be found. + Brukernavn kunne ikke bli funnet. + + + Account has expired. + Brukerkonto har utgått. + + + Credentials have expired. + Påloggingsinformasjon har utløpt. + + + Account is disabled. + Brukerkonto er deaktivert. + + + Account is locked. + Brukerkonto er sperret. + + + Too many failed login attempts, please try again later. + For mange mislykkede påloggingsforsøk. Prøv igjen senere. + + + Invalid or expired login link. + Ugyldig eller utløpt påloggingskobling. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.pl.xlf b/vendor/symfony/security-core/Resources/translations/security.pl.xlf new file mode 100644 index 0000000..430f9f2 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.pl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Wystąpił błąd uwierzytelniania. + + + Authentication credentials could not be found. + Dane uwierzytelniania nie zostały znalezione. + + + Authentication request could not be processed due to a system problem. + Żądanie uwierzytelniania nie mogło zostać pomyślnie zakończone z powodu problemu z systemem. + + + Invalid credentials. + Nieprawidłowe dane. + + + Cookie has already been used by someone else. + To ciasteczko jest używane przez kogoś innego. + + + Not privileged to request the resource. + Brak uprawnień dla żądania wskazanego zasobu. + + + Invalid CSRF token. + Nieprawidłowy token CSRF. + + + No authentication provider found to support the authentication token. + Nie znaleziono mechanizmu uwierzytelniania zdolnego do obsługi przesłanego tokenu. + + + No session available, it either timed out or cookies are not enabled. + Brak danych sesji, sesja wygasła lub ciasteczka nie są włączone. + + + No token could be found. + Nie znaleziono tokenu. + + + Username could not be found. + Użytkownik o podanej nazwie nie istnieje. + + + Account has expired. + Konto wygasło. + + + Credentials have expired. + Dane uwierzytelniania wygasły. + + + Account is disabled. + Konto jest wyłączone. + + + Account is locked. + Konto jest zablokowane. + + + Too many failed login attempts, please try again later. + Zbyt dużo nieudanych prób logowania, proszę spróbować ponownie później. + + + Invalid or expired login link. + Nieprawidłowy lub wygasły link logowania. + + + Too many failed login attempts, please try again in %minutes% minute. + Zbyt wiele nieudanych prób logowania, spróbuj ponownie po upływie %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + Zbyt wiele nieudanych prób logowania, spróbuj ponownie po upływie %minutes% minut. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.pt.xlf b/vendor/symfony/security-core/Resources/translations/security.pt.xlf new file mode 100644 index 0000000..e4034ae --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.pt.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ocorreu uma excepção durante a autenticação. + + + Authentication credentials could not be found. + As credenciais de autenticação não foram encontradas. + + + Authentication request could not be processed due to a system problem. + O pedido de autenticação não foi concluído devido a um problema no sistema. + + + Invalid credentials. + Credenciais inválidas. + + + Cookie has already been used by someone else. + Este cookie já está em uso. + + + Not privileged to request the resource. + Não possui privilégios para aceder a este recurso. + + + Invalid CSRF token. + Token CSRF inválido. + + + No authentication provider found to support the authentication token. + Nenhum fornecedor de autenticação encontrado para suportar o token de autenticação. + + + No session available, it either timed out or cookies are not enabled. + Não existe sessão disponível, esta expirou ou os cookies estão desativados. + + + No token could be found. + O token não foi encontrado. + + + Username could not be found. + Nome de utilizador não encontrado. + + + Account has expired. + A conta expirou. + + + Credentials have expired. + As credenciais expiraram. + + + Account is disabled. + Conta desativada. + + + Account is locked. + A conta está trancada. + + + Too many failed login attempts, please try again later. + Várias tentativas de login falhadas, por favor tente mais tarde. + + + Invalid or expired login link. + Ligação de login inválida ou expirada. + + + Too many failed login attempts, please try again in %minutes% minute. + Demasiadas tentativas de login, tente novamente num minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Demasiadas tentativas de login, tente novamente em %minutes% minutos. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.pt_BR.xlf b/vendor/symfony/security-core/Resources/translations/security.pt_BR.xlf new file mode 100644 index 0000000..438ae86 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.pt_BR.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Uma exceção ocorreu durante a autenticação. + + + Authentication credentials could not be found. + As credenciais de autenticação não foram encontradas. + + + Authentication request could not be processed due to a system problem. + A solicitação de autenticação não pôde ser processada devido a um problema no sistema. + + + Invalid credentials. + Credenciais inválidas. + + + Cookie has already been used by someone else. + Este cookie já foi usado por outra pessoa. + + + Not privileged to request the resource. + Sem privilégio para solicitar o recurso. + + + Invalid CSRF token. + Token CSRF inválido. + + + No authentication provider found to support the authentication token. + Nenhum provedor de autenticação encontrado para suportar o token de autenticação. + + + No session available, it either timed out or cookies are not enabled. + Nenhuma sessão disponível, ela expirou ou os cookies não estão habilitados. + + + No token could be found. + Nenhum token foi encontrado. + + + Username could not be found. + Nome de usuário não encontrado. + + + Account has expired. + A conta está expirada. + + + Credentials have expired. + As credenciais estão expiradas. + + + Account is disabled. + Conta desativada. + + + Account is locked. + A conta está travada. + + + Too many failed login attempts, please try again later. + Muitas tentativas de login malsucedidas, tente novamente mais tarde. + + + Invalid or expired login link. + Link de login inválido ou expirado. + + + Too many failed login attempts, please try again in %minutes% minute. + Muitas tentativas de login inválidas, por favor, tente novamente em um minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Muitas tentativas de login inválidas, por favor, tente novamente em %minutes% minutos. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.ro.xlf b/vendor/symfony/security-core/Resources/translations/security.ro.xlf new file mode 100644 index 0000000..9324a86 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.ro.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + A apărut o eroare de autentificare. + + + Authentication credentials could not be found. + Informațiile de autentificare nu au fost găsite. + + + Authentication request could not be processed due to a system problem. + Sistemul nu a putut procesa cererea de autentificare din cauza unei erori. + + + Invalid credentials. + Date de autentificare invalide. + + + Cookie has already been used by someone else. + Cookie este folosit deja de altcineva. + + + Not privileged to request the resource. + Permisiuni insuficiente pentru resursa cerută. + + + Invalid CSRF token. + Token CSRF este invalid. + + + No authentication provider found to support the authentication token. + Nu a fost găsit nici un agent de autentificare pentru tokenul specificat. + + + No session available, it either timed out or cookies are not enabled. + Sesiunea nu mai este disponibilă, a expirat sau suportul pentru cookies nu este activat. + + + No token could be found. + Tokenul nu a putut fi găsit. + + + Username could not be found. + Numele de utilizator nu a fost găsit. + + + Account has expired. + Contul a expirat. + + + Credentials have expired. + Datele de autentificare au expirat. + + + Account is disabled. + Contul este dezactivat. + + + Account is locked. + Contul este blocat. + + + Too many failed login attempts, please try again later. + Prea multe încercări de autentificare eșuate, vă rugăm să încercați mai târziu. + + + Invalid or expired login link. + Link de autentificare invalid sau expirat. + + + Too many failed login attempts, please try again in %minutes% minute. + Prea multe încercări nereușite, încearcă din nou în %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + Prea multe încercări nereușite, încearcă din nou în %minutes% minute. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.ru.xlf b/vendor/symfony/security-core/Resources/translations/security.ru.xlf new file mode 100644 index 0000000..4a3124f --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.ru.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ошибка аутентификации. + + + Authentication credentials could not be found. + Аутентификационные данные не найдены. + + + Authentication request could not be processed due to a system problem. + Запрос аутентификации не может быть обработан в связи с проблемой в системе. + + + Invalid credentials. + Недействительные аутентификационные данные. + + + Cookie has already been used by someone else. + Cookie уже был использован кем-то другим. + + + Not privileged to request the resource. + Отсутствуют права на запрос этого ресурса. + + + Invalid CSRF token. + Недействительный токен CSRF. + + + No authentication provider found to support the authentication token. + Не найден провайдер аутентификации, поддерживающий токен аутентификации. + + + No session available, it either timed out or cookies are not enabled. + Сессия не найдена, ее время истекло, либо cookies не включены. + + + No token could be found. + Токен не найден. + + + Username could not be found. + Имя пользователя не найдено. + + + Account has expired. + Время действия учетной записи истекло. + + + Credentials have expired. + Время действия аутентификационных данных истекло. + + + Account is disabled. + Учетная запись отключена. + + + Account is locked. + Учетная запись заблокирована. + + + Too many failed login attempts, please try again later. + Слишком много неудачных попыток входа, пожалуйста, попробуйте позже. + + + Invalid or expired login link. + Ссылка для входа недействительна или просрочена. + + + Too many failed login attempts, please try again in %minutes% minute. + Слишком много неудачных попыток входа в систему, повторите попытку через %minutes% минуту. + + + Too many failed login attempts, please try again in %minutes% minutes. + Слишком много неудачных попыток входа в систему, повторите попытку через %minutes% мин. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sk.xlf b/vendor/symfony/security-core/Resources/translations/security.sk.xlf new file mode 100644 index 0000000..8e06bef --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sk.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Pri overovaní došlo k chybe. + + + Authentication credentials could not be found. + Overovacie údaje neboli nájdené. + + + Authentication request could not be processed due to a system problem. + Požiadavok na overenie nemohol byť spracovaný kvôli systémovej chybe. + + + Invalid credentials. + Neplatné prihlasovacie údaje. + + + Cookie has already been used by someone else. + Cookie už bolo použité niekým iným. + + + Not privileged to request the resource. + Nemáte oprávnenie pristupovať k prostriedku. + + + Invalid CSRF token. + Neplatný CSRF token. + + + No authentication provider found to support the authentication token. + Poskytovateľ pre overovací token nebol nájdený. + + + No session available, it either timed out or cookies are not enabled. + Session nie je k dispozíci, vypršala jej platnosť, alebo sú zakázané cookies. + + + No token could be found. + Token nebol nájdený. + + + Username could not be found. + Prihlasovacie meno nebolo nájdené. + + + Account has expired. + Platnosť účtu skončila. + + + Credentials have expired. + Platnosť prihlasovacích údajov skončila. + + + Account is disabled. + Účet je zakázaný. + + + Account is locked. + Účet je zablokovaný. + + + Too many failed login attempts, please try again later. + Príliš mnoho neúspešných pokusov o prihlásenie. Skúste to prosím znovu neskôr. + + + Invalid or expired login link. + Neplatný alebo expirovaný odkaz na prihlásenie. + + + Too many failed login attempts, please try again in %minutes% minute. + Príliš veľa neúspešných pokusov o prihlásenie. Skúste to znova o %minutes% minútu. + + + Too many failed login attempts, please try again in %minutes% minutes. + Príliš veľa neúspešných pokusov o prihlásenie. Skúste to znova o %minutes% minút. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sl.xlf b/vendor/symfony/security-core/Resources/translations/security.sl.xlf new file mode 100644 index 0000000..6466e58 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Prišlo je do izjeme pri preverjanju avtentikacije. + + + Authentication credentials could not be found. + Poverilnic za avtentikacijo ni bilo mogoče najti. + + + Authentication request could not be processed due to a system problem. + Zahteve za avtentikacijo ni bilo mogoče izvesti zaradi sistemske težave. + + + Invalid credentials. + Neveljavne pravice. + + + Cookie has already been used by someone else. + Piškotek je uporabil že nekdo drug. + + + Not privileged to request the resource. + Nimate privilegijev za zahtevani vir. + + + Invalid CSRF token. + Neveljaven CSRF žeton. + + + No authentication provider found to support the authentication token. + Ponudnika avtentikacije za podporo prijavnega žetona ni bilo mogoče najti. + + + No session available, it either timed out or cookies are not enabled. + Seja ni na voljo, ali je potekla ali pa piškotki niso omogočeni. + + + No token could be found. + Žetona ni bilo mogoče najti. + + + Username could not be found. + Uporabniškega imena ni bilo mogoče najti. + + + Account has expired. + Račun je potekel. + + + Credentials have expired. + Poverilnice so potekle. + + + Account is disabled. + Račun je onemogočen. + + + Account is locked. + Račun je zaklenjen. + + + Too many failed login attempts, please try again later. + Preveč neuspelih poskusov prijave, poskusite znova pozneje. + + + Invalid or expired login link. + Neveljavna ali potekla povezava prijave. + + + Too many failed login attempts, please try again in %minutes% minute. + Preveč neuspelih poskusov prijave, poskusite znova čez %minutes% minuto. + + + Too many failed login attempts, please try again in %minutes% minutes. + Preveč neuspelih poskusov prijave, poskusite znova čez %minutes% minut. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sq.xlf b/vendor/symfony/security-core/Resources/translations/security.sq.xlf new file mode 100644 index 0000000..03e1370 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sq.xlf @@ -0,0 +1,75 @@ + + + + + + An authentication exception occurred. + Ndodhi një problem në autentikim. + + + Authentication credentials could not be found. + Kredencialet e autentikimit nuk mund të gjendeshin. + + + Authentication request could not be processed due to a system problem. + Kërkesa për autentikim nuk mund të përpunohej për shkak të një problemi në sistem. + + + Invalid credentials. + Kredenciale të pavlefshme. + + + Cookie has already been used by someone else. + Cookie është përdorur tashmë nga dikush tjetër. + + + Not privileged to request the resource. + Nuk është i privilegjuar të kërkojë burimin. + + + Invalid CSRF token. + Identifikues i pavlefshëm CSRF. + + + No authentication provider found to support the authentication token. + Asnjë ofrues i vërtetimit nuk u gjet që të mbështesë simbolin e vërtetimit. + + + No session available, it either timed out or cookies are not enabled. + Nuk ka asnjë sesion të vlefshëm, i ka skaduar koha ose cookies nuk janë aktivizuar. + + + No token could be found. + Asnjë simbol identifikimi nuk mund të gjendej. + + + Username could not be found. + Emri i përdoruesit nuk mund të gjendej. + + + Account has expired. + Llogaria ka skaduar. + + + Credentials have expired. + Kredencialet kanë skaduar. + + + Account is disabled. + Llogaria është çaktivizuar. + + + Account is locked. + Llogaria është e kyçur. + + + Too many failed login attempts, please try again later. + Shumë përpjekje të dështuara autentikimi, provo përsëri më vonë. + + + Invalid or expired login link. + Link hyrje i pavlefshëm ose i skaduar. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sr_Cyrl.xlf b/vendor/symfony/security-core/Resources/translations/security.sr_Cyrl.xlf new file mode 100644 index 0000000..97549bd --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sr_Cyrl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Изузетак при аутентификацији. + + + Authentication credentials could not be found. + Аутентификациони подаци нису пронађени. + + + Authentication request could not be processed due to a system problem. + Захтев за аутентификацију не може бити обрађен због системских проблема. + + + Invalid credentials. + Невалидни подаци за аутентификацију. + + + Cookie has already been used by someone else. + Колачић је већ искоришћен од стране неког другог. + + + Not privileged to request the resource. + Немате права приступа овом ресурсу. + + + Invalid CSRF token. + Невалидан CSRF токен. + + + No authentication provider found to support the authentication token. + Аутентификациони провајдер за подршку токена није пронађен. + + + No session available, it either timed out or cookies are not enabled. + Сесија није доступна, истекла је или су колачићи искључени. + + + No token could be found. + Токен не може бити пронађен. + + + Username could not be found. + Корисничко име не може бити пронађено. + + + Account has expired. + Налог је истекао. + + + Credentials have expired. + Подаци за аутентификацију су истекли. + + + Account is disabled. + Налог је онемогућен. + + + Account is locked. + Налог је закључан. + + + Too many failed login attempts, please try again later. + Превише неуспешних покушаја пријављивања, молим покушајте поново касније. + + + Invalid or expired login link. + Линк за пријављивање је истекао или је неисправан. + + + Too many failed login attempts, please try again in %minutes% minute. + Превише неуспешних покушаја пријављивања, молим покушајте поново за %minutes% минут. + + + Too many failed login attempts, please try again in %minutes% minutes. + Превише неуспешних покушаја пријављивања, молим покушајте поново за %minutes% минута. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sr_Latn.xlf b/vendor/symfony/security-core/Resources/translations/security.sr_Latn.xlf new file mode 100644 index 0000000..f3de5de --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sr_Latn.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Izuzetak pri autentifikaciji. + + + Authentication credentials could not be found. + Autentifikacioni podaci nisu pronađeni. + + + Authentication request could not be processed due to a system problem. + Zahtev za autentifikaciju ne može biti obrađen zbog sistemskih problema. + + + Invalid credentials. + Nevalidni podaci za autentifikaciju. + + + Cookie has already been used by someone else. + Kolačić je već iskorišćen od strane nekog drugog. + + + Not privileged to request the resource. + Nemate prava pristupa ovom resursu. + + + Invalid CSRF token. + Nevalidan CSRF token. + + + No authentication provider found to support the authentication token. + Autentifikacioni provajder za podršku tokena nije pronađen. + + + No session available, it either timed out or cookies are not enabled. + Sesija nije dostupna, istekla je ili su kolačići isključeni. + + + No token could be found. + Token ne može biti pronađen. + + + Username could not be found. + Korisničko ime ne može biti pronađeno. + + + Account has expired. + Nalog je istekao. + + + Credentials have expired. + Podaci za autentifikaciju su istekli. + + + Account is disabled. + Nalog je onemogućen. + + + Account is locked. + Nalog je zaključan. + + + Too many failed login attempts, please try again later. + Previše neuspešnih pokušaja prijavljivanja, molim pokušajte ponovo kasnije. + + + Invalid or expired login link. + Link za prijavljivanje je istekao ili je neispravan. + + + Too many failed login attempts, please try again in %minutes% minute. + Previše neuspešnih pokušaja prijavljivanja, molim pokušajte ponovo za %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + Previše neuspešnih pokušaja prijavljivanja, molim pokušajte ponovo za %minutes% minuta. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.sv.xlf b/vendor/symfony/security-core/Resources/translations/security.sv.xlf new file mode 100644 index 0000000..6d7b248 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.sv.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Ett autentiseringsfel har inträffat. + + + Authentication credentials could not be found. + Uppgifterna för autentisering kunde inte hittas. + + + Authentication request could not be processed due to a system problem. + Autentiseringen kunde inte genomföras på grund av systemfel. + + + Invalid credentials. + Felaktiga uppgifter. + + + Cookie has already been used by someone else. + Cookien har redan använts av någon annan. + + + Not privileged to request the resource. + Saknar rättigheter för resursen. + + + Invalid CSRF token. + Ogiltig CSRF-token. + + + No authentication provider found to support the authentication token. + Ingen leverantör för autentisering hittades för angiven autentiseringstoken. + + + No session available, it either timed out or cookies are not enabled. + Ingen session finns tillgänglig, antingen har den förfallit eller är cookies inte aktiverat. + + + No token could be found. + Ingen token kunde hittas. + + + Username could not be found. + Användarnamnet kunde inte hittas. + + + Account has expired. + Kontot har förfallit. + + + Credentials have expired. + Uppgifterna har förfallit. + + + Account is disabled. + Kontot är inaktiverat. + + + Account is locked. + Kontot är låst. + + + Too many failed login attempts, please try again later. + För många misslyckade inloggningsförsök, försök igen senare. + + + Invalid or expired login link. + Ogiltig eller utgången inloggningslänk. + + + Too many failed login attempts, please try again in %minutes% minute. + För många misslyckade inloggningsförsök, försök igen om %minutes% minut. + + + Too many failed login attempts, please try again in %minutes% minutes. + För många misslyckade inloggningsförsök, försök igen om %minutes% minuter. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.th.xlf b/vendor/symfony/security-core/Resources/translations/security.th.xlf new file mode 100644 index 0000000..658fcbf --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.th.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + พบความผิดพลาดในการรับรองตัวตน + + + Authentication credentials could not be found. + ไม่พบข้อมูลในการรับรองตัวตน (credentials) + + + Authentication request could not be processed due to a system problem. + คำร้องในการรับรองตัวตนไม่สามารถดำเนินการได้ เนื่องมาจากปัญหาของระบบ + + + Invalid credentials. + ข้อมูลการรับรองตัวตนไม่ถูกต้อง + + + Cookie has already been used by someone else. + Cookie ถูกใช้งานไปแล้วด้วยผู้อื่น + + + Not privileged to request the resource. + ไม่ได้รับสิทธิ์ให้ใช้งานส่วนนี้ได้ + + + Invalid CSRF token. + CSRF token ไม่ถูกต้อง + + + No authentication provider found to support the authentication token. + ไม่พบ authentication provider ที่รองรับสำหรับ authentication token + + + No session available, it either timed out or cookies are not enabled. + ไม่มี session ที่พร้อมใช้งาน, Session หมดอายุไปแล้วหรือ cookies ไม่ถูกเปิดใช้งาน + + + No token could be found. + ไม่พบ token + + + Username could not be found. + ไม่พบ Username + + + Account has expired. + บัญชีหมดอายุไปแล้ว + + + Credentials have expired. + ข้อมูลการระบุตัวตนหมดอายุแล้ว + + + Account is disabled. + บัญชีถูกระงับแล้ว + + + Account is locked. + บัญชีถูกล็อกแล้ว + + + Too many failed login attempts, please try again later. + มีความพยายามเข้าสู่ระบบล้มเหลวมากเกินไป กรุณาลองใหม่ภายหลัง + + + Invalid or expired login link. + ลิงค์เข้าสู่ระบบไม่ถูกต้องหรือหมดอายุไปแล้ว + + + Too many failed login attempts, please try again in %minutes% minute. + มีความพยายามเข้าสู่ระบบล้มเหลวมากเกินไป โปรดลองอีกครั้งใน %minutes% นาที + + + Too many failed login attempts, please try again in %minutes% minutes. + มีความพยายามเข้าสู่ระบบล้มเหลวมากเกินไป โปรดลองอีกครั้งใน %minutes% นาที + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.tl.xlf b/vendor/symfony/security-core/Resources/translations/security.tl.xlf new file mode 100644 index 0000000..eed0c7e --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.tl.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Nagkaroon ng isang pagbubukod sa pagpapatotoo. + + + Authentication credentials could not be found. + Hindi matagpuan ang mga kredensyal ng pagpapatotoo. + + + Authentication request could not be processed due to a system problem. + Ang kahilingan sa pagpapatotoo ay hindi naproseso dahil sa isang problema sa system. + + + Invalid credentials. + Di-wastong mga kredensyal. + + + Cookie has already been used by someone else. + Ang Cookie ay ginamit na ng ibang tao. + + + Not privileged to request the resource. + Walang pribilehiyo upang humingi ng mga bagong mapagkukunan. + + + Invalid CSRF token. + Di-wastong token ng CSRF. + + + No authentication provider found to support the authentication token. + Walang nahanap na provider ng pagpapatotoo upang suportahan ang token ng pagpapatotoo. + + + No session available, it either timed out or cookies are not enabled. + Walang magagamit na session, alinman sa nag-time out o ang cookies ay hindi pinagana. + + + No token could be found. + Walang makitang token. + + + Username could not be found. + Hindi makita ang username. + + + Account has expired. + Nag-expire na ang account. + + + Credentials have expired. + Nag-expire na ang mga kredensyal. + + + Account is disabled. + Ang account ay hindi pinagana. + + + Account is locked. + Ang account ay naka-lock. + + + Too many failed login attempts, please try again later. + Napakaraming nabigong mga pagtatangka sa pag-login, mangyaring subukang muli sa ibang pagkakataon. + + + Invalid or expired login link. + Inbalido o nagexpire na ang link para makapaglogin. + + + Too many failed login attempts, please try again in %minutes% minute. + Napakaraming nabigong mga pagtatangka sa pag-login, pakisubukan ulit sa% minuto% minuto. + + + Too many failed login attempts, please try again in %minutes% minute. + Napakaraming nabigong mga pagtatangka sa pag-login, pakisubukan ulit sa% minuto% minuto. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.tr.xlf b/vendor/symfony/security-core/Resources/translations/security.tr.xlf new file mode 100644 index 0000000..3466f8f --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.tr.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Bir yetkilendirme istisnası oluştu. + + + Authentication credentials could not be found. + Kimlik bilgileri bulunamadı. + + + Authentication request could not be processed due to a system problem. + Bir sistem hatası nedeniyle yetkilendirme isteği işleme alınamıyor. + + + Invalid credentials. + Geçersiz kimlik bilgileri. + + + Cookie has already been used by someone else. + Çerez bir başkası tarafından zaten kullanılmıştı. + + + Not privileged to request the resource. + Kaynak talebi için imtiyaz bulunamadı. + + + Invalid CSRF token. + Geçersiz CSRF fişi. + + + No authentication provider found to support the authentication token. + Yetkilendirme fişini destekleyecek yetkilendirme sağlayıcısı bulunamadı. + + + No session available, it either timed out or cookies are not enabled. + Oturum bulunamadı, zaman aşımına uğradı veya çerezler etkin değil. + + + No token could be found. + Fiş bulunamadı. + + + Username could not be found. + Kullanıcı adı bulunamadı. + + + Account has expired. + Hesap zaman aşımına uğradı. + + + Credentials have expired. + Kimlik bilgileri zaman aşımına uğradı. + + + Account is disabled. + Hesap engellenmiş. + + + Account is locked. + Hesap kilitlenmiş. + + + Too many failed login attempts, please try again later. + Çok fazla başarısız giriş denemesi, lütfen daha sonra tekrar deneyin. + + + Invalid or expired login link. + Geçersiz veya süresi dolmuş oturum açma bağlantısı. + + + Too many failed login attempts, please try again in %minutes% minute. + Çok fazla başarısız giriş denemesi, lütfen %minutes% dakika sonra tekrar deneyin. + + + Too many failed login attempts, please try again in %minutes% minutes. + Çok fazla başarısız giriş denemesi, lütfen %minutes% dakika sonra tekrar deneyin. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.uk.xlf b/vendor/symfony/security-core/Resources/translations/security.uk.xlf new file mode 100644 index 0000000..6d5cff4 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.uk.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Помилка автентифікації. + + + Authentication credentials could not be found. + Автентифікаційні дані не знайдено. + + + Authentication request could not be processed due to a system problem. + Запит на автентифікацію не може бути опрацьовано у зв’язку з проблемою в системі. + + + Invalid credentials. + Невірні автентифікаційні дані. + + + Cookie has already been used by someone else. + Хтось інший вже використав цей сookie. + + + Not privileged to request the resource. + Відсутні права на запит цього ресурсу. + + + Invalid CSRF token. + Невірний токен CSRF. + + + No authentication provider found to support the authentication token. + Не знайдено провайдера автентифікації, що підтримує токен автентифікаціії. + + + No session available, it either timed out or cookies are not enabled. + Сесія недоступна, її час вийшов, або cookies вимкнено. + + + No token could be found. + Токен не знайдено. + + + Username could not be found. + Ім’я користувача не знайдено. + + + Account has expired. + Термін дії облікового запису вичерпано. + + + Credentials have expired. + Термін дії автентифікаційних даних вичерпано. + + + Account is disabled. + Обліковий запис відключено. + + + Account is locked. + Обліковий запис заблоковано. + + + Too many failed login attempts, please try again later. + Забагато невдалих спроб входу. Будь ласка, спробуйте пізніше. + + + Invalid or expired login link. + Посилання для входу недійсне, або термін його дії закінчився. + + + Too many failed login attempts, please try again in %minutes% minute. + Забагато невдалих спроб входу. Будь ласка, спробуйте знову через %minutes% хвилину. + + + Too many failed login attempts, please try again in %minutes% minutes. + Забагато невдалих спроб входу. Будь ласка, спробуйте знову через %minutes% хв. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.uz.xlf b/vendor/symfony/security-core/Resources/translations/security.uz.xlf new file mode 100644 index 0000000..2b66d1b --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.uz.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Autentifikatsiyada xatolik. + + + Authentication credentials could not be found. + Autentifikatsiya ma'lumotlari topilmadi. + + + Authentication request could not be processed due to a system problem. + Tizimdagi muammo tufayli autentifikatsiya so'rovi bajarilmadi. + + + Invalid credentials. + Noto'g'ri ma'lumot. + + + Cookie has already been used by someone else. + Cookie faylini allaqachon kimdir ishlatgan. + + + Not privileged to request the resource. + Sizda ushbu manbani talab qilishga ruxsat yo'q.. + + + Invalid CSRF token. + Noto'g'ri CSRF belgisi. + + + No authentication provider found to support the authentication token. + Haqiqiylikni tasdiqlovchi belgini qo'llab-quvvatlovchi biron bir autentifikatsiya provayderi topilmadi. + + + No session available, it either timed out or cookies are not enabled. + Sessiya topilmadi, muddati tugamadi yoki cookie-fayllar yoqilmagan. + + + No token could be found. + To'ken topilmadi. + + + Username could not be found. + Foydalanuvchi nomi topilmadi. + + + Account has expired. + Akkunt muddati tugagan. + + + Credentials have expired. + Autentifikatsiya ma'lumotlari muddati tugagan. + + + Account is disabled. + Akkunt o'chirilgan. + + + Account is locked. + Akkunt bloklangan. + + + Too many failed login attempts, please try again later. + Kirish urinishlari muvaffaqiyatsiz tugadi, keyinroq qayta urinib ko'ring. + + + Invalid or expired login link. + Kirish havolasi yaroqsiz yoki muddati tugagan. + + + Too many failed login attempts, please try again in %minutes% minute. + Kirish uchun muvaffaqiyatsiz urinishlar, %minutes% daqiqadan so'ng qayta urinib ko'ring. + + + Too many failed login attempts, please try again in %minutes% minutes. + Kirish uchun muvaffaqiyatsiz urinishlar, %minutes% daqiqadan so'ng qayta urinib ko'ring. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.vi.xlf b/vendor/symfony/security-core/Resources/translations/security.vi.xlf new file mode 100644 index 0000000..5ad00a6 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.vi.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + Có lỗi trong quá trình xác thực. + + + Authentication credentials could not be found. + Thông tin dùng để xác thực không tìm thấy. + + + Authentication request could not be processed due to a system problem. + Yêu cầu xác thực không thể thực hiện do lỗi của hệ thống. + + + Invalid credentials. + Thông tin dùng để xác thực không hợp lệ. + + + Cookie has already been used by someone else. + Cookie đã được dùng bởi người dùng khác. + + + Not privileged to request the resource. + Không được phép yêu cầu tài nguyên. + + + Invalid CSRF token. + Mã CSRF không hợp lệ. + + + No authentication provider found to support the authentication token. + Không tìm thấy nhà cung cấp dịch vụ xác thực nào cho mã xác thực mà bạn sử dụng. + + + No session available, it either timed out or cookies are not enabled. + Không tìm thấy phiên làm việc. Phiên làm việc hoặc cookie có thể bị tắt. + + + No token could be found. + Không tìm thấy mã token. + + + Username could not be found. + Không tìm thấy tên người dùng. + + + Account has expired. + Tài khoản đã hết hạn. + + + Credentials have expired. + Thông tin xác thực đã hết hạn. + + + Account is disabled. + Tài khoản bị tạm ngừng. + + + Account is locked. + Tài khoản bị khóa. + + + Too many failed login attempts, please try again later. + Đăng nhập sai quá nhiều lần, vui lòng thử lại lần nữa. + + + Invalid or expired login link. + Liên kết đăng nhập không hợp lệ hoặc quá hạn. + + + Too many failed login attempts, please try again in %minutes% minute. + Quá nhiều lần thử đăng nhập không thành công, vui lòng thử lại sau %minutes% phút. + + + Too many failed login attempts, please try again in %minutes% minutes. + Quá nhiều lần thử đăng nhập không thành công, vui lòng thử lại sau %minutes% phút. + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.zh_CN.xlf b/vendor/symfony/security-core/Resources/translations/security.zh_CN.xlf new file mode 100644 index 0000000..6c4934e --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.zh_CN.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + 身份验证发生异常。 + + + Authentication credentials could not be found. + 没有找到身份验证的凭证。 + + + Authentication request could not be processed due to a system problem. + 由于系统故障,身份验证的请求无法被处理。 + + + Invalid credentials. + 无效的凭证。 + + + Cookie has already been used by someone else. + Cookie 已经被其他人使用。 + + + Not privileged to request the resource. + 没有权限请求此资源。 + + + Invalid CSRF token. + 无效的 CSRF token 。 + + + No authentication provider found to support the authentication token. + 没有找到支持此 token 的身份验证服务提供方。 + + + No session available, it either timed out or cookies are not enabled. + Session 不可用。会话超时或没有启用 cookies 。 + + + No token could be found. + 找不到 token 。 + + + Username could not be found. + 找不到用户名。 + + + Account has expired. + 帐号已过期。 + + + Credentials have expired. + 凭证已过期。 + + + Account is disabled. + 帐号已被禁用。 + + + Account is locked. + 帐号已被锁定。 + + + Too many failed login attempts, please try again later. + 登入失败的次数过多,请稍后再试。 + + + Invalid or expired login link. + 失效或过期的登入链接。 + + + Too many failed login attempts, please try again in %minutes% minute. + 登入失败的次数过多,请在%minutes%分钟后再试。 + + + Too many failed login attempts, please try again in %minutes% minutes. + 登入失败的次数过多,请在%minutes%分钟后再试。 + + + + diff --git a/vendor/symfony/security-core/Resources/translations/security.zh_TW.xlf b/vendor/symfony/security-core/Resources/translations/security.zh_TW.xlf new file mode 100644 index 0000000..fd30587 --- /dev/null +++ b/vendor/symfony/security-core/Resources/translations/security.zh_TW.xlf @@ -0,0 +1,83 @@ + + + + + + An authentication exception occurred. + 身份驗證發生異常。 + + + Authentication credentials could not be found. + 沒有找到身份驗證的憑證。 + + + Authentication request could not be processed due to a system problem. + 由於系統故障,身份驗證的請求無法被處理。 + + + Invalid credentials. + 無效的憑證。 + + + Cookie has already been used by someone else. + Cookie 已經被其他人使用。 + + + Not privileged to request the resource. + 沒有權限請求此資源。 + + + Invalid CSRF token. + 無效的 CSRF token 。 + + + No authentication provider found to support the authentication token. + 沒有找到支持此 token 的身份驗證服務提供方。 + + + No session available, it either timed out or cookies are not enabled. + Session 不可用。回話超時或沒有啓用 cookies 。 + + + No token could be found. + 找不到 token 。 + + + Username could not be found. + 找不到用戶名。 + + + Account has expired. + 賬號已逾期。 + + + Credentials have expired. + 憑證已逾期。 + + + Account is disabled. + 賬號已被禁用。 + + + Account is locked. + 賬號已被鎖定。 + + + Too many failed login attempts, please try again later. + 登入失敗的次數過多,請稍後再試。 + + + Invalid or expired login link. + 失效或過期的登入鏈接。 + + + Too many failed login attempts, please try again in %minutes% minute. + 登錄失敗的次數過多,請在%minutes%分鐘後再試。 + + + Too many failed login attempts, please try again in %minutes% minutes. + 登錄失敗的次數過多,請在%minutes%分鐘後再試。 + + + + diff --git a/vendor/symfony/security-core/Role/Role.php b/vendor/symfony/security-core/Role/Role.php new file mode 100644 index 0000000..374eb59 --- /dev/null +++ b/vendor/symfony/security-core/Role/Role.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Role; + +/** + * Allows migrating session payloads from v4. + * + * @internal + */ +class Role +{ + private $role; + + private function __construct() + { + } + + public function __toString(): string + { + return $this->role; + } +} diff --git a/vendor/symfony/security-core/Role/RoleHierarchy.php b/vendor/symfony/security-core/Role/RoleHierarchy.php new file mode 100644 index 0000000..d7960d4 --- /dev/null +++ b/vendor/symfony/security-core/Role/RoleHierarchy.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Role; + +/** + * RoleHierarchy defines a role hierarchy. + * + * @author Fabien Potencier + */ +class RoleHierarchy implements RoleHierarchyInterface +{ + private $hierarchy; + /** @var array> */ + protected $map; + + /** + * @param array> $hierarchy + */ + public function __construct(array $hierarchy) + { + $this->hierarchy = $hierarchy; + + $this->buildRoleMap(); + } + + /** + * {@inheritdoc} + */ + public function getReachableRoleNames(array $roles): array + { + $reachableRoles = $roles; + + foreach ($roles as $role) { + if (!isset($this->map[$role])) { + continue; + } + + foreach ($this->map[$role] as $r) { + $reachableRoles[] = $r; + } + } + + return array_values(array_unique($reachableRoles)); + } + + protected function buildRoleMap() + { + $this->map = []; + foreach ($this->hierarchy as $main => $roles) { + $this->map[$main] = $roles; + $visited = []; + $additionalRoles = $roles; + while ($role = array_shift($additionalRoles)) { + if (!isset($this->hierarchy[$role])) { + continue; + } + + $visited[] = $role; + + foreach ($this->hierarchy[$role] as $roleToAdd) { + $this->map[$main][] = $roleToAdd; + } + + foreach (array_diff($this->hierarchy[$role], $visited) as $additionalRole) { + $additionalRoles[] = $additionalRole; + } + } + + $this->map[$main] = array_unique($this->map[$main]); + } + } +} diff --git a/vendor/symfony/security-core/Role/RoleHierarchyInterface.php b/vendor/symfony/security-core/Role/RoleHierarchyInterface.php new file mode 100644 index 0000000..6e8fa81 --- /dev/null +++ b/vendor/symfony/security-core/Role/RoleHierarchyInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Role; + +/** + * RoleHierarchyInterface is the interface for a role hierarchy. + * + * @author Fabien Potencier + */ +interface RoleHierarchyInterface +{ + /** + * @param string[] $roles + * + * @return string[] + */ + public function getReachableRoleNames(array $roles): array; +} diff --git a/vendor/symfony/security-core/Role/SwitchUserRole.php b/vendor/symfony/security-core/Role/SwitchUserRole.php new file mode 100644 index 0000000..6a29fb4 --- /dev/null +++ b/vendor/symfony/security-core/Role/SwitchUserRole.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Role; + +/** + * Allows migrating session payloads from v4. + * + * @internal + */ +class SwitchUserRole extends Role +{ + private $deprecationTriggered; + private $source; +} diff --git a/vendor/symfony/security-core/Security.php b/vendor/symfony/security-core/Security.php new file mode 100644 index 0000000..0e0d4e5 --- /dev/null +++ b/vendor/symfony/security-core/Security.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core; + +use Psr\Container\ContainerInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Helper class for commonly-needed security tasks. + * + * @final + */ +class Security implements AuthorizationCheckerInterface +{ + public const ACCESS_DENIED_ERROR = '_security.403_error'; + public const AUTHENTICATION_ERROR = '_security.last_error'; + public const LAST_USERNAME = '_security.last_username'; + public const MAX_USERNAME_LENGTH = 4096; + + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function getUser(): ?UserInterface + { + if (!$token = $this->getToken()) { + return null; + } + + $user = $token->getUser(); + + // @deprecated since Symfony 5.4, $user will always be a UserInterface instance + if (!$user instanceof UserInterface) { + return null; + } + + return $user; + } + + /** + * Checks if the attributes are granted against the current authentication token and optionally supplied subject. + * + * @param mixed $attributes + * @param mixed $subject + */ + public function isGranted($attributes, $subject = null): bool + { + return $this->container->get('security.authorization_checker') + ->isGranted($attributes, $subject); + } + + public function getToken(): ?TokenInterface + { + return $this->container->get('security.token_storage')->getToken(); + } +} diff --git a/vendor/symfony/security-core/Signature/Exception/ExpiredSignatureException.php b/vendor/symfony/security-core/Signature/Exception/ExpiredSignatureException.php new file mode 100644 index 0000000..8986c62 --- /dev/null +++ b/vendor/symfony/security-core/Signature/Exception/ExpiredSignatureException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Signature\Exception; + +use Symfony\Component\Security\Core\Exception\RuntimeException; + +/** + * @author Wouter de Jong + */ +class ExpiredSignatureException extends RuntimeException +{ +} diff --git a/vendor/symfony/security-core/Signature/Exception/InvalidSignatureException.php b/vendor/symfony/security-core/Signature/Exception/InvalidSignatureException.php new file mode 100644 index 0000000..72102fe --- /dev/null +++ b/vendor/symfony/security-core/Signature/Exception/InvalidSignatureException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Signature\Exception; + +use Symfony\Component\Security\Core\Exception\RuntimeException; + +/** + * @author Wouter de Jong + */ +class InvalidSignatureException extends RuntimeException +{ +} diff --git a/vendor/symfony/security-core/Signature/ExpiredSignatureStorage.php b/vendor/symfony/security-core/Signature/ExpiredSignatureStorage.php new file mode 100644 index 0000000..9861c15 --- /dev/null +++ b/vendor/symfony/security-core/Signature/ExpiredSignatureStorage.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Signature; + +use Psr\Cache\CacheItemPoolInterface; + +/** + * @author Ryan Weaver + */ +final class ExpiredSignatureStorage +{ + private $cache; + private $lifetime; + + public function __construct(CacheItemPoolInterface $cache, int $lifetime) + { + $this->cache = $cache; + $this->lifetime = $lifetime; + } + + public function countUsages(string $hash): int + { + $key = rawurlencode($hash); + if (!$this->cache->hasItem($key)) { + return 0; + } + + return $this->cache->getItem($key)->get(); + } + + public function incrementUsages(string $hash): void + { + $item = $this->cache->getItem(rawurlencode($hash)); + + if (!$item->isHit()) { + $item->expiresAfter($this->lifetime); + } + + $item->set($this->countUsages($hash) + 1); + $this->cache->save($item); + } +} diff --git a/vendor/symfony/security-core/Signature/SignatureHasher.php b/vendor/symfony/security-core/Signature/SignatureHasher.php new file mode 100644 index 0000000..735c613 --- /dev/null +++ b/vendor/symfony/security-core/Signature/SignatureHasher.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Signature; + +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException; +use Symfony\Component\Security\Core\Signature\Exception\InvalidSignatureException; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Creates and validates secure hashes used in login links and remember-me cookies. + * + * @author Wouter de Jong + * @author Ryan Weaver + */ +class SignatureHasher +{ + private $propertyAccessor; + private $signatureProperties; + private $secret; + private $expiredSignaturesStorage; + private $maxUses; + + /** + * @param array $signatureProperties properties of the User; the hash is invalidated if these properties change + * @param ExpiredSignatureStorage|null $expiredSignaturesStorage if provided, secures a sequence of hashes that are expired + * @param int|null $maxUses used together with $expiredSignatureStorage to allow a maximum usage of a hash + */ + public function __construct(PropertyAccessorInterface $propertyAccessor, array $signatureProperties, string $secret, ExpiredSignatureStorage $expiredSignaturesStorage = null, int $maxUses = null) + { + $this->propertyAccessor = $propertyAccessor; + $this->signatureProperties = $signatureProperties; + $this->secret = $secret; + $this->expiredSignaturesStorage = $expiredSignaturesStorage; + $this->maxUses = $maxUses; + } + + /** + * Verifies the hash using the provided user and expire time. + * + * @param int $expires the expiry time as a unix timestamp + * @param string $hash the plaintext hash provided by the request + * + * @throws InvalidSignatureException If the signature does not match the provided parameters + * @throws ExpiredSignatureException If the signature is no longer valid + */ + public function verifySignatureHash(UserInterface $user, int $expires, string $hash): void + { + if (!hash_equals($hash, $this->computeSignatureHash($user, $expires))) { + throw new InvalidSignatureException('Invalid or expired signature.'); + } + + if ($expires < time()) { + throw new ExpiredSignatureException('Signature has expired.'); + } + + if ($this->expiredSignaturesStorage && $this->maxUses) { + if ($this->expiredSignaturesStorage->countUsages($hash) >= $this->maxUses) { + throw new ExpiredSignatureException(sprintf('Signature can only be used "%d" times.', $this->maxUses)); + } + + $this->expiredSignaturesStorage->incrementUsages($hash); + } + } + + /** + * Computes the secure hash for the provided user and expire time. + * + * @param int $expires the expiry time as a unix timestamp + */ + public function computeSignatureHash(UserInterface $user, int $expires): string + { + $signatureFields = [base64_encode(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()), $expires]; + + foreach ($this->signatureProperties as $property) { + $value = $this->propertyAccessor->getValue($user, $property) ?? ''; + if ($value instanceof \DateTimeInterface) { + $value = $value->format('c'); + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new \InvalidArgumentException(sprintf('The property path "%s" on the user object "%s" must return a value that can be cast to a string, but "%s" was returned.', $property, \get_class($user), get_debug_type($value))); + } + $signatureFields[] = base64_encode($value); + } + + return base64_encode(hash_hmac('sha256', implode(':', $signatureFields), $this->secret)); + } +} diff --git a/vendor/symfony/security-core/Test/AccessDecisionStrategyTestCase.php b/vendor/symfony/security-core/Test/AccessDecisionStrategyTestCase.php new file mode 100644 index 0000000..a82bf61 --- /dev/null +++ b/vendor/symfony/security-core/Test/AccessDecisionStrategyTestCase.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Test; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; +use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface; +use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + +/** + * Abstract test case for access decision strategies. + * + * @author Alexander M. Turek + */ +abstract class AccessDecisionStrategyTestCase extends TestCase +{ + /** + * @dataProvider provideStrategyTests + * + * @param VoterInterface[] $voters + */ + final public function testDecide(AccessDecisionStrategyInterface $strategy, array $voters, bool $expected) + { + $token = $this->createMock(TokenInterface::class); + $manager = new AccessDecisionManager($voters, $strategy); + + $this->assertSame($expected, $manager->decide($token, ['ROLE_FOO'])); + } + + /** + * @return iterable + */ + abstract public function provideStrategyTests(): iterable; + + /** + * @return VoterInterface[] + */ + final protected function getVoters(int $grants, int $denies, int $abstains): array + { + $voters = []; + for ($i = 0; $i < $grants; ++$i) { + $voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED); + } + for ($i = 0; $i < $denies; ++$i) { + $voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED); + } + for ($i = 0; $i < $abstains; ++$i) { + $voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN); + } + + return $voters; + } + + final protected function getVoter(int $vote): VoterInterface + { + $voter = $this->createMock(VoterInterface::class); + $voter->method('vote')->willReturn($vote); + + return $voter; + } +} diff --git a/vendor/symfony/security-core/User/ChainUserProvider.php b/vendor/symfony/security-core/User/ChainUserProvider.php new file mode 100644 index 0000000..148b239 --- /dev/null +++ b/vendor/symfony/security-core/User/ChainUserProvider.php @@ -0,0 +1,153 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; + +/** + * Chain User Provider. + * + * This provider calls several leaf providers in a chain until one is able to + * handle the request. + * + * @author Johannes M. Schmitt + */ +class ChainUserProvider implements UserProviderInterface, PasswordUpgraderInterface +{ + private $providers; + + /** + * @param iterable $providers + */ + public function __construct(iterable $providers) + { + $this->providers = $providers; + } + + /** + * @return UserProviderInterface[] + */ + public function getProviders() + { + if ($this->providers instanceof \Traversable) { + return iterator_to_array($this->providers); + } + + return $this->providers; + } + + /** + * {@inheritdoc} + */ + public function loadUserByUsername(string $username) + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use loadUserByIdentifier() instead.', __METHOD__); + + return $this->loadUserByIdentifier($username); + } + + public function loadUserByIdentifier(string $identifier): UserInterface + { + foreach ($this->providers as $provider) { + try { + // @deprecated since Symfony 5.3, change to $provider->loadUserByIdentifier() in 6.0 + if (!method_exists($provider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($provider)); + + return $provider->loadUserByUsername($identifier); + } + + return $provider->loadUserByIdentifier($identifier); + } catch (UserNotFoundException $e) { + // try next one + } + } + + $ex = new UserNotFoundException(sprintf('There is no user with identifier "%s".', $identifier)); + $ex->setUserIdentifier($identifier); + throw $ex; + } + + /** + * {@inheritdoc} + */ + public function refreshUser(UserInterface $user) + { + $supportedUserFound = false; + + foreach ($this->providers as $provider) { + try { + if (!$provider->supportsClass(get_debug_type($user))) { + continue; + } + + return $provider->refreshUser($user); + } catch (UnsupportedUserException $e) { + // try next one + } catch (UserNotFoundException $e) { + $supportedUserFound = true; + // try next one + } + } + + if ($supportedUserFound) { + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + $username = method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(); + $e = new UserNotFoundException(sprintf('There is no user with name "%s".', $username)); + $e->setUserIdentifier($username); + throw $e; + } else { + throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', get_debug_type($user))); + } + } + + /** + * {@inheritdoc} + */ + public function supportsClass(string $class) + { + foreach ($this->providers as $provider) { + if ($provider->supportsClass($class)) { + return true; + } + } + + return false; + } + + /** + * @param PasswordAuthenticatedUserInterface $user + * + * {@inheritdoc} + */ + public function upgradePassword($user, string $newHashedPassword): void + { + if (!$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'The "%s::upgradePassword()" method expects an instance of "%s" as first argument, the "%s" class should implement it.', PasswordUpgraderInterface::class, PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + + if (!$user instanceof UserInterface) { + throw new \TypeError(sprintf('The "%s::upgradePassword()" method expects an instance of "%s" as first argument, "%s" given.', static::class, PasswordAuthenticatedUserInterface::class, get_debug_type($user))); + } + } + + foreach ($this->providers as $provider) { + if ($provider instanceof PasswordUpgraderInterface) { + try { + $provider->upgradePassword($user, $newHashedPassword); + } catch (UnsupportedUserException $e) { + // ignore: password upgrades are opportunistic + } + } + } + } +} diff --git a/vendor/symfony/security-core/User/EquatableInterface.php b/vendor/symfony/security-core/User/EquatableInterface.php new file mode 100644 index 0000000..7040810 --- /dev/null +++ b/vendor/symfony/security-core/User/EquatableInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * EquatableInterface used to test if two objects are equal in security + * and re-authentication context. + * + * @author Dariusz Górecki + */ +interface EquatableInterface +{ + /** + * The equality comparison should neither be done by referential equality + * nor by comparing identities (i.e. getId() === getId()). + * + * However, you do not need to compare every attribute, but only those that + * are relevant for assessing whether re-authentication is required. + * + * @return bool + */ + public function isEqualTo(UserInterface $user); +} diff --git a/vendor/symfony/security-core/User/InMemoryUser.php b/vendor/symfony/security-core/User/InMemoryUser.php new file mode 100644 index 0000000..39da71e --- /dev/null +++ b/vendor/symfony/security-core/User/InMemoryUser.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * UserInterface implementation used by the in-memory user provider. + * + * This should not be used for anything else. + * + * @author Robin Chalas + * @author Fabien Potencier + */ +final class InMemoryUser extends User +{ + /** + * {@inheritdoc} + * + * @deprecated since Symfony 5.3 + */ + public function isAccountNonExpired(): bool + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, you should stop using it.', __METHOD__); + + return parent::isAccountNonExpired(); + } + + /** + * {@inheritdoc} + * + * @deprecated since Symfony 5.3 + */ + public function isAccountNonLocked(): bool + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, you should stop using it.', __METHOD__); + + return parent::isAccountNonLocked(); + } + + /** + * {@inheritdoc} + * + * @deprecated since Symfony 5.3 + */ + public function isCredentialsNonExpired(): bool + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, you should stop using it.', __METHOD__); + + return parent::isCredentialsNonExpired(); + } + + /** + * @deprecated since Symfony 5.3 + */ + public function getExtraFields(): array + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, you should stop using it.', __METHOD__); + + return parent::getExtraFields(); + } + + public function setPassword(string $password) + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, you should stop using it.', __METHOD__); + + parent::setPassword($password); + } +} diff --git a/vendor/symfony/security-core/User/InMemoryUserChecker.php b/vendor/symfony/security-core/User/InMemoryUserChecker.php new file mode 100644 index 0000000..b35e630 --- /dev/null +++ b/vendor/symfony/security-core/User/InMemoryUserChecker.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Security\Core\Exception\AccountExpiredException; +use Symfony\Component\Security\Core\Exception\CredentialsExpiredException; +use Symfony\Component\Security\Core\Exception\DisabledException; +use Symfony\Component\Security\Core\Exception\LockedException; + +/** + * Checks the state of the in-memory user account. + * + * @author Fabien Potencier + */ +class InMemoryUserChecker implements UserCheckerInterface +{ + public function checkPreAuth(UserInterface $user) + { + // @deprecated since Symfony 5.3, in 6.0 change to: + // if (!$user instanceof InMemoryUser) { + if (!$user instanceof InMemoryUser && !$user instanceof User) { + return; + } + + if (!$user->isEnabled()) { + $ex = new DisabledException('User account is disabled.'); + $ex->setUser($user); + throw $ex; + } + + // @deprecated since Symfony 5.3 + if (User::class === \get_class($user)) { + if (!$user->isAccountNonLocked()) { + $ex = new LockedException('User account is locked.'); + $ex->setUser($user); + throw $ex; + } + + if (!$user->isAccountNonExpired()) { + $ex = new AccountExpiredException('User account has expired.'); + $ex->setUser($user); + throw $ex; + } + } + } + + public function checkPostAuth(UserInterface $user) + { + // @deprecated since Symfony 5.3, noop in 6.0 + if (User::class !== \get_class($user)) { + return; + } + + if (!$user->isCredentialsNonExpired()) { + $ex = new CredentialsExpiredException('User credentials have expired.'); + $ex->setUser($user); + throw $ex; + } + } +} + +if (!class_exists(UserChecker::class, false)) { + class_alias(InMemoryUserChecker::class, UserChecker::class); +} diff --git a/vendor/symfony/security-core/User/InMemoryUserProvider.php b/vendor/symfony/security-core/User/InMemoryUserProvider.php new file mode 100644 index 0000000..6b0b41d --- /dev/null +++ b/vendor/symfony/security-core/User/InMemoryUserProvider.php @@ -0,0 +1,144 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; + +/** + * InMemoryUserProvider is a simple non persistent user provider. + * + * Useful for testing, demonstration, prototyping, and for simple needs + * (a backend with a unique admin for instance) + * + * @author Fabien Potencier + */ +class InMemoryUserProvider implements UserProviderInterface +{ + /** + * @var array + */ + private $users; + + /** + * The user array is a hash where the keys are usernames and the values are + * an array of attributes: 'password', 'enabled', and 'roles'. + * + * @param array}> $users An array of users + */ + public function __construct(array $users = []) + { + foreach ($users as $username => $attributes) { + $password = $attributes['password'] ?? null; + $enabled = $attributes['enabled'] ?? true; + $roles = $attributes['roles'] ?? []; + $user = new InMemoryUser($username, $password, $roles, $enabled); + + $this->createUser($user); + } + } + + /** + * Adds a new User to the provider. + * + * @throws \LogicException + */ + public function createUser(UserInterface $user) + { + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + $userIdentifier = strtolower(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()); + if (isset($this->users[$userIdentifier])) { + throw new \LogicException('Another user with the same username already exists.'); + } + + $this->users[$userIdentifier] = $user; + } + + /** + * {@inheritdoc} + */ + public function loadUserByUsername(string $username) + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use loadUserByIdentifier() instead.', __METHOD__); + + return $this->loadUserByIdentifier($username); + } + + public function loadUserByIdentifier(string $identifier): UserInterface + { + $user = $this->getUser($identifier); + + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + return new InMemoryUser(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), $user->getPassword(), $user->getRoles(), $user->isEnabled()); + } + + /** + * {@inheritdoc} + */ + public function refreshUser(UserInterface $user) + { + if (!$user instanceof InMemoryUser && !$user instanceof User) { + throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_debug_type($user))); + } + + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + $storedUser = $this->getUser(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()); + $userIdentifier = method_exists($storedUser, 'getUserIdentifier') ? $storedUser->getUserIdentifier() : $storedUser->getUsername(); + + // @deprecated since Symfony 5.3 + if (User::class === \get_class($user)) { + if (User::class !== \get_class($storedUser)) { + $accountNonExpired = true; + $credentialsNonExpired = $storedUser->getPassword() === $user->getPassword(); + $accountNonLocked = true; + } else { + $accountNonExpired = $storedUser->isAccountNonExpired(); + $credentialsNonExpired = $storedUser->isCredentialsNonExpired() && $storedUser->getPassword() === $user->getPassword(); + $accountNonLocked = $storedUser->isAccountNonLocked(); + } + + return new User($userIdentifier, $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled(), $accountNonExpired, $credentialsNonExpired, $accountNonLocked); + } + + return new InMemoryUser($userIdentifier, $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled()); + } + + /** + * {@inheritdoc} + */ + public function supportsClass(string $class) + { + // @deprecated since Symfony 5.3 + if (User::class === $class) { + return true; + } + + return InMemoryUser::class == $class; + } + + /** + * Returns the user by given username. + * + * @throws UserNotFoundException if user whose given username does not exist + */ + private function getUser(string $username)/*: InMemoryUser */ + { + if (!isset($this->users[strtolower($username)])) { + $ex = new UserNotFoundException(sprintf('Username "%s" does not exist.', $username)); + $ex->setUserIdentifier($username); + + throw $ex; + } + + return $this->users[strtolower($username)]; + } +} diff --git a/vendor/symfony/security-core/User/LegacyPasswordAuthenticatedUserInterface.php b/vendor/symfony/security-core/User/LegacyPasswordAuthenticatedUserInterface.php new file mode 100644 index 0000000..fcffe0b --- /dev/null +++ b/vendor/symfony/security-core/User/LegacyPasswordAuthenticatedUserInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * For users that can be authenticated using a password/salt couple. + * + * Once all password hashes have been upgraded to a modern algorithm via password migrations, + * implement {@see PasswordAuthenticatedUserInterface} instead. + * + * @author Robin Chalas + */ +interface LegacyPasswordAuthenticatedUserInterface extends PasswordAuthenticatedUserInterface +{ + /** + * Returns the salt that was originally used to hash the password. + */ + public function getSalt(): ?string; +} diff --git a/vendor/symfony/security-core/User/MissingUserProvider.php b/vendor/symfony/security-core/User/MissingUserProvider.php new file mode 100644 index 0000000..02df051 --- /dev/null +++ b/vendor/symfony/security-core/User/MissingUserProvider.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; + +/** + * MissingUserProvider is a dummy user provider used to throw proper exception + * when a firewall requires a user provider but none was defined. + * + * @internal + */ +class MissingUserProvider implements UserProviderInterface +{ + /** + * @param string $firewall the firewall missing a provider + */ + public function __construct(string $firewall) + { + throw new InvalidConfigurationException(sprintf('"%s" firewall requires a user provider but none was defined.', $firewall)); + } + + /** + * {@inheritdoc} + */ + public function loadUserByUsername(string $username): UserInterface + { + throw new \BadMethodCallException(); + } + + public function loadUserByIdentifier(string $identifier): UserInterface + { + throw new \BadMethodCallException(); + } + + /** + * {@inheritdoc} + */ + public function refreshUser(UserInterface $user): UserInterface + { + throw new \BadMethodCallException(); + } + + /** + * {@inheritdoc} + */ + public function supportsClass(string $class): bool + { + throw new \BadMethodCallException(); + } +} diff --git a/vendor/symfony/security-core/User/PasswordAuthenticatedUserInterface.php b/vendor/symfony/security-core/User/PasswordAuthenticatedUserInterface.php new file mode 100644 index 0000000..478c9e3 --- /dev/null +++ b/vendor/symfony/security-core/User/PasswordAuthenticatedUserInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * For users that can be authenticated using a password. + * + * @author Robin Chalas + * @author Wouter de Jong + */ +interface PasswordAuthenticatedUserInterface +{ + /** + * Returns the hashed password used to authenticate the user. + * + * Usually on authentication, a plain-text password will be compared to this value. + */ + public function getPassword(): ?string; +} diff --git a/vendor/symfony/security-core/User/PasswordUpgraderInterface.php b/vendor/symfony/security-core/User/PasswordUpgraderInterface.php new file mode 100644 index 0000000..16195fa --- /dev/null +++ b/vendor/symfony/security-core/User/PasswordUpgraderInterface.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * @author Nicolas Grekas + * + * @method void upgradePassword(PasswordAuthenticatedUserInterface|UserInterface $user, string $newHashedPassword) Upgrades the hashed password of a user, typically for using a better hash algorithm. + * This method should persist the new password in the user storage and update the $user object accordingly. + * Because you don't want your users not being able to log in, this method should be opportunistic: + * it's fine if it does nothing or if it fails without throwing any exception. + */ +interface PasswordUpgraderInterface +{ +} diff --git a/vendor/symfony/security-core/User/User.php b/vendor/symfony/security-core/User/User.php new file mode 100644 index 0000000..28f3304 --- /dev/null +++ b/vendor/symfony/security-core/User/User.php @@ -0,0 +1,218 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * User is the user implementation used by the in-memory user provider. + * + * This should not be used for anything else. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link InMemoryUser} instead + */ +class User implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface +{ + private $username; + private $password; + private $enabled; + private $accountNonExpired; + private $credentialsNonExpired; + private $accountNonLocked; + private $roles; + private $extraFields; + + public function __construct(?string $username, ?string $password, array $roles = [], bool $enabled = true, bool $userNonExpired = true, bool $credentialsNonExpired = true, bool $userNonLocked = true, array $extraFields = []) + { + if (InMemoryUser::class !== static::class) { + trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', self::class, InMemoryUser::class); + } + + if ('' === $username || null === $username) { + throw new \InvalidArgumentException('The username cannot be empty.'); + } + + $this->username = $username; + $this->password = $password; + $this->enabled = $enabled; + $this->accountNonExpired = $userNonExpired; + $this->credentialsNonExpired = $credentialsNonExpired; + $this->accountNonLocked = $userNonLocked; + $this->roles = $roles; + $this->extraFields = $extraFields; + } + + public function __toString(): string + { + return $this->getUserIdentifier(); + } + + /** + * {@inheritdoc} + */ + public function getRoles(): array + { + return $this->roles; + } + + /** + * {@inheritdoc} + */ + public function getPassword(): ?string + { + return $this->password; + } + + /** + * {@inheritdoc} + */ + public function getSalt(): ?string + { + return null; + } + + /** + * {@inheritdoc} + */ + public function getUsername(): string + { + trigger_deprecation('symfony/security-core', '5.3', 'Method "%s()" is deprecated, use getUserIdentifier() instead.', __METHOD__); + + return $this->username; + } + + /** + * Returns the identifier for this user (e.g. its username or email address). + */ + public function getUserIdentifier(): string + { + return $this->username; + } + + /** + * Checks whether the user's account has expired. + * + * Internally, if this method returns false, the authentication system + * will throw an AccountExpiredException and prevent login. + * + * @see AccountExpiredException + */ + public function isAccountNonExpired(): bool + { + return $this->accountNonExpired; + } + + /** + * Checks whether the user is locked. + * + * Internally, if this method returns false, the authentication system + * will throw a LockedException and prevent login. + * + * @see LockedException + */ + public function isAccountNonLocked(): bool + { + return $this->accountNonLocked; + } + + /** + * Checks whether the user's credentials (password) has expired. + * + * Internally, if this method returns false, the authentication system + * will throw a CredentialsExpiredException and prevent login. + * + * @see CredentialsExpiredException + */ + public function isCredentialsNonExpired(): bool + { + return $this->credentialsNonExpired; + } + + /** + * Checks whether the user is enabled. + * + * Internally, if this method returns false, the authentication system + * will throw a DisabledException and prevent login. + * + * @see DisabledException + */ + public function isEnabled(): bool + { + return $this->enabled; + } + + /** + * {@inheritdoc} + */ + public function eraseCredentials() + { + } + + public function getExtraFields(): array + { + return $this->extraFields; + } + + /** + * {@inheritdoc} + */ + public function isEqualTo(UserInterface $user): bool + { + if (!$user instanceof self) { + return false; + } + + if ($this->getPassword() !== $user->getPassword()) { + return false; + } + + if ($this->getSalt() !== $user->getSalt()) { + return false; + } + + $currentRoles = array_map('strval', (array) $this->getRoles()); + $newRoles = array_map('strval', (array) $user->getRoles()); + $rolesChanged = \count($currentRoles) !== \count($newRoles) || \count($currentRoles) !== \count(array_intersect($currentRoles, $newRoles)); + if ($rolesChanged) { + return false; + } + + if ($this->getUserIdentifier() !== $user->getUserIdentifier()) { + return false; + } + + if (self::class === static::class) { + if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) { + return false; + } + + if ($this->isAccountNonLocked() !== $user->isAccountNonLocked()) { + return false; + } + + if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) { + return false; + } + } + + if ($this->isEnabled() !== $user->isEnabled()) { + return false; + } + + return true; + } + + public function setPassword(string $password) + { + $this->password = $password; + } +} diff --git a/vendor/symfony/security-core/User/UserChecker.php b/vendor/symfony/security-core/User/UserChecker.php new file mode 100644 index 0000000..8ffecf1 --- /dev/null +++ b/vendor/symfony/security-core/User/UserChecker.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +trigger_deprecation('symfony/security-core', '5.3', 'The "%s" class is deprecated, use "%s" instead.', UserChecker::class, InMemoryUserChecker::class); + +class_exists(InMemoryUserChecker::class); + +if (false) { + /** + * UserChecker checks the user account flags. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use {@link InMemoryUserChecker} instead + */ + class UserChecker + { + } +} diff --git a/vendor/symfony/security-core/User/UserCheckerInterface.php b/vendor/symfony/security-core/User/UserCheckerInterface.php new file mode 100644 index 0000000..a7c5f17 --- /dev/null +++ b/vendor/symfony/security-core/User/UserCheckerInterface.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Security\Core\Exception\AccountStatusException; + +/** + * Implement to throw AccountStatusException during the authentication process. + * + * Can be used when you want to check the account status, e.g when the account is + * disabled or blocked. This should not be used to make authentication decisions. + * + * @author Fabien Potencier + */ +interface UserCheckerInterface +{ + /** + * Checks the user account before authentication. + * + * @throws AccountStatusException + */ + public function checkPreAuth(UserInterface $user); + + /** + * Checks the user account after authentication. + * + * @throws AccountStatusException + */ + public function checkPostAuth(UserInterface $user); +} diff --git a/vendor/symfony/security-core/User/UserInterface.php b/vendor/symfony/security-core/User/UserInterface.php new file mode 100644 index 0000000..806de8c --- /dev/null +++ b/vendor/symfony/security-core/User/UserInterface.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +/** + * Represents the interface that all user classes must implement. + * + * This interface is useful because the authentication layer can deal with + * the object through its lifecycle, using the object to get the hashed + * password (for checking against a submitted password), assigning roles + * and so on. + * + * Regardless of how your users are loaded or where they come from (a database, + * configuration, web service, etc.), you will have a class that implements + * this interface. Objects that implement this interface are created and + * loaded by different objects that implement UserProviderInterface. + * + * @see UserProviderInterface + * + * @method string getUserIdentifier() returns the identifier for this user (e.g. its username or email address) + * + * @author Fabien Potencier + */ +interface UserInterface +{ + /** + * Returns the roles granted to the user. + * + * public function getRoles() + * { + * return ['ROLE_USER']; + * } + * + * Alternatively, the roles might be stored in a ``roles`` property, + * and populated in any number of different ways when the user object + * is created. + * + * @return string[] + */ + public function getRoles(); + + /** + * Returns the password used to authenticate the user. + * + * This should be the hashed password. On authentication, a plain-text + * password will be hashed, and then compared to this value. + * + * This method is deprecated since Symfony 5.3, implement it from {@link PasswordAuthenticatedUserInterface} instead. + * + * @return string|null + */ + public function getPassword(); + + /** + * Returns the salt that was originally used to hash the password. + * + * This can return null if the password was not hashed using a salt. + * + * This method is deprecated since Symfony 5.3, implement it from {@link LegacyPasswordAuthenticatedUserInterface} instead. + * + * @return string|null + */ + public function getSalt(); + + /** + * Removes sensitive data from the user. + * + * This is important if, at any given point, sensitive information like + * the plain-text password is stored on this object. + */ + public function eraseCredentials(); + + /** + * @return string + * + * @deprecated since Symfony 5.3, use getUserIdentifier() instead + */ + public function getUsername(); +} diff --git a/vendor/symfony/security-core/User/UserProviderInterface.php b/vendor/symfony/security-core/User/UserProviderInterface.php new file mode 100644 index 0000000..52d24f9 --- /dev/null +++ b/vendor/symfony/security-core/User/UserProviderInterface.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\User; + +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; + +/** + * Represents a class that loads UserInterface objects from some source for the authentication system. + * + * In a typical authentication configuration, a user identifier (e.g. a + * username or email address) credential enters the system (via form login, or + * any method). The user provider that is configured with that authentication + * method is asked to load the UserInterface object for the given identifier (via + * loadUserByIdentifier) so that the rest of the process can continue. + * + * Internally, a user provider can load users from any source (databases, + * configuration, web service). This is totally independent of how the authentication + * information is submitted or what the UserInterface object looks like. + * + * @see UserInterface + * + * @method UserInterface loadUserByIdentifier(string $identifier) loads the user for the given user identifier (e.g. username or email). + * This method must throw UserNotFoundException if the user is not found. + * + * @author Fabien Potencier + */ +interface UserProviderInterface +{ + /** + * Refreshes the user. + * + * It is up to the implementation to decide if the user data should be + * totally reloaded (e.g. from the database), or if the UserInterface + * object can just be merged into some internal array of users / identity + * map. + * + * @return UserInterface + * + * @throws UnsupportedUserException if the user is not supported + * @throws UserNotFoundException if the user is not found + */ + public function refreshUser(UserInterface $user); + + /** + * Whether this provider supports the given user class. + * + * @return bool + */ + public function supportsClass(string $class); + + /** + * @return UserInterface + * + * @throws UserNotFoundException + * + * @deprecated since Symfony 5.3, use loadUserByIdentifier() instead + */ + public function loadUserByUsername(string $username); +} diff --git a/vendor/symfony/security-core/Validator/Constraints/UserPassword.php b/vendor/symfony/security-core/Validator/Constraints/UserPassword.php new file mode 100644 index 0000000..f9de213 --- /dev/null +++ b/vendor/symfony/security-core/Validator/Constraints/UserPassword.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class UserPassword extends Constraint +{ + public $message = 'This value should be the user\'s current password.'; + public $service = 'security.validator.user_password'; + + public function __construct(array $options = null, string $message = null, string $service = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->service = $service ?? $this->service; + } + + /** + * {@inheritdoc} + */ + public function validatedBy() + { + return $this->service; + } +} diff --git a/vendor/symfony/security-core/Validator/Constraints/UserPasswordValidator.php b/vendor/symfony/security-core/Validator/Constraints/UserPasswordValidator.php new file mode 100644 index 0000000..688426a --- /dev/null +++ b/vendor/symfony/security-core/Validator/Constraints/UserPasswordValidator.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Core\Validator\Constraints; + +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface; +use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +class UserPasswordValidator extends ConstraintValidator +{ + private $tokenStorage; + private $hasherFactory; + + /** + * @param PasswordHasherFactoryInterface $hasherFactory + */ + public function __construct(TokenStorageInterface $tokenStorage, $hasherFactory) + { + if ($hasherFactory instanceof EncoderFactoryInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Passing a "%s" instance to the "%s" constructor is deprecated, use "%s" instead.', EncoderFactoryInterface::class, __CLASS__, PasswordHasherFactoryInterface::class); + } + + $this->tokenStorage = $tokenStorage; + $this->hasherFactory = $hasherFactory; + } + + /** + * {@inheritdoc} + */ + public function validate($password, Constraint $constraint) + { + if (!$constraint instanceof UserPassword) { + throw new UnexpectedTypeException($constraint, UserPassword::class); + } + + if (null === $password || '' === $password) { + $this->context->addViolation($constraint->message); + + return; + } + + if (!\is_string($password)) { + throw new UnexpectedTypeException($password, 'string'); + } + + $user = $this->tokenStorage->getToken()->getUser(); + + if (!$user instanceof UserInterface) { + throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); + } + + if (!$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Using the "%s" validation constraint without implementing the "%s" interface is deprecated, the "%s" class should implement it.', UserPassword::class, PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $salt = $user->getSalt(); + if ($salt && !$user instanceof LegacyPasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $hasher = $this->hasherFactory instanceof EncoderFactoryInterface ? $this->hasherFactory->getEncoder($user) : $this->hasherFactory->getPasswordHasher($user); + + if (null === $user->getPassword() || !($hasher instanceof PasswordEncoderInterface ? $hasher->isPasswordValid($user->getPassword(), $password, $user->getSalt()) : $hasher->verify($user->getPassword(), $password, $user->getSalt()))) { + $this->context->addViolation($constraint->message); + } + } +} diff --git a/vendor/symfony/security-core/composer.json b/vendor/symfony/security-core/composer.json new file mode 100644 index 0000000..2270a04 --- /dev/null +++ b/vendor/symfony/security-core/composer.json @@ -0,0 +1,60 @@ +{ + "name": "symfony/security-core", + "type": "library", + "description": "Symfony Security Component - Core Library", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/event-dispatcher-contracts": "^1.1|^2|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1.6|^2|^3", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/password-hasher": "^5.3|^6.0" + }, + "require-dev": { + "psr/container": "^1.0|^2.0", + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/ldap": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/validator": "^5.2|^6.0", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/event-dispatcher": "<4.4", + "symfony/http-foundation": "<5.3", + "symfony/security-guard": "<4.4", + "symfony/ldap": "<4.4", + "symfony/validator": "<5.2" + }, + "suggest": { + "psr/container-implementation": "To instantiate the Security class", + "symfony/event-dispatcher": "", + "symfony/http-foundation": "", + "symfony/validator": "For using the user password constraint", + "symfony/expression-language": "For using the expression voter", + "symfony/ldap": "For using LDAP integration" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Security\\Core\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/security-csrf/CHANGELOG.md b/vendor/symfony/security-csrf/CHANGELOG.md new file mode 100644 index 0000000..22652b0 --- /dev/null +++ b/vendor/symfony/security-csrf/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +5.3 +--- + +The CHANGELOG for version 5.3 and earlier can be found at https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Security/CHANGELOG.md diff --git a/vendor/symfony/security-csrf/CsrfToken.php b/vendor/symfony/security-csrf/CsrfToken.php new file mode 100644 index 0000000..861a510 --- /dev/null +++ b/vendor/symfony/security-csrf/CsrfToken.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf; + +/** + * A CSRF token. + * + * @author Bernhard Schussek + */ +class CsrfToken +{ + private $id; + private $value; + + public function __construct(string $id, ?string $value) + { + $this->id = $id; + $this->value = $value ?? ''; + } + + /** + * Returns the ID of the CSRF token. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Returns the value of the CSRF token. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns the value of the CSRF token. + * + * @return string + */ + public function __toString() + { + return $this->value; + } +} diff --git a/vendor/symfony/security-csrf/CsrfTokenManager.php b/vendor/symfony/security-csrf/CsrfTokenManager.php new file mode 100644 index 0000000..3e7454e --- /dev/null +++ b/vendor/symfony/security-csrf/CsrfTokenManager.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf; + +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Exception\InvalidArgumentException; +use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface; +use Symfony\Component\Security\Csrf\TokenGenerator\UriSafeTokenGenerator; +use Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage; +use Symfony\Component\Security\Csrf\TokenStorage\TokenStorageInterface; + +/** + * Default implementation of {@link CsrfTokenManagerInterface}. + * + * @author Bernhard Schussek + * @author Kévin Dunglas + */ +class CsrfTokenManager implements CsrfTokenManagerInterface +{ + private $generator; + private $storage; + private $namespace; + + /** + * @param string|RequestStack|callable|null $namespace + * * null: generates a namespace using $_SERVER['HTTPS'] + * * string: uses the given string + * * RequestStack: generates a namespace using the current main request + * * callable: uses the result of this callable (must return a string) + */ + public function __construct(TokenGeneratorInterface $generator = null, TokenStorageInterface $storage = null, $namespace = null) + { + $this->generator = $generator ?? new UriSafeTokenGenerator(); + $this->storage = $storage ?? new NativeSessionTokenStorage(); + + $superGlobalNamespaceGenerator = function () { + return !empty($_SERVER['HTTPS']) && 'off' !== strtolower($_SERVER['HTTPS']) ? 'https-' : ''; + }; + + if (null === $namespace) { + $this->namespace = $superGlobalNamespaceGenerator; + } elseif ($namespace instanceof RequestStack) { + $this->namespace = function () use ($namespace, $superGlobalNamespaceGenerator) { + if ($request = $namespace->getMainRequest()) { + return $request->isSecure() ? 'https-' : ''; + } + + return $superGlobalNamespaceGenerator(); + }; + } elseif (\is_callable($namespace) || \is_string($namespace)) { + $this->namespace = $namespace; + } else { + throw new InvalidArgumentException(sprintf('$namespace must be a string, a callable returning a string, null or an instance of "RequestStack". "%s" given.', get_debug_type($namespace))); + } + } + + /** + * {@inheritdoc} + */ + public function getToken(string $tokenId) + { + $namespacedId = $this->getNamespace().$tokenId; + if ($this->storage->hasToken($namespacedId)) { + $value = $this->storage->getToken($namespacedId); + } else { + $value = $this->generator->generateToken(); + + $this->storage->setToken($namespacedId, $value); + } + + return new CsrfToken($tokenId, $this->randomize($value)); + } + + /** + * {@inheritdoc} + */ + public function refreshToken(string $tokenId) + { + $namespacedId = $this->getNamespace().$tokenId; + $value = $this->generator->generateToken(); + + $this->storage->setToken($namespacedId, $value); + + return new CsrfToken($tokenId, $this->randomize($value)); + } + + /** + * {@inheritdoc} + */ + public function removeToken(string $tokenId) + { + return $this->storage->removeToken($this->getNamespace().$tokenId); + } + + /** + * {@inheritdoc} + */ + public function isTokenValid(CsrfToken $token) + { + $namespacedId = $this->getNamespace().$token->getId(); + if (!$this->storage->hasToken($namespacedId)) { + return false; + } + + return hash_equals($this->storage->getToken($namespacedId), $this->derandomize($token->getValue())); + } + + private function getNamespace(): string + { + return \is_callable($ns = $this->namespace) ? $ns() : $ns; + } + + private function randomize(string $value): string + { + $key = random_bytes(32); + $value = $this->xor($value, $key); + + return sprintf('%s.%s.%s', substr(md5($key), 0, 1 + (\ord($key[0]) % 32)), rtrim(strtr(base64_encode($key), '+/', '-_'), '='), rtrim(strtr(base64_encode($value), '+/', '-_'), '=')); + } + + private function derandomize(string $value): string + { + $parts = explode('.', $value); + if (3 !== \count($parts)) { + return $value; + } + $key = base64_decode(strtr($parts[1], '-_', '+/')); + $value = base64_decode(strtr($parts[2], '-_', '+/')); + + return $this->xor($value, $key); + } + + private function xor(string $value, string $key): string + { + if (\strlen($value) > \strlen($key)) { + $key = str_repeat($key, ceil(\strlen($value) / \strlen($key))); + } + + return $value ^ $key; + } +} diff --git a/vendor/symfony/security-csrf/CsrfTokenManagerInterface.php b/vendor/symfony/security-csrf/CsrfTokenManagerInterface.php new file mode 100644 index 0000000..8e4d72c --- /dev/null +++ b/vendor/symfony/security-csrf/CsrfTokenManagerInterface.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf; + +/** + * Manages CSRF tokens. + * + * @author Bernhard Schussek + */ +interface CsrfTokenManagerInterface +{ + /** + * Returns a CSRF token for the given ID. + * + * If previously no token existed for the given ID, a new token is + * generated. Otherwise the existing token is returned (with the same value, + * not the same instance). + * + * @param string $tokenId The token ID. You may choose an arbitrary value + * for the ID + * + * @return CsrfToken + */ + public function getToken(string $tokenId); + + /** + * Generates a new token value for the given ID. + * + * This method will generate a new token for the given token ID, independent + * of whether a token value previously existed or not. It can be used to + * enforce once-only tokens in environments with high security needs. + * + * @param string $tokenId The token ID. You may choose an arbitrary value + * for the ID + * + * @return CsrfToken + */ + public function refreshToken(string $tokenId); + + /** + * Invalidates the CSRF token with the given ID, if one exists. + * + * @return string|null Returns the removed token value if one existed, NULL + * otherwise + */ + public function removeToken(string $tokenId); + + /** + * Returns whether the given CSRF token is valid. + * + * @return bool + */ + public function isTokenValid(CsrfToken $token); +} diff --git a/vendor/symfony/security-csrf/Exception/TokenNotFoundException.php b/vendor/symfony/security-csrf/Exception/TokenNotFoundException.php new file mode 100644 index 0000000..936afde --- /dev/null +++ b/vendor/symfony/security-csrf/Exception/TokenNotFoundException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\Exception; + +use Symfony\Component\Security\Core\Exception\RuntimeException; + +/** + * @author Bernhard Schussek + */ +class TokenNotFoundException extends RuntimeException +{ +} diff --git a/vendor/symfony/security-csrf/LICENSE b/vendor/symfony/security-csrf/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/security-csrf/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/security-csrf/README.md b/vendor/symfony/security-csrf/README.md new file mode 100644 index 0000000..a27d877 --- /dev/null +++ b/vendor/symfony/security-csrf/README.md @@ -0,0 +1,29 @@ +Security Component - CSRF +========================= + +The Security CSRF (cross-site request forgery) component provides a class +`CsrfTokenManager` for generating and validating CSRF tokens. + +Sponsor +------- + +The Security component for Symfony 5.4/6.0 is [backed][1] by [SymfonyCasts][2]. + +Learn Symfony faster by watching real projects being built and actively coding +along with them. SymfonyCasts bridges that learning gap, bringing you video +tutorials and coding challenges. Code on! + +Help Symfony by [sponsoring][3] its development! + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/security.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://symfonycasts.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/security-csrf/TokenGenerator/TokenGeneratorInterface.php b/vendor/symfony/security-csrf/TokenGenerator/TokenGeneratorInterface.php new file mode 100644 index 0000000..efb4360 --- /dev/null +++ b/vendor/symfony/security-csrf/TokenGenerator/TokenGeneratorInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenGenerator; + +/** + * Generates CSRF tokens. + * + * @author Bernhard Schussek + */ +interface TokenGeneratorInterface +{ + /** + * Generates a CSRF token. + * + * @return string + */ + public function generateToken(); +} diff --git a/vendor/symfony/security-csrf/TokenGenerator/UriSafeTokenGenerator.php b/vendor/symfony/security-csrf/TokenGenerator/UriSafeTokenGenerator.php new file mode 100644 index 0000000..5963851 --- /dev/null +++ b/vendor/symfony/security-csrf/TokenGenerator/UriSafeTokenGenerator.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenGenerator; + +/** + * Generates CSRF tokens. + * + * @author Bernhard Schussek + */ +class UriSafeTokenGenerator implements TokenGeneratorInterface +{ + private $entropy; + + /** + * Generates URI-safe CSRF tokens. + * + * @param int $entropy The amount of entropy collected for each token (in bits) + */ + public function __construct(int $entropy = 256) + { + $this->entropy = $entropy; + } + + /** + * {@inheritdoc} + */ + public function generateToken() + { + // Generate an URI safe base64 encoded string that does not contain "+", + // "/" or "=" which need to be URL encoded and make URLs unnecessarily + // longer. + $bytes = random_bytes($this->entropy / 8); + + return rtrim(strtr(base64_encode($bytes), '+/', '-_'), '='); + } +} diff --git a/vendor/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php b/vendor/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php new file mode 100644 index 0000000..0d6f16b --- /dev/null +++ b/vendor/symfony/security-csrf/TokenStorage/ClearableTokenStorageInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenStorage; + +/** + * @author Christian Flothmann + */ +interface ClearableTokenStorageInterface extends TokenStorageInterface +{ + /** + * Removes all CSRF tokens. + */ + public function clear(); +} diff --git a/vendor/symfony/security-csrf/TokenStorage/NativeSessionTokenStorage.php b/vendor/symfony/security-csrf/TokenStorage/NativeSessionTokenStorage.php new file mode 100644 index 0000000..97a95b6 --- /dev/null +++ b/vendor/symfony/security-csrf/TokenStorage/NativeSessionTokenStorage.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenStorage; + +use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException; + +/** + * Token storage that uses PHP's native session handling. + * + * @author Bernhard Schussek + */ +class NativeSessionTokenStorage implements ClearableTokenStorageInterface +{ + /** + * The namespace used to store values in the session. + */ + public const SESSION_NAMESPACE = '_csrf'; + + private $sessionStarted = false; + private $namespace; + + /** + * Initializes the storage with a session namespace. + * + * @param string $namespace The namespace under which the token is stored in the session + */ + public function __construct(string $namespace = self::SESSION_NAMESPACE) + { + $this->namespace = $namespace; + } + + /** + * {@inheritdoc} + */ + public function getToken(string $tokenId) + { + if (!$this->sessionStarted) { + $this->startSession(); + } + + if (!isset($_SESSION[$this->namespace][$tokenId])) { + throw new TokenNotFoundException('The CSRF token with ID '.$tokenId.' does not exist.'); + } + + return (string) $_SESSION[$this->namespace][$tokenId]; + } + + /** + * {@inheritdoc} + */ + public function setToken(string $tokenId, string $token) + { + if (!$this->sessionStarted) { + $this->startSession(); + } + + $_SESSION[$this->namespace][$tokenId] = $token; + } + + /** + * {@inheritdoc} + */ + public function hasToken(string $tokenId) + { + if (!$this->sessionStarted) { + $this->startSession(); + } + + return isset($_SESSION[$this->namespace][$tokenId]); + } + + /** + * {@inheritdoc} + */ + public function removeToken(string $tokenId) + { + if (!$this->sessionStarted) { + $this->startSession(); + } + + if (!isset($_SESSION[$this->namespace][$tokenId])) { + return null; + } + + $token = (string) $_SESSION[$this->namespace][$tokenId]; + + unset($_SESSION[$this->namespace][$tokenId]); + + if (!$_SESSION[$this->namespace]) { + unset($_SESSION[$this->namespace]); + } + + return $token; + } + + /** + * {@inheritdoc} + */ + public function clear() + { + unset($_SESSION[$this->namespace]); + } + + private function startSession() + { + if (\PHP_SESSION_NONE === session_status()) { + session_start(); + } + + $this->sessionStarted = true; + } +} diff --git a/vendor/symfony/security-csrf/TokenStorage/SessionTokenStorage.php b/vendor/symfony/security-csrf/TokenStorage/SessionTokenStorage.php new file mode 100644 index 0000000..84f9954 --- /dev/null +++ b/vendor/symfony/security-csrf/TokenStorage/SessionTokenStorage.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenStorage; + +use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException; + +/** + * Token storage that uses a Symfony Session object. + * + * @author Bernhard Schussek + */ +class SessionTokenStorage implements ClearableTokenStorageInterface +{ + /** + * The namespace used to store values in the session. + */ + public const SESSION_NAMESPACE = '_csrf'; + + private $requestStack; + private $namespace; + /** + * To be removed in Symfony 6.0. + */ + private $session; + + /** + * Initializes the storage with a RequestStack object and a session namespace. + * + * @param RequestStack $requestStack + * @param string $namespace The namespace under which the token is stored in the requestStack + */ + public function __construct(/* RequestStack*/ $requestStack, string $namespace = self::SESSION_NAMESPACE) + { + if ($requestStack instanceof SessionInterface) { + trigger_deprecation('symfony/security-csrf', '5.3', 'Passing a "%s" to "%s" is deprecated, use a "%s" instead.', SessionInterface::class, __CLASS__, RequestStack::class); + $request = new Request(); + $request->setSession($requestStack); + + $requestStack = new RequestStack(); + $requestStack->push($request); + } + $this->requestStack = $requestStack; + $this->namespace = $namespace; + } + + /** + * {@inheritdoc} + */ + public function getToken(string $tokenId) + { + $session = $this->getSession(); + if (!$session->isStarted()) { + $session->start(); + } + + if (!$session->has($this->namespace.'/'.$tokenId)) { + throw new TokenNotFoundException('The CSRF token with ID '.$tokenId.' does not exist.'); + } + + return (string) $session->get($this->namespace.'/'.$tokenId); + } + + /** + * {@inheritdoc} + */ + public function setToken(string $tokenId, string $token) + { + $session = $this->getSession(); + if (!$session->isStarted()) { + $session->start(); + } + + $session->set($this->namespace.'/'.$tokenId, $token); + } + + /** + * {@inheritdoc} + */ + public function hasToken(string $tokenId) + { + $session = $this->getSession(); + if (!$session->isStarted()) { + $session->start(); + } + + return $session->has($this->namespace.'/'.$tokenId); + } + + /** + * {@inheritdoc} + */ + public function removeToken(string $tokenId) + { + $session = $this->getSession(); + if (!$session->isStarted()) { + $session->start(); + } + + return $session->remove($this->namespace.'/'.$tokenId); + } + + /** + * {@inheritdoc} + */ + public function clear() + { + $session = $this->getSession(); + foreach (array_keys($session->all()) as $key) { + if (str_starts_with($key, $this->namespace.'/')) { + $session->remove($key); + } + } + } + + private function getSession(): SessionInterface + { + try { + return $this->session ?? $this->requestStack->getSession(); + } catch (SessionNotFoundException $e) { + trigger_deprecation('symfony/security-csrf', '5.3', 'Using the "%s" without a session has no effect and is deprecated. It will throw a "%s" in Symfony 6.0', __CLASS__, SessionNotFoundException::class); + + return $this->session ?? $this->session = new Session(new MockArraySessionStorage()); + } + } +} diff --git a/vendor/symfony/security-csrf/TokenStorage/TokenStorageInterface.php b/vendor/symfony/security-csrf/TokenStorage/TokenStorageInterface.php new file mode 100644 index 0000000..15d8bbd --- /dev/null +++ b/vendor/symfony/security-csrf/TokenStorage/TokenStorageInterface.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Csrf\TokenStorage; + +/** + * Stores CSRF tokens. + * + * @author Bernhard Schussek + */ +interface TokenStorageInterface +{ + /** + * Reads a stored CSRF token. + * + * @return string + * + * @throws \Symfony\Component\Security\Csrf\Exception\TokenNotFoundException If the token ID does not exist + */ + public function getToken(string $tokenId); + + /** + * Stores a CSRF token. + */ + public function setToken(string $tokenId, string $token); + + /** + * Removes a CSRF token. + * + * @return string|null Returns the removed token if one existed, NULL + * otherwise + */ + public function removeToken(string $tokenId); + + /** + * Checks whether a token with the given token ID exists. + * + * @return bool + */ + public function hasToken(string $tokenId); +} diff --git a/vendor/symfony/security-csrf/composer.json b/vendor/symfony/security-csrf/composer.json new file mode 100644 index 0000000..ce55876 --- /dev/null +++ b/vendor/symfony/security-csrf/composer.json @@ -0,0 +1,39 @@ +{ + "name": "symfony/security-csrf", + "type": "library", + "description": "Symfony Security Component - CSRF Library", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/security-core": "^4.4|^5.0|^6.0" + }, + "require-dev": { + "symfony/http-foundation": "^5.3|^6.0" + }, + "conflict": { + "symfony/http-foundation": "<5.3" + }, + "suggest": { + "symfony/http-foundation": "For using the class SessionTokenStorage." + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Security\\Csrf\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/security-guard/AbstractGuardAuthenticator.php b/vendor/symfony/security-guard/AbstractGuardAuthenticator.php new file mode 100644 index 0000000..13ada75 --- /dev/null +++ b/vendor/symfony/security-guard/AbstractGuardAuthenticator.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard; + +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken; + +/** + * An optional base class that creates a PostAuthenticationGuardToken for you. + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +abstract class AbstractGuardAuthenticator implements AuthenticatorInterface +{ + /** + * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really + * care about which authenticated token you're using. + * + * @return PostAuthenticationGuardToken + */ + public function createAuthenticatedToken(UserInterface $user, string $providerKey) + { + return new PostAuthenticationGuardToken( + $user, + $providerKey, + $user->getRoles() + ); + } +} diff --git a/vendor/symfony/security-guard/Authenticator/AbstractFormLoginAuthenticator.php b/vendor/symfony/security-guard/Authenticator/AbstractFormLoginAuthenticator.php new file mode 100644 index 0000000..a02fb13 --- /dev/null +++ b/vendor/symfony/security-guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Authenticator; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; + +/** + * A base class to make form login authentication easier! + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator +{ + /** + * Return the URL to the login page. + * + * @return string + */ + abstract protected function getLoginUrl(); + + /** + * Override to change what happens after a bad username/password is submitted. + * + * @return RedirectResponse + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { + if ($request->hasSession()) { + $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); + } + + $url = $this->getLoginUrl(); + + return new RedirectResponse($url); + } + + public function supportsRememberMe() + { + return true; + } + + /** + * Override to control what happens when the user hits a secure page + * but isn't logged in yet. + * + * @return RedirectResponse + */ + public function start(Request $request, AuthenticationException $authException = null) + { + $url = $this->getLoginUrl(); + + return new RedirectResponse($url); + } +} diff --git a/vendor/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php b/vendor/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php new file mode 100644 index 0000000..5d447b4 --- /dev/null +++ b/vendor/symfony/security-guard/Authenticator/GuardBridgeAuthenticator.php @@ -0,0 +1,147 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Authenticator; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface; +use Symfony\Component\Security\Guard\PasswordAuthenticatedInterface; +use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardBridgeAuthenticator::class); + +/** + * This authenticator is used to bridge Guard authenticators with + * the Symfony Authenticator system. + * + * @author Wouter de Jong + * + * @deprecated since Symfony 5.3 + */ +class GuardBridgeAuthenticator implements InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface +{ + private $guard; + private $userProvider; + + public function __construct(GuardAuthenticatorInterface $guard, UserProviderInterface $userProvider) + { + $this->guard = $guard; + $this->userProvider = $userProvider; + } + + public function start(Request $request, AuthenticationException $authException = null) + { + return $this->guard->start($request, $authException); + } + + public function supports(Request $request): ?bool + { + return $this->guard->supports($request); + } + + public function authenticate(Request $request): PassportInterface + { + $credentials = $this->guard->getCredentials($request); + + if (null === $credentials) { + throw new \UnexpectedValueException(sprintf('The return value of "%1$s::getCredentials()" must not be null. Return false from "%1$s::supports()" instead.', get_debug_type($this->guard))); + } + + // get the user from the GuardAuthenticator + if (class_exists(UserBadge::class)) { + $user = new UserBadge('guard_authenticator_'.md5(serialize($credentials)), function () use ($credentials) { return $this->getUser($credentials); }); + } else { + // BC with symfony/security-http:5.1 + $user = $this->getUser($credentials); + } + + if ($this->guard instanceof PasswordAuthenticatedInterface && !$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-guard', '5.3', 'Not implementing the "%s" interface in class "%s" while using password-based guard authenticators is deprecated.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $passport = new Passport($user, new CustomCredentials([$this->guard, 'checkCredentials'], $credentials)); + if ($this->userProvider instanceof PasswordUpgraderInterface && $this->guard instanceof PasswordAuthenticatedInterface && (null !== $password = $this->guard->getPassword($credentials))) { + $passport->addBadge(new PasswordUpgradeBadge($password, $this->userProvider)); + } + + if ($this->guard->supportsRememberMe()) { + $passport->addBadge(new RememberMeBadge()); + } + + return $passport; + } + + public function getGuardAuthenticator(): GuardAuthenticatorInterface + { + return $this->guard; + } + + private function getUser($credentials): UserInterface + { + $user = $this->guard->getUser($credentials, $this->userProvider); + + if (null === $user) { + throw new UserNotFoundException(sprintf('Null returned from "%s::getUser()".', get_debug_type($this->guard))); + } + + if (!$user instanceof UserInterface) { + throw new \UnexpectedValueException(sprintf('The "%s::getUser()" method must return a UserInterface. You returned "%s".', get_debug_type($this->guard), get_debug_type($user))); + } + + return $user; + } + + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + if (!$passport instanceof UserPassportInterface) { + throw new \LogicException(sprintf('"%s" does not support non-user passports.', __CLASS__)); + } + + return $this->guard->createAuthenticatedToken($passport->getUser(), $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return $this->guard->createAuthenticatedToken($passport->getUser(), $firewallName); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return $this->guard->onAuthenticationSuccess($request, $token, $firewallName); + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + return $this->guard->onAuthenticationFailure($request, $exception); + } + + public function isInteractive(): bool + { + // the GuardAuthenticationHandler always dispatches the InteractiveLoginEvent + return true; + } +} diff --git a/vendor/symfony/security-guard/AuthenticatorInterface.php b/vendor/symfony/security-guard/AuthenticatorInterface.php new file mode 100644 index 0000000..699fd3e --- /dev/null +++ b/vendor/symfony/security-guard/AuthenticatorInterface.php @@ -0,0 +1,155 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Guard\Token\GuardTokenInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +/** + * The interface for all "guard" authenticators. + * + * The methods on this interface are called throughout the guard authentication + * process to give you the power to control most parts of the process from + * one location. + * + * @author Ryan Weaver + * @author Amaury Leroux de Lens + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +interface AuthenticatorInterface extends AuthenticationEntryPointInterface +{ + /** + * Does the authenticator support the given Request? + * + * If this returns false, the authenticator will be skipped. + * + * @return bool + */ + public function supports(Request $request); + + /** + * Get the authentication credentials from the request and return them + * as any type (e.g. an associate array). + * + * Whatever value you return here will be passed to getUser() and checkCredentials() + * + * For example, for a form login, you might: + * + * return [ + * 'username' => $request->request->get('_username'), + * 'password' => $request->request->get('_password'), + * ]; + * + * Or for an API token that's on a header, you might use: + * + * return ['api_key' => $request->headers->get('X-API-TOKEN')]; + * + * @return mixed Any non-null value + * + * @throws \UnexpectedValueException If null is returned + */ + public function getCredentials(Request $request); + + /** + * Return a UserInterface object based on the credentials. + * + * The *credentials* are the return value from getCredentials() + * + * You may throw an AuthenticationException if you wish. If you return + * null, then a UserNotFoundException is thrown for you. + * + * @param mixed $credentials + * + * @throws AuthenticationException + * + * @return UserInterface|null + */ + public function getUser($credentials, UserProviderInterface $userProvider); + + /** + * Returns true if the credentials are valid. + * + * If false is returned, authentication will fail. You may also throw + * an AuthenticationException if you wish to cause authentication to fail. + * + * The *credentials* are the return value from getCredentials() + * + * @param mixed $credentials + * + * @return bool + * + * @throws AuthenticationException + */ + public function checkCredentials($credentials, UserInterface $user); + + /** + * Create an authenticated token for the given user. + * + * If you don't care about which token class is used or don't really + * understand what a "token" is, you can skip this method by extending + * the AbstractGuardAuthenticator class from your authenticator. + * + * @see AbstractGuardAuthenticator + * + * @return GuardTokenInterface + */ + public function createAuthenticatedToken(UserInterface $user, string $providerKey); + + /** + * Called when authentication executed, but failed (e.g. wrong username password). + * + * This should return the Response sent back to the user, like a + * RedirectResponse to the login page or a 401 response. + * + * If you return null, the request will continue, but the user will + * not be authenticated. This is probably not what you want to do. + * + * @return Response|null + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception); + + /** + * Called when authentication executed and was successful! + * + * This should return the Response sent back to the user, like a + * RedirectResponse to the last page they visited. + * + * If you return null, the current request will continue, and the user + * will be authenticated. This makes sense, for example, with an API. + * + * @return Response|null + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey); + + /** + * Does this method support remember me cookies? + * + * Remember me cookie will be set if *all* of the following are met: + * A) This method returns true + * B) The remember_me key under your firewall is configured + * C) The "remember me" functionality is activated. This is usually + * done by having a _remember_me checkbox in your form, but + * can be configured by the "always_remember_me" and "remember_me_parameter" + * parameters under the "remember_me" firewall key + * D) The onAuthenticationSuccess method returns a Response object + * + * @return bool + */ + public function supportsRememberMe(); +} diff --git a/vendor/symfony/security-guard/CHANGELOG.md b/vendor/symfony/security-guard/CHANGELOG.md new file mode 100644 index 0000000..22652b0 --- /dev/null +++ b/vendor/symfony/security-guard/CHANGELOG.md @@ -0,0 +1,7 @@ +CHANGELOG +========= + +5.3 +--- + +The CHANGELOG for version 5.3 and earlier can be found at https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Security/CHANGELOG.md diff --git a/vendor/symfony/security-guard/Firewall/GuardAuthenticationListener.php b/vendor/symfony/security-guard/Firewall/GuardAuthenticationListener.php new file mode 100644 index 0000000..81fb20f --- /dev/null +++ b/vendor/symfony/security-guard/Firewall/GuardAuthenticationListener.php @@ -0,0 +1,242 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Guard\AuthenticatorInterface; +use Symfony\Component\Security\Guard\GuardAuthenticatorHandler; +use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken; +use Symfony\Component\Security\Http\Firewall\AbstractListener; +use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticationListener::class); + +/** + * Authentication listener for the "guard" system. + * + * @author Ryan Weaver + * @author Amaury Leroux de Lens + * + * @final + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class GuardAuthenticationListener extends AbstractListener +{ + private $guardHandler; + private $authenticationManager; + private $providerKey; + private $guardAuthenticators; + private $logger; + private $rememberMeServices; + private $hideUserNotFoundExceptions; + + /** + * @param string $providerKey The provider (i.e. firewall) key + * @param iterable $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider + */ + public function __construct(GuardAuthenticatorHandler $guardHandler, AuthenticationManagerInterface $authenticationManager, string $providerKey, iterable $guardAuthenticators, LoggerInterface $logger = null, bool $hideUserNotFoundExceptions = true) + { + if (empty($providerKey)) { + throw new \InvalidArgumentException('$providerKey must not be empty.'); + } + + $this->guardHandler = $guardHandler; + $this->authenticationManager = $authenticationManager; + $this->providerKey = $providerKey; + $this->guardAuthenticators = $guardAuthenticators; + $this->logger = $logger; + $this->hideUserNotFoundExceptions = $hideUserNotFoundExceptions; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + if (null !== $this->logger) { + $context = ['firewall_key' => $this->providerKey]; + + if ($this->guardAuthenticators instanceof \Countable || \is_array($this->guardAuthenticators)) { + $context['authenticators'] = \count($this->guardAuthenticators); + } + + $this->logger->debug('Checking for guard authentication credentials.', $context); + } + + $guardAuthenticators = []; + + foreach ($this->guardAuthenticators as $key => $guardAuthenticator) { + if (null !== $this->logger) { + $this->logger->debug('Checking support on guard authenticator.', ['firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)]); + } + + if ($guardAuthenticator->supports($request)) { + $guardAuthenticators[$key] = $guardAuthenticator; + } elseif (null !== $this->logger) { + $this->logger->debug('Guard authenticator does not support the request.', ['firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)]); + } + } + + if (!$guardAuthenticators) { + return false; + } + + $request->attributes->set('_guard_authenticators', $guardAuthenticators); + + return true; + } + + /** + * Iterates over each authenticator to see if each wants to authenticate the request. + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + $guardAuthenticators = $request->attributes->get('_guard_authenticators'); + $request->attributes->remove('_guard_authenticators'); + + foreach ($guardAuthenticators as $key => $guardAuthenticator) { + // get a key that's unique to *this* guard authenticator + // this MUST be the same as GuardAuthenticationProvider + $uniqueGuardKey = $this->providerKey.'_'.$key; + + $this->executeGuardAuthenticator($uniqueGuardKey, $guardAuthenticator, $event); + + if ($event->hasResponse()) { + if (null !== $this->logger) { + $this->logger->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => \get_class($guardAuthenticator)]); + } + + break; + } + } + } + + private function executeGuardAuthenticator(string $uniqueGuardKey, AuthenticatorInterface $guardAuthenticator, RequestEvent $event) + { + $request = $event->getRequest(); + try { + if (null !== $this->logger) { + $this->logger->debug('Calling getCredentials() on guard authenticator.', ['firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)]); + } + + // allow the authenticator to fetch authentication info from the request + $credentials = $guardAuthenticator->getCredentials($request); + + if (null === $credentials) { + throw new \UnexpectedValueException(sprintf('The return value of "%1$s::getCredentials()" must not be null. Return false from "%1$s::supports()" instead.', get_debug_type($guardAuthenticator))); + } + + // create a token with the unique key, so that the provider knows which authenticator to use + $token = new PreAuthenticationGuardToken($credentials, $uniqueGuardKey); + + if (null !== $this->logger) { + $this->logger->debug('Passing guard token information to the GuardAuthenticationProvider', ['firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator)]); + } + // pass the token into the AuthenticationManager system + // this indirectly calls GuardAuthenticationProvider::authenticate() + $token = $this->authenticationManager->authenticate($token); + + if (null !== $this->logger) { + $this->logger->info('Guard authentication successful!', ['token' => $token, 'authenticator' => \get_class($guardAuthenticator)]); + } + + // sets the token on the token storage, etc + $this->guardHandler->authenticateWithToken($token, $request, $this->providerKey); + } catch (AuthenticationException $e) { + // oh no! Authentication failed! + + if (null !== $this->logger) { + $this->logger->info('Guard authentication failed.', ['exception' => $e, 'authenticator' => \get_class($guardAuthenticator)]); + } + + // Avoid leaking error details in case of invalid user (e.g. user not found or invalid account status) + // to prevent user enumeration via response content + if ($this->hideUserNotFoundExceptions && ($e instanceof UsernameNotFoundException || ($e instanceof AccountStatusException && !$e instanceof CustomUserMessageAccountStatusException))) { + $e = new BadCredentialsException('Bad credentials.', 0, $e); + } + + $response = $this->guardHandler->handleAuthenticationFailure($e, $request, $guardAuthenticator, $this->providerKey); + + if ($response instanceof Response) { + $event->setResponse($response); + } + + return; + } + + // success! + $response = $this->guardHandler->handleAuthenticationSuccess($token, $request, $guardAuthenticator, $this->providerKey); + if ($response instanceof Response) { + if (null !== $this->logger) { + $this->logger->debug('Guard authenticator set success response.', ['response' => $response, 'authenticator' => \get_class($guardAuthenticator)]); + } + + $event->setResponse($response); + } else { + if (null !== $this->logger) { + $this->logger->debug('Guard authenticator set no success response: request continues.', ['authenticator' => \get_class($guardAuthenticator)]); + } + } + + // attempt to trigger the remember me functionality + $this->triggerRememberMe($guardAuthenticator, $request, $token, $response); + } + + /** + * Should be called if this listener will support remember me. + */ + public function setRememberMeServices(RememberMeServicesInterface $rememberMeServices) + { + $this->rememberMeServices = $rememberMeServices; + } + + /** + * Checks to see if remember me is supported in the authenticator and + * on the firewall. If it is, the RememberMeServicesInterface is notified. + */ + private function triggerRememberMe(AuthenticatorInterface $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null) + { + if (null === $this->rememberMeServices) { + if (null !== $this->logger) { + $this->logger->debug('Remember me skipped: it is not configured for the firewall.', ['authenticator' => \get_class($guardAuthenticator)]); + } + + return; + } + + if (!$guardAuthenticator->supportsRememberMe()) { + if (null !== $this->logger) { + $this->logger->debug('Remember me skipped: your authenticator does not support it.', ['authenticator' => \get_class($guardAuthenticator)]); + } + + return; + } + + if (!$response instanceof Response) { + throw new \LogicException(sprintf('"%s::onAuthenticationSuccess()" *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', get_debug_type($guardAuthenticator))); + } + + $this->rememberMeServices->loginSuccess($request, $response, $token); + } +} diff --git a/vendor/symfony/security-guard/GuardAuthenticatorHandler.php b/vendor/symfony/security-guard/GuardAuthenticatorHandler.php new file mode 100644 index 0000000..cbd5bdf --- /dev/null +++ b/vendor/symfony/security-guard/GuardAuthenticatorHandler.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticatorHandler::class); + +/** + * A utility class that does much of the *work* during the guard authentication process. + * + * By having the logic here instead of the listener, more of the process + * can be called directly (e.g. for manual authentication) or overridden. + * + * @author Ryan Weaver + * + * @final + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class GuardAuthenticatorHandler +{ + private $tokenStorage; + private $dispatcher; + private $sessionStrategy; + private $statelessProviderKeys; + + /** + * @param array $statelessProviderKeys An array of provider/firewall keys that are "stateless" and so do not need the session migrated on success + */ + public function __construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null, array $statelessProviderKeys = []) + { + $this->tokenStorage = $tokenStorage; + $this->dispatcher = $eventDispatcher; + $this->statelessProviderKeys = $statelessProviderKeys; + } + + /** + * Authenticates the given token in the system. + */ + public function authenticateWithToken(TokenInterface $token, Request $request, string $providerKey = null) + { + $this->migrateSession($request, $token, $providerKey); + $this->tokenStorage->setToken($token); + + if (null !== $this->dispatcher) { + $loginEvent = new InteractiveLoginEvent($request, $token); + $this->dispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + } + + /** + * Returns the "on success" response for the given GuardAuthenticator. + */ + public function handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response + { + $response = $guardAuthenticator->onAuthenticationSuccess($request, $token, $providerKey); + + // check that it's a Response or null + if ($response instanceof Response || null === $response) { + return $response; + } + + throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationSuccess()" method must return null or a Response object. You returned "%s".', \get_class($guardAuthenticator), get_debug_type($response))); + } + + /** + * Convenience method for authenticating the user and returning the + * Response *if any* for success. + */ + public function authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, string $providerKey): ?Response + { + // create an authenticated token for the User + $token = $authenticator->createAuthenticatedToken($user, $providerKey); + // authenticate this in the system + $this->authenticateWithToken($token, $request, $providerKey); + + // return the success metric + return $this->handleAuthenticationSuccess($token, $request, $authenticator, $providerKey); + } + + /** + * Handles an authentication failure and returns the Response for the + * GuardAuthenticator. + */ + public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey): ?Response + { + $response = $guardAuthenticator->onAuthenticationFailure($request, $authenticationException); + if ($response instanceof Response || null === $response) { + // returning null is ok, it means they want the request to continue + return $response; + } + + throw new \UnexpectedValueException(sprintf('The "%s::onAuthenticationFailure()" method must return null or a Response object. You returned "%s".', \get_class($guardAuthenticator), get_debug_type($response))); + } + + /** + * Call this method if your authentication token is stored to a session. + * + * @final + */ + public function setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy) + { + $this->sessionStrategy = $sessionStrategy; + } + + private function migrateSession(Request $request, TokenInterface $token, ?string $providerKey) + { + if (\in_array($providerKey, $this->statelessProviderKeys, true) || !$this->sessionStrategy || !$request->hasSession() || !$request->hasPreviousSession()) { + return; + } + + $this->sessionStrategy->onAuthentication($request, $token); + } +} diff --git a/vendor/symfony/security-guard/LICENSE b/vendor/symfony/security-guard/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/security-guard/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/security-guard/PasswordAuthenticatedInterface.php b/vendor/symfony/security-guard/PasswordAuthenticatedInterface.php new file mode 100644 index 0000000..deebad3 --- /dev/null +++ b/vendor/symfony/security-guard/PasswordAuthenticatedInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PasswordAuthenticatedInterface::class); + +/** + * An optional interface for "guard" authenticators that deal with user passwords. + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +interface PasswordAuthenticatedInterface +{ + /** + * Returns the clear-text password contained in credentials if any. + * + * @param mixed $credentials The user credentials + */ + public function getPassword($credentials): ?string; +} diff --git a/vendor/symfony/security-guard/Provider/GuardAuthenticationProvider.php b/vendor/symfony/security-guard/Provider/GuardAuthenticationProvider.php new file mode 100644 index 0000000..000c102 --- /dev/null +++ b/vendor/symfony/security-guard/Provider/GuardAuthenticationProvider.php @@ -0,0 +1,185 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Provider; + +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; +use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\AuthenticationExpiredException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Guard\AuthenticatorInterface; +use Symfony\Component\Security\Guard\PasswordAuthenticatedInterface; +use Symfony\Component\Security\Guard\Token\GuardTokenInterface; +use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticationProvider::class); + +/** + * Responsible for accepting the PreAuthenticationGuardToken and calling + * the correct authenticator to retrieve the authenticated token. + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class GuardAuthenticationProvider implements AuthenticationProviderInterface +{ + private $guardAuthenticators; + private $userProvider; + private $providerKey; + private $userChecker; + private $passwordHasher; + + /** + * @param iterable $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener + * @param string $providerKey The provider (i.e. firewall) key + * @param UserPasswordHasherInterface $passwordHasher + */ + public function __construct(iterable $guardAuthenticators, UserProviderInterface $userProvider, string $providerKey, UserCheckerInterface $userChecker, $passwordHasher = null) + { + $this->guardAuthenticators = $guardAuthenticators; + $this->userProvider = $userProvider; + $this->providerKey = $providerKey; + $this->userChecker = $userChecker; + $this->passwordHasher = $passwordHasher; + + if ($passwordHasher instanceof UserPasswordEncoderInterface) { + trigger_deprecation('symfony/security-core', '5.3', sprintf('Passing a "%s" instance to the "%s" constructor is deprecated, use "%s" instead.', UserPasswordEncoderInterface::class, __CLASS__, UserPasswordHasherInterface::class)); + } + } + + /** + * Finds the correct authenticator for the token and calls it. + * + * @param GuardTokenInterface $token + * + * @return TokenInterface + */ + public function authenticate(TokenInterface $token) + { + if (!$token instanceof GuardTokenInterface) { + throw new \InvalidArgumentException('GuardAuthenticationProvider only supports GuardTokenInterface.'); + } + + if (!$token instanceof PreAuthenticationGuardToken) { + /* + * The listener *only* passes PreAuthenticationGuardToken instances. + * This means that an authenticated token (e.g. PostAuthenticationGuardToken) + * is being passed here, which happens if that token becomes + * "not authenticated" (e.g. happens if the user changes between + * requests). In this case, the user should be logged out, so + * we will return an AnonymousToken to accomplish that. + */ + + // this should never happen - but technically, the token is + // authenticated... so it could just be returned + if ($token->isAuthenticated(false)) { + return $token; + } + + // this causes the user to be logged out + throw new AuthenticationExpiredException(); + } + + $guardAuthenticator = $this->findOriginatingAuthenticator($token); + + if (null === $guardAuthenticator) { + throw new AuthenticationException(sprintf('Token with provider key "%s" did not originate from any of the guard authenticators of provider "%s".', $token->getGuardProviderKey(), $this->providerKey)); + } + + return $this->authenticateViaGuard($guardAuthenticator, $token); + } + + private function authenticateViaGuard(AuthenticatorInterface $guardAuthenticator, PreAuthenticationGuardToken $token): GuardTokenInterface + { + // get the user from the GuardAuthenticator + $user = $guardAuthenticator->getUser($token->getCredentials(), $this->userProvider); + + if (null === $user) { + $e = new UserNotFoundException(sprintf('Null returned from "%s::getUser()".', get_debug_type($guardAuthenticator))); + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + $e->setUserIdentifier(method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()); + + throw $e; + } + + if (!$user instanceof UserInterface) { + throw new \UnexpectedValueException(sprintf('The "%s::getUser()" method must return a UserInterface. You returned "%s".', get_debug_type($guardAuthenticator), get_debug_type($user))); + } + + if ($guardAuthenticator instanceof PasswordAuthenticatedInterface && !$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-guard', '5.3', 'Not implementing the "%s" interface in class "%s" while using password-based guard authenticators is deprecated.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + $this->userChecker->checkPreAuth($user); + if (true !== $checkCredentialsResult = $guardAuthenticator->checkCredentials($token->getCredentials(), $user)) { + if (false !== $checkCredentialsResult) { + throw new \TypeError(sprintf('"%s::checkCredentials()" must return a boolean value.', get_debug_type($guardAuthenticator))); + } + + throw new BadCredentialsException(sprintf('Authentication failed because "%s::checkCredentials()" did not return true.', get_debug_type($guardAuthenticator))); + } + if ($this->userProvider instanceof PasswordUpgraderInterface && $guardAuthenticator instanceof PasswordAuthenticatedInterface && null !== $this->passwordHasher && (null !== $password = $guardAuthenticator->getPassword($token->getCredentials())) && $this->passwordHasher->needsRehash($user)) { + if ($this->passwordHasher instanceof UserPasswordEncoderInterface) { + // @deprecated since Symfony 5.3 + $this->userProvider->upgradePassword($user, $this->passwordHasher->encodePassword($user, $password)); + } else { + $this->userProvider->upgradePassword($user, $this->passwordHasher->hashPassword($user, $password)); + } + } + $this->userChecker->checkPostAuth($user); + + // turn the UserInterface into a TokenInterface + $authenticatedToken = $guardAuthenticator->createAuthenticatedToken($user, $this->providerKey); + if (!$authenticatedToken instanceof TokenInterface) { + throw new \UnexpectedValueException(sprintf('The "%s::createAuthenticatedToken()" method must return a TokenInterface. You returned "%s".', get_debug_type($guardAuthenticator), get_debug_type($authenticatedToken))); + } + + return $authenticatedToken; + } + + private function findOriginatingAuthenticator(PreAuthenticationGuardToken $token): ?AuthenticatorInterface + { + // find the *one* GuardAuthenticator that this token originated from + foreach ($this->guardAuthenticators as $key => $guardAuthenticator) { + // get a key that's unique to *this* guard authenticator + // this MUST be the same as GuardAuthenticationListener + $uniqueGuardKey = $this->providerKey.'_'.$key; + + if ($uniqueGuardKey === $token->getGuardProviderKey()) { + return $guardAuthenticator; + } + } + + // no matching authenticator found - but there will be multiple GuardAuthenticationProvider + // instances that will be checked if you have multiple firewalls. + + return null; + } + + public function supports(TokenInterface $token) + { + if ($token instanceof PreAuthenticationGuardToken) { + return null !== $this->findOriginatingAuthenticator($token); + } + + return $token instanceof GuardTokenInterface; + } +} diff --git a/vendor/symfony/security-guard/README.md b/vendor/symfony/security-guard/README.md new file mode 100644 index 0000000..7316a8d --- /dev/null +++ b/vendor/symfony/security-guard/README.md @@ -0,0 +1,30 @@ +Security Component - Guard +========================== + +The Guard component brings many layers of authentication together, making +it much easier to create complex authentication systems where you have +total control. + +Sponsor +------- + +The Security component for Symfony 5.4/6.0 is [backed][1] by [SymfonyCasts][2]. + +Learn Symfony faster by watching real projects being built and actively coding +along with them. SymfonyCasts bridges that learning gap, bringing you video +tutorials and coding challenges. Code on! + +Help Symfony by [sponsoring][3] its development! + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/security.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://symfonycasts.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/security-guard/Token/GuardTokenInterface.php b/vendor/symfony/security-guard/Token/GuardTokenInterface.php new file mode 100644 index 0000000..a44413b --- /dev/null +++ b/vendor/symfony/security-guard/Token/GuardTokenInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Token; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardTokenInterface::class); + +/** + * A marker interface that both guard tokens implement. + * + * Any tokens passed to GuardAuthenticationProvider (i.e. any tokens that + * are handled by the guard auth system) must implement this + * interface. + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +interface GuardTokenInterface extends TokenInterface +{ +} diff --git a/vendor/symfony/security-guard/Token/PostAuthenticationGuardToken.php b/vendor/symfony/security-guard/Token/PostAuthenticationGuardToken.php new file mode 100644 index 0000000..a9050a4 --- /dev/null +++ b/vendor/symfony/security-guard/Token/PostAuthenticationGuardToken.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Token; + +use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PostAuthenticationGuardToken::class); + +/** + * Used as an "authenticated" token, though it could be set to not-authenticated later. + * + * If you're using Guard authentication, you *must* use a class that implements + * GuardTokenInterface as your authenticated token (like this class). + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class PostAuthenticationGuardToken extends AbstractToken implements GuardTokenInterface +{ + private $providerKey; + + /** + * @param string $providerKey The provider (firewall) key + * @param string[] $roles An array of roles + * + * @throws \InvalidArgumentException + */ + public function __construct(UserInterface $user, string $providerKey, array $roles) + { + parent::__construct($roles); + + if (empty($providerKey)) { + throw new \InvalidArgumentException('$providerKey (i.e. firewall key) must not be empty.'); + } + + $this->setUser($user); + $this->providerKey = $providerKey; + + // this token is meant to be used after authentication success, so it is always authenticated + // you could set it as non authenticated later if you need to + $this->setAuthenticated(true, false); + } + + /** + * This is meant to be only an authenticated token, where credentials + * have already been used and are thus cleared. + * + * {@inheritdoc} + */ + public function getCredentials() + { + return []; + } + + /** + * Returns the provider (firewall) key. + * + * @return string + */ + public function getProviderKey() + { + return $this->providerKey; + } + + public function getFirewallName(): string + { + return $this->getProviderKey(); + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->providerKey, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->providerKey, $parentData] = $data; + $parentData = \is_array($parentData) ? $parentData : unserialize($parentData); + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-guard/Token/PreAuthenticationGuardToken.php b/vendor/symfony/security-guard/Token/PreAuthenticationGuardToken.php new file mode 100644 index 0000000..8c8ceb2 --- /dev/null +++ b/vendor/symfony/security-guard/Token/PreAuthenticationGuardToken.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Guard\Token; + +use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; + +trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PreAuthenticationGuardToken::class); + +/** + * The token used by the guard auth system before authentication. + * + * The GuardAuthenticationListener creates this, which is then consumed + * immediately by the GuardAuthenticationProvider. If authentication is + * successful, a different authenticated token is returned + * + * @author Ryan Weaver + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class PreAuthenticationGuardToken extends AbstractToken implements GuardTokenInterface +{ + private $credentials; + private $guardProviderKey; + + /** + * @param mixed $credentials + * @param string $guardProviderKey Unique key that bind this token to a specific AuthenticatorInterface + */ + public function __construct($credentials, string $guardProviderKey) + { + $this->credentials = $credentials; + $this->guardProviderKey = $guardProviderKey; + + parent::__construct([]); + + // @deprecated since Symfony 5.4 + parent::setAuthenticated(false); + } + + public function getGuardProviderKey() + { + return $this->guardProviderKey; + } + + /** + * Returns the user credentials, which might be an array of anything you + * wanted to put in there (e.g. username, password, favoriteColor). + * + * @return mixed + */ + public function getCredentials() + { + return $this->credentials; + } + + /** + * @deprecated since Symfony 5.4 + */ + public function setAuthenticated(bool $authenticated) + { + throw new \LogicException('The PreAuthenticationGuardToken is *never* authenticated.'); + } +} diff --git a/vendor/symfony/security-guard/composer.json b/vendor/symfony/security-guard/composer.json new file mode 100644 index 0000000..4852ce9 --- /dev/null +++ b/vendor/symfony/security-guard/composer.json @@ -0,0 +1,34 @@ +{ + "name": "symfony/security-guard", + "type": "library", + "description": "Symfony Security Component - Guard", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/security-core": "^5.0", + "symfony/security-http": "^5.3", + "symfony/polyfill-php80": "^1.15" + }, + "require-dev": { + "psr/log": "^1|^2|^3" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Security\\Guard\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/security-http/AccessMap.php b/vendor/symfony/security-http/AccessMap.php new file mode 100644 index 0000000..f87283f --- /dev/null +++ b/vendor/symfony/security-http/AccessMap.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestMatcherInterface; + +/** + * AccessMap allows configuration of different access control rules for + * specific parts of the website. + * + * @author Fabien Potencier + */ +class AccessMap implements AccessMapInterface +{ + private $map = []; + + /** + * @param array $attributes An array of attributes to pass to the access decision manager (like roles) + * @param string|null $channel The channel to enforce (http, https, or null) + */ + public function add(RequestMatcherInterface $requestMatcher, array $attributes = [], string $channel = null) + { + $this->map[] = [$requestMatcher, $attributes, $channel]; + } + + /** + * {@inheritdoc} + */ + public function getPatterns(Request $request) + { + foreach ($this->map as $elements) { + if (null === $elements[0] || $elements[0]->matches($request)) { + return [$elements[1], $elements[2]]; + } + } + + return [null, null]; + } +} diff --git a/vendor/symfony/security-http/AccessMapInterface.php b/vendor/symfony/security-http/AccessMapInterface.php new file mode 100644 index 0000000..70a1134 --- /dev/null +++ b/vendor/symfony/security-http/AccessMapInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\Request; + +/** + * AccessMap allows configuration of different access control rules for + * specific parts of the website. + * + * @author Fabien Potencier + * @author Kris Wallsmith + */ +interface AccessMapInterface +{ + /** + * Returns security attributes and required channel for the supplied request. + * + * @return array{0: array|null, 1: string|null} A tuple of security attributes and the required channel + */ + public function getPatterns(Request $request); +} diff --git a/vendor/symfony/security-http/Attribute/CurrentUser.php b/vendor/symfony/security-http/Attribute/CurrentUser.php new file mode 100644 index 0000000..413f982 --- /dev/null +++ b/vendor/symfony/security-http/Attribute/CurrentUser.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Attribute; + +/** + * Indicates that a controller argument should receive the current logged user. + */ +#[\Attribute(\Attribute::TARGET_PARAMETER)] +class CurrentUser +{ +} diff --git a/vendor/symfony/security-http/Authentication/AuthenticationFailureHandlerInterface.php b/vendor/symfony/security-http/Authentication/AuthenticationFailureHandlerInterface.php new file mode 100644 index 0000000..10ebac1 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/AuthenticationFailureHandlerInterface.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * Interface for custom authentication failure handlers. + * + * If you want to customize the failure handling process, instead of + * overwriting the respective listener globally, you can set a custom failure + * handler which implements this interface. + * + * @author Johannes M. Schmitt + */ +interface AuthenticationFailureHandlerInterface +{ + /** + * This is called when an interactive authentication attempt fails. This is + * called by authentication listeners inheriting from + * AbstractAuthenticationListener. + * + * @return Response + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception); +} diff --git a/vendor/symfony/security-http/Authentication/AuthenticationSuccessHandlerInterface.php b/vendor/symfony/security-http/Authentication/AuthenticationSuccessHandlerInterface.php new file mode 100644 index 0000000..b1e6e27 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/AuthenticationSuccessHandlerInterface.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * Interface for a custom authentication success handler. + * + * If you want to customize the success handling process, instead of + * overwriting the respective listener globally, you can set a custom success + * handler which implements this interface. + * + * @author Johannes M. Schmitt + */ +interface AuthenticationSuccessHandlerInterface +{ + /** + * This is called when an interactive authentication attempt succeeds. This + * is called by authentication listeners inheriting from + * AbstractAuthenticationListener. + * + * @return Response + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token); +} diff --git a/vendor/symfony/security-http/Authentication/AuthenticationUtils.php b/vendor/symfony/security-http/Authentication/AuthenticationUtils.php new file mode 100644 index 0000000..c7d6bfe --- /dev/null +++ b/vendor/symfony/security-http/Authentication/AuthenticationUtils.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Security; + +/** + * Extracts Security Errors from Request. + * + * @author Boris Vujicic + */ +class AuthenticationUtils +{ + private $requestStack; + + public function __construct(RequestStack $requestStack) + { + $this->requestStack = $requestStack; + } + + /** + * @return AuthenticationException|null + */ + public function getLastAuthenticationError(bool $clearSession = true) + { + $request = $this->getRequest(); + $authenticationException = null; + + if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) { + $authenticationException = $request->attributes->get(Security::AUTHENTICATION_ERROR); + } elseif ($request->hasSession() && ($session = $request->getSession())->has(Security::AUTHENTICATION_ERROR)) { + $authenticationException = $session->get(Security::AUTHENTICATION_ERROR); + + if ($clearSession) { + $session->remove(Security::AUTHENTICATION_ERROR); + } + } + + return $authenticationException; + } + + /** + * @return string + */ + public function getLastUsername() + { + $request = $this->getRequest(); + + if ($request->attributes->has(Security::LAST_USERNAME)) { + return $request->attributes->get(Security::LAST_USERNAME, ''); + } + + return $request->hasSession() ? $request->getSession()->get(Security::LAST_USERNAME, '') : ''; + } + + /** + * @throws \LogicException + */ + private function getRequest(): Request + { + $request = $this->requestStack->getCurrentRequest(); + + if (null === $request) { + throw new \LogicException('Request should exist so it can be processed for error.'); + } + + return $request; + } +} diff --git a/vendor/symfony/security-http/Authentication/AuthenticatorManager.php b/vendor/symfony/security-http/Authentication/AuthenticatorManager.php new file mode 100644 index 0000000..82c8cd2 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/AuthenticatorManager.php @@ -0,0 +1,285 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\AuthenticationEvents; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator; +use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; +use Symfony\Component\Security\Http\Event\AuthenticationTokenCreatedEvent; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\Event\LoginFailureEvent; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * @author Wouter de Jong + * @author Ryan Weaver + * @author Amaury Leroux de Lens + */ +class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthenticatorInterface +{ + private $authenticators; + private $tokenStorage; + private $eventDispatcher; + private $eraseCredentials; + private $logger; + private $firewallName; + private $hideUserNotFoundExceptions; + private $requiredBadges; + + /** + * @param iterable $authenticators + */ + public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = []) + { + $this->authenticators = $authenticators; + $this->tokenStorage = $tokenStorage; + $this->eventDispatcher = $eventDispatcher; + $this->firewallName = $firewallName; + $this->logger = $logger; + $this->eraseCredentials = $eraseCredentials; + $this->hideUserNotFoundExceptions = $hideUserNotFoundExceptions; + $this->requiredBadges = $requiredBadges; + } + + /** + * @param BadgeInterface[] $badges Optionally, pass some Passport badges to use for the manual login + */ + public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response + { + // create an authentication token for the User + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + $passport = new SelfValidatingPassport(new UserBadge(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), function () use ($user) { return $user; }), $badges); + $token = method_exists($authenticator, 'createToken') ? $authenticator->createToken($passport, $this->firewallName) : $authenticator->createAuthenticatedToken($passport, $this->firewallName); + + // announce the authentication token + $token = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($token, $passport))->getAuthenticatedToken(); + + // authenticate this in the system + return $this->handleAuthenticationSuccess($token, $passport, $request, $authenticator); + } + + public function supports(Request $request): ?bool + { + if (null !== $this->logger) { + $context = ['firewall_name' => $this->firewallName]; + + if ($this->authenticators instanceof \Countable || \is_array($this->authenticators)) { + $context['authenticators'] = \count($this->authenticators); + } + + $this->logger->debug('Checking for authenticator support.', $context); + } + + $authenticators = []; + $skippedAuthenticators = []; + $lazy = true; + foreach ($this->authenticators as $authenticator) { + if (null !== $this->logger) { + $this->logger->debug('Checking support on authenticator.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]); + } + + if (false !== $supports = $authenticator->supports($request)) { + $authenticators[] = $authenticator; + $lazy = $lazy && null === $supports; + } else { + if (null !== $this->logger) { + $this->logger->debug('Authenticator does not support the request.', ['firewall_name' => $this->firewallName, 'authenticator' => \get_class($authenticator)]); + } + $skippedAuthenticators[] = $authenticator; + } + } + + if (!$authenticators) { + return false; + } + + $request->attributes->set('_security_authenticators', $authenticators); + $request->attributes->set('_security_skipped_authenticators', $skippedAuthenticators); + + return $lazy ? null : true; + } + + public function authenticateRequest(Request $request): ?Response + { + $authenticators = $request->attributes->get('_security_authenticators'); + $request->attributes->remove('_security_authenticators'); + $request->attributes->remove('_security_skipped_authenticators'); + + if (!$authenticators) { + return null; + } + + return $this->executeAuthenticators($authenticators, $request); + } + + /** + * @param AuthenticatorInterface[] $authenticators + */ + private function executeAuthenticators(array $authenticators, Request $request): ?Response + { + foreach ($authenticators as $authenticator) { + // recheck if the authenticator still supports the listener. supports() is called + // eagerly (before token storage is initialized), whereas authenticate() is called + // lazily (after initialization). + if (false === $authenticator->supports($request)) { + if (null !== $this->logger) { + $this->logger->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + + continue; + } + + $response = $this->executeAuthenticator($authenticator, $request); + if (null !== $response) { + if (null !== $this->logger) { + $this->logger->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + + return $response; + } + } + + return null; + } + + private function executeAuthenticator(AuthenticatorInterface $authenticator, Request $request): ?Response + { + $passport = null; + + try { + // get the passport from the Authenticator + $passport = $authenticator->authenticate($request); + + // check the passport (e.g. password checking) + $event = new CheckPassportEvent($authenticator, $passport); + $this->eventDispatcher->dispatch($event); + + // check if all badges are resolved + $resolvedBadges = []; + foreach ($passport->getBadges() as $badge) { + if (!$badge->isResolved()) { + throw new BadCredentialsException(sprintf('Authentication failed: Security badge "%s" is not resolved, did you forget to register the correct listeners?', get_debug_type($badge))); + } + + $resolvedBadges[] = \get_class($badge); + } + + $missingRequiredBadges = array_diff($this->requiredBadges, $resolvedBadges); + if ($missingRequiredBadges) { + throw new BadCredentialsException(sprintf('Authentication failed; Some badges marked as required by the firewall config are not available on the passport: "%s".', implode('", "', $missingRequiredBadges))); + } + + // create the authentication token + $authenticatedToken = method_exists($authenticator, 'createToken') ? $authenticator->createToken($passport, $this->firewallName) : $authenticator->createAuthenticatedToken($passport, $this->firewallName); + + // announce the authentication token + $authenticatedToken = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($authenticatedToken, $passport))->getAuthenticatedToken(); + + if (true === $this->eraseCredentials) { + $authenticatedToken->eraseCredentials(); + } + + $this->eventDispatcher->dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS); + + if (null !== $this->logger) { + $this->logger->info('Authenticator successful!', ['token' => $authenticatedToken, 'authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + } catch (AuthenticationException $e) { + // oh no! Authentication failed! + $response = $this->handleAuthenticationFailure($e, $request, $authenticator, $passport); + if ($response instanceof Response) { + return $response; + } + + return null; + } + + // success! (sets the token on the token storage, etc) + $response = $this->handleAuthenticationSuccess($authenticatedToken, $passport, $request, $authenticator); + if ($response instanceof Response) { + return $response; + } + + if (null !== $this->logger) { + $this->logger->debug('Authenticator set no success response: request continues.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + + return null; + } + + private function handleAuthenticationSuccess(TokenInterface $authenticatedToken, PassportInterface $passport, Request $request, AuthenticatorInterface $authenticator): ?Response + { + // @deprecated since Symfony 5.3 + $user = $authenticatedToken->getUser(); + if ($user instanceof UserInterface && !method_exists($user, 'getUserIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "getUserIdentifier(): string" in user class "%s" is deprecated. This method will replace "getUsername()" in Symfony 6.0.', get_debug_type($authenticatedToken->getUser())); + } + + $this->tokenStorage->setToken($authenticatedToken); + + $response = $authenticator->onAuthenticationSuccess($request, $authenticatedToken, $this->firewallName); + if ($authenticator instanceof InteractiveAuthenticatorInterface && $authenticator->isInteractive()) { + $loginEvent = new InteractiveLoginEvent($request, $authenticatedToken); + $this->eventDispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + + $this->eventDispatcher->dispatch($loginSuccessEvent = new LoginSuccessEvent($authenticator, $passport, $authenticatedToken, $request, $response, $this->firewallName)); + + return $loginSuccessEvent->getResponse(); + } + + /** + * Handles an authentication failure and returns the Response for the authenticator. + */ + private function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $authenticator, ?PassportInterface $passport): ?Response + { + if (null !== $this->logger) { + $this->logger->info('Authenticator failed.', ['exception' => $authenticationException, 'authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + + // Avoid leaking error details in case of invalid user (e.g. user not found or invalid account status) + // to prevent user enumeration via response content comparison + if ($this->hideUserNotFoundExceptions && ($authenticationException instanceof UsernameNotFoundException || ($authenticationException instanceof AccountStatusException && !$authenticationException instanceof CustomUserMessageAccountStatusException))) { + $authenticationException = new BadCredentialsException('Bad credentials.', 0, $authenticationException); + } + + $response = $authenticator->onAuthenticationFailure($request, $authenticationException); + if (null !== $response && null !== $this->logger) { + $this->logger->debug('The "{authenticator}" authenticator set the failure response.', ['authenticator' => \get_class($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)]); + } + + $this->eventDispatcher->dispatch($loginFailureEvent = new LoginFailureEvent($authenticationException, $authenticator, $request, $response, $this->firewallName, $passport)); + + // returning null is ok, it means they want the request to continue + return $loginFailureEvent->getResponse(); + } +} diff --git a/vendor/symfony/security-http/Authentication/AuthenticatorManagerInterface.php b/vendor/symfony/security-http/Authentication/AuthenticatorManagerInterface.php new file mode 100644 index 0000000..4bac7b7 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/AuthenticatorManagerInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; + +/** + * @author Wouter de Jong + * @author Ryan Weaver + */ +interface AuthenticatorManagerInterface +{ + /** + * Called to see if authentication should be attempted on this request. + * + * @see FirewallListenerInterface::supports() + */ + public function supports(Request $request): ?bool; + + /** + * Tries to authenticate the request and returns a response - if any authenticator set one. + */ + public function authenticateRequest(Request $request): ?Response; +} diff --git a/vendor/symfony/security-http/Authentication/CustomAuthenticationFailureHandler.php b/vendor/symfony/security-http/Authentication/CustomAuthenticationFailureHandler.php new file mode 100644 index 0000000..f49f180 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/CustomAuthenticationFailureHandler.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * @author Fabien Potencier + */ +class CustomAuthenticationFailureHandler implements AuthenticationFailureHandlerInterface +{ + private $handler; + + /** + * @param array $options Options for processing a successful authentication attempt + */ + public function __construct(AuthenticationFailureHandlerInterface $handler, array $options) + { + $this->handler = $handler; + if (method_exists($handler, 'setOptions')) { + $this->handler->setOptions($options); + } + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { + return $this->handler->onAuthenticationFailure($request, $exception); + } +} diff --git a/vendor/symfony/security-http/Authentication/CustomAuthenticationSuccessHandler.php b/vendor/symfony/security-http/Authentication/CustomAuthenticationSuccessHandler.php new file mode 100644 index 0000000..fd318b4 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/CustomAuthenticationSuccessHandler.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * @author Fabien Potencier + */ +class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface +{ + private $handler; + + /** + * @param array $options Options for processing a successful authentication attempt + */ + public function __construct(AuthenticationSuccessHandlerInterface $handler, array $options, string $firewallName) + { + $this->handler = $handler; + if (method_exists($handler, 'setOptions')) { + $this->handler->setOptions($options); + } + + if (method_exists($handler, 'setFirewallName')) { + $this->handler->setFirewallName($firewallName); + } elseif (method_exists($handler, 'setProviderKey')) { + trigger_deprecation('symfony/security-http', '5.2', 'Method "%s::setProviderKey()" is deprecated, rename the method to "setFirewallName()" instead.', \get_class($handler)); + + $this->handler->setProviderKey($firewallName); + } + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token) + { + return $this->handler->onAuthenticationSuccess($request, $token); + } +} diff --git a/vendor/symfony/security-http/Authentication/DefaultAuthenticationFailureHandler.php b/vendor/symfony/security-http/Authentication/DefaultAuthenticationFailureHandler.php new file mode 100644 index 0000000..31b5f64 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/DefaultAuthenticationFailureHandler.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\ParameterBagUtils; + +/** + * Class with the default authentication failure handling logic. + * + * Can be optionally be extended from by the developer to alter the behavior + * while keeping the default behavior. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * @author Alexander + */ +class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandlerInterface +{ + protected $httpKernel; + protected $httpUtils; + protected $logger; + protected $options; + protected $defaultOptions = [ + 'failure_path' => null, + 'failure_forward' => false, + 'login_path' => '/login', + 'failure_path_parameter' => '_failure_path', + ]; + + public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options = [], LoggerInterface $logger = null) + { + $this->httpKernel = $httpKernel; + $this->httpUtils = $httpUtils; + $this->logger = $logger; + $this->setOptions($options); + } + + /** + * Gets the options. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + public function setOptions(array $options) + { + $this->options = array_merge($this->defaultOptions, $options); + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { + if ($failureUrl = ParameterBagUtils::getRequestParameterValue($request, $this->options['failure_path_parameter'])) { + $this->options['failure_path'] = $failureUrl; + } + + if (null === $this->options['failure_path']) { + $this->options['failure_path'] = $this->options['login_path']; + } + + if ($this->options['failure_forward']) { + if (null !== $this->logger) { + $this->logger->debug('Authentication failure, forward triggered.', ['failure_path' => $this->options['failure_path']]); + } + + $subRequest = $this->httpUtils->createRequest($request, $this->options['failure_path']); + $subRequest->attributes->set(Security::AUTHENTICATION_ERROR, $exception); + + return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + } + + if (null !== $this->logger) { + $this->logger->debug('Authentication failure, redirect triggered.', ['failure_path' => $this->options['failure_path']]); + } + + $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); + + return $this->httpUtils->createRedirectResponse($request, $this->options['failure_path']); + } +} diff --git a/vendor/symfony/security-http/Authentication/DefaultAuthenticationSuccessHandler.php b/vendor/symfony/security-http/Authentication/DefaultAuthenticationSuccessHandler.php new file mode 100644 index 0000000..0972af9 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\ParameterBagUtils; +use Symfony\Component\Security\Http\Util\TargetPathTrait; + +/** + * Class with the default authentication success handling logic. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * @author Alexander + */ +class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface +{ + use TargetPathTrait; + + protected $httpUtils; + protected $options; + /** @deprecated since Symfony 5.2, use $firewallName instead */ + protected $providerKey; + protected $firewallName; + protected $defaultOptions = [ + 'always_use_default_target_path' => false, + 'default_target_path' => '/', + 'login_path' => '/login', + 'target_path_parameter' => '_target_path', + 'use_referer' => false, + ]; + + /** + * @param array $options Options for processing a successful authentication attempt + */ + public function __construct(HttpUtils $httpUtils, array $options = []) + { + $this->httpUtils = $httpUtils; + $this->setOptions($options); + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token) + { + return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); + } + + /** + * Gets the options. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + public function setOptions(array $options) + { + $this->options = array_merge($this->defaultOptions, $options); + } + + /** + * Get the provider key. + * + * @return string + * + * @deprecated since Symfony 5.2, use getFirewallName() instead + */ + public function getProviderKey() + { + if (1 !== \func_num_args() || true !== func_get_arg(0)) { + trigger_deprecation('symfony/security-core', '5.2', 'Method "%s()" is deprecated, use "getFirewallName()" instead.', __METHOD__); + } + + if ($this->providerKey !== $this->firewallName) { + trigger_deprecation('symfony/security-core', '5.2', 'The "%1$s::$providerKey" property is deprecated, use "%1$s::$firewallName" instead.', __CLASS__); + + return $this->providerKey; + } + + return $this->firewallName; + } + + public function setProviderKey(string $providerKey) + { + if (2 !== \func_num_args() || true !== func_get_arg(1)) { + trigger_deprecation('symfony/security-http', '5.2', 'Method "%s" is deprecated, use "setFirewallName()" instead.', __METHOD__); + } + + $this->providerKey = $providerKey; + } + + public function getFirewallName(): ?string + { + return $this->getProviderKey(true); + } + + public function setFirewallName(string $firewallName): void + { + $this->setProviderKey($firewallName, true); + + $this->firewallName = $firewallName; + } + + /** + * Builds the target URL according to the defined options. + * + * @return string + */ + protected function determineTargetUrl(Request $request) + { + if ($this->options['always_use_default_target_path']) { + return $this->options['default_target_path']; + } + + if ($targetUrl = ParameterBagUtils::getRequestParameterValue($request, $this->options['target_path_parameter'])) { + return $targetUrl; + } + + $firewallName = $this->getFirewallName(); + if (null !== $firewallName && $targetUrl = $this->getTargetPath($request->getSession(), $firewallName)) { + $this->removeTargetPath($request->getSession(), $firewallName); + + return $targetUrl; + } + + if ($this->options['use_referer'] && $targetUrl = $request->headers->get('Referer')) { + if (false !== $pos = strpos($targetUrl, '?')) { + $targetUrl = substr($targetUrl, 0, $pos); + } + if ($targetUrl && $targetUrl !== $this->httpUtils->generateUri($request, $this->options['login_path'])) { + return $targetUrl; + } + } + + return $this->options['default_target_path']; + } +} diff --git a/vendor/symfony/security-http/Authentication/NoopAuthenticationManager.php b/vendor/symfony/security-http/Authentication/NoopAuthenticationManager.php new file mode 100644 index 0000000..c5a0d7b --- /dev/null +++ b/vendor/symfony/security-http/Authentication/NoopAuthenticationManager.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * This class is used when the authenticator system is activated. + * + * This is used to not break AuthenticationChecker and ContextListener when + * using the authenticator system. + * + * @author Wouter de Jong + * + * @internal + */ +class NoopAuthenticationManager implements AuthenticationManagerInterface +{ + public function authenticate(TokenInterface $token): TokenInterface + { + return $token; + } +} diff --git a/vendor/symfony/security-http/Authentication/UserAuthenticatorInterface.php b/vendor/symfony/security-http/Authentication/UserAuthenticatorInterface.php new file mode 100644 index 0000000..a59a792 --- /dev/null +++ b/vendor/symfony/security-http/Authentication/UserAuthenticatorInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; + +/** + * @author Wouter de Jong + */ +interface UserAuthenticatorInterface +{ + /** + * Convenience method to programmatically login a user and return a + * Response *if any* for success. + * + * @param BadgeInterface[] $badges Optionally, pass some Passport badges to use for the manual login + */ + public function authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = []): ?Response; +} diff --git a/vendor/symfony/security-http/Authenticator/AbstractAuthenticator.php b/vendor/symfony/security-http/Authenticator/AbstractAuthenticator.php new file mode 100644 index 0000000..673274d --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/AbstractAuthenticator.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken; + +/** + * An optional base class that creates the necessary tokens for you. + * + * @author Ryan Weaver + */ +abstract class AbstractAuthenticator implements AuthenticatorInterface +{ + /** + * Shortcut to create a PostAuthenticationToken for you, if you don't really + * care about which authenticated token you're using. + */ + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + if (self::class !== (new \ReflectionMethod($this, 'createAuthenticatedToken'))->getDeclaringClass()->getName() && self::class === (new \ReflectionMethod($this, 'createToken'))->getDeclaringClass()->getName()) { + return $this->createAuthenticatedToken($passport, $firewallName); + } + + return new PostAuthenticationToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + // @deprecated since Symfony 5.4 + if (!$passport instanceof UserPassportInterface) { + throw new LogicException(sprintf('Passport does not contain a user, overwrite "createToken()" in "%s" to create a custom authentication token.', static::class)); + } + + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return new PostAuthenticationToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } +} diff --git a/vendor/symfony/security-http/Authenticator/AbstractLoginFormAuthenticator.php b/vendor/symfony/security-http/Authenticator/AbstractLoginFormAuthenticator.php new file mode 100644 index 0000000..25413b7 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/AbstractLoginFormAuthenticator.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +/** + * A base class to make form login authentication easier! + * + * @author Ryan Weaver + */ +abstract class AbstractLoginFormAuthenticator extends AbstractAuthenticator implements AuthenticationEntryPointInterface, InteractiveAuthenticatorInterface +{ + /** + * Return the URL to the login page. + */ + abstract protected function getLoginUrl(Request $request): string; + + /** + * {@inheritdoc} + * + * Override to change the request conditions that have to be + * matched in order to handle the login form submit. + * + * This default implementation handles all POST requests to the + * login path (@see getLoginUrl()). + */ + public function supports(Request $request): bool + { + return $request->isMethod('POST') && $this->getLoginUrl($request) === $request->getPathInfo(); + } + + /** + * Override to change what happens after a bad username/password is submitted. + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response + { + if ($request->hasSession()) { + $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); + } + + $url = $this->getLoginUrl($request); + + return new RedirectResponse($url); + } + + /** + * Override to control what happens when the user hits a secure page + * but isn't logged in yet. + */ + public function start(Request $request, AuthenticationException $authException = null): Response + { + $url = $this->getLoginUrl($request); + + return new RedirectResponse($url); + } + + public function isInteractive(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/AbstractPreAuthenticatedAuthenticator.php b/vendor/symfony/security-http/Authenticator/AbstractPreAuthenticatedAuthenticator.php new file mode 100644 index 0000000..e28d669 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/AbstractPreAuthenticatedAuthenticator.php @@ -0,0 +1,158 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PreAuthenticatedUserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; + +/** + * The base authenticator for authenticators to use pre-authenticated + * requests (e.g. using certificates). + * + * @author Wouter de Jong + * @author Fabien Potencier + * + * @internal + */ +abstract class AbstractPreAuthenticatedAuthenticator implements InteractiveAuthenticatorInterface +{ + private $userProvider; + private $tokenStorage; + private $firewallName; + private $logger; + + public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, LoggerInterface $logger = null) + { + $this->userProvider = $userProvider; + $this->tokenStorage = $tokenStorage; + $this->firewallName = $firewallName; + $this->logger = $logger; + } + + /** + * Returns the username of the pre-authenticated user. + * + * This authenticator is skipped if null is returned or a custom + * BadCredentialsException is thrown. + */ + abstract protected function extractUsername(Request $request): ?string; + + public function supports(Request $request): ?bool + { + try { + $username = $this->extractUsername($request); + } catch (BadCredentialsException $e) { + $this->clearToken($e); + + if (null !== $this->logger) { + $this->logger->debug('Skipping pre-authenticated authenticator as a BadCredentialsException is thrown.', ['exception' => $e, 'authenticator' => static::class]); + } + + return false; + } + + if (null === $username) { + if (null !== $this->logger) { + $this->logger->debug('Skipping pre-authenticated authenticator no username could be extracted.', ['authenticator' => static::class]); + } + + return false; + } + + // do not overwrite already stored tokens from the same user (i.e. from the session) + $token = $this->tokenStorage->getToken(); + + if ($token instanceof PreAuthenticatedToken && $this->firewallName === $token->getFirewallName() && $token->getUserIdentifier() === $username) { + if (null !== $this->logger) { + $this->logger->debug('Skipping pre-authenticated authenticator as the user already has an existing session.', ['authenticator' => static::class]); + } + + return false; + } + + $request->attributes->set('_pre_authenticated_username', $username); + + return true; + } + + public function authenticate(Request $request): Passport + { + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + $method = 'loadUserByIdentifier'; + if (!method_exists($this->userProvider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $method = 'loadUserByUsername'; + } + + return new SelfValidatingPassport( + new UserBadge($request->attributes->get('_pre_authenticated_username'), [$this->userProvider, $method]), + [new PreAuthenticatedUserBadge()] + ); + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return $this->createToken($passport, $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return new PreAuthenticatedToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return null; // let the original request continue + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + $this->clearToken($exception); + + return null; + } + + public function isInteractive(): bool + { + return true; + } + + private function clearToken(AuthenticationException $exception): void + { + $token = $this->tokenStorage->getToken(); + if ($token instanceof PreAuthenticatedToken && $this->firewallName === $token->getFirewallName()) { + $this->tokenStorage->setToken(null); + + if (null !== $this->logger) { + $this->logger->info('Cleared pre-authenticated token due to an exception.', ['exception' => $exception]); + } + } + } +} diff --git a/vendor/symfony/security-http/Authenticator/AuthenticatorInterface.php b/vendor/symfony/security-http/Authenticator/AuthenticatorInterface.php new file mode 100644 index 0000000..940448b --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/AuthenticatorInterface.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; + +/** + * The interface for all authenticators. + * + * @author Ryan Weaver + * @author Amaury Leroux de Lens + * @author Wouter de Jong + * + * @method TokenInterface createToken(Passport $passport, string $firewallName) Creates a token for the given user. + * If you don't care about which token class is used, you can skip this method by extending + * the AbstractAuthenticator class from your authenticator. + */ +interface AuthenticatorInterface +{ + /** + * Does the authenticator support the given Request? + * + * If this returns true, authenticate() will be called. If false, the authenticator will be skipped. + * + * Returning null means authenticate() can be called lazily when accessing the token storage. + */ + public function supports(Request $request): ?bool; + + /** + * Create a passport for the current request. + * + * The passport contains the user, credentials and any additional information + * that has to be checked by the Symfony Security system. For example, a login + * form authenticator will probably return a passport containing the user, the + * presented password and the CSRF token value. + * + * You may throw any AuthenticationException in this method in case of error (e.g. + * a UserNotFoundException when the user cannot be found). + * + * @throws AuthenticationException + * + * @return Passport + */ + public function authenticate(Request $request); /*: Passport;*/ + + /** + * Create an authenticated token for the given user. + * + * If you don't care about which token class is used or don't really + * understand what a "token" is, you can skip this method by extending + * the AbstractAuthenticator class from your authenticator. + * + * @see AbstractAuthenticator + * + * @param PassportInterface $passport The passport returned from authenticate() + * + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface; + + /** + * Called when authentication executed and was successful! + * + * This should return the Response sent back to the user, like a + * RedirectResponse to the last page they visited. + * + * If you return null, the current request will continue, and the user + * will be authenticated. This makes sense, for example, with an API. + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response; + + /** + * Called when authentication executed, but failed (e.g. wrong username password). + * + * This should return the Response sent back to the user, like a + * RedirectResponse to the login page or a 403 response. + * + * If you return null, the request will continue, but the user will + * not be authenticated. This is probably not what you want to do. + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response; +} diff --git a/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.php b/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.php new file mode 100644 index 0000000..4b77d9c --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.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\Component\Security\Http\Authenticator\Debug; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Guard\Authenticator\GuardBridgeAuthenticator; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException; +use Symfony\Component\VarDumper\Caster\ClassStub; + +/** + * Collects info about an authenticator for debugging purposes. + * + * @author Robin Chalas + */ +final class TraceableAuthenticator implements AuthenticatorInterface, InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface +{ + private $authenticator; + private $passport; + private $duration; + private $stub; + + public function __construct(AuthenticatorInterface $authenticator) + { + $this->authenticator = $authenticator; + } + + public function getInfo(): array + { + $class = \get_class($this->authenticator instanceof GuardBridgeAuthenticator ? $this->authenticator->getGuardAuthenticator() : $this->authenticator); + + return [ + 'supports' => true, + 'passport' => $this->passport, + 'duration' => $this->duration, + 'stub' => $this->stub ?? $this->stub = class_exists(ClassStub::class) ? new ClassStub($class) : $class, + ]; + } + + public function supports(Request $request): ?bool + { + return $this->authenticator->supports($request); + } + + public function authenticate(Request $request): PassportInterface + { + $startTime = microtime(true); + $this->passport = $this->authenticator->authenticate($request); + $this->duration = microtime(true) - $startTime; + + return $this->passport; + } + + public function createToken(PassportInterface $passport, string $firewallName): TokenInterface + { + return method_exists($this->authenticator, 'createToken') ? $this->authenticator->createToken($passport, $firewallName) : $this->authenticator->createAuthenticatedToken($passport, $firewallName); + } + + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + return $this->authenticator->createAuthenticatedToken($passport, $firewallName); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return $this->authenticator->onAuthenticationSuccess($request, $token, $firewallName); + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + return $this->authenticator->onAuthenticationFailure($request, $exception); + } + + public function start(Request $request, AuthenticationException $authException = null): Response + { + if (!$this->authenticator instanceof AuthenticationEntryPointInterface) { + throw new NotAnEntryPointException(); + } + + return $this->authenticator->start($request, $authException); + } + + public function isInteractive(): bool + { + return $this->authenticator instanceof InteractiveAuthenticatorInterface && $this->authenticator->isInteractive(); + } + + /** + * @internal + */ + public function getAuthenticator(): AuthenticatorInterface + { + return $this->authenticator; + } + + public function __call($method, $args) + { + return $this->authenticator->{$method}(...$args); + } +} diff --git a/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php b/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php new file mode 100644 index 0000000..3286ce2 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Debug; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Http\Firewall\AbstractListener; +use Symfony\Component\Security\Http\Firewall\AuthenticatorManagerListener; +use Symfony\Component\VarDumper\Caster\ClassStub; + +/** + * Decorates the AuthenticatorManagerListener to collect information about security authenticators. + * + * @author Robin Chalas + */ +final class TraceableAuthenticatorManagerListener extends AbstractListener +{ + private $authenticationManagerListener; + private $authenticatorsInfo = []; + private $hasVardumper; + + public function __construct(AuthenticatorManagerListener $authenticationManagerListener) + { + $this->authenticationManagerListener = $authenticationManagerListener; + $this->hasVardumper = class_exists(ClassStub::class); + } + + public function supports(Request $request): ?bool + { + return $this->authenticationManagerListener->supports($request); + } + + public function authenticate(RequestEvent $event): void + { + $request = $event->getRequest(); + + if (!$authenticators = $request->attributes->get('_security_authenticators')) { + return; + } + + foreach ($request->attributes->get('_security_skipped_authenticators') as $skippedAuthenticator) { + $this->authenticatorsInfo[] = [ + 'supports' => false, + 'stub' => $this->hasVardumper ? new ClassStub(\get_class($skippedAuthenticator)) : \get_class($skippedAuthenticator), + 'passport' => null, + 'duration' => 0, + ]; + } + + foreach ($authenticators as $key => $authenticator) { + $authenticators[$key] = new TraceableAuthenticator($authenticator); + } + + $request->attributes->set('_security_authenticators', $authenticators); + + $this->authenticationManagerListener->authenticate($event); + + foreach ($authenticators as $authenticator) { + $this->authenticatorsInfo[] = $authenticator->getInfo(); + } + } + + public function getAuthenticatorManagerListener(): AuthenticatorManagerListener + { + return $this->authenticationManagerListener; + } + + public function getAuthenticatorsInfo(): array + { + return $this->authenticatorsInfo; + } +} diff --git a/vendor/symfony/security-http/Authenticator/FormLoginAuthenticator.php b/vendor/symfony/security-http/Authenticator/FormLoginAuthenticator.php new file mode 100644 index 0000000..2609d0d --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/FormLoginAuthenticator.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\ParameterBagUtils; + +/** + * @author Wouter de Jong + * @author Fabien Potencier + * + * @final + */ +class FormLoginAuthenticator extends AbstractLoginFormAuthenticator +{ + private $httpUtils; + private $userProvider; + private $successHandler; + private $failureHandler; + private $options; + private $httpKernel; + + public function __construct(HttpUtils $httpUtils, UserProviderInterface $userProvider, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options) + { + $this->httpUtils = $httpUtils; + $this->userProvider = $userProvider; + $this->successHandler = $successHandler; + $this->failureHandler = $failureHandler; + $this->options = array_merge([ + 'username_parameter' => '_username', + 'password_parameter' => '_password', + 'check_path' => '/login_check', + 'post_only' => true, + 'form_only' => false, + 'enable_csrf' => false, + 'csrf_parameter' => '_csrf_token', + 'csrf_token_id' => 'authenticate', + ], $options); + } + + protected function getLoginUrl(Request $request): string + { + return $this->httpUtils->generateUri($request, $this->options['login_path']); + } + + public function supports(Request $request): bool + { + return ($this->options['post_only'] ? $request->isMethod('POST') : true) + && $this->httpUtils->checkRequestPath($request, $this->options['check_path']) + && ($this->options['form_only'] ? 'form' === $request->getContentType() : true); + } + + public function authenticate(Request $request): Passport + { + $credentials = $this->getCredentials($request); + + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + $method = 'loadUserByIdentifier'; + if (!method_exists($this->userProvider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $method = 'loadUserByUsername'; + } + + $passport = new Passport( + new UserBadge($credentials['username'], [$this->userProvider, $method]), + new PasswordCredentials($credentials['password']), + [new RememberMeBadge()] + ); + if ($this->options['enable_csrf']) { + $passport->addBadge(new CsrfTokenBadge($this->options['csrf_token_id'], $credentials['csrf_token'])); + } + + if ($this->userProvider instanceof PasswordUpgraderInterface) { + $passport->addBadge(new PasswordUpgradeBadge($credentials['password'], $this->userProvider)); + } + + return $passport; + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return $this->createToken($passport, $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return new UsernamePasswordToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return $this->successHandler->onAuthenticationSuccess($request, $token); + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response + { + return $this->failureHandler->onAuthenticationFailure($request, $exception); + } + + private function getCredentials(Request $request): array + { + $credentials = []; + $credentials['csrf_token'] = ParameterBagUtils::getRequestParameterValue($request, $this->options['csrf_parameter']); + + if ($this->options['post_only']) { + $credentials['username'] = ParameterBagUtils::getParameterBagValue($request->request, $this->options['username_parameter']); + $credentials['password'] = ParameterBagUtils::getParameterBagValue($request->request, $this->options['password_parameter']) ?? ''; + } else { + $credentials['username'] = ParameterBagUtils::getRequestParameterValue($request, $this->options['username_parameter']); + $credentials['password'] = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']) ?? ''; + } + + if (!\is_string($credentials['username']) && (!\is_object($credentials['username']) || !method_exists($credentials['username'], '__toString'))) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($credentials['username']))); + } + + $credentials['username'] = trim($credentials['username']); + + if (\strlen($credentials['username']) > Security::MAX_USERNAME_LENGTH) { + throw new BadCredentialsException('Invalid username.'); + } + + $request->getSession()->set(Security::LAST_USERNAME, $credentials['username']); + + return $credentials; + } + + public function setHttpKernel(HttpKernelInterface $httpKernel): void + { + $this->httpKernel = $httpKernel; + } + + public function start(Request $request, AuthenticationException $authException = null): Response + { + if (!$this->options['use_forward']) { + return parent::start($request, $authException); + } + + $subRequest = $this->httpUtils->createRequest($request, $this->options['login_path']); + $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + if (200 === $response->getStatusCode()) { + $response->setStatusCode(401); + } + + return $response; + } +} diff --git a/vendor/symfony/security-http/Authenticator/HttpBasicAuthenticator.php b/vendor/symfony/security-http/Authenticator/HttpBasicAuthenticator.php new file mode 100644 index 0000000..892fce4 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/HttpBasicAuthenticator.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +/** + * @author Wouter de Jong + * @author Fabien Potencier + * + * @final + */ +class HttpBasicAuthenticator implements AuthenticatorInterface, AuthenticationEntryPointInterface +{ + private $realmName; + private $userProvider; + private $logger; + + public function __construct(string $realmName, UserProviderInterface $userProvider, LoggerInterface $logger = null) + { + $this->realmName = $realmName; + $this->userProvider = $userProvider; + $this->logger = $logger; + } + + public function start(Request $request, AuthenticationException $authException = null): Response + { + $response = new Response(); + $response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName)); + $response->setStatusCode(401); + + return $response; + } + + public function supports(Request $request): ?bool + { + return $request->headers->has('PHP_AUTH_USER'); + } + + public function authenticate(Request $request): PassportInterface + { + $username = $request->headers->get('PHP_AUTH_USER'); + $password = $request->headers->get('PHP_AUTH_PW', ''); + + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + $method = 'loadUserByIdentifier'; + if (!method_exists($this->userProvider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $method = 'loadUserByUsername'; + } + + $passport = new Passport( + new UserBadge($username, [$this->userProvider, $method]), + new PasswordCredentials($password) + ); + if ($this->userProvider instanceof PasswordUpgraderInterface) { + $passport->addBadge(new PasswordUpgradeBadge($password, $this->userProvider)); + } + + return $passport; + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return $this->createToken($passport, $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return new UsernamePasswordToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return null; + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + if (null !== $this->logger) { + $this->logger->info('Basic authentication failed for user.', ['username' => $request->headers->get('PHP_AUTH_USER'), 'exception' => $exception]); + } + + return $this->start($request, $exception); + } +} diff --git a/vendor/symfony/security-http/Authenticator/InteractiveAuthenticatorInterface.php b/vendor/symfony/security-http/Authenticator/InteractiveAuthenticatorInterface.php new file mode 100644 index 0000000..71b6ade --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/InteractiveAuthenticatorInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +/** + * This is an extension of the authenticator interface that must + * be used by interactive authenticators. + * + * Interactive login requires explicit user action (e.g. a login + * form or HTTP basic authentication). Implementing this interface + * will dispatch the InteractiveLoginEvent upon successful login. + * + * @author Wouter de Jong + */ +interface InteractiveAuthenticatorInterface extends AuthenticatorInterface +{ + /** + * Should return true to make this authenticator perform + * an interactive login. + */ + public function isInteractive(): bool; +} diff --git a/vendor/symfony/security-http/Authenticator/JsonLoginAuthenticator.php b/vendor/symfony/security-http/Authenticator/JsonLoginAuthenticator.php new file mode 100644 index 0000000..30da36a --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/JsonLoginAuthenticator.php @@ -0,0 +1,196 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\PropertyAccess\Exception\AccessException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * Provides a stateless implementation of an authentication via + * a JSON document composed of a username and a password. + * + * @author Kévin Dunglas + * @author Wouter de Jong + * + * @final + */ +class JsonLoginAuthenticator implements InteractiveAuthenticatorInterface +{ + private $options; + private $httpUtils; + private $userProvider; + private $propertyAccessor; + private $successHandler; + private $failureHandler; + + /** + * @var TranslatorInterface|null + */ + private $translator; + + public function __construct(HttpUtils $httpUtils, UserProviderInterface $userProvider, AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler = null, array $options = [], PropertyAccessorInterface $propertyAccessor = null) + { + $this->options = array_merge(['username_path' => 'username', 'password_path' => 'password'], $options); + $this->httpUtils = $httpUtils; + $this->successHandler = $successHandler; + $this->failureHandler = $failureHandler; + $this->userProvider = $userProvider; + $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + } + + public function supports(Request $request): ?bool + { + if (false === strpos($request->getRequestFormat() ?? '', 'json') && false === strpos($request->getContentType() ?? '', 'json')) { + return false; + } + + if (isset($this->options['check_path']) && !$this->httpUtils->checkRequestPath($request, $this->options['check_path'])) { + return false; + } + + return true; + } + + public function authenticate(Request $request): PassportInterface + { + try { + $credentials = $this->getCredentials($request); + } catch (BadRequestHttpException $e) { + $request->setRequestFormat('json'); + + throw $e; + } + + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + $method = 'loadUserByIdentifier'; + if (!method_exists($this->userProvider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $method = 'loadUserByUsername'; + } + + $passport = new Passport( + new UserBadge($credentials['username'], [$this->userProvider, $method]), + new PasswordCredentials($credentials['password']) + ); + if ($this->userProvider instanceof PasswordUpgraderInterface) { + $passport->addBadge(new PasswordUpgradeBadge($credentials['password'], $this->userProvider)); + } + + return $passport; + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return $this->createToken($passport, $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return new UsernamePasswordToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles()); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + if (null === $this->successHandler) { + return null; // let the original request continue + } + + return $this->successHandler->onAuthenticationSuccess($request, $token); + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + if (null === $this->failureHandler) { + if (null !== $this->translator) { + $errorMessage = $this->translator->trans($exception->getMessageKey(), $exception->getMessageData(), 'security'); + } else { + $errorMessage = strtr($exception->getMessageKey(), $exception->getMessageData()); + } + + return new JsonResponse(['error' => $errorMessage], JsonResponse::HTTP_UNAUTHORIZED); + } + + return $this->failureHandler->onAuthenticationFailure($request, $exception); + } + + public function isInteractive(): bool + { + return true; + } + + public function setTranslator(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + private function getCredentials(Request $request) + { + $data = json_decode($request->getContent()); + if (!$data instanceof \stdClass) { + throw new BadRequestHttpException('Invalid JSON.'); + } + + $credentials = []; + try { + $credentials['username'] = $this->propertyAccessor->getValue($data, $this->options['username_path']); + + if (!\is_string($credentials['username'])) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['username_path'])); + } + + if (\strlen($credentials['username']) > Security::MAX_USERNAME_LENGTH) { + throw new BadCredentialsException('Invalid username.'); + } + } catch (AccessException $e) { + throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['username_path']), $e); + } + + try { + $credentials['password'] = $this->propertyAccessor->getValue($data, $this->options['password_path']); + + if (!\is_string($credentials['password'])) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['password_path'])); + } + } catch (AccessException $e) { + throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['password_path']), $e); + } + + return $credentials; + } +} diff --git a/vendor/symfony/security-http/Authenticator/LoginLinkAuthenticator.php b/vendor/symfony/security-http/Authenticator/LoginLinkAuthenticator.php new file mode 100644 index 0000000..098349c --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/LoginLinkAuthenticator.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\LoginLink\Exception\InvalidLoginLinkAuthenticationException; +use Symfony\Component\Security\Http\LoginLink\Exception\InvalidLoginLinkExceptionInterface; +use Symfony\Component\Security\Http\LoginLink\LoginLinkHandlerInterface; + +/** + * @author Ryan Weaver + */ +final class LoginLinkAuthenticator extends AbstractAuthenticator implements InteractiveAuthenticatorInterface +{ + private $loginLinkHandler; + private $httpUtils; + private $successHandler; + private $failureHandler; + private $options; + + public function __construct(LoginLinkHandlerInterface $loginLinkHandler, HttpUtils $httpUtils, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options) + { + $this->loginLinkHandler = $loginLinkHandler; + $this->httpUtils = $httpUtils; + $this->successHandler = $successHandler; + $this->failureHandler = $failureHandler; + $this->options = $options + ['check_post_only' => false]; + } + + public function supports(Request $request): ?bool + { + return ($this->options['check_post_only'] ? $request->isMethod('POST') : true) + && $this->httpUtils->checkRequestPath($request, $this->options['check_route']); + } + + public function authenticate(Request $request): PassportInterface + { + $username = $request->get('user'); + if (!$username) { + throw new InvalidLoginLinkAuthenticationException('Missing user from link.'); + } + + return new SelfValidatingPassport( + new UserBadge($username, function () use ($request) { + try { + $user = $this->loginLinkHandler->consumeLoginLink($request); + } catch (InvalidLoginLinkExceptionInterface $e) { + throw new InvalidLoginLinkAuthenticationException('Login link could not be validated.', 0, $e); + } + + return $user; + }), + [new RememberMeBadge()] + ); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return $this->successHandler->onAuthenticationSuccess($request, $token); + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response + { + return $this->failureHandler->onAuthenticationFailure($request, $exception); + } + + public function isInteractive(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/BadgeInterface.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/BadgeInterface.php new file mode 100644 index 0000000..009449f --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/BadgeInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +/** + * Passport badges allow to add more information to a passport (e.g. a CSRF token). + * + * @author Wouter de Jong + */ +interface BadgeInterface +{ + /** + * Checks if this badge is resolved by the security system. + * + * After authentication, all badges must return `true` in this method in order + * for the authentication to succeed. + */ + public function isResolved(): bool; +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/CsrfTokenBadge.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/CsrfTokenBadge.php new file mode 100644 index 0000000..a4114a0 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/CsrfTokenBadge.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +use Symfony\Component\Security\Http\EventListener\CsrfProtectionListener; + +/** + * Adds automatic CSRF tokens checking capabilities to this authenticator. + * + * @see CsrfProtectionListener + * + * @author Wouter de Jong + * + * @final + */ +class CsrfTokenBadge implements BadgeInterface +{ + private $resolved = false; + private $csrfTokenId; + private $csrfToken; + + /** + * @param string $csrfTokenId An arbitrary string used to generate the value of the CSRF token. + * Using a different string for each authenticator improves its security. + * @param string|null $csrfToken The CSRF token presented in the request, if any + */ + public function __construct(string $csrfTokenId, ?string $csrfToken) + { + $this->csrfTokenId = $csrfTokenId; + $this->csrfToken = $csrfToken; + } + + public function getCsrfTokenId(): string + { + return $this->csrfTokenId; + } + + public function getCsrfToken(): ?string + { + return $this->csrfToken; + } + + /** + * @internal + */ + public function markResolved(): void + { + $this->resolved = true; + } + + public function isResolved(): bool + { + return $this->resolved; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php new file mode 100644 index 0000000..3488146 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; + +/** + * Adds automatic password migration, if enabled and required in the password encoder. + * + * @see PasswordUpgraderInterface + * + * @author Wouter de Jong + * + * @final + */ +class PasswordUpgradeBadge implements BadgeInterface +{ + private $plaintextPassword; + private $passwordUpgrader; + + /** + * @param string $plaintextPassword The presented password, used in the rehash + * @param PasswordUpgraderInterface|null $passwordUpgrader The password upgrader, defaults to the UserProvider if null + */ + public function __construct(string $plaintextPassword, PasswordUpgraderInterface $passwordUpgrader = null) + { + $this->plaintextPassword = $plaintextPassword; + $this->passwordUpgrader = $passwordUpgrader; + } + + public function getAndErasePlaintextPassword(): string + { + $password = $this->plaintextPassword; + if (null === $password) { + throw new LogicException('The password is erased as another listener already used this badge.'); + } + + $this->plaintextPassword = null; + + return $password; + } + + public function getPasswordUpgrader(): ?PasswordUpgraderInterface + { + return $this->passwordUpgrader; + } + + public function isResolved(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/PreAuthenticatedUserBadge.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/PreAuthenticatedUserBadge.php new file mode 100644 index 0000000..642f83f --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/PreAuthenticatedUserBadge.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +use Symfony\Component\Security\Http\Authenticator\AbstractPreAuthenticatedAuthenticator; + +/** + * Marks the authentication as being pre-authenticated. + * + * This disables pre-authentication user checkers. + * + * @see AbstractPreAuthenticatedAuthenticator + * + * @author Wouter de Jong + * + * @final + */ +class PreAuthenticatedUserBadge implements BadgeInterface +{ + public function isResolved(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/RememberMeBadge.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/RememberMeBadge.php new file mode 100644 index 0000000..d961ef6 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/RememberMeBadge.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +use Symfony\Component\Security\Http\EventListener\CheckRememberMeConditionsListener; + +/** + * Adds support for remember me to this authenticator. + * + * The presence of this badge doesn't create the remember-me cookie. The actual + * cookie is only created if this badge is enabled. By default, this is done + * by the {@see CheckRememberMeConditionsListener} if all conditions are met. + * + * @author Wouter de Jong + * + * @final + */ +class RememberMeBadge implements BadgeInterface +{ + private $enabled = false; + + /** + * Enables remember-me cookie creation. + * + * In most cases, {@see CheckRememberMeConditionsListener} enables this + * automatically if always_remember_me is true or the remember_me_parameter + * exists in the request. + * + * @return $this + */ + public function enable(): self + { + $this->enabled = true; + + return $this; + } + + /** + * Disables remember-me cookie creation. + * + * The default is disabled, this can be called to suppress creation + * after it was enabled. + * + * @return $this + */ + public function disable(): self + { + $this->enabled = false; + + return $this; + } + + public function isEnabled(): bool + { + return $this->enabled; + } + + public function isResolved(): bool + { + return true; // remember me does not need to be explicitly resolved + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php b/vendor/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php new file mode 100644 index 0000000..5e8dbdc --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Badge/UserBadge.php @@ -0,0 +1,102 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge; + +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\AuthenticationServiceException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\EventListener\UserProviderListener; + +/** + * Represents the user in the authentication process. + * + * It uses an identifier (e.g. email, or username) and + * "user loader" to load the related User object. + * + * @author Wouter de Jong + */ +class UserBadge implements BadgeInterface +{ + private $userIdentifier; + private $userLoader; + private $user; + + /** + * Initializes the user badge. + * + * You must provide a $userIdentifier. This is a unique string representing the + * user for this authentication (e.g. the email if authentication is done using + * email + password; or a string combining email+company if authentication is done + * based on email *and* company name). This string can be used for e.g. login throttling. + * + * Optionally, you may pass a user loader. This callable receives the $userIdentifier + * as argument and must return a UserInterface object (otherwise an AuthenticationServiceException + * is thrown). If this is not set, the default user provider will be used with + * $userIdentifier as username. + */ + public function __construct(string $userIdentifier, callable $userLoader = null) + { + $this->userIdentifier = $userIdentifier; + $this->userLoader = $userLoader; + } + + public function getUserIdentifier(): string + { + return $this->userIdentifier; + } + + /** + * @throws AuthenticationException when the user cannot be found + */ + public function getUser(): UserInterface + { + if (null !== $this->user) { + return $this->user; + } + + if (null === $this->userLoader) { + throw new \LogicException(sprintf('No user loader is configured, did you forget to register the "%s" listener?', UserProviderListener::class)); + } + + $user = ($this->userLoader)($this->userIdentifier); + + // No user has been found via the $this->userLoader callback + if (null === $user) { + $exception = new UserNotFoundException(); + $exception->setUserIdentifier($this->userIdentifier); + + throw $exception; + } + + if (!$user instanceof UserInterface) { + throw new AuthenticationServiceException(sprintf('The user provider must return a UserInterface object, "%s" given.', get_debug_type($user))); + } + + return $this->user = $user; + } + + public function getUserLoader(): ?callable + { + return $this->userLoader; + } + + public function setUserLoader(callable $userLoader): void + { + $this->userLoader = $userLoader; + } + + public function isResolved(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Credentials/CredentialsInterface.php b/vendor/symfony/security-http/Authenticator/Passport/Credentials/CredentialsInterface.php new file mode 100644 index 0000000..c22af0c --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Credentials/CredentialsInterface.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Credentials; + +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; + +/** + * Credentials are a special badge used to explicitly mark the + * credential check of an authenticator. + * + * @author Wouter de Jong + */ +interface CredentialsInterface extends BadgeInterface +{ +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Credentials/CustomCredentials.php b/vendor/symfony/security-http/Authenticator/Passport/Credentials/CustomCredentials.php new file mode 100644 index 0000000..6dba836 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Credentials/CustomCredentials.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Credentials; + +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Implements credentials checking using a custom checker function. + * + * @author Wouter de Jong + * + * @final + */ +class CustomCredentials implements CredentialsInterface +{ + private $customCredentialsChecker; + private $credentials; + private $resolved = false; + + /** + * @param callable $customCredentialsChecker the check function. If this function does not return `true`, a + * BadCredentialsException is thrown. You may also throw a more + * specific exception in the function. + * @param mixed $credentials + */ + public function __construct(callable $customCredentialsChecker, $credentials) + { + $this->customCredentialsChecker = $customCredentialsChecker; + $this->credentials = $credentials; + } + + public function executeCustomChecker(UserInterface $user): void + { + $checker = $this->customCredentialsChecker; + + if (true !== $checker($this->credentials, $user)) { + throw new BadCredentialsException('Credentials check failed as the callable passed to CustomCredentials did not return "true".'); + } + + $this->resolved = true; + } + + public function isResolved(): bool + { + return $this->resolved; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php b/vendor/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php new file mode 100644 index 0000000..1c27ac9 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Credentials/PasswordCredentials.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport\Credentials; + +use Symfony\Component\Security\Core\Exception\LogicException; + +/** + * Implements password credentials. + * + * These plaintext passwords are checked by the UserPasswordEncoder during + * authentication. + * + * @author Wouter de Jong + * + * @final + */ +class PasswordCredentials implements CredentialsInterface +{ + private $password; + private $resolved = false; + + public function __construct(string $password) + { + $this->password = $password; + } + + public function getPassword(): string + { + if (null === $this->password) { + throw new LogicException('The credentials are erased as another listener already verified these credentials.'); + } + + return $this->password; + } + + /** + * @internal + */ + public function markResolved(): void + { + $this->resolved = true; + $this->password = null; + } + + public function isResolved(): bool + { + return $this->resolved; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/Passport.php b/vendor/symfony/security-http/Authenticator/Passport/Passport.php new file mode 100644 index 0000000..24ed029 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/Passport.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport; + +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CredentialsInterface; + +/** + * The default implementation for passports. + * + * @author Wouter de Jong + */ +class Passport implements UserPassportInterface +{ + protected $user; + + private $badges = []; + private $attributes = []; + + /** + * @param CredentialsInterface $credentials the credentials to check for this authentication, use + * SelfValidatingPassport if no credentials should be checked + * @param BadgeInterface[] $badges + */ + public function __construct(UserBadge $userBadge, CredentialsInterface $credentials, array $badges = []) + { + $this->addBadge($userBadge); + $this->addBadge($credentials); + foreach ($badges as $badge) { + $this->addBadge($badge); + } + } + + /** + * {@inheritdoc} + */ + public function getUser(): UserInterface + { + if (null === $this->user) { + if (!$this->hasBadge(UserBadge::class)) { + throw new \LogicException('Cannot get the Security user, no username or UserBadge configured for this passport.'); + } + + $this->user = $this->getBadge(UserBadge::class)->getUser(); + } + + return $this->user; + } + + /** + * @return $this + */ + public function addBadge(BadgeInterface $badge): PassportInterface + { + $this->badges[\get_class($badge)] = $badge; + + return $this; + } + + public function hasBadge(string $badgeFqcn): bool + { + return isset($this->badges[$badgeFqcn]); + } + + public function getBadge(string $badgeFqcn): ?BadgeInterface + { + return $this->badges[$badgeFqcn] ?? null; + } + + /** + * @return array, BadgeInterface> + */ + public function getBadges(): array + { + return $this->badges; + } + + /** + * @param mixed $value + */ + public function setAttribute(string $name, $value): void + { + $this->attributes[$name] = $value; + } + + /** + * @param mixed $default + * + * @return mixed + */ + public function getAttribute(string $name, $default = null) + { + return $this->attributes[$name] ?? $default; + } + + public function getAttributes(): array + { + return $this->attributes; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/PassportInterface.php b/vendor/symfony/security-http/Authenticator/Passport/PassportInterface.php new file mode 100644 index 0000000..14198b8 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/PassportInterface.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport; + +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; + +/** + * A Passport contains all security-related information that needs to be + * validated during authentication. + * + * A passport badge can be used to add any additional information to the + * passport. + * + * @author Wouter de Jong + * + * @deprecated since Symfony 5.4, use {@link Passport} instead + */ +interface PassportInterface +{ + /** + * Adds a new security badge. + * + * A passport can hold only one instance of the same security badge. + * This method replaces the current badge if it is already set on this + * passport. + * + * @return $this + */ + public function addBadge(BadgeInterface $badge): self; + + public function hasBadge(string $badgeFqcn): bool; + + public function getBadge(string $badgeFqcn): ?BadgeInterface; + + /** + * @return array, BadgeInterface> + */ + public function getBadges(): array; +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/PassportTrait.php b/vendor/symfony/security-http/Authenticator/Passport/PassportTrait.php new file mode 100644 index 0000000..2a00014 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/PassportTrait.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport; + +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" trait is deprecated, you must extend from "%s" instead.', PassportTrait::class, Passport::class); + +/** + * @author Wouter de Jong + * + * @deprecated since Symfony 5.4, use {@see Passport} instead + */ +trait PassportTrait +{ + private $badges = []; + + /** + * @return $this + */ + public function addBadge(BadgeInterface $badge): PassportInterface + { + $this->badges[\get_class($badge)] = $badge; + + return $this; + } + + public function hasBadge(string $badgeFqcn): bool + { + return isset($this->badges[$badgeFqcn]); + } + + public function getBadge(string $badgeFqcn): ?BadgeInterface + { + return $this->badges[$badgeFqcn] ?? null; + } + + /** + * @return array, BadgeInterface> + */ + public function getBadges(): array + { + return $this->badges; + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/SelfValidatingPassport.php b/vendor/symfony/security-http/Authenticator/Passport/SelfValidatingPassport.php new file mode 100644 index 0000000..23e7600 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/SelfValidatingPassport.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport; + +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; + +/** + * An implementation used when there are no credentials to be checked (e.g. + * API token authentication). + * + * @author Wouter de Jong + */ +class SelfValidatingPassport extends Passport +{ + /** + * @param BadgeInterface[] $badges + */ + public function __construct(UserBadge $userBadge, array $badges = []) + { + $this->addBadge($userBadge); + foreach ($badges as $badge) { + $this->addBadge($badge); + } + } +} diff --git a/vendor/symfony/security-http/Authenticator/Passport/UserPassportInterface.php b/vendor/symfony/security-http/Authenticator/Passport/UserPassportInterface.php new file mode 100644 index 0000000..319c295 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Passport/UserPassportInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Passport; + +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Represents a passport for a Security User. + * + * @author Wouter de Jong + * + * @deprecated since Symfony 5.4, use {@link Passport} instead + */ +interface UserPassportInterface extends PassportInterface +{ + /** + * @throws AuthenticationException when the user cannot be found + */ + public function getUser(): UserInterface; +} diff --git a/vendor/symfony/security-http/Authenticator/RememberMeAuthenticator.php b/vendor/symfony/security-http/Authenticator/RememberMeAuthenticator.php new file mode 100644 index 0000000..cca50c8 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/RememberMeAuthenticator.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\CookieTheftException; +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport; +use Symfony\Component\Security\Http\RememberMe\RememberMeDetails; +use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface; +use Symfony\Component\Security\Http\RememberMe\ResponseListener; + +/** + * The RememberMe *Authenticator* performs remember me authentication. + * + * This authenticator is executed whenever a user's session + * expired and a remember-me cookie was found. This authenticator + * then "re-authenticates" the user using the information in the + * cookie. + * + * @author Johannes M. Schmitt + * @author Wouter de Jong + * + * @final + */ +class RememberMeAuthenticator implements InteractiveAuthenticatorInterface +{ + private $rememberMeHandler; + private $secret; + private $tokenStorage; + private $cookieName; + private $logger; + + public function __construct(RememberMeHandlerInterface $rememberMeHandler, string $secret, TokenStorageInterface $tokenStorage, string $cookieName, LoggerInterface $logger = null) + { + $this->rememberMeHandler = $rememberMeHandler; + $this->secret = $secret; + $this->tokenStorage = $tokenStorage; + $this->cookieName = $cookieName; + $this->logger = $logger; + } + + public function supports(Request $request): ?bool + { + // do not overwrite already stored tokens (i.e. from the session) + if (null !== $this->tokenStorage->getToken()) { + return false; + } + + if (($cookie = $request->attributes->get(ResponseListener::COOKIE_ATTR_NAME)) && null === $cookie->getValue()) { + return false; + } + + if (!$request->cookies->has($this->cookieName)) { + return false; + } + + if (null !== $this->logger) { + $this->logger->debug('Remember-me cookie detected.'); + } + + // the `null` return value indicates that this authenticator supports lazy firewalls + return null; + } + + public function authenticate(Request $request): PassportInterface + { + $rawCookie = $request->cookies->get($this->cookieName); + if (!$rawCookie) { + throw new \LogicException('No remember-me cookie is found.'); + } + + $rememberMeCookie = RememberMeDetails::fromRawCookie($rawCookie); + + return new SelfValidatingPassport(new UserBadge($rememberMeCookie->getUserIdentifier(), function () use ($rememberMeCookie) { + return $this->rememberMeHandler->consumeRememberMeCookie($rememberMeCookie); + })); + } + + /** + * @deprecated since Symfony 5.4, use {@link createToken()} instead + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use "%s::createToken()" instead.', __METHOD__, __CLASS__); + + return $this->createToken($passport, $firewallName); + } + + public function createToken(Passport $passport, string $firewallName): TokenInterface + { + return new RememberMeToken($passport->getUser(), $firewallName, $this->secret); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return null; // let the original request continue + } + + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + if (null !== $this->logger) { + if ($exception instanceof UsernameNotFoundException) { + $this->logger->info('User for remember-me cookie not found.', ['exception' => $exception]); + } elseif ($exception instanceof UnsupportedUserException) { + $this->logger->warning('User class for remember-me cookie not supported.', ['exception' => $exception]); + } elseif (!$exception instanceof CookieTheftException) { + $this->logger->debug('Remember me authentication failed.', ['exception' => $exception]); + } + } + + return null; + } + + public function isInteractive(): bool + { + return true; + } +} diff --git a/vendor/symfony/security-http/Authenticator/RemoteUserAuthenticator.php b/vendor/symfony/security-http/Authenticator/RemoteUserAuthenticator.php new file mode 100644 index 0000000..d856b54 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/RemoteUserAuthenticator.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * This authenticator authenticates a remote user. + * + * @author Wouter de Jong + * @author Fabien Potencier + * @author Maxime Douailin + * + * @final + * + * @internal in Symfony 5.1 + */ +class RemoteUserAuthenticator extends AbstractPreAuthenticatedAuthenticator +{ + private $userKey; + + public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'REMOTE_USER', LoggerInterface $logger = null) + { + parent::__construct($userProvider, $tokenStorage, $firewallName, $logger); + + $this->userKey = $userKey; + } + + protected function extractUsername(Request $request): ?string + { + if (!$request->server->has($this->userKey)) { + throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey)); + } + + return $request->server->get($this->userKey); + } +} diff --git a/vendor/symfony/security-http/Authenticator/Token/PostAuthenticationToken.php b/vendor/symfony/security-http/Authenticator/Token/PostAuthenticationToken.php new file mode 100644 index 0000000..6bbec6f --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/Token/PostAuthenticationToken.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator\Token; + +use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; +use Symfony\Component\Security\Core\User\UserInterface; + +class PostAuthenticationToken extends AbstractToken +{ + private $firewallName; + + /** + * @param string[] $roles An array of roles + * + * @throws \InvalidArgumentException + */ + public function __construct(UserInterface $user, string $firewallName, array $roles) + { + parent::__construct($roles); + + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + + $this->setUser($user); + $this->firewallName = $firewallName; + + // @deprecated since Symfony 5.4 + if (method_exists($this, 'setAuthenticated')) { + // this token is meant to be used after authentication success, so it is always authenticated + $this->setAuthenticated(true, false); + } + } + + /** + * This is meant to be only a token, where credentials + * have already been used and are thus cleared. + * + * {@inheritdoc} + */ + public function getCredentials() + { + return []; + } + + public function getFirewallName(): string + { + return $this->firewallName; + } + + /** + * {@inheritdoc} + */ + public function __serialize(): array + { + return [$this->firewallName, parent::__serialize()]; + } + + /** + * {@inheritdoc} + */ + public function __unserialize(array $data): void + { + [$this->firewallName, $parentData] = $data; + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/security-http/Authenticator/X509Authenticator.php b/vendor/symfony/security-http/Authenticator/X509Authenticator.php new file mode 100644 index 0000000..79e6883 --- /dev/null +++ b/vendor/symfony/security-http/Authenticator/X509Authenticator.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authenticator; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * This authenticator authenticates pre-authenticated (by the + * webserver) X.509 certificates. + * + * @author Wouter de Jong + * @author Fabien Potencier + * + * @final + */ +class X509Authenticator extends AbstractPreAuthenticatedAuthenticator +{ + private $userKey; + private $credentialsKey; + + public function __construct(UserProviderInterface $userProvider, TokenStorageInterface $tokenStorage, string $firewallName, string $userKey = 'SSL_CLIENT_S_DN_Email', string $credentialsKey = 'SSL_CLIENT_S_DN', LoggerInterface $logger = null) + { + parent::__construct($userProvider, $tokenStorage, $firewallName, $logger); + + $this->userKey = $userKey; + $this->credentialsKey = $credentialsKey; + } + + protected function extractUsername(Request $request): string + { + $username = null; + if ($request->server->has($this->userKey)) { + $username = $request->server->get($this->userKey); + } elseif ( + $request->server->has($this->credentialsKey) + && preg_match('#emailAddress=([^,/@]++@[^,/]++)#', $request->server->get($this->credentialsKey), $matches) + ) { + $username = $matches[1]; + } + + if (null === $username) { + throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s', $this->userKey, $this->credentialsKey)); + } + + return $username; + } +} diff --git a/vendor/symfony/security-http/Authorization/AccessDeniedHandlerInterface.php b/vendor/symfony/security-http/Authorization/AccessDeniedHandlerInterface.php new file mode 100644 index 0000000..871c877 --- /dev/null +++ b/vendor/symfony/security-http/Authorization/AccessDeniedHandlerInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authorization; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; + +/** + * This is used by the ExceptionListener to translate an AccessDeniedException + * to a Response object. + * + * @author Johannes M. Schmitt + */ +interface AccessDeniedHandlerInterface +{ + /** + * Handles an access denied failure. + * + * @return Response|null + */ + public function handle(Request $request, AccessDeniedException $accessDeniedException); +} diff --git a/vendor/symfony/security-http/CHANGELOG.md b/vendor/symfony/security-http/CHANGELOG.md new file mode 100644 index 0000000..1071015 --- /dev/null +++ b/vendor/symfony/security-http/CHANGELOG.md @@ -0,0 +1,23 @@ +CHANGELOG +========= + +5.4 +--- + + * Deprecate the `$authenticationEntryPoint` argument of `ChannelListener`, and add `$httpPort` and `$httpsPort` arguments + * Deprecate `RetryAuthenticationEntryPoint`, this code is now inlined in the `ChannelListener` + * Deprecate `FormAuthenticationEntryPoint` and `BasicAuthenticationEntryPoint`, in the new system the `FormLoginAuthenticator` + and `HttpBasicAuthenticator` should be used instead + * Deprecate `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`, + `TokenBasedRememberMeServices`, use the remember me handler alternatives instead + * Deprecate the `$authManager` argument of `AccessListener` + * Deprecate not setting the `$exceptionOnNoToken` argument of `AccessListener` to `false` + * Deprecate `DeauthenticatedEvent`, use `TokenDeauthenticatedEvent` instead + * Deprecate `CookieClearingLogoutHandler`, `SessionLogoutHandler` and `CsrfTokenClearingLogoutHandler`. + Use `CookieClearingLogoutListener`, `SessionLogoutListener` and `CsrfTokenClearingLogoutListener` instead + * Deprecate `PassportInterface`, `UserPassportInterface` and `PassportTrait`, use `Passport` instead + +5.3 +--- + +The CHANGELOG for version 5.3 and earlier can be found at https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Security/CHANGELOG.md diff --git a/vendor/symfony/security-http/Controller/UserValueResolver.php b/vendor/symfony/security-http/Controller/UserValueResolver.php new file mode 100644 index 0000000..9d10f32 --- /dev/null +++ b/vendor/symfony/security-http/Controller/UserValueResolver.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Controller; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; +use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Attribute\CurrentUser; + +/** + * Supports the argument type of {@see UserInterface}. + * + * @author Iltar van der Berg + */ +final class UserValueResolver implements ArgumentValueResolverInterface +{ + private $tokenStorage; + + public function __construct(TokenStorageInterface $tokenStorage) + { + $this->tokenStorage = $tokenStorage; + } + + public function supports(Request $request, ArgumentMetadata $argument): bool + { + // with the attribute, the type can be any UserInterface implementation + // otherwise, the type must be UserInterface + if (UserInterface::class !== $argument->getType() && !$argument->getAttributes(CurrentUser::class, ArgumentMetadata::IS_INSTANCEOF)) { + return false; + } + + $token = $this->tokenStorage->getToken(); + if (!$token instanceof TokenInterface) { + return false; + } + + $user = $token->getUser(); + + // in case it's not an object we cannot do anything with it; E.g. "anon." + // @deprecated since 5.4 + return $user instanceof UserInterface; + } + + public function resolve(Request $request, ArgumentMetadata $argument): iterable + { + yield $this->tokenStorage->getToken()->getUser(); + } +} diff --git a/vendor/symfony/security-http/EntryPoint/AuthenticationEntryPointInterface.php b/vendor/symfony/security-http/EntryPoint/AuthenticationEntryPointInterface.php new file mode 100644 index 0000000..91271d1 --- /dev/null +++ b/vendor/symfony/security-http/EntryPoint/AuthenticationEntryPointInterface.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EntryPoint; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * Implement this interface for any classes that will be called to "start" + * the authentication process (see method for more details). + * + * @author Fabien Potencier + */ +interface AuthenticationEntryPointInterface +{ + /** + * Returns a response that directs the user to authenticate. + * + * This is called when an anonymous request accesses a resource that + * requires authentication. The job of this method is to return some + * response that "helps" the user start into the authentication process. + * + * Examples: + * + * - For a form login, you might redirect to the login page + * + * return new RedirectResponse('/login'); + * + * - For an API token authentication system, you return a 401 response + * + * return new Response('Auth header required', 401); + * + * @return Response + */ + public function start(Request $request, AuthenticationException $authException = null); +} diff --git a/vendor/symfony/security-http/EntryPoint/BasicAuthenticationEntryPoint.php b/vendor/symfony/security-http/EntryPoint/BasicAuthenticationEntryPoint.php new file mode 100644 index 0000000..53a0293 --- /dev/null +++ b/vendor/symfony/security-http/EntryPoint/BasicAuthenticationEntryPoint.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EntryPoint; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use the new security system with "%s" instead.', BasicAuthenticationEntryPoint::class, HttpBasicAuthenticator::class); + +/** + * BasicAuthenticationEntryPoint starts an HTTP Basic authentication. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.4 + */ +class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface +{ + private $realmName; + + public function __construct(string $realmName) + { + $this->realmName = $realmName; + } + + /** + * {@inheritdoc} + */ + public function start(Request $request, AuthenticationException $authException = null) + { + $response = new Response(); + $response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName)); + $response->setStatusCode(401); + + return $response; + } +} diff --git a/vendor/symfony/security-http/EntryPoint/Exception/NotAnEntryPointException.php b/vendor/symfony/security-http/EntryPoint/Exception/NotAnEntryPointException.php new file mode 100644 index 0000000..e421dcf --- /dev/null +++ b/vendor/symfony/security-http/EntryPoint/Exception/NotAnEntryPointException.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EntryPoint\Exception; + +/** + * Thrown by generic decorators when a decorated authenticator does not implement + * {@see AuthenticationEntryPointInterface}. + * + * @author Robin Chalas + */ +class NotAnEntryPointException extends \RuntimeException +{ +} diff --git a/vendor/symfony/security-http/EntryPoint/FormAuthenticationEntryPoint.php b/vendor/symfony/security-http/EntryPoint/FormAuthenticationEntryPoint.php new file mode 100644 index 0000000..32cc5a0 --- /dev/null +++ b/vendor/symfony/security-http/EntryPoint/FormAuthenticationEntryPoint.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EntryPoint; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator; +use Symfony\Component\Security\Http\HttpUtils; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use the new security system with "%s" instead.', FormAuthenticationEntryPoint::class, FormLoginAuthenticator::class); + +/** + * FormAuthenticationEntryPoint starts an authentication via a login form. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.4 + */ +class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface +{ + private $loginPath; + private $useForward; + private $httpKernel; + private $httpUtils; + + /** + * @param string $loginPath The path to the login form + * @param bool $useForward Whether to forward or redirect to the login form + */ + public function __construct(HttpKernelInterface $kernel, HttpUtils $httpUtils, string $loginPath, bool $useForward = false) + { + $this->httpKernel = $kernel; + $this->httpUtils = $httpUtils; + $this->loginPath = $loginPath; + $this->useForward = $useForward; + } + + /** + * {@inheritdoc} + */ + public function start(Request $request, AuthenticationException $authException = null) + { + if ($this->useForward) { + $subRequest = $this->httpUtils->createRequest($request, $this->loginPath); + + $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + if (200 === $response->getStatusCode()) { + $response->setStatusCode(401); + } + + return $response; + } + + return $this->httpUtils->createRedirectResponse($request, $this->loginPath); + } +} diff --git a/vendor/symfony/security-http/EntryPoint/RetryAuthenticationEntryPoint.php b/vendor/symfony/security-http/EntryPoint/RetryAuthenticationEntryPoint.php new file mode 100644 index 0000000..55e86f9 --- /dev/null +++ b/vendor/symfony/security-http/EntryPoint/RetryAuthenticationEntryPoint.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EntryPoint; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Firewall\ChannelListener; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" directly (and optionally configure the HTTP(s) ports there).', RetryAuthenticationEntryPoint::class, ChannelListener::class); + +/** + * RetryAuthenticationEntryPoint redirects URL based on the configured scheme. + * + * This entry point is not intended to work with HTTP post requests. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.4 + */ +class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface +{ + private $httpPort; + private $httpsPort; + + public function __construct(int $httpPort = 80, int $httpsPort = 443) + { + $this->httpPort = $httpPort; + $this->httpsPort = $httpsPort; + } + + /** + * {@inheritdoc} + */ + public function start(Request $request, AuthenticationException $authException = null) + { + $scheme = $request->isSecure() ? 'http' : 'https'; + if ('http' === $scheme && 80 != $this->httpPort) { + $port = ':'.$this->httpPort; + } elseif ('https' === $scheme && 443 != $this->httpsPort) { + $port = ':'.$this->httpsPort; + } else { + $port = ''; + } + + $qs = $request->getQueryString(); + if (null !== $qs) { + $qs = '?'.$qs; + } + + $url = $scheme.'://'.$request->getHost().$port.$request->getBaseUrl().$request->getPathInfo().$qs; + + return new RedirectResponse($url, 301); + } +} diff --git a/vendor/symfony/security-http/Event/AuthenticationTokenCreatedEvent.php b/vendor/symfony/security-http/Event/AuthenticationTokenCreatedEvent.php new file mode 100644 index 0000000..632f3ec --- /dev/null +++ b/vendor/symfony/security-http/Event/AuthenticationTokenCreatedEvent.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * When a newly authenticated security token was created, before it becomes effective in the security system. + * + * @author Christian Scheb + */ +class AuthenticationTokenCreatedEvent extends Event +{ + private $authenticatedToken; + private $passport; + + /** + * @param Passport $passport + */ + public function __construct(TokenInterface $token, PassportInterface $passport) + { + if (!$passport instanceof Passport) { + trigger_deprecation('symfony/security-http', '5.4', 'Not passing an instance of "%s" as "$passport" argument of "%s()" is deprecated, "%s" given.', Passport::class, __METHOD__, get_debug_type($passport)); + } + + $this->authenticatedToken = $token; + $this->passport = $passport; + } + + public function getAuthenticatedToken(): TokenInterface + { + return $this->authenticatedToken; + } + + public function setAuthenticatedToken(TokenInterface $authenticatedToken): void + { + $this->authenticatedToken = $authenticatedToken; + } + + public function getPassport(): PassportInterface + { + return $this->passport; + } +} diff --git a/vendor/symfony/security-http/Event/CheckPassportEvent.php b/vendor/symfony/security-http/Event/CheckPassportEvent.php new file mode 100644 index 0000000..a3fe109 --- /dev/null +++ b/vendor/symfony/security-http/Event/CheckPassportEvent.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This event is dispatched when the credentials have to be checked. + * + * Listeners to this event must validate the user and the + * credentials (e.g. default listeners do password verification and + * user checking) + * + * @author Wouter de Jong + */ +class CheckPassportEvent extends Event +{ + private $authenticator; + private $passport; + + /** + * @param Passport $passport + */ + public function __construct(AuthenticatorInterface $authenticator, PassportInterface $passport) + { + if (!$passport instanceof Passport) { + trigger_deprecation('symfony/security-http', '5.4', 'Not passing an instance of "%s" as "$passport" argument of "%s()" is deprecated, "%s" given.', Passport::class, __METHOD__, get_debug_type($passport)); + } + + $this->authenticator = $authenticator; + $this->passport = $passport; + } + + public function getAuthenticator(): AuthenticatorInterface + { + return $this->authenticator; + } + + public function getPassport(): PassportInterface + { + return $this->passport; + } +} diff --git a/vendor/symfony/security-http/Event/DeauthenticatedEvent.php b/vendor/symfony/security-http/Event/DeauthenticatedEvent.php new file mode 100644 index 0000000..f064cce --- /dev/null +++ b/vendor/symfony/security-http/Event/DeauthenticatedEvent.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * Deauthentication happens in case the user has changed when trying to + * refresh the token. + * + * Use {@see TokenDeauthenticatedEvent} if you want to cover all cases where + * a session is deauthenticated. + * + * @author Hamza Amrouche + * + * @deprecated since Symfony 5.4, use TokenDeauthenticatedEvent instead + */ +final class DeauthenticatedEvent extends Event +{ + private $originalToken; + private $refreshedToken; + + public function __construct(TokenInterface $originalToken, TokenInterface $refreshedToken, bool $triggerDeprecation = true) + { + if ($triggerDeprecation) { + @trigger_deprecation('symfony/security-http', '5.4', 'Class "%s" is deprecated, use "%s" instead.', __CLASS__, TokenDeauthenticatedEvent::class); + } + + $this->originalToken = $originalToken; + $this->refreshedToken = $refreshedToken; + } + + public function getRefreshedToken(): TokenInterface + { + @trigger_deprecation('symfony/security-http', '5.4', 'Class "%s" is deprecated, use "%s" instead.', __CLASS__, TokenDeauthenticatedEvent::class); + + return $this->refreshedToken; + } + + public function getOriginalToken(): TokenInterface + { + @trigger_deprecation('symfony/security-http', '5.4', 'Class "%s" is deprecated, use "%s" instead.', __CLASS__, TokenDeauthenticatedEvent::class); + + return $this->originalToken; + } +} diff --git a/vendor/symfony/security-http/Event/InteractiveLoginEvent.php b/vendor/symfony/security-http/Event/InteractiveLoginEvent.php new file mode 100644 index 0000000..3ba9863 --- /dev/null +++ b/vendor/symfony/security-http/Event/InteractiveLoginEvent.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * @author Fabien Potencier + */ +final class InteractiveLoginEvent extends Event +{ + private $request; + private $authenticationToken; + + public function __construct(Request $request, TokenInterface $authenticationToken) + { + $this->request = $request; + $this->authenticationToken = $authenticationToken; + } + + public function getRequest(): Request + { + return $this->request; + } + + public function getAuthenticationToken(): TokenInterface + { + return $this->authenticationToken; + } +} diff --git a/vendor/symfony/security-http/Event/LazyResponseEvent.php b/vendor/symfony/security-http/Event/LazyResponseEvent.php new file mode 100644 index 0000000..319be37 --- /dev/null +++ b/vendor/symfony/security-http/Event/LazyResponseEvent.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\Security\Core\Exception\LazyResponseException; + +/** + * Wraps a lazily computed response in a signaling exception. + * + * @author Nicolas Grekas + */ +final class LazyResponseEvent extends RequestEvent +{ + private $event; + + public function __construct(parent $event) + { + $this->event = $event; + } + + /** + * {@inheritdoc} + */ + public function setResponse(Response $response) + { + $this->stopPropagation(); + $this->event->stopPropagation(); + + throw new LazyResponseException($response); + } + + /** + * {@inheritdoc} + */ + public function getKernel(): HttpKernelInterface + { + return $this->event->getKernel(); + } + + /** + * {@inheritdoc} + */ + public function getRequest(): Request + { + return $this->event->getRequest(); + } + + /** + * {@inheritdoc} + */ + public function getRequestType(): int + { + return $this->event->getRequestType(); + } + + /** + * {@inheritdoc} + */ + public function isMainRequest(): bool + { + return $this->event->isMainRequest(); + } + + /** + * {@inheritdoc} + */ + public function isMasterRequest(): bool + { + trigger_deprecation('symfony/security-http', '5.3', '"%s()" is deprecated, use "isMainRequest()" instead.', __METHOD__); + + return $this->event->isMainRequest(); + } +} diff --git a/vendor/symfony/security-http/Event/LoginFailureEvent.php b/vendor/symfony/security-http/Event/LoginFailureEvent.php new file mode 100644 index 0000000..1d58c1d --- /dev/null +++ b/vendor/symfony/security-http/Event/LoginFailureEvent.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This event is dispatched after an error during authentication. + * + * Listeners to this event can change state based on authentication + * failure (e.g. to implement login throttling). + * + * @author Wouter de Jong + */ +class LoginFailureEvent extends Event +{ + private $exception; + private $authenticator; + private $request; + private $response; + private $firewallName; + private $passport; + + /** + * @param Passport|null $passport + */ + public function __construct(AuthenticationException $exception, AuthenticatorInterface $authenticator, Request $request, ?Response $response, string $firewallName, PassportInterface $passport = null) + { + if (null !== $passport && !$passport instanceof Passport) { + trigger_deprecation('symfony/security-http', '5.4', 'Not passing an instance of "%s" or "null" as "$passport" argument of "%s()" is deprecated, "%s" given.', Passport::class, __METHOD__, get_debug_type($passport)); + } + + $this->exception = $exception; + $this->authenticator = $authenticator; + $this->request = $request; + $this->response = $response; + $this->firewallName = $firewallName; + $this->passport = $passport; + } + + public function getException(): AuthenticationException + { + return $this->exception; + } + + public function getAuthenticator(): AuthenticatorInterface + { + return $this->authenticator; + } + + public function getFirewallName(): string + { + return $this->firewallName; + } + + public function getRequest(): Request + { + return $this->request; + } + + public function setResponse(?Response $response) + { + $this->response = $response; + } + + public function getResponse(): ?Response + { + return $this->response; + } + + public function getPassport(): ?PassportInterface + { + return $this->passport; + } +} diff --git a/vendor/symfony/security-http/Event/LoginSuccessEvent.php b/vendor/symfony/security-http/Event/LoginSuccessEvent.php new file mode 100644 index 0000000..d2272fe --- /dev/null +++ b/vendor/symfony/security-http/Event/LoginSuccessEvent.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This event is dispatched after authentication has successfully completed. + * + * At this stage, the authenticator created a token and + * generated an authentication success response. Listeners to + * this event can do actions related to successful authentication + * (such as migrating the password). + * + * @author Wouter de Jong + */ +class LoginSuccessEvent extends Event +{ + private $authenticator; + private $passport; + private $authenticatedToken; + private $request; + private $response; + private $firewallName; + + /** + * @param Passport $passport + */ + public function __construct(AuthenticatorInterface $authenticator, PassportInterface $passport, TokenInterface $authenticatedToken, Request $request, ?Response $response, string $firewallName) + { + if (!$passport instanceof Passport) { + trigger_deprecation('symfony/security-http', '5.4', 'Not passing an instance of "%s" as "$passport" argument of "%s()" is deprecated, "%s" given.', Passport::class, __METHOD__, get_debug_type($passport)); + } + + $this->authenticator = $authenticator; + $this->passport = $passport; + $this->authenticatedToken = $authenticatedToken; + $this->request = $request; + $this->response = $response; + $this->firewallName = $firewallName; + } + + public function getAuthenticator(): AuthenticatorInterface + { + return $this->authenticator; + } + + public function getPassport(): PassportInterface + { + return $this->passport; + } + + public function getUser(): UserInterface + { + // @deprecated since Symfony 5.4, passport will always have a user in 6.0 + if (!$this->passport instanceof UserPassportInterface) { + throw new LogicException(sprintf('Cannot call "%s" as the authenticator ("%s") did not set a user.', __METHOD__, \get_class($this->authenticator))); + } + + return $this->passport->getUser(); + } + + public function getAuthenticatedToken(): TokenInterface + { + return $this->authenticatedToken; + } + + public function getRequest(): Request + { + return $this->request; + } + + public function getFirewallName(): string + { + return $this->firewallName; + } + + public function setResponse(?Response $response): void + { + $this->response = $response; + } + + public function getResponse(): ?Response + { + return $this->response; + } +} diff --git a/vendor/symfony/security-http/Event/LogoutEvent.php b/vendor/symfony/security-http/Event/LogoutEvent.php new file mode 100644 index 0000000..3c521f1 --- /dev/null +++ b/vendor/symfony/security-http/Event/LogoutEvent.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * @author Wouter de Jong + */ +class LogoutEvent extends Event +{ + private $request; + private $response; + private $token; + + public function __construct(Request $request, ?TokenInterface $token) + { + $this->request = $request; + $this->token = $token; + } + + public function getRequest(): Request + { + return $this->request; + } + + public function getToken(): ?TokenInterface + { + return $this->token; + } + + public function setResponse(Response $response): void + { + $this->response = $response; + } + + public function getResponse(): ?Response + { + return $this->response; + } +} diff --git a/vendor/symfony/security-http/Event/SwitchUserEvent.php b/vendor/symfony/security-http/Event/SwitchUserEvent.php new file mode 100644 index 0000000..1bea6c8 --- /dev/null +++ b/vendor/symfony/security-http/Event/SwitchUserEvent.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * SwitchUserEvent. + * + * @author Fabien Potencier + */ +final class SwitchUserEvent extends Event +{ + private $request; + private $targetUser; + private $token; + + public function __construct(Request $request, UserInterface $targetUser, TokenInterface $token = null) + { + $this->request = $request; + $this->targetUser = $targetUser; + $this->token = $token; + } + + public function getRequest(): Request + { + return $this->request; + } + + public function getTargetUser(): UserInterface + { + return $this->targetUser; + } + + public function getToken(): ?TokenInterface + { + return $this->token; + } + + public function setToken(TokenInterface $token) + { + $this->token = $token; + } +} diff --git a/vendor/symfony/security-http/Event/TokenDeauthenticatedEvent.php b/vendor/symfony/security-http/Event/TokenDeauthenticatedEvent.php new file mode 100644 index 0000000..b09f4ec --- /dev/null +++ b/vendor/symfony/security-http/Event/TokenDeauthenticatedEvent.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Event; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Contracts\EventDispatcher\Event; + +/** + * This event is dispatched when the current security token is deauthenticated + * when trying to reference the token. + * + * This includes changes in the user ({@see DeauthenticatedEvent}), but + * also cases where there is no user provider available to refresh the user. + * + * Use this event if you want to trigger some actions whenever a user is + * deauthenticated and redirected back to the authentication entry point + * (e.g. clearing all remember-me cookies). + * + * @author Wouter de Jong + */ +final class TokenDeauthenticatedEvent extends Event +{ + private $originalToken; + private $request; + + public function __construct(TokenInterface $originalToken, Request $request) + { + $this->originalToken = $originalToken; + $this->request = $request; + } + + public function getOriginalToken(): TokenInterface + { + return $this->originalToken; + } + + public function getRequest(): Request + { + return $this->request; + } +} diff --git a/vendor/symfony/security-http/EventListener/CheckCredentialsListener.php b/vendor/symfony/security-http/EventListener/CheckCredentialsListener.php new file mode 100644 index 0000000..812419d --- /dev/null +++ b/vendor/symfony/security-http/EventListener/CheckCredentialsListener.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; + +/** + * This listeners uses the interfaces of authenticators to + * determine how to check credentials. + * + * @author Wouter de Jong + * + * @final + */ +class CheckCredentialsListener implements EventSubscriberInterface +{ + private $hasherFactory; + + /** + * @param PasswordHasherFactoryInterface $hasherFactory + */ + public function __construct($hasherFactory) + { + if ($hasherFactory instanceof EncoderFactoryInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Passing a "%s" instance to the "%s" constructor is deprecated, use "%s" instead.', EncoderFactoryInterface::class, __CLASS__, PasswordHasherFactoryInterface::class); + } + + $this->hasherFactory = $hasherFactory; + } + + public function checkPassport(CheckPassportEvent $event): void + { + $passport = $event->getPassport(); + if ($passport instanceof UserPassportInterface && $passport->hasBadge(PasswordCredentials::class)) { + // Use the password hasher to validate the credentials + $user = $passport->getUser(); + + if (!$user instanceof PasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-http', '5.3', 'Not implementing the "%s" interface in class "%s" while using password-based authentication is deprecated.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + /** @var PasswordCredentials $badge */ + $badge = $passport->getBadge(PasswordCredentials::class); + + if ($badge->isResolved()) { + return; + } + + $presentedPassword = $badge->getPassword(); + if ('' === $presentedPassword) { + throw new BadCredentialsException('The presented password cannot be empty.'); + } + + if (null === $user->getPassword()) { + throw new BadCredentialsException('The presented password is invalid.'); + } + + $salt = method_exists($user, 'getSalt') ? $user->getSalt() : ''; + if ($salt && !$user instanceof LegacyPasswordAuthenticatedUserInterface) { + trigger_deprecation('symfony/security-http', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user)); + } + + // @deprecated since Symfony 5.3 + if ($this->hasherFactory instanceof EncoderFactoryInterface) { + if (!$this->hasherFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $presentedPassword, $salt)) { + throw new BadCredentialsException('The presented password is invalid.'); + } + } else { + if (!$this->hasherFactory->getPasswordHasher($user)->verify($user->getPassword(), $presentedPassword, $salt)) { + throw new BadCredentialsException('The presented password is invalid.'); + } + } + + $badge->markResolved(); + + if (!$passport->hasBadge(PasswordUpgradeBadge::class)) { + $passport->addBadge(new PasswordUpgradeBadge($presentedPassword)); + } + + return; + } + + if ($passport->hasBadge(CustomCredentials::class)) { + /** @var CustomCredentials $badge */ + $badge = $passport->getBadge(CustomCredentials::class); + if ($badge->isResolved()) { + return; + } + + $badge->executeCustomChecker($passport->getUser()); + + return; + } + } + + public static function getSubscribedEvents(): array + { + return [CheckPassportEvent::class => 'checkPassport']; + } +} diff --git a/vendor/symfony/security-http/EventListener/CheckRememberMeConditionsListener.php b/vendor/symfony/security-http/EventListener/CheckRememberMeConditionsListener.php new file mode 100644 index 0000000..cd738cc --- /dev/null +++ b/vendor/symfony/security-http/EventListener/CheckRememberMeConditionsListener.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; +use Symfony\Component\Security\Http\ParameterBagUtils; + +/** + * Checks if all conditions are met for remember me. + * + * The conditions that must be met for this listener to enable remember me: + * A) This badge is present in the Passport + * B) The remember_me key under your firewall is configured + * C) The "remember me" functionality is activated. This is usually + * done by having a _remember_me checkbox in your form, but + * can be configured by the "always_remember_me" and "remember_me_parameter" + * parameters under the "remember_me" firewall key (or "always_remember_me" + * is enabled) + * + * @author Wouter de Jong + * + * @final + */ +class CheckRememberMeConditionsListener implements EventSubscriberInterface +{ + private $options; + private $logger; + + public function __construct(array $options = [], LoggerInterface $logger = null) + { + $this->options = $options + ['always_remember_me' => false, 'remember_me_parameter' => '_remember_me']; + $this->logger = $logger; + } + + public function onSuccessfulLogin(LoginSuccessEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport->hasBadge(RememberMeBadge::class)) { + return; + } + + /** @var RememberMeBadge $badge */ + $badge = $passport->getBadge(RememberMeBadge::class); + if (!$this->options['always_remember_me']) { + $parameter = ParameterBagUtils::getRequestParameterValue($event->getRequest(), $this->options['remember_me_parameter']); + if (!('true' === $parameter || 'on' === $parameter || '1' === $parameter || 'yes' === $parameter || true === $parameter)) { + if (null !== $this->logger) { + $this->logger->debug('Remember me disabled; request does not contain remember me parameter ("{parameter}").', ['parameter' => $this->options['remember_me_parameter']]); + } + + return; + } + } + + $badge->enable(); + } + + public static function getSubscribedEvents(): array + { + return [LoginSuccessEvent::class => ['onSuccessfulLogin', -32]]; + } +} diff --git a/vendor/symfony/security-http/EventListener/CookieClearingLogoutListener.php b/vendor/symfony/security-http/EventListener/CookieClearingLogoutListener.php new file mode 100644 index 0000000..d178b92 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/CookieClearingLogoutListener.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; + +/** + * This listener clears the passed cookies when a user logs out. + * + * @author Johannes M. Schmitt + * + * @final + */ +class CookieClearingLogoutListener implements EventSubscriberInterface +{ + private $cookies; + + /** + * @param array $cookies An array of cookies (keys are names, values contain path and domain) to unset + */ + public function __construct(array $cookies) + { + $this->cookies = $cookies; + } + + public function onLogout(LogoutEvent $event): void + { + if (!$response = $event->getResponse()) { + return; + } + + foreach ($this->cookies as $cookieName => $cookieData) { + $response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], $cookieData['secure'] ?? false, true, $cookieData['samesite'] ?? null); + } + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => ['onLogout', -255], + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/CsrfProtectionListener.php b/vendor/symfony/security-http/EventListener/CsrfProtectionListener.php new file mode 100644 index 0000000..91f46f3 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/CsrfProtectionListener.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; +use Symfony\Component\Security\Csrf\CsrfToken; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; + +/** + * @author Wouter de Jong + * + * @final + */ +class CsrfProtectionListener implements EventSubscriberInterface +{ + private $csrfTokenManager; + + public function __construct(CsrfTokenManagerInterface $csrfTokenManager) + { + $this->csrfTokenManager = $csrfTokenManager; + } + + public function checkPassport(CheckPassportEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport->hasBadge(CsrfTokenBadge::class)) { + return; + } + + /** @var CsrfTokenBadge $badge */ + $badge = $passport->getBadge(CsrfTokenBadge::class); + if ($badge->isResolved()) { + return; + } + + $csrfToken = new CsrfToken($badge->getCsrfTokenId(), $badge->getCsrfToken()); + + if (false === $this->csrfTokenManager->isTokenValid($csrfToken)) { + throw new InvalidCsrfTokenException('Invalid CSRF token.'); + } + + $badge->markResolved(); + } + + public static function getSubscribedEvents(): array + { + return [CheckPassportEvent::class => ['checkPassport', 512]]; + } +} diff --git a/vendor/symfony/security-http/EventListener/CsrfTokenClearingLogoutListener.php b/vendor/symfony/security-http/EventListener/CsrfTokenClearingLogoutListener.php new file mode 100644 index 0000000..984041e --- /dev/null +++ b/vendor/symfony/security-http/EventListener/CsrfTokenClearingLogoutListener.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; + +/** + * @author Christian Flothmann + * + * @final + */ +class CsrfTokenClearingLogoutListener implements EventSubscriberInterface +{ + private $csrfTokenStorage; + + public function __construct(ClearableTokenStorageInterface $csrfTokenStorage) + { + $this->csrfTokenStorage = $csrfTokenStorage; + } + + public function onLogout(LogoutEvent $event): void + { + $this->csrfTokenStorage->clear(); + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => 'onLogout', + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/DefaultLogoutListener.php b/vendor/symfony/security-http/EventListener/DefaultLogoutListener.php new file mode 100644 index 0000000..8a9e000 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/DefaultLogoutListener.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\HttpUtils; + +/** + * Default logout listener will redirect users to a configured path. + * + * @author Fabien Potencier + * @author Alexander + * + * @final + */ +class DefaultLogoutListener implements EventSubscriberInterface +{ + private $httpUtils; + private $targetUrl; + + public function __construct(HttpUtils $httpUtils, string $targetUrl = '/') + { + $this->httpUtils = $httpUtils; + $this->targetUrl = $targetUrl; + } + + public function onLogout(LogoutEvent $event): void + { + if (null !== $event->getResponse()) { + return; + } + + $event->setResponse($this->httpUtils->createRedirectResponse($event->getRequest(), $this->targetUrl)); + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => ['onLogout', 64], + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/LoginThrottlingListener.php b/vendor/symfony/security-http/EventListener/LoginThrottlingListener.php new file mode 100644 index 0000000..2284f93 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/LoginThrottlingListener.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\RateLimiter\RequestRateLimiterInterface; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Exception\TooManyLoginAttemptsAuthenticationException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; + +/** + * @author Wouter de Jong + */ +final class LoginThrottlingListener implements EventSubscriberInterface +{ + private $requestStack; + private $limiter; + + public function __construct(RequestStack $requestStack, RequestRateLimiterInterface $limiter) + { + $this->requestStack = $requestStack; + $this->limiter = $limiter; + } + + public function checkPassport(CheckPassportEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport->hasBadge(UserBadge::class)) { + return; + } + + $request = $this->requestStack->getMainRequest(); + $request->attributes->set(Security::LAST_USERNAME, $passport->getBadge(UserBadge::class)->getUserIdentifier()); + + $limit = $this->limiter->consume($request); + if (!$limit->isAccepted()) { + throw new TooManyLoginAttemptsAuthenticationException(ceil(($limit->getRetryAfter()->getTimestamp() - time()) / 60)); + } + } + + public function onSuccessfulLogin(LoginSuccessEvent $event): void + { + $this->limiter->reset($event->getRequest()); + } + + public static function getSubscribedEvents(): array + { + return [ + CheckPassportEvent::class => ['checkPassport', 2080], + LoginSuccessEvent::class => 'onSuccessfulLogin', + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/PasswordMigratingListener.php b/vendor/symfony/security-http/EventListener/PasswordMigratingListener.php new file mode 100644 index 0000000..2650d45 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/PasswordMigratingListener.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; +use Symfony\Component\PasswordHasher\PasswordHasherInterface; +use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; + +/** + * @author Wouter de Jong + * + * @final + */ +class PasswordMigratingListener implements EventSubscriberInterface +{ + private $hasherFactory; + + /** + * @param PasswordHasherFactoryInterface $hasherFactory + */ + public function __construct($hasherFactory) + { + if ($hasherFactory instanceof EncoderFactoryInterface) { + trigger_deprecation('symfony/security-core', '5.3', 'Passing a "%s" instance to the "%s" constructor is deprecated, use "%s" instead.', EncoderFactoryInterface::class, __CLASS__, PasswordHasherFactoryInterface::class); + } + + $this->hasherFactory = $hasherFactory; + } + + public function onLoginSuccess(LoginSuccessEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport instanceof UserPassportInterface || !$passport->hasBadge(PasswordUpgradeBadge::class)) { + return; + } + + /** @var PasswordUpgradeBadge $badge */ + $badge = $passport->getBadge(PasswordUpgradeBadge::class); + $plaintextPassword = $badge->getAndErasePlaintextPassword(); + + if ('' === $plaintextPassword) { + return; + } + + $user = $passport->getUser(); + if (null === $user->getPassword()) { + return; + } + + $passwordHasher = $this->hasherFactory instanceof EncoderFactoryInterface ? $this->hasherFactory->getEncoder($user) : $this->hasherFactory->getPasswordHasher($user); + if (!$passwordHasher->needsRehash($user->getPassword())) { + return; + } + + $passwordUpgrader = $badge->getPasswordUpgrader(); + + if (null === $passwordUpgrader) { + if (!$passport->hasBadge(UserBadge::class)) { + return; + } + + /** @var UserBadge $userBadge */ + $userBadge = $passport->getBadge(UserBadge::class); + $userLoader = $userBadge->getUserLoader(); + if (\is_array($userLoader) && $userLoader[0] instanceof PasswordUpgraderInterface) { + $passwordUpgrader = $userLoader[0]; + } elseif (!$userLoader instanceof \Closure + || !($passwordUpgrader = (new \ReflectionFunction($userLoader))->getClosureThis()) instanceof PasswordUpgraderInterface + ) { + return; + } + } + + $passwordUpgrader->upgradePassword($user, $passwordHasher instanceof PasswordHasherInterface ? $passwordHasher->hash($plaintextPassword, $user->getSalt()) : $passwordHasher->encodePassword($plaintextPassword, $user->getSalt())); + } + + public static function getSubscribedEvents(): array + { + return [LoginSuccessEvent::class => 'onLoginSuccess']; + } +} diff --git a/vendor/symfony/security-http/EventListener/RememberMeListener.php b/vendor/symfony/security-http/EventListener/RememberMeListener.php new file mode 100644 index 0000000..510eca6 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/RememberMeListener.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge; +use Symfony\Component\Security\Http\Event\LoginFailureEvent; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\Event\TokenDeauthenticatedEvent; +use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface; + +/** + * The RememberMe *listener* creates and deletes remember-me cookies. + * + * Upon login success or failure and support for remember me + * in the firewall and authenticator, this listener will create + * a remember-me cookie. + * Upon login failure, all remember-me cookies are removed. + * + * @author Wouter de Jong + * + * @final + */ +class RememberMeListener implements EventSubscriberInterface +{ + private $rememberMeHandler; + private $logger; + + public function __construct(RememberMeHandlerInterface $rememberMeHandler, LoggerInterface $logger = null) + { + $this->rememberMeHandler = $rememberMeHandler; + $this->logger = $logger; + } + + public function onSuccessfulLogin(LoginSuccessEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport->hasBadge(RememberMeBadge::class)) { + if (null !== $this->logger) { + $this->logger->debug('Remember me skipped: your authenticator does not support it.', ['authenticator' => \get_class($event->getAuthenticator())]); + } + + return; + } + + // Make sure any old remember-me cookies are cancelled + $this->rememberMeHandler->clearRememberMeCookie(); + + /** @var RememberMeBadge $badge */ + $badge = $passport->getBadge(RememberMeBadge::class); + if (!$badge->isEnabled()) { + if (null !== $this->logger) { + $this->logger->debug('Remember me skipped: the RememberMeBadge is not enabled.'); + } + + return; + } + + if (null !== $this->logger) { + $this->logger->debug('Remember-me was requested; setting cookie.'); + } + + $this->rememberMeHandler->createRememberMeCookie($event->getUser()); + } + + public function clearCookie(): void + { + $this->rememberMeHandler->clearRememberMeCookie(); + } + + public static function getSubscribedEvents(): array + { + return [ + LoginSuccessEvent::class => ['onSuccessfulLogin', -64], + LoginFailureEvent::class => 'clearCookie', + LogoutEvent::class => 'clearCookie', + TokenDeauthenticatedEvent::class => 'clearCookie', + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/RememberMeLogoutListener.php b/vendor/symfony/security-http/EventListener/RememberMeLogoutListener.php new file mode 100644 index 0000000..b97558f --- /dev/null +++ b/vendor/symfony/security-http/EventListener/RememberMeLogoutListener.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated.', RememberMeLogoutListener::class); + +/** + * @author Wouter de Jong + * + * @final + * + * @deprecated since Symfony 5.4 + */ +class RememberMeLogoutListener implements EventSubscriberInterface +{ + private $rememberMeServices; + + public function __construct(RememberMeServicesInterface $rememberMeServices) + { + if (!method_exists($rememberMeServices, 'logout')) { + trigger_deprecation('symfony/security-core', '5.1', '"%s" should implement the "logout(Request $request, Response $response, TokenInterface $token)" method, this method will be added to the "%s" in version 6.0.', \get_class($rememberMeServices), RememberMeServicesInterface::class); + } + + $this->rememberMeServices = $rememberMeServices; + } + + public function onLogout(LogoutEvent $event): void + { + if (!method_exists($this->rememberMeServices, 'logout')) { + return; + } + + if (!$event->getToken()) { + return; + } + + if (null === $event->getResponse()) { + throw new LogicException(sprintf('No response was set for this logout action. Make sure the DefaultLogoutListener or another listener has set the response before "%s" is called.', __CLASS__)); + } + + $this->rememberMeServices->logout($event->getRequest(), $event->getResponse(), $event->getToken()); + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => 'onLogout', + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/SessionLogoutListener.php b/vendor/symfony/security-http/EventListener/SessionLogoutListener.php new file mode 100644 index 0000000..06b84d6 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/SessionLogoutListener.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; + +/** + * Handler for clearing invalidating the current session. + * + * @author Johannes M. Schmitt + * + * @final + */ +class SessionLogoutListener implements EventSubscriberInterface +{ + public function onLogout(LogoutEvent $event): void + { + if ($event->getRequest()->hasSession()) { + $event->getRequest()->getSession()->invalidate(); + } + } + + public static function getSubscribedEvents(): array + { + return [ + LogoutEvent::class => 'onLogout', + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/SessionStrategyListener.php b/vendor/symfony/security-http/EventListener/SessionStrategyListener.php new file mode 100644 index 0000000..b1ba288 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/SessionStrategyListener.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Http\Event\LoginSuccessEvent; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; + +/** + * Migrates/invalidates the session after successful login. + * + * This should be registered as subscriber to any "stateful" firewalls. + * + * @see SessionAuthenticationStrategy + * + * @author Wouter de Jong + */ +class SessionStrategyListener implements EventSubscriberInterface +{ + private $sessionAuthenticationStrategy; + + public function __construct(SessionAuthenticationStrategyInterface $sessionAuthenticationStrategy) + { + $this->sessionAuthenticationStrategy = $sessionAuthenticationStrategy; + } + + public function onSuccessfulLogin(LoginSuccessEvent $event): void + { + $request = $event->getRequest(); + $token = $event->getAuthenticatedToken(); + + if (!$request->hasSession() || !$request->hasPreviousSession()) { + return; + } + + $this->sessionAuthenticationStrategy->onAuthentication($request, $token); + } + + public static function getSubscribedEvents(): array + { + return [LoginSuccessEvent::class => 'onSuccessfulLogin']; + } +} diff --git a/vendor/symfony/security-http/EventListener/UserCheckerListener.php b/vendor/symfony/security-http/EventListener/UserCheckerListener.php new file mode 100644 index 0000000..55be8b7 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/UserCheckerListener.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PreAuthenticatedUserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; + +/** + * @author Wouter de Jong + * + * @final + */ +class UserCheckerListener implements EventSubscriberInterface +{ + private $userChecker; + + public function __construct(UserCheckerInterface $userChecker) + { + $this->userChecker = $userChecker; + } + + public function preCheckCredentials(CheckPassportEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport instanceof UserPassportInterface || $passport->hasBadge(PreAuthenticatedUserBadge::class)) { + return; + } + + $this->userChecker->checkPreAuth($passport->getUser()); + } + + public function postCheckCredentials(AuthenticationSuccessEvent $event): void + { + $user = $event->getAuthenticationToken()->getUser(); + if (!$user instanceof UserInterface) { + return; + } + + $this->userChecker->checkPostAuth($user); + } + + public static function getSubscribedEvents(): array + { + return [ + CheckPassportEvent::class => ['preCheckCredentials', 256], + AuthenticationSuccessEvent::class => ['postCheckCredentials', 256], + ]; + } +} diff --git a/vendor/symfony/security-http/EventListener/UserProviderListener.php b/vendor/symfony/security-http/EventListener/UserProviderListener.php new file mode 100644 index 0000000..a340878 --- /dev/null +++ b/vendor/symfony/security-http/EventListener/UserProviderListener.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\EventListener; + +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Event\CheckPassportEvent; + +/** + * Configures the user provider as user loader, if no user load + * has been explicitly set. + * + * @author Wouter de Jong + * + * @final + */ +class UserProviderListener +{ + private $userProvider; + + public function __construct(UserProviderInterface $userProvider) + { + $this->userProvider = $userProvider; + } + + public function checkPassport(CheckPassportEvent $event): void + { + $passport = $event->getPassport(); + if (!$passport->hasBadge(UserBadge::class)) { + return; + } + + /** @var UserBadge $badge */ + $badge = $passport->getBadge(UserBadge::class); + if (null !== $badge->getUserLoader()) { + return; + } + + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($this->userProvider, 'loadUserByIdentifier')) { + $badge->setUserLoader([$this->userProvider, 'loadUserByIdentifier']); + } else { + trigger_deprecation('symfony/security-http', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $badge->setUserLoader([$this->userProvider, 'loadUserByUsername']); + } + } +} diff --git a/vendor/symfony/security-http/Firewall.php b/vendor/symfony/security-http/Firewall.php new file mode 100644 index 0000000..be758a6 --- /dev/null +++ b/vendor/symfony/security-http/Firewall.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * Firewall uses a FirewallMap to register security listeners for the given + * request. + * + * It allows for different security strategies within the same application + * (a Basic authentication for the /api, and a web based authentication for + * everything else for instance). + * + * @author Fabien Potencier + */ +class Firewall implements EventSubscriberInterface +{ + private $map; + private $dispatcher; + + /** + * @var \SplObjectStorage + */ + private $exceptionListeners; + + public function __construct(FirewallMapInterface $map, EventDispatcherInterface $dispatcher) + { + $this->map = $map; + $this->dispatcher = $dispatcher; + $this->exceptionListeners = new \SplObjectStorage(); + } + + public function onKernelRequest(RequestEvent $event) + { + if (!$event->isMainRequest()) { + return; + } + + // register listeners for this firewall + $listeners = $this->map->getListeners($event->getRequest()); + + $authenticationListeners = $listeners[0]; + $exceptionListener = $listeners[1]; + $logoutListener = $listeners[2]; + + if (null !== $exceptionListener) { + $this->exceptionListeners[$event->getRequest()] = $exceptionListener; + $exceptionListener->register($this->dispatcher); + } + + // Authentication listeners are pre-sorted by SortFirewallListenersPass + $authenticationListeners = function () use ($authenticationListeners, $logoutListener) { + if (null !== $logoutListener) { + $logoutListenerPriority = $this->getListenerPriority($logoutListener); + } + + foreach ($authenticationListeners as $listener) { + $listenerPriority = $this->getListenerPriority($listener); + + // Yielding the LogoutListener at the correct position + if (null !== $logoutListener && $listenerPriority < $logoutListenerPriority) { + yield $logoutListener; + $logoutListener = null; + } + + yield $listener; + } + + // When LogoutListener has the lowest priority of all listeners + if (null !== $logoutListener) { + yield $logoutListener; + } + }; + + $this->callListeners($event, $authenticationListeners()); + } + + public function onKernelFinishRequest(FinishRequestEvent $event) + { + $request = $event->getRequest(); + + if (isset($this->exceptionListeners[$request])) { + $this->exceptionListeners[$request]->unregister($this->dispatcher); + unset($this->exceptionListeners[$request]); + } + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() + { + return [ + KernelEvents::REQUEST => ['onKernelRequest', 8], + KernelEvents::FINISH_REQUEST => 'onKernelFinishRequest', + ]; + } + + protected function callListeners(RequestEvent $event, iterable $listeners) + { + foreach ($listeners as $listener) { + $listener($event); + + if ($event->hasResponse()) { + break; + } + } + } + + private function getListenerPriority(object $logoutListener): int + { + return $logoutListener instanceof FirewallListenerInterface ? $logoutListener->getPriority() : 0; + } +} diff --git a/vendor/symfony/security-http/Firewall/AbstractAuthenticationListener.php b/vendor/symfony/security-http/Firewall/AbstractAuthenticationListener.php new file mode 100644 index 0000000..33e2c08 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AbstractAuthenticationListener.php @@ -0,0 +1,229 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\SessionUnavailableException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AbstractAuthenticationListener::class); + +/** + * The AbstractAuthenticationListener is the preferred base class for all + * browser-/HTTP-based authentication requests. + * + * Subclasses likely have to implement the following: + * - an TokenInterface to hold authentication related data + * - an AuthenticationProvider to perform the actual authentication of the + * token, retrieve the UserInterface implementation from a database, and + * perform the specific account checks using the UserChecker + * + * By default, this listener only is active for a specific path, e.g. + * /login_check. If you want to change this behavior, you can overwrite the + * requiresAuthentication() method. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +abstract class AbstractAuthenticationListener extends AbstractListener +{ + protected $options; + protected $logger; + protected $authenticationManager; + protected $providerKey; + protected $httpUtils; + + private $tokenStorage; + private $sessionStrategy; + private $dispatcher; + private $successHandler; + private $failureHandler; + private $rememberMeServices; + + /** + * @throws \InvalidArgumentException + */ + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) + { + if (empty($providerKey)) { + throw new \InvalidArgumentException('$providerKey must not be empty.'); + } + + $this->tokenStorage = $tokenStorage; + $this->authenticationManager = $authenticationManager; + $this->sessionStrategy = $sessionStrategy; + $this->providerKey = $providerKey; + $this->successHandler = $successHandler; + $this->failureHandler = $failureHandler; + $this->options = array_merge([ + 'check_path' => '/login_check', + 'login_path' => '/login', + 'always_use_default_target_path' => false, + 'default_target_path' => '/', + 'target_path_parameter' => '_target_path', + 'use_referer' => false, + 'failure_path' => null, + 'failure_forward' => false, + 'require_previous_session' => true, + ], $options); + $this->logger = $logger; + $this->dispatcher = $dispatcher; + $this->httpUtils = $httpUtils; + } + + /** + * Sets the RememberMeServices implementation to use. + */ + public function setRememberMeServices(RememberMeServicesInterface $rememberMeServices) + { + $this->rememberMeServices = $rememberMeServices; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return $this->requiresAuthentication($request); + } + + /** + * Handles form based authentication. + * + * @throws \RuntimeException + * @throws SessionUnavailableException + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + if (!$request->hasSession()) { + throw new \RuntimeException('This authentication method requires a session.'); + } + + try { + if ($this->options['require_previous_session'] && !$request->hasPreviousSession()) { + throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.'); + } + + if (null === $returnValue = $this->attemptAuthentication($request)) { + return; + } + + if ($returnValue instanceof TokenInterface) { + $this->sessionStrategy->onAuthentication($request, $returnValue); + + $response = $this->onSuccess($request, $returnValue); + } elseif ($returnValue instanceof Response) { + $response = $returnValue; + } else { + throw new \RuntimeException('attemptAuthentication() must either return a Response, an implementation of TokenInterface, or null.'); + } + } catch (AuthenticationException $e) { + $response = $this->onFailure($request, $e); + } + + $event->setResponse($response); + } + + /** + * Whether this request requires authentication. + * + * The default implementation only processes requests to a specific path, + * but a subclass could change this to only authenticate requests where a + * certain parameters is present. + * + * @return bool + */ + protected function requiresAuthentication(Request $request) + { + return $this->httpUtils->checkRequestPath($request, $this->options['check_path']); + } + + /** + * Performs authentication. + * + * @return TokenInterface|Response|null The authenticated token, null if full authentication is not possible, or a Response + * + * @throws AuthenticationException if the authentication fails + */ + abstract protected function attemptAuthentication(Request $request); + + private function onFailure(Request $request, AuthenticationException $failed): Response + { + if (null !== $this->logger) { + $this->logger->info('Authentication request failed.', ['exception' => $failed]); + } + + $token = $this->tokenStorage->getToken(); + if ($token instanceof UsernamePasswordToken && $this->providerKey === $token->getFirewallName()) { + $this->tokenStorage->setToken(null); + } + + $response = $this->failureHandler->onAuthenticationFailure($request, $failed); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Failure Handler did not return a Response.'); + } + + return $response; + } + + private function onSuccess(Request $request, TokenInterface $token): Response + { + if (null !== $this->logger) { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + $this->logger->info('User has been authenticated successfully.', ['username' => method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()]); + } + + $this->tokenStorage->setToken($token); + + $session = $request->getSession(); + $session->remove(Security::AUTHENTICATION_ERROR); + $session->remove(Security::LAST_USERNAME); + + if (null !== $this->dispatcher) { + $loginEvent = new InteractiveLoginEvent($request, $token); + $this->dispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + + $response = $this->successHandler->onAuthenticationSuccess($request, $token); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Success Handler did not return a Response.'); + } + + if (null !== $this->rememberMeServices) { + $this->rememberMeServices->loginSuccess($request, $response, $token); + } + + return $response; + } +} diff --git a/vendor/symfony/security-http/Firewall/AbstractListener.php b/vendor/symfony/security-http/Firewall/AbstractListener.php new file mode 100644 index 0000000..cbc8f93 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AbstractListener.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Symfony\Component\HttpKernel\Event\RequestEvent; + +/** + * A base class for listeners that can tell whether they should authenticate incoming requests. + * + * @author Nicolas Grekas + */ +abstract class AbstractListener implements FirewallListenerInterface +{ + final public function __invoke(RequestEvent $event) + { + if (false !== $this->supports($event->getRequest())) { + $this->authenticate($event); + } + } + + public static function getPriority(): int + { + return 0; // Default + } +} diff --git a/vendor/symfony/security-http/Firewall/AbstractPreAuthenticatedListener.php b/vendor/symfony/security-http/Firewall/AbstractPreAuthenticatedListener.php new file mode 100644 index 0000000..b698e1e --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AbstractPreAuthenticatedListener.php @@ -0,0 +1,160 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AbstractPreAuthenticatedListener::class); + +/** + * AbstractPreAuthenticatedListener is the base class for all listener that + * authenticates users based on a pre-authenticated request (like a certificate + * for instance). + * + * @author Fabien Potencier + * + * @internal + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +abstract class AbstractPreAuthenticatedListener extends AbstractListener +{ + protected $logger; + private $tokenStorage; + private $authenticationManager; + private $providerKey; + private $dispatcher; + private $sessionStrategy; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, string $providerKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) + { + $this->tokenStorage = $tokenStorage; + $this->authenticationManager = $authenticationManager; + $this->providerKey = $providerKey; + $this->logger = $logger; + $this->dispatcher = $dispatcher; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + try { + $request->attributes->set('_pre_authenticated_data', $this->getPreAuthenticatedData($request)); + } catch (BadCredentialsException $e) { + $this->clearToken($e); + + return false; + } + + return true; + } + + /** + * Handles pre-authentication. + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + [$user, $credentials] = $request->attributes->get('_pre_authenticated_data'); + $request->attributes->remove('_pre_authenticated_data'); + + if (null !== $this->logger) { + $this->logger->debug('Checking current security token.', ['token' => (string) $this->tokenStorage->getToken()]); + } + + if (null !== $token = $this->tokenStorage->getToken()) { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + if ($token instanceof PreAuthenticatedToken && $this->providerKey == $token->getFirewallName() && $token->isAuthenticated() && (method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()) === $user) { + return; + } + } + + if (null !== $this->logger) { + $this->logger->debug('Trying to pre-authenticate user.', ['username' => (string) $user]); + } + + try { + $token = $this->authenticationManager->authenticate(new PreAuthenticatedToken($user, $credentials, $this->providerKey)); + + if (null !== $this->logger) { + $this->logger->info('Pre-authentication successful.', ['token' => (string) $token]); + } + + $this->migrateSession($request, $token); + + $this->tokenStorage->setToken($token); + + if (null !== $this->dispatcher) { + $loginEvent = new InteractiveLoginEvent($request, $token); + $this->dispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + } catch (AuthenticationException $e) { + $this->clearToken($e); + } + } + + /** + * Call this method if your authentication token is stored to a session. + * + * @final + */ + public function setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy) + { + $this->sessionStrategy = $sessionStrategy; + } + + /** + * Clears a PreAuthenticatedToken for this provider (if present). + */ + private function clearToken(AuthenticationException $exception) + { + $token = $this->tokenStorage->getToken(); + if ($token instanceof PreAuthenticatedToken && $this->providerKey === $token->getFirewallName()) { + $this->tokenStorage->setToken(null); + + if (null !== $this->logger) { + $this->logger->info('Cleared security token due to an exception.', ['exception' => $exception]); + } + } + } + + /** + * Gets the user and credentials from the Request. + * + * @return array An array composed of the user and the credentials + */ + abstract protected function getPreAuthenticatedData(Request $request); + + private function migrateSession(Request $request, TokenInterface $token) + { + if (!$this->sessionStrategy || !$request->hasSession() || !$request->hasPreviousSession()) { + return; + } + + $this->sessionStrategy->onAuthentication($request, $token); + } +} diff --git a/vendor/symfony/security-http/Firewall/AccessListener.php b/vendor/symfony/security-http/Firewall/AccessListener.php new file mode 100644 index 0000000..1ea6ee1 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AccessListener.php @@ -0,0 +1,143 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\NullToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; +use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; +use Symfony\Component\Security\Http\AccessMapInterface; +use Symfony\Component\Security\Http\Authentication\NoopAuthenticationManager; +use Symfony\Component\Security\Http\Event\LazyResponseEvent; + +/** + * AccessListener enforces access control rules. + * + * @author Fabien Potencier + * + * @final + */ +class AccessListener extends AbstractListener +{ + private $tokenStorage; + private $accessDecisionManager; + private $map; + private $authManager; + private $exceptionOnNoToken; + + public function __construct(TokenStorageInterface $tokenStorage, AccessDecisionManagerInterface $accessDecisionManager, AccessMapInterface $map, /*bool*/ $exceptionOnNoToken = true) + { + if ($exceptionOnNoToken instanceof AuthenticationManagerInterface) { + trigger_deprecation('symfony/security-http', '5.4', 'The $authManager argument of "%s" is deprecated.', __METHOD__); + $authManager = $exceptionOnNoToken; + $exceptionOnNoToken = \func_num_args() > 4 ? func_get_arg(4) : true; + } + + if (false !== $exceptionOnNoToken) { + trigger_deprecation('symfony/security-http', '5.4', 'Not setting the $exceptionOnNoToken argument of "%s" to "false" is deprecated.', __METHOD__); + } + + $this->tokenStorage = $tokenStorage; + $this->accessDecisionManager = $accessDecisionManager; + $this->map = $map; + $this->authManager = $authManager ?? (class_exists(AuthenticationManagerInterface::class) ? new NoopAuthenticationManager() : null); + $this->exceptionOnNoToken = $exceptionOnNoToken; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + [$attributes] = $this->map->getPatterns($request); + $request->attributes->set('_access_control_attributes', $attributes); + + if ($attributes && ( + (\defined(AuthenticatedVoter::class.'::IS_AUTHENTICATED_ANONYMOUSLY') ? [AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY] !== $attributes : true) + && [AuthenticatedVoter::PUBLIC_ACCESS] !== $attributes + )) { + return true; + } + + return null; + } + + /** + * Handles access authorization. + * + * @throws AccessDeniedException + * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token and $exceptionOnNoToken is set to true + */ + public function authenticate(RequestEvent $event) + { + if (!$event instanceof LazyResponseEvent && null === ($token = $this->tokenStorage->getToken()) && $this->exceptionOnNoToken) { + throw new AuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.'); + } + + $request = $event->getRequest(); + + $attributes = $request->attributes->get('_access_control_attributes'); + $request->attributes->remove('_access_control_attributes'); + + if (!$attributes || (( + (\defined(AuthenticatedVoter::class.'::IS_AUTHENTICATED_ANONYMOUSLY') ? [AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY] === $attributes : false) + || [AuthenticatedVoter::PUBLIC_ACCESS] === $attributes + ) && $event instanceof LazyResponseEvent)) { + return; + } + + if ($event instanceof LazyResponseEvent) { + $token = $this->tokenStorage->getToken(); + } + + if (null === $token) { + if ($this->exceptionOnNoToken) { + throw new AuthenticationCredentialsNotFoundException('A Token was not found in the TokenStorage.'); + } + + $token = new NullToken(); + } + + // @deprecated since Symfony 5.4 + if (method_exists($token, 'isAuthenticated') && !$token->isAuthenticated(false)) { + trigger_deprecation('symfony/core', '5.4', 'Returning false from "%s()" is deprecated, return null from "getUser()" instead.'); + + if ($this->authManager) { + $token = $this->authManager->authenticate($token); + $this->tokenStorage->setToken($token); + } + } + + if (!$this->accessDecisionManager->decide($token, $attributes, $request, true)) { + throw $this->createAccessDeniedException($request, $attributes); + } + } + + private function createAccessDeniedException(Request $request, array $attributes) + { + $exception = new AccessDeniedException(); + $exception->setAttributes($attributes); + $exception->setSubject($request); + + return $exception; + } + + public static function getPriority(): int + { + return -255; + } +} diff --git a/vendor/symfony/security-http/Firewall/AnonymousAuthenticationListener.php b/vendor/symfony/security-http/Firewall/AnonymousAuthenticationListener.php new file mode 100644 index 0000000..8f175ae --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AnonymousAuthenticationListener.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AnonymousAuthenticationListener::class); + +// Help opcache.preload discover always-needed symbols +class_exists(AnonymousToken::class); + +/** + * AnonymousAuthenticationListener automatically adds a Token if none is + * already present. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class AnonymousAuthenticationListener extends AbstractListener +{ + private $tokenStorage; + private $secret; + private $authenticationManager; + private $logger; + + public function __construct(TokenStorageInterface $tokenStorage, string $secret, LoggerInterface $logger = null, AuthenticationManagerInterface $authenticationManager = null) + { + $this->tokenStorage = $tokenStorage; + $this->secret = $secret; + $this->authenticationManager = $authenticationManager; + $this->logger = $logger; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return null; // always run authenticate() lazily with lazy firewalls + } + + /** + * Handles anonymous authentication. + */ + public function authenticate(RequestEvent $event) + { + if (null !== $this->tokenStorage->getToken()) { + return; + } + + try { + $token = new AnonymousToken($this->secret, 'anon.', []); + if (null !== $this->authenticationManager) { + $token = $this->authenticationManager->authenticate($token); + } + + $this->tokenStorage->setToken($token); + + if (null !== $this->logger) { + $this->logger->info('Populated the TokenStorage with an anonymous Token.'); + } + } catch (AuthenticationException $failed) { + if (null !== $this->logger) { + $this->logger->info('Anonymous authentication failed.', ['exception' => $failed]); + } + } + } +} diff --git a/vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php b/vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php new file mode 100644 index 0000000..408f80c --- /dev/null +++ b/vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Http\Authentication\AuthenticatorManagerInterface; + +/** + * Firewall authentication listener that delegates to the authenticator system. + * + * @author Wouter de Jong + */ +class AuthenticatorManagerListener extends AbstractListener +{ + private $authenticatorManager; + + public function __construct(AuthenticatorManagerInterface $authenticationManager) + { + $this->authenticatorManager = $authenticationManager; + } + + public function supports(Request $request): ?bool + { + return $this->authenticatorManager->supports($request); + } + + public function authenticate(RequestEvent $event): void + { + $request = $event->getRequest(); + $response = $this->authenticatorManager->authenticateRequest($request); + if (null === $response) { + return; + } + + $event->setResponse($response); + } +} diff --git a/vendor/symfony/security-http/Firewall/BasicAuthenticationListener.php b/vendor/symfony/security-http/Firewall/BasicAuthenticationListener.php new file mode 100644 index 0000000..8113e9f --- /dev/null +++ b/vendor/symfony/security-http/Firewall/BasicAuthenticationListener.php @@ -0,0 +1,132 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', AnonymousAuthenticationListener::class); + +/** + * BasicAuthenticationListener implements Basic HTTP authentication. + * + * @author Fabien Potencier + * + * @final + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class BasicAuthenticationListener extends AbstractListener +{ + private $tokenStorage; + private $authenticationManager; + private $providerKey; + private $authenticationEntryPoint; + private $logger; + private $ignoreFailure; + private $sessionStrategy; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, string $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint, LoggerInterface $logger = null) + { + if (empty($providerKey)) { + throw new \InvalidArgumentException('$providerKey must not be empty.'); + } + + $this->tokenStorage = $tokenStorage; + $this->authenticationManager = $authenticationManager; + $this->providerKey = $providerKey; + $this->authenticationEntryPoint = $authenticationEntryPoint; + $this->logger = $logger; + $this->ignoreFailure = false; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return null !== $request->headers->get('PHP_AUTH_USER'); + } + + /** + * Handles basic authentication. + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + if (null === $username = $request->headers->get('PHP_AUTH_USER')) { + return; + } + + if (null !== $token = $this->tokenStorage->getToken()) { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + if ($token instanceof UsernamePasswordToken && $token->isAuthenticated(false) && (method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()) === $username) { + return; + } + } + + if (null !== $this->logger) { + $this->logger->info('Basic authentication Authorization header found for user.', ['username' => $username]); + } + + try { + $token = $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $request->headers->get('PHP_AUTH_PW'), $this->providerKey)); + + $this->migrateSession($request, $token); + + $this->tokenStorage->setToken($token); + } catch (AuthenticationException $e) { + $token = $this->tokenStorage->getToken(); + if ($token instanceof UsernamePasswordToken && $this->providerKey === $token->getFirewallName()) { + $this->tokenStorage->setToken(null); + } + + if (null !== $this->logger) { + $this->logger->info('Basic authentication failed for user.', ['username' => $username, 'exception' => $e]); + } + + if ($this->ignoreFailure) { + return; + } + + $event->setResponse($this->authenticationEntryPoint->start($request, $e)); + } + } + + /** + * Call this method if your authentication token is stored to a session. + * + * @final + */ + public function setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy) + { + $this->sessionStrategy = $sessionStrategy; + } + + private function migrateSession(Request $request, TokenInterface $token) + { + if (!$this->sessionStrategy || !$request->hasSession() || !$request->hasPreviousSession()) { + return; + } + + $this->sessionStrategy->onAuthentication($request, $token); + } +} diff --git a/vendor/symfony/security-http/Firewall/ChannelListener.php b/vendor/symfony/security-http/Firewall/ChannelListener.php new file mode 100644 index 0000000..f466cdc --- /dev/null +++ b/vendor/symfony/security-http/Firewall/ChannelListener.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Http\AccessMapInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; + +/** + * ChannelListener switches the HTTP protocol based on the access control + * configuration. + * + * @author Fabien Potencier + * + * @final + */ +class ChannelListener extends AbstractListener +{ + private $map; + private $authenticationEntryPoint = null; + private $logger; + private $httpPort; + private $httpsPort; + + public function __construct(AccessMapInterface $map, /*LoggerInterface*/ $logger = null, /*int*/ $httpPort = 80, /*int*/ $httpsPort = 443) + { + if ($logger instanceof AuthenticationEntryPointInterface) { + trigger_deprecation('symfony/security-http', '5.4', 'The "$authenticationEntryPoint" argument of "%s()" is deprecated.', __METHOD__); + + $this->authenticationEntryPoint = $logger; + $nrOfArgs = \func_num_args(); + $logger = $nrOfArgs > 2 ? func_get_arg(2) : null; + $httpPort = $nrOfArgs > 3 ? func_get_arg(3) : 80; + $httpsPort = $nrOfArgs > 4 ? func_get_arg(4) : 443; + } + + if (null !== $logger && !$logger instanceof LoggerInterface) { + throw new \TypeError(sprintf('Argument "$logger" of "%s()" must be instance of "%s", "%s" given.', __METHOD__, LoggerInterface::class, get_debug_type($logger))); + } + + $this->map = $map; + $this->logger = $logger; + $this->httpPort = $httpPort; + $this->httpsPort = $httpsPort; + } + + /** + * Handles channel management. + */ + public function supports(Request $request): ?bool + { + [, $channel] = $this->map->getPatterns($request); + + if ('https' === $channel && !$request->isSecure()) { + if (null !== $this->logger) { + if ('https' === $request->headers->get('X-Forwarded-Proto')) { + $this->logger->info('Redirecting to HTTPS. ("X-Forwarded-Proto" header is set to "https" - did you set "trusted_proxies" correctly?)'); + } elseif (str_contains($request->headers->get('Forwarded', ''), 'proto=https')) { + $this->logger->info('Redirecting to HTTPS. ("Forwarded" header is set to "proto=https" - did you set "trusted_proxies" correctly?)'); + } else { + $this->logger->info('Redirecting to HTTPS.'); + } + } + + return true; + } + + if ('http' === $channel && $request->isSecure()) { + if (null !== $this->logger) { + $this->logger->info('Redirecting to HTTP.'); + } + + return true; + } + + return false; + } + + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + $event->setResponse($this->createRedirectResponse($request)); + } + + private function createRedirectResponse(Request $request): RedirectResponse + { + if (null !== $this->authenticationEntryPoint) { + return $this->authenticationEntryPoint->start($request); + } + + $scheme = $request->isSecure() ? 'http' : 'https'; + if ('http' === $scheme && 80 != $this->httpPort) { + $port = ':'.$this->httpPort; + } elseif ('https' === $scheme && 443 != $this->httpsPort) { + $port = ':'.$this->httpsPort; + } else { + $port = ''; + } + + $qs = $request->getQueryString(); + if (null !== $qs) { + $qs = '?'.$qs; + } + + $url = $scheme.'://'.$request->getHost().$port.$request->getBaseUrl().$request->getPathInfo().$qs; + + return new RedirectResponse($url, 301); + } +} diff --git a/vendor/symfony/security-http/Firewall/ContextListener.php b/vendor/symfony/security-http/Firewall/ContextListener.php new file mode 100644 index 0000000..e09af80 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/ContextListener.php @@ -0,0 +1,402 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\Event; +use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; +use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\EquatableInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Event\DeauthenticatedEvent; +use Symfony\Component\Security\Http\Event\TokenDeauthenticatedEvent; +use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * ContextListener manages the SecurityContext persistence through a session. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @final + */ +class ContextListener extends AbstractListener +{ + private $tokenStorage; + private $sessionKey; + private $logger; + private $userProviders; + private $dispatcher; + private $registered; + private $trustResolver; + private $rememberMeServices; + private $sessionTrackerEnabler; + + /** + * @param iterable $userProviders + */ + public function __construct(TokenStorageInterface $tokenStorage, iterable $userProviders, string $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, AuthenticationTrustResolverInterface $trustResolver = null, callable $sessionTrackerEnabler = null) + { + if (empty($contextKey)) { + throw new \InvalidArgumentException('$contextKey must not be empty.'); + } + + $this->tokenStorage = $tokenStorage; + $this->userProviders = $userProviders; + $this->sessionKey = '_security_'.$contextKey; + $this->logger = $logger; + $this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher; + + $this->trustResolver = $trustResolver ?? new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class); + $this->sessionTrackerEnabler = $sessionTrackerEnabler; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return null; // always run authenticate() lazily with lazy firewalls + } + + /** + * Reads the Security Token from the session. + */ + public function authenticate(RequestEvent $event) + { + if (!$this->registered && null !== $this->dispatcher && $event->isMainRequest()) { + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']); + $this->registered = true; + } + + $request = $event->getRequest(); + $session = $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null; + + $request->attributes->set('_security_firewall_run', $this->sessionKey); + + if (null !== $session) { + $usageIndexValue = $session instanceof Session ? $usageIndexReference = &$session->getUsageIndex() : 0; + $usageIndexReference = \PHP_INT_MIN; + $sessionId = $request->cookies->all()[$session->getName()] ?? null; + $token = $session->get($this->sessionKey); + + // sessionId = true is used in the tests + if ($this->sessionTrackerEnabler && \in_array($sessionId, [true, $session->getId()], true)) { + $usageIndexReference = $usageIndexValue; + } else { + $usageIndexReference = $usageIndexReference - \PHP_INT_MIN + $usageIndexValue; + } + } + + if (null === $session || null === $token) { + if ($this->sessionTrackerEnabler) { + ($this->sessionTrackerEnabler)(); + } + + $this->tokenStorage->setToken(null); + + return; + } + + $token = $this->safelyUnserialize($token); + + if (null !== $this->logger) { + $this->logger->debug('Read existing security token from the session.', [ + 'key' => $this->sessionKey, + 'token_class' => \is_object($token) ? \get_class($token) : null, + ]); + } + + if ($token instanceof TokenInterface) { + $originalToken = $token; + $token = $this->refreshUser($token); + + if (!$token) { + if ($this->logger) { + $this->logger->debug('Token was deauthenticated after trying to refresh it.'); + } + + if ($this->dispatcher) { + $this->dispatcher->dispatch(new TokenDeauthenticatedEvent($originalToken, $request)); + } + + if ($this->rememberMeServices) { + $this->rememberMeServices->loginFail($request); + } + } + } elseif (null !== $token) { + if (null !== $this->logger) { + $this->logger->warning('Expected a security token from the session, got something else.', ['key' => $this->sessionKey, 'received' => $token]); + } + + $token = null; + } + + if ($this->sessionTrackerEnabler) { + ($this->sessionTrackerEnabler)(); + } + + $this->tokenStorage->setToken($token); + } + + /** + * Writes the security token into the session. + */ + public function onKernelResponse(ResponseEvent $event) + { + if (!$event->isMainRequest()) { + return; + } + + $request = $event->getRequest(); + + if (!$request->hasSession() || $request->attributes->get('_security_firewall_run') !== $this->sessionKey) { + return; + } + + if ($this->dispatcher) { + $this->dispatcher->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']); + } + $this->registered = false; + $session = $request->getSession(); + $sessionId = $session->getId(); + $usageIndexValue = $session instanceof Session ? $usageIndexReference = &$session->getUsageIndex() : null; + $token = $this->tokenStorage->getToken(); + + // @deprecated always use isAuthenticated() in 6.0 + $notAuthenticated = method_exists($this->trustResolver, 'isAuthenticated') ? !$this->trustResolver->isAuthenticated($token) : (null === $token || $this->trustResolver->isAnonymous($token)); + if ($notAuthenticated) { + if ($request->hasPreviousSession()) { + $session->remove($this->sessionKey); + } + } else { + $session->set($this->sessionKey, serialize($token)); + + if (null !== $this->logger) { + $this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]); + } + } + + if ($this->sessionTrackerEnabler && $session->getId() === $sessionId) { + $usageIndexReference = $usageIndexValue; + } + } + + /** + * Refreshes the user by reloading it from the user provider. + * + * @throws \RuntimeException + */ + protected function refreshUser(TokenInterface $token): ?TokenInterface + { + $user = $token->getUser(); + if (!$user instanceof UserInterface) { + return $token; + } + + $userNotFoundByProvider = false; + $userDeauthenticated = false; + $userClass = \get_class($user); + + foreach ($this->userProviders as $provider) { + if (!$provider instanceof UserProviderInterface) { + throw new \InvalidArgumentException(sprintf('User provider "%s" must implement "%s".', get_debug_type($provider), UserProviderInterface::class)); + } + + if (!$provider->supportsClass($userClass)) { + continue; + } + + try { + $refreshedUser = $provider->refreshUser($user); + $newToken = clone $token; + $newToken->setUser($refreshedUser, false); + + // tokens can be deauthenticated if the user has been changed. + if ($token instanceof AbstractToken && $this->hasUserChanged($user, $newToken)) { + $userDeauthenticated = true; + // @deprecated since Symfony 5.4 + if (method_exists($newToken, 'setAuthenticated')) { + $newToken->setAuthenticated(false, false); + } + + if (null !== $this->logger) { + // @deprecated since Symfony 5.3, change to $refreshedUser->getUserIdentifier() in 6.0 + $this->logger->debug('Cannot refresh token because user has changed.', ['username' => method_exists($refreshedUser, 'getUserIdentifier') ? $refreshedUser->getUserIdentifier() : $refreshedUser->getUsername(), 'provider' => \get_class($provider)]); + } + + continue; + } + + $token->setUser($refreshedUser); + + if (null !== $this->logger) { + // @deprecated since Symfony 5.3, change to $refreshedUser->getUserIdentifier() in 6.0 + $context = ['provider' => \get_class($provider), 'username' => method_exists($refreshedUser, 'getUserIdentifier') ? $refreshedUser->getUserIdentifier() : $refreshedUser->getUsername()]; + + if ($token instanceof SwitchUserToken) { + $originalToken = $token->getOriginalToken(); + // @deprecated since Symfony 5.3, change to $originalToken->getUserIdentifier() in 6.0 + $context['impersonator_username'] = method_exists($originalToken, 'getUserIdentifier') ? $originalToken->getUserIdentifier() : $originalToken->getUsername(); + } + + $this->logger->debug('User was reloaded from a user provider.', $context); + } + + return $token; + } catch (UnsupportedUserException $e) { + // let's try the next user provider + } catch (UserNotFoundException $e) { + if (null !== $this->logger) { + $this->logger->warning('Username could not be found in the selected user provider.', ['username' => method_exists($e, 'getUserIdentifier') ? $e->getUserIdentifier() : $e->getUsername(), 'provider' => \get_class($provider)]); + } + + $userNotFoundByProvider = true; + } + } + + if ($userDeauthenticated) { + // @deprecated since Symfony 5.4 + if ($this->dispatcher) { + $this->dispatcher->dispatch(new DeauthenticatedEvent($token, $newToken, false), DeauthenticatedEvent::class); + } + + return null; + } + + if ($userNotFoundByProvider) { + return null; + } + + throw new \RuntimeException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', $userClass)); + } + + private function safelyUnserialize(string $serializedToken) + { + $token = null; + $prevUnserializeHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); + $prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler) { + if (__FILE__ === $file) { + throw new \ErrorException($msg, 0x37313BC, $type, $file, $line); + } + + return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false; + }); + + try { + $token = unserialize($serializedToken); + } catch (\ErrorException $e) { + if (0x37313BC !== $e->getCode()) { + throw $e; + } + if ($this->logger) { + $this->logger->warning('Failed to unserialize the security token from the session.', ['key' => $this->sessionKey, 'received' => $serializedToken, 'exception' => $e]); + } + } finally { + restore_error_handler(); + ini_set('unserialize_callback_func', $prevUnserializeHandler); + } + + return $token; + } + + /** + * @param string|\Stringable|UserInterface $originalUser + */ + private static function hasUserChanged($originalUser, TokenInterface $refreshedToken): bool + { + $refreshedUser = $refreshedToken->getUser(); + + if ($originalUser instanceof UserInterface) { + if (!$refreshedUser instanceof UserInterface) { + return true; + } else { + // noop + } + } elseif ($refreshedUser instanceof UserInterface) { + return true; + } else { + return (string) $originalUser !== (string) $refreshedUser; + } + + if ($originalUser instanceof EquatableInterface) { + return !(bool) $originalUser->isEqualTo($refreshedUser); + } + + // @deprecated since Symfony 5.3, check for PasswordAuthenticatedUserInterface on both user objects before comparing passwords + if ($originalUser->getPassword() !== $refreshedUser->getPassword()) { + return true; + } + + // @deprecated since Symfony 5.3, check for LegacyPasswordAuthenticatedUserInterface on both user objects before comparing salts + if ($originalUser->getSalt() !== $refreshedUser->getSalt()) { + return true; + } + + $userRoles = array_map('strval', (array) $refreshedUser->getRoles()); + + if ($refreshedToken instanceof SwitchUserToken) { + $userRoles[] = 'ROLE_PREVIOUS_ADMIN'; + } + + if ( + \count($userRoles) !== \count($refreshedToken->getRoleNames()) || + \count($userRoles) !== \count(array_intersect($userRoles, $refreshedToken->getRoleNames())) + ) { + return true; + } + + // @deprecated since Symfony 5.3, drop getUsername() in 6.0 + $userIdentifier = function ($refreshedUser) { + return method_exists($refreshedUser, 'getUserIdentifier') ? $refreshedUser->getUserIdentifier() : $refreshedUser->getUsername(); + }; + if ($userIdentifier($originalUser) !== $userIdentifier($refreshedUser)) { + return true; + } + + return false; + } + + /** + * @internal + */ + public static function handleUnserializeCallback(string $class) + { + throw new \ErrorException('Class not found: '.$class, 0x37313BC); + } + + /** + * @deprecated since Symfony 5.4 + */ + public function setRememberMeServices(RememberMeServicesInterface $rememberMeServices) + { + trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use the new remember me handlers instead.', __METHOD__); + + $this->rememberMeServices = $rememberMeServices; + } +} diff --git a/vendor/symfony/security-http/Firewall/ExceptionListener.php b/vendor/symfony/security-http/Firewall/ExceptionListener.php new file mode 100644 index 0000000..32a1b60 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/ExceptionListener.php @@ -0,0 +1,250 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException; +use Symfony\Component\Security\Core\Exception\LazyResponseException; +use Symfony\Component\Security\Core\Exception\LogoutException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; +use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\Util\TargetPathTrait; + +/** + * ExceptionListener catches authentication exception and converts them to + * Response instances. + * + * @author Fabien Potencier + * + * @final + */ +class ExceptionListener +{ + use TargetPathTrait; + + private $tokenStorage; + private $firewallName; + private $accessDeniedHandler; + private $authenticationEntryPoint; + private $authenticationTrustResolver; + private $errorPage; + private $logger; + private $httpUtils; + private $stateless; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, string $firewallName, AuthenticationEntryPointInterface $authenticationEntryPoint = null, string $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null, bool $stateless = false) + { + $this->tokenStorage = $tokenStorage; + $this->accessDeniedHandler = $accessDeniedHandler; + $this->httpUtils = $httpUtils; + $this->firewallName = $firewallName; + $this->authenticationEntryPoint = $authenticationEntryPoint; + $this->authenticationTrustResolver = $trustResolver; + $this->errorPage = $errorPage; + $this->logger = $logger; + $this->stateless = $stateless; + } + + /** + * Registers a onKernelException listener to take care of security exceptions. + */ + public function register(EventDispatcherInterface $dispatcher) + { + $dispatcher->addListener(KernelEvents::EXCEPTION, [$this, 'onKernelException'], 1); + } + + /** + * Unregisters the dispatcher. + */ + public function unregister(EventDispatcherInterface $dispatcher) + { + $dispatcher->removeListener(KernelEvents::EXCEPTION, [$this, 'onKernelException']); + } + + /** + * Handles security related exceptions. + */ + public function onKernelException(ExceptionEvent $event) + { + $exception = $event->getThrowable(); + do { + if ($exception instanceof AuthenticationException) { + $this->handleAuthenticationException($event, $exception); + + return; + } + + if ($exception instanceof AccessDeniedException) { + $this->handleAccessDeniedException($event, $exception); + + return; + } + + if ($exception instanceof LazyResponseException) { + $event->setResponse($exception->getResponse()); + + return; + } + + if ($exception instanceof LogoutException) { + $this->handleLogoutException($event, $exception); + + return; + } + } while (null !== $exception = $exception->getPrevious()); + } + + private function handleAuthenticationException(ExceptionEvent $event, AuthenticationException $exception): void + { + if (null !== $this->logger) { + $this->logger->info('An AuthenticationException was thrown; redirecting to authentication entry point.', ['exception' => $exception]); + } + + try { + $event->setResponse($this->startAuthentication($event->getRequest(), $exception)); + $event->allowCustomResponseCode(); + } catch (\Exception $e) { + $event->setThrowable($e); + } + } + + private function handleAccessDeniedException(ExceptionEvent $event, AccessDeniedException $exception) + { + $event->setThrowable(new AccessDeniedHttpException($exception->getMessage(), $exception)); + + $token = $this->tokenStorage->getToken(); + if (!$this->authenticationTrustResolver->isFullFledged($token)) { + if (null !== $this->logger) { + $this->logger->debug('Access denied, the user is not fully authenticated; redirecting to authentication entry point.', ['exception' => $exception]); + } + + try { + $insufficientAuthenticationException = new InsufficientAuthenticationException('Full authentication is required to access this resource.', 0, $exception); + if (null !== $token) { + $insufficientAuthenticationException->setToken($token); + } + + $event->setResponse($this->startAuthentication($event->getRequest(), $insufficientAuthenticationException)); + } catch (\Exception $e) { + $event->setThrowable($e); + } + + return; + } + + if (null !== $this->logger) { + $this->logger->debug('Access denied, the user is neither anonymous, nor remember-me.', ['exception' => $exception]); + } + + try { + if (null !== $this->accessDeniedHandler) { + $response = $this->accessDeniedHandler->handle($event->getRequest(), $exception); + + if ($response instanceof Response) { + $event->setResponse($response); + } + } elseif (null !== $this->errorPage) { + $subRequest = $this->httpUtils->createRequest($event->getRequest(), $this->errorPage); + $subRequest->attributes->set(Security::ACCESS_DENIED_ERROR, $exception); + + $event->setResponse($event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true)); + $event->allowCustomResponseCode(); + } + } catch (\Exception $e) { + if (null !== $this->logger) { + $this->logger->error('An exception was thrown when handling an AccessDeniedException.', ['exception' => $e]); + } + + $event->setThrowable(new \RuntimeException('Exception thrown when handling an exception.', 0, $e)); + } + } + + private function handleLogoutException(ExceptionEvent $event, LogoutException $exception): void + { + $event->setThrowable(new AccessDeniedHttpException($exception->getMessage(), $exception)); + + if (null !== $this->logger) { + $this->logger->info('A LogoutException was thrown; wrapping with AccessDeniedHttpException', ['exception' => $exception]); + } + } + + private function startAuthentication(Request $request, AuthenticationException $authException): Response + { + if (null === $this->authenticationEntryPoint) { + $this->throwUnauthorizedException($authException); + } + + if (null !== $this->logger) { + $this->logger->debug('Calling Authentication entry point.'); + } + + if (!$this->stateless) { + $this->setTargetPath($request); + } + + if ($authException instanceof AccountStatusException) { + // remove the security token to prevent infinite redirect loops + $this->tokenStorage->setToken(null); + + if (null !== $this->logger) { + $this->logger->info('The security token was removed due to an AccountStatusException.', ['exception' => $authException]); + } + } + + try { + $response = $this->authenticationEntryPoint->start($request, $authException); + } catch (NotAnEntryPointException $e) { + $this->throwUnauthorizedException($authException); + } + + if (!$response instanceof Response) { + $given = get_debug_type($response); + + throw new \LogicException(sprintf('The "%s::start()" method must return a Response object ("%s" returned).', get_debug_type($this->authenticationEntryPoint), $given)); + } + + return $response; + } + + protected function setTargetPath(Request $request) + { + // session isn't required when using HTTP basic authentication mechanism for example + if ($request->hasSession() && $request->isMethodSafe() && !$request->isXmlHttpRequest()) { + $this->saveTargetPath($request->getSession(), $this->firewallName, $request->getUri()); + } + } + + private function throwUnauthorizedException(AuthenticationException $authException) + { + if (null !== $this->logger) { + $this->logger->notice(sprintf('No Authentication entry point configured, returning a %s HTTP response. Configure "entry_point" on the firewall "%s" if you want to modify the response.', Response::HTTP_UNAUTHORIZED, $this->firewallName)); + } + + throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, [], $authException->getCode()); + } +} diff --git a/vendor/symfony/security-http/Firewall/FirewallListenerInterface.php b/vendor/symfony/security-http/Firewall/FirewallListenerInterface.php new file mode 100644 index 0000000..485d767 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/FirewallListenerInterface.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; + +/** + * Can be implemented by firewall listeners. + * + * @author Christian Scheb + * @author Nicolas Grekas + * @author Robin Chalas + */ +interface FirewallListenerInterface +{ + /** + * Tells whether the authenticate() method should be called or not depending on the incoming request. + * + * Returning null means authenticate() can be called lazily when accessing the token storage. + */ + public function supports(Request $request): ?bool; + + /** + * Does whatever is required to authenticate the request, typically calling $event->setResponse() internally. + */ + public function authenticate(RequestEvent $event); + + /** + * Defines the priority of the listener. + * The higher the number, the earlier a listener is executed. + */ + public static function getPriority(): int; +} diff --git a/vendor/symfony/security-http/Firewall/LogoutListener.php b/vendor/symfony/security-http/Firewall/LogoutListener.php new file mode 100644 index 0000000..69af6d8 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/LogoutListener.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\LogicException; +use Symfony\Component\Security\Core\Exception\LogoutException; +use Symfony\Component\Security\Csrf\CsrfToken; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Component\Security\Http\Event\LogoutEvent; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface; +use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; +use Symfony\Component\Security\Http\ParameterBagUtils; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * LogoutListener logout users. + * + * @author Fabien Potencier + * + * @final + */ +class LogoutListener extends AbstractListener +{ + private $tokenStorage; + private $options; + private $httpUtils; + private $csrfTokenManager; + private $eventDispatcher; + + /** + * @param EventDispatcherInterface $eventDispatcher + * @param array $options An array of options to process a logout attempt + */ + public function __construct(TokenStorageInterface $tokenStorage, HttpUtils $httpUtils, $eventDispatcher, array $options = [], CsrfTokenManagerInterface $csrfTokenManager = null) + { + if (!$eventDispatcher instanceof EventDispatcherInterface) { + trigger_deprecation('symfony/security-http', '5.1', 'Passing a logout success handler to "%s" is deprecated, pass an instance of "%s" instead.', __METHOD__, EventDispatcherInterface::class); + + if (!$eventDispatcher instanceof LogoutSuccessHandlerInterface) { + throw new \TypeError(sprintf('Argument 3 of "%s" must be instance of "%s" or "%s", "%s" given.', __METHOD__, EventDispatcherInterface::class, LogoutSuccessHandlerInterface::class, get_debug_type($eventDispatcher))); + } + + $successHandler = $eventDispatcher; + $eventDispatcher = new EventDispatcher(); + $eventDispatcher->addListener(LogoutEvent::class, function (LogoutEvent $event) use ($successHandler) { + $event->setResponse($r = $successHandler->onLogoutSuccess($event->getRequest())); + }); + } + + $this->tokenStorage = $tokenStorage; + $this->httpUtils = $httpUtils; + $this->options = array_merge([ + 'csrf_parameter' => '_csrf_token', + 'csrf_token_id' => 'logout', + 'logout_path' => '/logout', + ], $options); + $this->csrfTokenManager = $csrfTokenManager; + $this->eventDispatcher = $eventDispatcher; + } + + /** + * @deprecated since Symfony 5.1 + */ + public function addHandler(LogoutHandlerInterface $handler) + { + trigger_deprecation('symfony/security-http', '5.1', 'Calling "%s" is deprecated, register a listener on the "%s" event instead.', __METHOD__, LogoutEvent::class); + + $this->eventDispatcher->addListener(LogoutEvent::class, function (LogoutEvent $event) use ($handler) { + if (null === $event->getResponse()) { + throw new LogicException(sprintf('No response was set for this logout action. Make sure the DefaultLogoutListener or another listener has set the response before "%s" is called.', __CLASS__)); + } + + $handler->logout($event->getRequest(), $event->getResponse(), $event->getToken()); + }); + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return $this->requiresLogout($request); + } + + /** + * Performs the logout if requested. + * + * If a CsrfTokenManagerInterface instance is available, it will be used to + * validate the request. + * + * @throws LogoutException if the CSRF token is invalid + * @throws \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + if (null !== $this->csrfTokenManager) { + $csrfToken = ParameterBagUtils::getRequestParameterValue($request, $this->options['csrf_parameter']); + + if (!\is_string($csrfToken) || false === $this->csrfTokenManager->isTokenValid(new CsrfToken($this->options['csrf_token_id'], $csrfToken))) { + throw new LogoutException('Invalid CSRF token.'); + } + } + + $logoutEvent = new LogoutEvent($request, $this->tokenStorage->getToken()); + $this->eventDispatcher->dispatch($logoutEvent); + + $response = $logoutEvent->getResponse(); + if (!$response instanceof Response) { + throw new \RuntimeException('No logout listener set the Response, make sure at least the DefaultLogoutListener is registered.'); + } + + $this->tokenStorage->setToken(null); + + $event->setResponse($response); + } + + /** + * Whether this request is asking for logout. + * + * The default implementation only processed requests to a specific path, + * but a subclass could change this to logout requests where + * certain parameters is present. + */ + protected function requiresLogout(Request $request): bool + { + return isset($this->options['logout_path']) && $this->httpUtils->checkRequestPath($request, $this->options['logout_path']); + } + + public static function getPriority(): int + { + return -127; + } +} diff --git a/vendor/symfony/security-http/Firewall/RememberMeListener.php b/vendor/symfony/security-http/Firewall/RememberMeListener.php new file mode 100644 index 0000000..fe59505 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/RememberMeListener.php @@ -0,0 +1,130 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', RememberMeListener::class); + +/** + * RememberMeListener implements authentication capabilities via a cookie. + * + * @author Johannes M. Schmitt + * + * @final + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class RememberMeListener extends AbstractListener +{ + private $tokenStorage; + private $rememberMeServices; + private $authenticationManager; + private $logger; + private $dispatcher; + private $catchExceptions = true; + private $sessionStrategy; + + public function __construct(TokenStorageInterface $tokenStorage, RememberMeServicesInterface $rememberMeServices, AuthenticationManagerInterface $authenticationManager, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, bool $catchExceptions = true, SessionAuthenticationStrategyInterface $sessionStrategy = null) + { + $this->tokenStorage = $tokenStorage; + $this->rememberMeServices = $rememberMeServices; + $this->authenticationManager = $authenticationManager; + $this->logger = $logger; + $this->dispatcher = $dispatcher; + $this->catchExceptions = $catchExceptions; + $this->sessionStrategy = $sessionStrategy ?? new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE); + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + return null; // always run authenticate() lazily with lazy firewalls + } + + /** + * Handles remember-me cookie based authentication. + */ + public function authenticate(RequestEvent $event) + { + if (null !== $this->tokenStorage->getToken()) { + return; + } + + $request = $event->getRequest(); + try { + if (null === $token = $this->rememberMeServices->autoLogin($request)) { + return; + } + } catch (AuthenticationException $e) { + if (null !== $this->logger) { + $this->logger->warning( + 'The token storage was not populated with remember-me token as the' + .' RememberMeServices was not able to create a token from the remember' + .' me information.', ['exception' => $e] + ); + } + + $this->rememberMeServices->loginFail($request); + + if (!$this->catchExceptions) { + throw $e; + } + + return; + } + + try { + $token = $this->authenticationManager->authenticate($token); + if ($request->hasSession() && $request->getSession()->isStarted()) { + $this->sessionStrategy->onAuthentication($request, $token); + } + $this->tokenStorage->setToken($token); + + if (null !== $this->dispatcher) { + $loginEvent = new InteractiveLoginEvent($request, $token); + $this->dispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + + if (null !== $this->logger) { + $this->logger->debug('Populated the token storage with a remember-me token.'); + } + } catch (AuthenticationException $e) { + if (null !== $this->logger) { + $this->logger->warning( + 'The token storage was not populated with remember-me token as the' + .' AuthenticationManager rejected the AuthenticationToken returned' + .' by the RememberMeServices.', ['exception' => $e] + ); + } + + $this->rememberMeServices->loginFail($request, $e); + + if (!$this->catchExceptions) { + throw $e; + } + } + } +} diff --git a/vendor/symfony/security-http/Firewall/RemoteUserAuthenticationListener.php b/vendor/symfony/security-http/Firewall/RemoteUserAuthenticationListener.php new file mode 100644 index 0000000..d4b0389 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/RemoteUserAuthenticationListener.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', RemoteUserAuthenticationListener::class); + +/** + * REMOTE_USER authentication listener. + * + * @author Fabien Potencier + * @author Maxime Douailin + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class RemoteUserAuthenticationListener extends AbstractPreAuthenticatedListener +{ + private $userKey; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, string $providerKey, string $userKey = 'REMOTE_USER', LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) + { + parent::__construct($tokenStorage, $authenticationManager, $providerKey, $logger, $dispatcher); + + $this->userKey = $userKey; + } + + /** + * {@inheritdoc} + */ + protected function getPreAuthenticatedData(Request $request) + { + if (!$request->server->has($this->userKey)) { + throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey)); + } + + return [$request->server->get($this->userKey), null]; + } +} diff --git a/vendor/symfony/security-http/Firewall/SwitchUserListener.php b/vendor/symfony/security-http/Firewall/SwitchUserListener.php new file mode 100644 index 0000000..250d9ef --- /dev/null +++ b/vendor/symfony/security-http/Firewall/SwitchUserListener.php @@ -0,0 +1,235 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Event\SwitchUserEvent; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +/** + * SwitchUserListener allows a user to impersonate another one temporarily + * (like the Unix su command). + * + * @author Fabien Potencier + * + * @final + */ +class SwitchUserListener extends AbstractListener +{ + public const EXIT_VALUE = '_exit'; + + private $tokenStorage; + private $provider; + private $userChecker; + private $firewallName; + private $accessDecisionManager; + private $usernameParameter; + private $role; + private $logger; + private $dispatcher; + private $stateless; + + public function __construct(TokenStorageInterface $tokenStorage, UserProviderInterface $provider, UserCheckerInterface $userChecker, string $firewallName, AccessDecisionManagerInterface $accessDecisionManager, LoggerInterface $logger = null, string $usernameParameter = '_switch_user', string $role = 'ROLE_ALLOWED_TO_SWITCH', EventDispatcherInterface $dispatcher = null, bool $stateless = false) + { + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + + $this->tokenStorage = $tokenStorage; + $this->provider = $provider; + $this->userChecker = $userChecker; + $this->firewallName = $firewallName; + $this->accessDecisionManager = $accessDecisionManager; + $this->usernameParameter = $usernameParameter; + $this->role = $role; + $this->logger = $logger; + $this->dispatcher = $dispatcher; + $this->stateless = $stateless; + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + // usernames can be falsy + $username = $request->get($this->usernameParameter); + + if (null === $username || '' === $username) { + $username = $request->headers->get($this->usernameParameter); + } + + // if it's still "empty", nothing to do. + if (null === $username || '' === $username) { + return false; + } + + $request->attributes->set('_switch_user_username', $username); + + return true; + } + + /** + * Handles the switch to another user. + * + * @throws \LogicException if switching to a user failed + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + + $username = $request->attributes->get('_switch_user_username'); + $request->attributes->remove('_switch_user_username'); + + if (null === $this->tokenStorage->getToken()) { + throw new AuthenticationCredentialsNotFoundException('Could not find original Token object.'); + } + + if (self::EXIT_VALUE === $username) { + $this->tokenStorage->setToken($this->attemptExitUser($request)); + } else { + try { + $this->tokenStorage->setToken($this->attemptSwitchUser($request, $username)); + } catch (AuthenticationException $e) { + // Generate 403 in any conditions to prevent user enumeration vulnerabilities + throw new AccessDeniedException('Switch User failed: '.$e->getMessage(), $e); + } + } + + if (!$this->stateless) { + $request->query->remove($this->usernameParameter); + $request->server->set('QUERY_STRING', http_build_query($request->query->all(), '', '&')); + $response = new RedirectResponse($request->getUri(), 302); + + $event->setResponse($response); + } + } + + /** + * Attempts to switch to another user and returns the new token if successfully switched. + * + * @throws \LogicException + * @throws AccessDeniedException + */ + private function attemptSwitchUser(Request $request, string $username): ?TokenInterface + { + $token = $this->tokenStorage->getToken(); + $originalToken = $this->getOriginalToken($token); + + if (null !== $originalToken) { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + if ((method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()) === $username) { + return $token; + } + + // User already switched, exit before seamlessly switching to another user + $token = $this->attemptExitUser($request); + } + + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + $currentUsername = method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername(); + $nonExistentUsername = '_'.md5(random_bytes(8).$username); + + // To protect against user enumeration via timing measurements + // we always load both successfully and unsuccessfully + $methodName = 'loadUserByIdentifier'; + if (!method_exists($this->provider, $methodName)) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->provider)); + + $methodName = 'loadUserByUsername'; + } + try { + $user = $this->provider->$methodName($username); + + try { + $this->provider->$methodName($nonExistentUsername); + } catch (\Exception $e) { + } + } catch (AuthenticationException $e) { + $this->provider->$methodName($currentUsername); + + throw $e; + } + + if (false === $this->accessDecisionManager->decide($token, [$this->role], $user)) { + $exception = new AccessDeniedException(); + $exception->setAttributes($this->role); + + throw $exception; + } + + if (null !== $this->logger) { + $this->logger->info('Attempting to switch to user.', ['username' => $username]); + } + + $this->userChecker->checkPostAuth($user); + + $roles = $user->getRoles(); + $roles[] = 'ROLE_PREVIOUS_ADMIN'; + $originatedFromUri = str_replace('/&', '/?', preg_replace('#[&?]'.$this->usernameParameter.'=[^&]*#', '', $request->getRequestUri())); + $token = new SwitchUserToken($user, $this->firewallName, $roles, $token, $originatedFromUri); + + if (null !== $this->dispatcher) { + $switchEvent = new SwitchUserEvent($request, $token->getUser(), $token); + $this->dispatcher->dispatch($switchEvent, SecurityEvents::SWITCH_USER); + // use the token from the event in case any listeners have replaced it. + $token = $switchEvent->getToken(); + } + + return $token; + } + + /** + * Attempts to exit from an already switched user and returns the original token. + * + * @throws AuthenticationCredentialsNotFoundException + */ + private function attemptExitUser(Request $request): TokenInterface + { + if (null === ($currentToken = $this->tokenStorage->getToken()) || null === $original = $this->getOriginalToken($currentToken)) { + throw new AuthenticationCredentialsNotFoundException('Could not find original Token object.'); + } + + if (null !== $this->dispatcher && $original->getUser() instanceof UserInterface) { + $user = $this->provider->refreshUser($original->getUser()); + $original->setUser($user); + $switchEvent = new SwitchUserEvent($request, $user, $original); + $this->dispatcher->dispatch($switchEvent, SecurityEvents::SWITCH_USER); + $original = $switchEvent->getToken(); + } + + return $original; + } + + private function getOriginalToken(TokenInterface $token): ?TokenInterface + { + if ($token instanceof SwitchUserToken) { + return $token->getOriginalToken(); + } + + return null; + } +} diff --git a/vendor/symfony/security-http/Firewall/UsernamePasswordFormAuthenticationListener.php b/vendor/symfony/security-http/Firewall/UsernamePasswordFormAuthenticationListener.php new file mode 100644 index 0000000..ad98464 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Csrf\CsrfToken; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\ParameterBagUtils; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', UsernamePasswordFormAuthenticationListener::class); + +/** + * UsernamePasswordFormAuthenticationListener is the default implementation of + * an authentication via a simple form composed of a username and a password. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationListener +{ + private $csrfTokenManager; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfTokenManagerInterface $csrfTokenManager = null) + { + parent::__construct($tokenStorage, $authenticationManager, $sessionStrategy, $httpUtils, $providerKey, $successHandler, $failureHandler, array_merge([ + 'username_parameter' => '_username', + 'password_parameter' => '_password', + 'csrf_parameter' => '_csrf_token', + 'csrf_token_id' => 'authenticate', + 'post_only' => true, + ], $options), $logger, $dispatcher); + + $this->csrfTokenManager = $csrfTokenManager; + } + + /** + * {@inheritdoc} + */ + protected function requiresAuthentication(Request $request) + { + if ($this->options['post_only'] && !$request->isMethod('POST')) { + return false; + } + + return parent::requiresAuthentication($request); + } + + /** + * {@inheritdoc} + */ + protected function attemptAuthentication(Request $request) + { + if (null !== $this->csrfTokenManager) { + $csrfToken = ParameterBagUtils::getRequestParameterValue($request, $this->options['csrf_parameter']); + + if (!\is_string($csrfToken) || false === $this->csrfTokenManager->isTokenValid(new CsrfToken($this->options['csrf_token_id'], $csrfToken))) { + throw new InvalidCsrfTokenException('Invalid CSRF token.'); + } + } + + if ($this->options['post_only']) { + $username = ParameterBagUtils::getParameterBagValue($request->request, $this->options['username_parameter']); + $password = ParameterBagUtils::getParameterBagValue($request->request, $this->options['password_parameter']); + } else { + $username = ParameterBagUtils::getRequestParameterValue($request, $this->options['username_parameter']); + $password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']); + } + + if (!\is_string($username) && (!\is_object($username) || !method_exists($username, '__toString'))) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], get_debug_type($username))); + } + + $username = trim($username); + + if (\strlen($username) > Security::MAX_USERNAME_LENGTH) { + throw new BadCredentialsException('Invalid username.'); + } + + if (null === $password) { + throw new \LogicException(sprintf('The key "%s" cannot be null; check that the password field name of the form matches.', $this->options['password_parameter'])); + } + + $request->getSession()->set(Security::LAST_USERNAME, $username); + + return $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $password, $this->providerKey)); + } +} diff --git a/vendor/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php b/vendor/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php new file mode 100644 index 0000000..9679b33 --- /dev/null +++ b/vendor/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php @@ -0,0 +1,235 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\RequestEvent; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\PropertyAccess\Exception\AccessException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; +use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\SecurityEvents; +use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', UsernamePasswordJsonAuthenticationListener::class); + +/** + * UsernamePasswordJsonAuthenticationListener is a stateless implementation of + * an authentication via a JSON document composed of a username and a password. + * + * @author Kévin Dunglas + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class UsernamePasswordJsonAuthenticationListener extends AbstractListener +{ + private $tokenStorage; + private $authenticationManager; + private $httpUtils; + private $providerKey; + private $successHandler; + private $failureHandler; + private $options; + private $logger; + private $eventDispatcher; + private $propertyAccessor; + private $sessionStrategy; + + /** + * @var TranslatorInterface|null + */ + private $translator; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, HttpUtils $httpUtils, string $providerKey, AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler = null, array $options = [], LoggerInterface $logger = null, EventDispatcherInterface $eventDispatcher = null, PropertyAccessorInterface $propertyAccessor = null) + { + $this->tokenStorage = $tokenStorage; + $this->authenticationManager = $authenticationManager; + $this->httpUtils = $httpUtils; + $this->providerKey = $providerKey; + $this->successHandler = $successHandler; + $this->failureHandler = $failureHandler; + $this->logger = $logger; + $this->eventDispatcher = $eventDispatcher; + $this->options = array_merge(['username_path' => 'username', 'password_path' => 'password'], $options); + $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); + } + + public function supports(Request $request): ?bool + { + if (!str_contains($request->getRequestFormat() ?? '', 'json') + && !str_contains($request->getContentType() ?? '', 'json') + ) { + return false; + } + + if (isset($this->options['check_path']) && !$this->httpUtils->checkRequestPath($request, $this->options['check_path'])) { + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function authenticate(RequestEvent $event) + { + $request = $event->getRequest(); + $data = json_decode($request->getContent()); + + try { + if (!$data instanceof \stdClass) { + throw new BadRequestHttpException('Invalid JSON.'); + } + + try { + $username = $this->propertyAccessor->getValue($data, $this->options['username_path']); + } catch (AccessException $e) { + throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['username_path']), $e); + } + + try { + $password = $this->propertyAccessor->getValue($data, $this->options['password_path']); + } catch (AccessException $e) { + throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['password_path']), $e); + } + + if (!\is_string($username)) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['username_path'])); + } + + if (\strlen($username) > Security::MAX_USERNAME_LENGTH) { + throw new BadCredentialsException('Invalid username.'); + } + + if (!\is_string($password)) { + throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['password_path'])); + } + + $token = new UsernamePasswordToken($username, $password, $this->providerKey); + + $authenticatedToken = $this->authenticationManager->authenticate($token); + $response = $this->onSuccess($request, $authenticatedToken); + } catch (AuthenticationException $e) { + $response = $this->onFailure($request, $e); + } catch (BadRequestHttpException $e) { + $request->setRequestFormat('json'); + + throw $e; + } + + if (null === $response) { + return; + } + + $event->setResponse($response); + } + + private function onSuccess(Request $request, TokenInterface $token): ?Response + { + if (null !== $this->logger) { + // @deprecated since Symfony 5.3, change to $token->getUserIdentifier() in 6.0 + $this->logger->info('User has been authenticated successfully.', ['username' => method_exists($token, 'getUserIdentifier') ? $token->getUserIdentifier() : $token->getUsername()]); + } + + $this->migrateSession($request, $token); + + $this->tokenStorage->setToken($token); + + if (null !== $this->eventDispatcher) { + $loginEvent = new InteractiveLoginEvent($request, $token); + $this->eventDispatcher->dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN); + } + + if (!$this->successHandler) { + return null; // let the original request succeeds + } + + $response = $this->successHandler->onAuthenticationSuccess($request, $token); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Success Handler did not return a Response.'); + } + + return $response; + } + + private function onFailure(Request $request, AuthenticationException $failed): Response + { + if (null !== $this->logger) { + $this->logger->info('Authentication request failed.', ['exception' => $failed]); + } + + $token = $this->tokenStorage->getToken(); + if ($token instanceof UsernamePasswordToken && $this->providerKey === $token->getFirewallName()) { + $this->tokenStorage->setToken(null); + } + + if (!$this->failureHandler) { + if (null !== $this->translator) { + $errorMessage = $this->translator->trans($failed->getMessageKey(), $failed->getMessageData(), 'security'); + } else { + $errorMessage = strtr($failed->getMessageKey(), $failed->getMessageData()); + } + + return new JsonResponse(['error' => $errorMessage], 401); + } + + $response = $this->failureHandler->onAuthenticationFailure($request, $failed); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Failure Handler did not return a Response.'); + } + + return $response; + } + + /** + * Call this method if your authentication token is stored to a session. + * + * @final + */ + public function setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy) + { + $this->sessionStrategy = $sessionStrategy; + } + + public function setTranslator(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + private function migrateSession(Request $request, TokenInterface $token) + { + if (!$this->sessionStrategy || !$request->hasSession() || !$request->hasPreviousSession()) { + return; + } + + $this->sessionStrategy->onAuthentication($request, $token); + } +} diff --git a/vendor/symfony/security-http/Firewall/X509AuthenticationListener.php b/vendor/symfony/security-http/Firewall/X509AuthenticationListener.php new file mode 100644 index 0000000..07a287e --- /dev/null +++ b/vendor/symfony/security-http/Firewall/X509AuthenticationListener.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Firewall; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Exception\BadCredentialsException; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/security-http', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', X509AuthenticationListener::class); + +/** + * X509 authentication listener. + * + * @author Fabien Potencier + * + * @deprecated since Symfony 5.3, use the new authenticator system instead + */ +class X509AuthenticationListener extends AbstractPreAuthenticatedListener +{ + private $userKey; + private $credentialKey; + + public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, string $providerKey, string $userKey = 'SSL_CLIENT_S_DN_Email', string $credentialKey = 'SSL_CLIENT_S_DN', LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) + { + parent::__construct($tokenStorage, $authenticationManager, $providerKey, $logger, $dispatcher); + + $this->userKey = $userKey; + $this->credentialKey = $credentialKey; + } + + /** + * {@inheritdoc} + */ + protected function getPreAuthenticatedData(Request $request) + { + $user = null; + if ($request->server->has($this->userKey)) { + $user = $request->server->get($this->userKey); + } elseif ( + $request->server->has($this->credentialKey) + && preg_match('#emailAddress=([^,/@]++@[^,/]++)#', $request->server->get($this->credentialKey), $matches) + ) { + $user = $matches[1]; + } + + if (null === $user) { + throw new BadCredentialsException(sprintf('SSL credentials not found: "%s", "%s".', $this->userKey, $this->credentialKey)); + } + + return [$user, $request->server->get($this->credentialKey, '')]; + } +} diff --git a/vendor/symfony/security-http/FirewallMap.php b/vendor/symfony/security-http/FirewallMap.php new file mode 100644 index 0000000..cc9d853 --- /dev/null +++ b/vendor/symfony/security-http/FirewallMap.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestMatcherInterface; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\LogoutListener; + +/** + * FirewallMap allows configuration of different firewalls for specific parts + * of the website. + * + * @author Fabien Potencier + */ +class FirewallMap implements FirewallMapInterface +{ + /** + * @var list, ExceptionListener|null, LogoutListener|null}> + */ + private $map = []; + + /** + * @param list $listeners + */ + public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = [], ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null) + { + $this->map[] = [$requestMatcher, $listeners, $exceptionListener, $logoutListener]; + } + + /** + * {@inheritdoc} + */ + public function getListeners(Request $request) + { + foreach ($this->map as $elements) { + if (null === $elements[0] || $elements[0]->matches($request)) { + return [$elements[1], $elements[2], $elements[3]]; + } + } + + return [[], null, null]; + } +} diff --git a/vendor/symfony/security-http/FirewallMapInterface.php b/vendor/symfony/security-http/FirewallMapInterface.php new file mode 100644 index 0000000..480ea8a --- /dev/null +++ b/vendor/symfony/security-http/FirewallMapInterface.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\Firewall\ExceptionListener; +use Symfony\Component\Security\Http\Firewall\LogoutListener; + +/** + * This interface must be implemented by firewall maps. + * + * @author Johannes M. Schmitt + */ +interface FirewallMapInterface +{ + /** + * Returns the authentication listeners, and the exception listener to use + * for the given request. + * + * If there are no authentication listeners, the first inner array must be + * empty. + * + * If there is no exception listener, the second element of the outer array + * must be null. + * + * If there is no logout listener, the third element of the outer array + * must be null. + * + * @return array{iterable, ExceptionListener, LogoutListener} + */ + public function getListeners(Request $request); +} diff --git a/vendor/symfony/security-http/HttpUtils.php b/vendor/symfony/security-http/HttpUtils.php new file mode 100644 index 0000000..6a1cb94 --- /dev/null +++ b/vendor/symfony/security-http/HttpUtils.php @@ -0,0 +1,180 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\Matcher\UrlMatcherInterface; +use Symfony\Component\Security\Core\Security; + +/** + * Encapsulates the logic needed to create sub-requests, redirect the user, and match URLs. + * + * @author Fabien Potencier + */ +class HttpUtils +{ + private $urlGenerator; + private $urlMatcher; + private $domainRegexp; + private $secureDomainRegexp; + + /** + * @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The URL or Request matcher + * @param string|null $domainRegexp A regexp the target of HTTP redirections must match, scheme included + * @param string|null $secureDomainRegexp A regexp the target of HTTP redirections must match when the scheme is "https" + * + * @throws \InvalidArgumentException + */ + public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null, string $domainRegexp = null, string $secureDomainRegexp = null) + { + $this->urlGenerator = $urlGenerator; + if (null !== $urlMatcher && !$urlMatcher instanceof UrlMatcherInterface && !$urlMatcher instanceof RequestMatcherInterface) { + throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); + } + $this->urlMatcher = $urlMatcher; + $this->domainRegexp = $domainRegexp; + $this->secureDomainRegexp = $secureDomainRegexp; + } + + /** + * Creates a redirect Response. + * + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * @param int $status The status code + * + * @return RedirectResponse + */ + public function createRedirectResponse(Request $request, string $path, int $status = 302) + { + if (null !== $this->secureDomainRegexp && 'https' === $this->urlMatcher->getContext()->getScheme() && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->secureDomainRegexp, preg_quote($request->getHttpHost())), $host[0])) { + $path = '/'; + } + if (null !== $this->domainRegexp && preg_match('#^https?:[/\\\\]{2,}+[^/]++#i', $path, $host) && !preg_match(sprintf($this->domainRegexp, preg_quote($request->getHttpHost())), $host[0])) { + $path = '/'; + } + + return new RedirectResponse($this->generateUri($request, $path), $status); + } + + /** + * Creates a Request. + * + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * + * @return Request + */ + public function createRequest(Request $request, string $path) + { + $newRequest = Request::create($this->generateUri($request, $path), 'get', [], $request->cookies->all(), [], $request->server->all()); + + static $setSession; + + if (null === $setSession) { + $setSession = \Closure::bind(static function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class); + } + $setSession($newRequest, $request); + + if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) { + $newRequest->attributes->set(Security::AUTHENTICATION_ERROR, $request->attributes->get(Security::AUTHENTICATION_ERROR)); + } + if ($request->attributes->has(Security::ACCESS_DENIED_ERROR)) { + $newRequest->attributes->set(Security::ACCESS_DENIED_ERROR, $request->attributes->get(Security::ACCESS_DENIED_ERROR)); + } + if ($request->attributes->has(Security::LAST_USERNAME)) { + $newRequest->attributes->set(Security::LAST_USERNAME, $request->attributes->get(Security::LAST_USERNAME)); + } + + if ($request->get('_format')) { + $newRequest->attributes->set('_format', $request->get('_format')); + } + if ($request->getDefaultLocale() !== $request->getLocale()) { + $newRequest->setLocale($request->getLocale()); + } + + return $newRequest; + } + + /** + * Checks that a given path matches the Request. + * + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * + * @return bool true if the path is the same as the one from the Request, false otherwise + */ + public function checkRequestPath(Request $request, string $path) + { + if ('/' !== $path[0]) { + try { + // matching a request is more powerful than matching a URL path + context, so try that first + if ($this->urlMatcher instanceof RequestMatcherInterface) { + $parameters = $this->urlMatcher->matchRequest($request); + } else { + $parameters = $this->urlMatcher->match($request->getPathInfo()); + } + + return isset($parameters['_route']) && $path === $parameters['_route']; + } catch (MethodNotAllowedException $e) { + return false; + } catch (ResourceNotFoundException $e) { + return false; + } + } + + return $path === rawurldecode($request->getPathInfo()); + } + + /** + * Generates a URI, based on the given path or absolute URL. + * + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * + * @return string + * + * @throws \LogicException + */ + public function generateUri(Request $request, string $path) + { + if (str_starts_with($path, 'http') || !$path) { + return $path; + } + + if ('/' === $path[0]) { + return $request->getUriForPath($path); + } + + if (null === $this->urlGenerator) { + throw new \LogicException('You must provide a UrlGeneratorInterface instance to be able to use routes.'); + } + + $url = $this->urlGenerator->generate($path, $request->attributes->all(), UrlGeneratorInterface::ABSOLUTE_URL); + + // unnecessary query string parameters must be removed from URL + // (ie. query parameters that are presents in $attributes) + // fortunately, they all are, so we have to remove entire query string + $position = strpos($url, '?'); + if (false !== $position) { + $fragment = parse_url($url, \PHP_URL_FRAGMENT); + $url = substr($url, 0, $position); + // fragment must be preserved + if ($fragment) { + $url .= "#$fragment"; + } + } + + return $url; + } +} diff --git a/vendor/symfony/security-http/Impersonate/ImpersonateUrlGenerator.php b/vendor/symfony/security-http/Impersonate/ImpersonateUrlGenerator.php new file mode 100644 index 0000000..b560e55 --- /dev/null +++ b/vendor/symfony/security-http/Impersonate/ImpersonateUrlGenerator.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Impersonate; + +use Symfony\Bundle\SecurityBundle\Security\FirewallMap; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; +use Symfony\Component\Security\Http\Firewall\SwitchUserListener; + +/** + * Provides generator functions for the impersonate url exit. + * + * @author Amrouche Hamza + * @author Damien Fayet + */ +class ImpersonateUrlGenerator +{ + private $requestStack; + private $tokenStorage; + private $firewallMap; + + public function __construct(RequestStack $requestStack, FirewallMap $firewallMap, TokenStorageInterface $tokenStorage) + { + $this->requestStack = $requestStack; + $this->tokenStorage = $tokenStorage; + $this->firewallMap = $firewallMap; + } + + public function generateExitPath(string $targetUri = null): string + { + return $this->buildExitPath($targetUri); + } + + public function generateExitUrl(string $targetUri = null): string + { + if (null === $request = $this->requestStack->getCurrentRequest()) { + return ''; + } + + return $request->getUriForPath($this->buildExitPath($targetUri)); + } + + private function isImpersonatedUser(): bool + { + return $this->tokenStorage->getToken() instanceof SwitchUserToken; + } + + private function buildExitPath(string $targetUri = null): string + { + if (null === ($request = $this->requestStack->getCurrentRequest()) || !$this->isImpersonatedUser()) { + return ''; + } + + if (null === $switchUserConfig = $this->firewallMap->getFirewallConfig($request)->getSwitchUser()) { + throw new \LogicException('Unable to generate the impersonate exit URL without a firewall configured for the user switch.'); + } + + if (null === $targetUri) { + $targetUri = $request->getRequestUri(); + } + + $targetUri .= (parse_url($targetUri, \PHP_URL_QUERY) ? '&' : '?').http_build_query([$switchUserConfig['parameter'] => SwitchUserListener::EXIT_VALUE], '', '&'); + + return $targetUri; + } +} diff --git a/vendor/symfony/security-http/LICENSE b/vendor/symfony/security-http/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/security-http/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/security-http/LoginLink/Exception/ExpiredLoginLinkException.php b/vendor/symfony/security-http/LoginLink/Exception/ExpiredLoginLinkException.php new file mode 100644 index 0000000..7971ddb --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/Exception/ExpiredLoginLinkException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink\Exception; + +use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException; + +/** + * @author Ryan Weaver + */ +class ExpiredLoginLinkException extends ExpiredSignatureException implements InvalidLoginLinkExceptionInterface +{ +} diff --git a/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkAuthenticationException.php b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkAuthenticationException.php new file mode 100644 index 0000000..a4f64ba --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkAuthenticationException.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink\Exception; + +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * Thrown when a login link is invalid. + * + * @author Ryan Weaver + */ +class InvalidLoginLinkAuthenticationException extends AuthenticationException +{ + /** + * {@inheritdoc} + */ + public function getMessageKey() + { + return 'Invalid or expired login link.'; + } +} diff --git a/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkException.php b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkException.php new file mode 100644 index 0000000..5683c18 --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink\Exception; + +/** + * @author Ryan Weaver + */ +class InvalidLoginLinkException extends \RuntimeException implements InvalidLoginLinkExceptionInterface +{ +} diff --git a/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkExceptionInterface.php b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkExceptionInterface.php new file mode 100644 index 0000000..e32e8dc --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/Exception/InvalidLoginLinkExceptionInterface.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink\Exception; + +/** + * @author Ryan Weaver + */ +interface InvalidLoginLinkExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/security-http/LoginLink/LoginLinkDetails.php b/vendor/symfony/security-http/LoginLink/LoginLinkDetails.php new file mode 100644 index 0000000..9057a09 --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/LoginLinkDetails.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink; + +/** + * @author Ryan Weaver + */ +class LoginLinkDetails +{ + private $url; + private $expiresAt; + + public function __construct(string $url, \DateTimeImmutable $expiresAt) + { + $this->url = $url; + $this->expiresAt = $expiresAt; + } + + public function getUrl(): string + { + return $this->url; + } + + public function getExpiresAt(): \DateTimeImmutable + { + return $this->expiresAt; + } + + public function __toString() + { + return $this->url; + } +} diff --git a/vendor/symfony/security-http/LoginLink/LoginLinkHandler.php b/vendor/symfony/security-http/LoginLink/LoginLinkHandler.php new file mode 100644 index 0000000..b55e8aa --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/LoginLinkHandler.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException; +use Symfony\Component\Security\Core\Signature\Exception\InvalidSignatureException; +use Symfony\Component\Security\Core\Signature\SignatureHasher; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\LoginLink\Exception\ExpiredLoginLinkException; +use Symfony\Component\Security\Http\LoginLink\Exception\InvalidLoginLinkException; + +/** + * @author Ryan Weaver + */ +final class LoginLinkHandler implements LoginLinkHandlerInterface +{ + private $urlGenerator; + private $userProvider; + private $options; + private $signatureHashUtil; + + public function __construct(UrlGeneratorInterface $urlGenerator, UserProviderInterface $userProvider, SignatureHasher $signatureHashUtil, array $options) + { + $this->urlGenerator = $urlGenerator; + $this->userProvider = $userProvider; + $this->signatureHashUtil = $signatureHashUtil; + $this->options = array_merge([ + 'route_name' => null, + 'lifetime' => 600, + ], $options); + } + + public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails + { + $expires = time() + $this->options['lifetime']; + $expiresAt = new \DateTimeImmutable('@'.$expires); + + $parameters = [ + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + 'user' => method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), + 'expires' => $expires, + 'hash' => $this->signatureHashUtil->computeSignatureHash($user, $expires), + ]; + + if ($request) { + $currentRequestContext = $this->urlGenerator->getContext(); + $this->urlGenerator->setContext( + (new RequestContext()) + ->fromRequest($request) + ->setParameter('_locale', $request->getLocale()) + ); + } + + try { + $url = $this->urlGenerator->generate( + $this->options['route_name'], + $parameters, + UrlGeneratorInterface::ABSOLUTE_URL + ); + } finally { + if ($request) { + $this->urlGenerator->setContext($currentRequestContext); + } + } + + return new LoginLinkDetails($url, $expiresAt); + } + + public function consumeLoginLink(Request $request): UserInterface + { + $userIdentifier = $request->get('user'); + + try { + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($this->userProvider, 'loadUserByIdentifier')) { + $user = $this->userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $user = $this->userProvider->loadUserByUsername($userIdentifier); + } + } catch (UserNotFoundException $exception) { + throw new InvalidLoginLinkException('User not found.', 0, $exception); + } + + $hash = $request->get('hash'); + $expires = $request->get('expires'); + + try { + $this->signatureHashUtil->verifySignatureHash($user, $expires, $hash); + } catch (ExpiredSignatureException $e) { + throw new ExpiredLoginLinkException(ucfirst(str_ireplace('signature', 'login link', $e->getMessage())), 0, $e); + } catch (InvalidSignatureException $e) { + throw new InvalidLoginLinkException(ucfirst(str_ireplace('signature', 'login link', $e->getMessage())), 0, $e); + } + + return $user; + } +} diff --git a/vendor/symfony/security-http/LoginLink/LoginLinkHandlerInterface.php b/vendor/symfony/security-http/LoginLink/LoginLinkHandlerInterface.php new file mode 100644 index 0000000..b0ee6ef --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/LoginLinkHandlerInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * A class that is able to create and handle "magic" login links. + * + * @author Ryan Weaver + */ +interface LoginLinkHandlerInterface +{ + /** + * Generate a link that can be used to authenticate as the given user. + */ + public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails; + + /** + * Validates if this request contains a login link and returns the associated User. + * + * Throw InvalidLoginLinkExceptionInterface if the link is invalid. + */ + public function consumeLoginLink(Request $request): UserInterface; +} diff --git a/vendor/symfony/security-http/LoginLink/LoginLinkNotification.php b/vendor/symfony/security-http/LoginLink/LoginLinkNotification.php new file mode 100644 index 0000000..85cdd79 --- /dev/null +++ b/vendor/symfony/security-http/LoginLink/LoginLinkNotification.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\LoginLink; + +use Symfony\Bridge\Twig\Mime\NotificationEmail; +use Symfony\Component\Notifier\Message\EmailMessage; +use Symfony\Component\Notifier\Message\SmsMessage; +use Symfony\Component\Notifier\Notification\EmailNotificationInterface; +use Symfony\Component\Notifier\Notification\Notification; +use Symfony\Component\Notifier\Notification\SmsNotificationInterface; +use Symfony\Component\Notifier\Recipient\EmailRecipientInterface; +use Symfony\Component\Notifier\Recipient\SmsRecipientInterface; + +/** + * Use this notification to ease sending login link + * emails/SMS using the Notifier component. + * + * @author Wouter de Jong + */ +class LoginLinkNotification extends Notification implements EmailNotificationInterface, SmsNotificationInterface +{ + private $loginLinkDetails; + + public function __construct(LoginLinkDetails $loginLinkDetails, string $subject, array $channels = []) + { + parent::__construct($subject, $channels); + + $this->loginLinkDetails = $loginLinkDetails; + } + + public function asEmailMessage(EmailRecipientInterface $recipient, string $transport = null): ?EmailMessage + { + if (!class_exists(NotificationEmail::class)) { + throw new \LogicException(sprintf('The "%s" method requires "symfony/twig-bridge:>4.4".', __METHOD__)); + } + + $email = NotificationEmail::asPublicEmail() + ->to($recipient->getEmail()) + ->subject($this->getSubject()) + ->content($this->getContent() ?: $this->getDefaultContent('button below')) + ->action('Sign in', $this->loginLinkDetails->getUrl()) + ; + + return new EmailMessage($email); + } + + public function asSmsMessage(SmsRecipientInterface $recipient, string $transport = null): ?SmsMessage + { + return new SmsMessage($recipient->getPhone(), $this->getDefaultContent('link').' '.$this->loginLinkDetails->getUrl()); + } + + private function getDefaultContent(string $target): string + { + $duration = $this->loginLinkDetails->getExpiresAt()->getTimestamp() - time(); + $durationString = floor($duration / 60).' minute'.($duration > 60 ? 's' : ''); + if (($hours = $duration / 3600) >= 1) { + $durationString = floor($hours).' hour'.($hours >= 2 ? 's' : ''); + } + + return sprintf('Click on the %s to confirm you want to sign in. This link will expire in %s.', $target, $durationString); + } +} diff --git a/vendor/symfony/security-http/Logout/CookieClearingLogoutHandler.php b/vendor/symfony/security-http/Logout/CookieClearingLogoutHandler.php new file mode 100644 index 0000000..2adb5b3 --- /dev/null +++ b/vendor/symfony/security-http/Logout/CookieClearingLogoutHandler.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Http\EventListener\CookieClearingLogoutListener; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', CookieClearingLogoutHandler::class, CookieClearingLogoutListener::class); + +/** + * This handler clears the passed cookies when a user logs out. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.4, use {@link CookieClearingLogoutListener} instead + */ +class CookieClearingLogoutHandler implements LogoutHandlerInterface +{ + private $cookies; + + /** + * @param array $cookies An array of cookie names to unset + */ + public function __construct(array $cookies) + { + $this->cookies = $cookies; + } + + /** + * Implementation for the LogoutHandlerInterface. Deletes all requested cookies. + */ + public function logout(Request $request, Response $response, TokenInterface $token) + { + foreach ($this->cookies as $cookieName => $cookieData) { + $response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], $cookieData['secure'] ?? false, true, $cookieData['samesite'] ?? null); + } + } +} diff --git a/vendor/symfony/security-http/Logout/CsrfTokenClearingLogoutHandler.php b/vendor/symfony/security-http/Logout/CsrfTokenClearingLogoutHandler.php new file mode 100644 index 0000000..2678da7 --- /dev/null +++ b/vendor/symfony/security-http/Logout/CsrfTokenClearingLogoutHandler.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface; +use Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', CsrfTokenClearingLogoutHandler::class, CsrfTokenClearingLogoutListener::class); + +/** + * @author Christian Flothmann + * + * @deprecated since Symfony 5.4, use {@link CsrfTokenClearingLogoutListener} instead + */ +class CsrfTokenClearingLogoutHandler implements LogoutHandlerInterface +{ + private $csrfTokenStorage; + + public function __construct(ClearableTokenStorageInterface $csrfTokenStorage) + { + $this->csrfTokenStorage = $csrfTokenStorage; + } + + public function logout(Request $request, Response $response, TokenInterface $token) + { + $this->csrfTokenStorage->clear(); + } +} diff --git a/vendor/symfony/security-http/Logout/DefaultLogoutSuccessHandler.php b/vendor/symfony/security-http/Logout/DefaultLogoutSuccessHandler.php new file mode 100644 index 0000000..dbf30ce --- /dev/null +++ b/vendor/symfony/security-http/Logout/DefaultLogoutSuccessHandler.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\EventListener\DefaultLogoutListener; +use Symfony\Component\Security\Http\HttpUtils; + +trigger_deprecation('symfony/security-http', '5.1', 'The "%s" class is deprecated, use "%s" instead.', DefaultLogoutSuccessHandler::class, DefaultLogoutListener::class); + +/** + * Default logout success handler will redirect users to a configured path. + * + * @author Fabien Potencier + * @author Alexander + * + * @deprecated since Symfony 5.1 + */ +class DefaultLogoutSuccessHandler implements LogoutSuccessHandlerInterface +{ + protected $httpUtils; + protected $targetUrl; + + public function __construct(HttpUtils $httpUtils, string $targetUrl = '/') + { + $this->httpUtils = $httpUtils; + $this->targetUrl = $targetUrl; + } + + /** + * {@inheritdoc} + */ + public function onLogoutSuccess(Request $request) + { + return $this->httpUtils->createRedirectResponse($request, $this->targetUrl); + } +} diff --git a/vendor/symfony/security-http/Logout/LogoutHandlerInterface.php b/vendor/symfony/security-http/Logout/LogoutHandlerInterface.php new file mode 100644 index 0000000..4c19b45 --- /dev/null +++ b/vendor/symfony/security-http/Logout/LogoutHandlerInterface.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * Interface that needs to be implemented by LogoutHandlers. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.1 + */ +interface LogoutHandlerInterface +{ + /** + * This method is called by the LogoutListener when a user has requested + * to be logged out. Usually, you would unset session variables, or remove + * cookies, etc. + */ + public function logout(Request $request, Response $response, TokenInterface $token); +} diff --git a/vendor/symfony/security-http/Logout/LogoutSuccessHandlerInterface.php b/vendor/symfony/security-http/Logout/LogoutSuccessHandlerInterface.php new file mode 100644 index 0000000..90d9605 --- /dev/null +++ b/vendor/symfony/security-http/Logout/LogoutSuccessHandlerInterface.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Http\Event\LogoutEvent; + +trigger_deprecation('symfony/security-http', '5.1', 'The "%s" interface is deprecated, create a listener for the "%s" event instead.', LogoutSuccessHandlerInterface::class, LogoutEvent::class); + +/** + * LogoutSuccesshandlerInterface. + * + * In contrast to the LogoutHandlerInterface, this interface can return a response + * which is then used instead of the default behavior. + * + * If you want to only perform some logout related clean-up task, use the + * LogoutHandlerInterface instead. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.1 + */ +interface LogoutSuccessHandlerInterface +{ + /** + * Creates a Response object to send upon a successful logout. + * + * @return Response + */ + public function onLogoutSuccess(Request $request); +} diff --git a/vendor/symfony/security-http/Logout/LogoutUrlGenerator.php b/vendor/symfony/security-http/Logout/LogoutUrlGenerator.php new file mode 100644 index 0000000..296f60c --- /dev/null +++ b/vendor/symfony/security-http/Logout/LogoutUrlGenerator.php @@ -0,0 +1,170 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; + +/** + * Provides generator functions for the logout URL. + * + * @author Fabien Potencier + * @author Jeremy Mikola + */ +class LogoutUrlGenerator +{ + private $requestStack; + private $router; + private $tokenStorage; + private $listeners = []; + /** @var string|null */ + private $currentFirewallName; + /** @var string|null */ + private $currentFirewallContext; + + public function __construct(RequestStack $requestStack = null, UrlGeneratorInterface $router = null, TokenStorageInterface $tokenStorage = null) + { + $this->requestStack = $requestStack; + $this->router = $router; + $this->tokenStorage = $tokenStorage; + } + + /** + * Registers a firewall's LogoutListener, allowing its URL to be generated. + * + * @param string $key The firewall key + * @param string $logoutPath The path that starts the logout process + * @param string|null $csrfTokenId The ID of the CSRF token + * @param string|null $csrfParameter The CSRF token parameter name + * @param string|null $context The listener context + */ + public function registerListener(string $key, string $logoutPath, ?string $csrfTokenId, ?string $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null) + { + $this->listeners[$key] = [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context]; + } + + /** + * Generates the absolute logout path for the firewall. + * + * @return string + */ + public function getLogoutPath(string $key = null) + { + return $this->generateLogoutUrl($key, UrlGeneratorInterface::ABSOLUTE_PATH); + } + + /** + * Generates the absolute logout URL for the firewall. + * + * @return string + */ + public function getLogoutUrl(string $key = null) + { + return $this->generateLogoutUrl($key, UrlGeneratorInterface::ABSOLUTE_URL); + } + + public function setCurrentFirewall(?string $key, string $context = null) + { + $this->currentFirewallName = $key; + $this->currentFirewallContext = $context; + } + + /** + * Generates the logout URL for the firewall. + */ + private function generateLogoutUrl(?string $key, int $referenceType): string + { + [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager] = $this->getListener($key); + + if (null === $logoutPath) { + throw new \LogicException('Unable to generate the logout URL without a path.'); + } + + $parameters = null !== $csrfTokenManager ? [$csrfParameter => (string) $csrfTokenManager->getToken($csrfTokenId)] : []; + + if ('/' === $logoutPath[0]) { + if (!$this->requestStack) { + throw new \LogicException('Unable to generate the logout URL without a RequestStack.'); + } + + $request = $this->requestStack->getCurrentRequest(); + + $url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath; + + if (!empty($parameters)) { + $url .= '?'.http_build_query($parameters, '', '&'); + } + } else { + if (!$this->router) { + throw new \LogicException('Unable to generate the logout URL without a Router.'); + } + + $url = $this->router->generate($logoutPath, $parameters, $referenceType); + } + + return $url; + } + + /** + * @throws \InvalidArgumentException if no LogoutListener is registered for the key or could not be found automatically + */ + private function getListener(?string $key): array + { + if (null !== $key) { + if (isset($this->listeners[$key])) { + return $this->listeners[$key]; + } + + throw new \InvalidArgumentException(sprintf('No LogoutListener found for firewall key "%s".', $key)); + } + + // Fetch the current provider key from token, if possible + if (null !== $this->tokenStorage) { + $token = $this->tokenStorage->getToken(); + + // @deprecated since Symfony 5.4 + if ($token instanceof AnonymousToken) { + throw new \InvalidArgumentException('Unable to generate a logout url for an anonymous token.'); + } + + if (null !== $token) { + if (method_exists($token, 'getFirewallName')) { + $key = $token->getFirewallName(); + } elseif (method_exists($token, 'getProviderKey')) { + trigger_deprecation('symfony/security-http', '5.2', 'Method "%s::getProviderKey()" has been deprecated, rename it to "getFirewallName()" instead.', \get_class($token)); + + $key = $token->getProviderKey(); + } + + if (isset($this->listeners[$key])) { + return $this->listeners[$key]; + } + } + } + + // Fetch from injected current firewall information, if possible + if (isset($this->listeners[$this->currentFirewallName])) { + return $this->listeners[$this->currentFirewallName]; + } + + foreach ($this->listeners as $listener) { + if (isset($listener[4]) && $this->currentFirewallContext === $listener[4]) { + return $listener; + } + } + + throw new \InvalidArgumentException('Unable to find the current firewall LogoutListener, please provide the provider key manually.'); + } +} diff --git a/vendor/symfony/security-http/Logout/SessionLogoutHandler.php b/vendor/symfony/security-http/Logout/SessionLogoutHandler.php new file mode 100644 index 0000000..09e4ea0 --- /dev/null +++ b/vendor/symfony/security-http/Logout/SessionLogoutHandler.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Http\EventListener\SessionLogoutListener; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', SessionLogoutHandler::class, SessionLogoutListener::class); + +/** + * Handler for clearing invalidating the current session. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.4, use {@link SessionLogoutListener} instead + */ +class SessionLogoutHandler implements LogoutHandlerInterface +{ + /** + * Invalidate the current session. + */ + public function logout(Request $request, Response $response, TokenInterface $token) + { + $request->getSession()->invalidate(); + } +} diff --git a/vendor/symfony/security-http/ParameterBagUtils.php b/vendor/symfony/security-http/ParameterBagUtils.php new file mode 100644 index 0000000..db7ac6e --- /dev/null +++ b/vendor/symfony/security-http/ParameterBagUtils.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\PropertyAccess\Exception\AccessException; +use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; +use Symfony\Component\PropertyAccess\PropertyAccess; + +/** + * @internal + */ +final class ParameterBagUtils +{ + private static $propertyAccessor; + + /** + * Returns a "parameter" value. + * + * Paths like foo[bar] will be evaluated to find deeper items in nested data structures. + * + * @return mixed + * + * @throws InvalidArgumentException when the given path is malformed + */ + public static function getParameterBagValue(ParameterBag $parameters, string $path) + { + if (false === $pos = strpos($path, '[')) { + return $parameters->all()[$path] ?? null; + } + + $root = substr($path, 0, $pos); + + if (null === $value = $parameters->all()[$root] ?? null) { + return null; + } + + if (null === self::$propertyAccessor) { + self::$propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + try { + return self::$propertyAccessor->getValue($value, substr($path, $pos)); + } catch (AccessException $e) { + return null; + } + } + + /** + * Returns a request "parameter" value. + * + * Paths like foo[bar] will be evaluated to find deeper items in nested data structures. + * + * @return mixed + * + * @throws InvalidArgumentException when the given path is malformed + */ + public static function getRequestParameterValue(Request $request, string $path) + { + if (false === $pos = strpos($path, '[')) { + return $request->get($path); + } + + $root = substr($path, 0, $pos); + + if (null === $value = $request->get($root)) { + return null; + } + + if (null === self::$propertyAccessor) { + self::$propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + try { + return self::$propertyAccessor->getValue($value, substr($path, $pos)); + } catch (AccessException $e) { + return null; + } + } +} diff --git a/vendor/symfony/security-http/README.md b/vendor/symfony/security-http/README.md new file mode 100644 index 0000000..91a7583 --- /dev/null +++ b/vendor/symfony/security-http/README.md @@ -0,0 +1,37 @@ +Security Component - HTTP Integration +===================================== + +The Security HTTP component provides an HTTP integration of the Security Core +component. It allows securing (parts of) your application using firewalls and +provides authenticators to authenticate visitors. + +Getting Started +--------------- + +``` +$ composer require symfony/security-http +``` + +Sponsor +------- + +The Security component for Symfony 5.4/6.0 is [backed][1] by [SymfonyCasts][2]. + +Learn Symfony faster by watching real projects being built and actively coding +along with them. SymfonyCasts bridges that learning gap, bringing you video +tutorials and coding challenges. Code on! + +Help Symfony by [sponsoring][3] its development! + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/security.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://symfonycasts.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/security-http/RateLimiter/DefaultLoginRateLimiter.php b/vendor/symfony/security-http/RateLimiter/DefaultLoginRateLimiter.php new file mode 100644 index 0000000..7b773f2 --- /dev/null +++ b/vendor/symfony/security-http/RateLimiter/DefaultLoginRateLimiter.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RateLimiter; + +use Symfony\Component\HttpFoundation\RateLimiter\AbstractRequestRateLimiter; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\RateLimiter\RateLimiterFactory; +use Symfony\Component\Security\Core\Security; + +/** + * A default login throttling limiter. + * + * This limiter prevents breadth-first attacks by enforcing + * a limit on username+IP and a (higher) limit on IP. + * + * @author Wouter de Jong + */ +final class DefaultLoginRateLimiter extends AbstractRequestRateLimiter +{ + private $globalFactory; + private $localFactory; + + public function __construct(RateLimiterFactory $globalFactory, RateLimiterFactory $localFactory) + { + $this->globalFactory = $globalFactory; + $this->localFactory = $localFactory; + } + + protected function getLimiters(Request $request): array + { + $username = $request->attributes->get(Security::LAST_USERNAME, ''); + $username = preg_match('//u', $username) ? mb_strtolower($username, 'UTF-8') : strtolower($username); + + return [ + $this->globalFactory->create($request->getClientIp()), + $this->localFactory->create($username.'-'.$request->getClientIp()), + ]; + } +} diff --git a/vendor/symfony/security-http/RememberMe/AbstractRememberMeHandler.php b/vendor/symfony/security-http/RememberMe/AbstractRememberMeHandler.php new file mode 100644 index 0000000..97918c8 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/AbstractRememberMeHandler.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * @author Wouter de Jong + */ +abstract class AbstractRememberMeHandler implements RememberMeHandlerInterface +{ + private $userProvider; + protected $requestStack; + protected $options; + protected $logger; + + public function __construct(UserProviderInterface $userProvider, RequestStack $requestStack, array $options = [], LoggerInterface $logger = null) + { + $this->userProvider = $userProvider; + $this->requestStack = $requestStack; + $this->options = $options + [ + 'name' => 'REMEMBERME', + 'lifetime' => 31536000, + 'path' => '/', + 'domain' => null, + 'secure' => false, + 'httponly' => true, + 'samesite' => null, + 'always_remember_me' => false, + 'remember_me_parameter' => '_remember_me', + ]; + $this->logger = $logger; + } + + /** + * Checks if the RememberMeDetails is a valid cookie to login the given User. + * + * This method should also: + * - Create a new remember-me cookie to be sent with the response (using {@see createCookie()}); + * - If you store the token somewhere else (e.g. in a database), invalidate the stored token. + * + * @throws AuthenticationException throw this exception if the remember me details are not accepted + */ + abstract protected function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void; + + /** + * {@inheritdoc} + */ + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface + { + try { + // @deprecated since Symfony 5.3, change to $this->userProvider->loadUserByIdentifier() in 6.0 + $method = 'loadUserByIdentifier'; + if (!method_exists($this->userProvider, 'loadUserByIdentifier')) { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($this->userProvider)); + + $method = 'loadUserByUsername'; + } + + $user = $this->userProvider->$method($rememberMeDetails->getUserIdentifier()); + } catch (AuthenticationException $e) { + throw $e; + } + + if (!$user instanceof UserInterface) { + throw new \LogicException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_debug_type($user))); + } + + $this->processRememberMe($rememberMeDetails, $user); + + if (null !== $this->logger) { + $this->logger->info('Remember-me cookie accepted.'); + } + + return $user; + } + + /** + * {@inheritdoc} + */ + public function clearRememberMeCookie(): void + { + if (null !== $this->logger) { + $this->logger->debug('Clearing remember-me cookie.', ['name' => $this->options['name']]); + } + + $this->createCookie(null); + } + + /** + * Creates the remember-me cookie using the correct configuration. + * + * @param RememberMeDetails|null $rememberMeDetails The details for the cookie, or null to clear the remember-me cookie + */ + protected function createCookie(?RememberMeDetails $rememberMeDetails) + { + $request = $this->requestStack->getMainRequest(); + if (!$request) { + throw new \LogicException('Cannot create the remember-me cookie; no master request available.'); + } + + // the ResponseListener configures the cookie saved in this attribute on the final response object + $request->attributes->set(ResponseListener::COOKIE_ATTR_NAME, new Cookie( + $this->options['name'], + $rememberMeDetails ? $rememberMeDetails->toString() : null, + $rememberMeDetails ? $rememberMeDetails->getExpires() : 1, + $this->options['path'], + $this->options['domain'], + $this->options['secure'] ?? $request->isSecure(), + $this->options['httponly'], + false, + $this->options['samesite'] + )); + } +} diff --git a/vendor/symfony/security-http/RememberMe/AbstractRememberMeServices.php b/vendor/symfony/security-http/RememberMe/AbstractRememberMeServices.php new file mode 100644 index 0000000..f18a4c2 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/AbstractRememberMeServices.php @@ -0,0 +1,309 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\CookieTheftException; +use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface; +use Symfony\Component\Security\Http\ParameterBagUtils; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', AbstractRememberMeServices::class, AbstractRememberMeHandler::class); + +/** + * Base class implementing the RememberMeServicesInterface. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.4, use {@see AbstractRememberMeHandler} instead + */ +abstract class AbstractRememberMeServices implements RememberMeServicesInterface, LogoutHandlerInterface +{ + public const COOKIE_DELIMITER = ':'; + + protected $logger; + protected $options = [ + 'secure' => false, + 'httponly' => true, + 'samesite' => null, + 'path' => null, + 'domain' => null, + ]; + private $firewallName; + private $secret; + private $userProviders; + + /** + * @throws \InvalidArgumentException + */ + public function __construct(iterable $userProviders, string $secret, string $firewallName, array $options = [], LoggerInterface $logger = null) + { + if (empty($secret)) { + throw new \InvalidArgumentException('$secret must not be empty.'); + } + if ('' === $firewallName) { + throw new \InvalidArgumentException('$firewallName must not be empty.'); + } + if (!\is_array($userProviders) && !$userProviders instanceof \Countable) { + $userProviders = iterator_to_array($userProviders, false); + } + if (0 === \count($userProviders)) { + throw new \InvalidArgumentException('You must provide at least one user provider.'); + } + + $this->userProviders = $userProviders; + $this->secret = $secret; + $this->firewallName = $firewallName; + $this->options = array_merge($this->options, $options); + $this->logger = $logger; + } + + /** + * Returns the parameter that is used for checking whether remember-me + * services have been requested. + * + * @return string + */ + public function getRememberMeParameter() + { + return $this->options['remember_me_parameter']; + } + + /** + * @return string + */ + public function getSecret() + { + return $this->secret; + } + + /** + * Implementation of RememberMeServicesInterface. Detects whether a remember-me + * cookie was set, decodes it, and hands it to subclasses for further processing. + * + * @throws CookieTheftException + * @throws \RuntimeException + */ + final public function autoLogin(Request $request): ?TokenInterface + { + if (($cookie = $request->attributes->get(self::COOKIE_ATTR_NAME)) && null === $cookie->getValue()) { + return null; + } + + if (null === $cookie = $request->cookies->get($this->options['name'])) { + return null; + } + + if (null !== $this->logger) { + $this->logger->debug('Remember-me cookie detected.'); + } + + $cookieParts = $this->decodeCookie($cookie); + + try { + $user = $this->processAutoLoginCookie($cookieParts, $request); + + if (!$user instanceof UserInterface) { + throw new \RuntimeException('processAutoLoginCookie() must return a UserInterface implementation.'); + } + + if (null !== $this->logger) { + $this->logger->info('Remember-me cookie accepted.'); + } + + return new RememberMeToken($user, $this->firewallName, $this->secret); + } catch (CookieTheftException $e) { + $this->loginFail($request, $e); + + throw $e; + } catch (UserNotFoundException $e) { + if (null !== $this->logger) { + $this->logger->info('User for remember-me cookie not found.', ['exception' => $e]); + } + + $this->loginFail($request, $e); + } catch (UnsupportedUserException $e) { + if (null !== $this->logger) { + $this->logger->warning('User class for remember-me cookie not supported.', ['exception' => $e]); + } + + $this->loginFail($request, $e); + } catch (AuthenticationException $e) { + if (null !== $this->logger) { + $this->logger->debug('Remember-Me authentication failed.', ['exception' => $e]); + } + + $this->loginFail($request, $e); + } catch (\Exception $e) { + $this->loginFail($request, $e); + + throw $e; + } + + return null; + } + + /** + * Implementation for LogoutHandlerInterface. Deletes the cookie. + */ + public function logout(Request $request, Response $response, TokenInterface $token) + { + $this->cancelCookie($request); + } + + /** + * Implementation for RememberMeServicesInterface. Deletes the cookie when + * an attempted authentication fails. + */ + final public function loginFail(Request $request, \Exception $exception = null) + { + $this->cancelCookie($request); + $this->onLoginFail($request, $exception); + } + + /** + * Implementation for RememberMeServicesInterface. This is called when an + * authentication is successful. + */ + final public function loginSuccess(Request $request, Response $response, TokenInterface $token) + { + // Make sure any old remember-me cookies are cancelled + $this->cancelCookie($request); + + if (!$token->getUser() instanceof UserInterface) { + if (null !== $this->logger) { + $this->logger->debug('Remember-me ignores token since it does not contain a UserInterface implementation.'); + } + + return; + } + + if (!$this->isRememberMeRequested($request)) { + if (null !== $this->logger) { + $this->logger->debug('Remember-me was not requested.'); + } + + return; + } + + if (null !== $this->logger) { + $this->logger->debug('Remember-me was requested; setting cookie.'); + } + + // Remove attribute from request that sets a NULL cookie. + // It was set by $this->cancelCookie() + // (cancelCookie does other things too for some RememberMeServices + // so we should still call it at the start of this method) + $request->attributes->remove(self::COOKIE_ATTR_NAME); + + $this->onLoginSuccess($request, $response, $token); + } + + /** + * Subclasses should validate the cookie and do any additional processing + * that is required. This is called from autoLogin(). + * + * @return UserInterface + */ + abstract protected function processAutoLoginCookie(array $cookieParts, Request $request); + + protected function onLoginFail(Request $request, \Exception $exception = null) + { + } + + /** + * This is called after a user has been logged in successfully, and has + * requested remember-me capabilities. The implementation usually sets a + * cookie and possibly stores a persistent record of it. + */ + abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token); + + final protected function getUserProvider(string $class): UserProviderInterface + { + foreach ($this->userProviders as $provider) { + if ($provider->supportsClass($class)) { + return $provider; + } + } + + throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', $class)); + } + + /** + * Decodes the raw cookie value. + * + * @return array + */ + protected function decodeCookie(string $rawCookie) + { + return explode(self::COOKIE_DELIMITER, base64_decode($rawCookie)); + } + + /** + * Encodes the cookie parts. + * + * @return string + * + * @throws \InvalidArgumentException When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it. + */ + protected function encodeCookie(array $cookieParts) + { + foreach ($cookieParts as $cookiePart) { + if (str_contains($cookiePart, self::COOKIE_DELIMITER)) { + throw new \InvalidArgumentException(sprintf('$cookieParts should not contain the cookie delimiter "%s".', self::COOKIE_DELIMITER)); + } + } + + return base64_encode(implode(self::COOKIE_DELIMITER, $cookieParts)); + } + + /** + * Deletes the remember-me cookie. + */ + protected function cancelCookie(Request $request) + { + if (null !== $this->logger) { + $this->logger->debug('Clearing remember-me cookie.', ['name' => $this->options['name']]); + } + + $request->attributes->set(self::COOKIE_ATTR_NAME, new Cookie($this->options['name'], null, 1, $this->options['path'], $this->options['domain'], $this->options['secure'] ?? $request->isSecure(), $this->options['httponly'], false, $this->options['samesite'])); + } + + /** + * Checks whether remember-me capabilities were requested. + * + * @return bool + */ + protected function isRememberMeRequested(Request $request) + { + if (true === $this->options['always_remember_me']) { + return true; + } + + $parameter = ParameterBagUtils::getRequestParameterValue($request, $this->options['remember_me_parameter']); + + if (null === $parameter && null !== $this->logger) { + $this->logger->debug('Did not send remember-me cookie.', ['parameter' => $this->options['remember_me_parameter']]); + } + + return 'true' === $parameter || 'on' === $parameter || '1' === $parameter || 'yes' === $parameter || true === $parameter; + } +} diff --git a/vendor/symfony/security-http/RememberMe/PersistentRememberMeHandler.php b/vendor/symfony/security-http/RememberMe/PersistentRememberMeHandler.php new file mode 100644 index 0000000..191d2ed --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/PersistentRememberMeHandler.php @@ -0,0 +1,132 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken; +use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface; +use Symfony\Component\Security\Core\Authentication\RememberMe\TokenVerifierInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\CookieTheftException; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * Implements remember-me tokens using a {@see TokenProviderInterface}. + * + * This requires storing remember-me tokens in a database. This allows + * more control over the invalidation of remember-me tokens. See + * {@see SignatureRememberMeHandler} if you don't want to use a database. + * + * @author Wouter de Jong + */ +final class PersistentRememberMeHandler extends AbstractRememberMeHandler +{ + private $tokenProvider; + private $tokenVerifier; + private $secret; + + public function __construct(TokenProviderInterface $tokenProvider, string $secret, UserProviderInterface $userProvider, RequestStack $requestStack, array $options, LoggerInterface $logger = null, TokenVerifierInterface $tokenVerifier = null) + { + parent::__construct($userProvider, $requestStack, $options, $logger); + + if (!$tokenVerifier && $tokenProvider instanceof TokenVerifierInterface) { + $tokenVerifier = $tokenProvider; + } + $this->tokenProvider = $tokenProvider; + $this->tokenVerifier = $tokenVerifier; + $this->secret = $secret; + } + + /** + * {@inheritdoc} + */ + public function createRememberMeCookie(UserInterface $user): void + { + $series = base64_encode(random_bytes(64)); + $tokenValue = $this->generateHash(base64_encode(random_bytes(64))); + $token = new PersistentToken(\get_class($user), method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), $series, $tokenValue, new \DateTime()); + + $this->tokenProvider->createNewToken($token); + $this->createCookie(RememberMeDetails::fromPersistentToken($token, time() + $this->options['lifetime'])); + } + + /** + * {@inheritdoc} + */ + public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void + { + if (!str_contains($rememberMeDetails->getValue(), ':')) { + throw new AuthenticationException('The cookie is incorrectly formatted.'); + } + + [$series, $tokenValue] = explode(':', $rememberMeDetails->getValue()); + $persistentToken = $this->tokenProvider->loadTokenBySeries($series); + + if ($this->tokenVerifier) { + $isTokenValid = $this->tokenVerifier->verifyToken($persistentToken, $tokenValue); + } else { + $isTokenValid = hash_equals($persistentToken->getTokenValue(), $tokenValue); + } + if (!$isTokenValid) { + throw new CookieTheftException('This token was already used. The account is possibly compromised.'); + } + + if ($persistentToken->getLastUsed()->getTimestamp() + $this->options['lifetime'] < time()) { + throw new AuthenticationException('The cookie has expired.'); + } + + // if a token was regenerated less than a minute ago, there is no need to regenerate it + // if multiple concurrent requests reauthenticate a user we do not want to update the token several times + if ($persistentToken->getLastUsed()->getTimestamp() + 60 < time()) { + $tokenValue = $this->generateHash(base64_encode(random_bytes(64))); + $tokenLastUsed = new \DateTime(); + if ($this->tokenVerifier) { + $this->tokenVerifier->updateExistingToken($persistentToken, $tokenValue, $tokenLastUsed); + } + $this->tokenProvider->updateToken($series, $tokenValue, $tokenLastUsed); + } + + $this->createCookie($rememberMeDetails->withValue($series.':'.$tokenValue)); + } + + /** + * {@inheritdoc} + */ + public function clearRememberMeCookie(): void + { + parent::clearRememberMeCookie(); + + $cookie = $this->requestStack->getMainRequest()->cookies->get($this->options['name']); + if (null === $cookie) { + return; + } + + $rememberMeDetails = RememberMeDetails::fromRawCookie($cookie); + [$series, ] = explode(':', $rememberMeDetails->getValue()); + $this->tokenProvider->deleteTokenBySeries($series); + } + + /** + * @internal + */ + public function getTokenProvider(): TokenProviderInterface + { + return $this->tokenProvider; + } + + private function generateHash(string $tokenValue): string + { + return hash_hmac('sha256', $tokenValue, $this->secret); + } +} diff --git a/vendor/symfony/security-http/RememberMe/PersistentTokenBasedRememberMeServices.php b/vendor/symfony/security-http/RememberMe/PersistentTokenBasedRememberMeServices.php new file mode 100644 index 0000000..2bf9d3c --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/PersistentTokenBasedRememberMeServices.php @@ -0,0 +1,167 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken; +use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentTokenInterface; +use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\CookieTheftException; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', PersistentTokenBasedRememberMeServices::class, PersistentRememberMeHandler::class); + +/** + * Concrete implementation of the RememberMeServicesInterface which needs + * an implementation of TokenProviderInterface for providing remember-me + * capabilities. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.4, use {@see PersistentRememberMeHandler} instead + */ +class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices +{ + private const HASHED_TOKEN_PREFIX = 'sha256_'; + + /** @var TokenProviderInterface */ + private $tokenProvider; + + public function setTokenProvider(TokenProviderInterface $tokenProvider) + { + $this->tokenProvider = $tokenProvider; + } + + /** + * {@inheritdoc} + */ + protected function cancelCookie(Request $request) + { + // Delete cookie on the client + parent::cancelCookie($request); + + // Delete cookie from the tokenProvider + if (null !== ($cookie = $request->cookies->get($this->options['name'])) + && 2 === \count($parts = $this->decodeCookie($cookie)) + ) { + [$series] = $parts; + $this->tokenProvider->deleteTokenBySeries($series); + } + } + + /** + * {@inheritdoc} + */ + protected function processAutoLoginCookie(array $cookieParts, Request $request) + { + if (2 !== \count($cookieParts)) { + throw new AuthenticationException('The cookie is invalid.'); + } + + [$series, $tokenValue] = $cookieParts; + $persistentToken = $this->tokenProvider->loadTokenBySeries($series); + + if (!$this->isTokenValueValid($persistentToken, $tokenValue)) { + throw new CookieTheftException('This token was already used. The account is possibly compromised.'); + } + + if ($persistentToken->getLastUsed()->getTimestamp() + $this->options['lifetime'] < time()) { + throw new AuthenticationException('The cookie has expired.'); + } + + $tokenValue = base64_encode(random_bytes(64)); + $this->tokenProvider->updateToken($series, $this->generateHash($tokenValue), new \DateTime()); + $request->attributes->set(self::COOKIE_ATTR_NAME, + new Cookie( + $this->options['name'], + $this->encodeCookie([$series, $tokenValue]), + time() + $this->options['lifetime'], + $this->options['path'], + $this->options['domain'], + $this->options['secure'] ?? $request->isSecure(), + $this->options['httponly'], + false, + $this->options['samesite'] + ) + ); + + $userProvider = $this->getUserProvider($persistentToken->getClass()); + // @deprecated since Symfony 5.3, change to $persistentToken->getUserIdentifier() in 6.0 + if (method_exists($persistentToken, 'getUserIdentifier')) { + $userIdentifier = $persistentToken->getUserIdentifier(); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "getUserIdentifier()" in persistent token "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($persistentToken)); + + $userIdentifier = $persistentToken->getUsername(); + } + + // @deprecated since Symfony 5.3, change to $userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($userProvider, 'loadUserByIdentifier')) { + return $userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($userProvider)); + + return $userProvider->loadUserByUsername($userIdentifier); + } + } + + /** + * {@inheritdoc} + */ + protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token) + { + $series = base64_encode(random_bytes(64)); + $tokenValue = base64_encode(random_bytes(64)); + + $this->tokenProvider->createNewToken( + new PersistentToken( + \get_class($user = $token->getUser()), + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), + $series, + $this->generateHash($tokenValue), + new \DateTime() + ) + ); + + $response->headers->setCookie( + new Cookie( + $this->options['name'], + $this->encodeCookie([$series, $tokenValue]), + time() + $this->options['lifetime'], + $this->options['path'], + $this->options['domain'], + $this->options['secure'] ?? $request->isSecure(), + $this->options['httponly'], + false, + $this->options['samesite'] + ) + ); + } + + private function generateHash(string $tokenValue): string + { + return self::HASHED_TOKEN_PREFIX.hash_hmac('sha256', $tokenValue, $this->getSecret()); + } + + private function isTokenValueValid(PersistentTokenInterface $persistentToken, string $tokenValue): bool + { + if (0 === strpos($persistentToken->getTokenValue(), self::HASHED_TOKEN_PREFIX)) { + return hash_equals($persistentToken->getTokenValue(), $this->generateHash($tokenValue)); + } + + return hash_equals($persistentToken->getTokenValue(), $tokenValue); + } +} diff --git a/vendor/symfony/security-http/RememberMe/RememberMeDetails.php b/vendor/symfony/security-http/RememberMe/RememberMeDetails.php new file mode 100644 index 0000000..ba9b118 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/RememberMeDetails.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken; +use Symfony\Component\Security\Core\Exception\AuthenticationException; + +/** + * @author Wouter de Jong + */ +class RememberMeDetails +{ + public const COOKIE_DELIMITER = ':'; + + private $userFqcn; + private $userIdentifier; + private $expires; + private $value; + + public function __construct(string $userFqcn, string $userIdentifier, int $expires, string $value) + { + $this->userFqcn = $userFqcn; + $this->userIdentifier = $userIdentifier; + $this->expires = $expires; + $this->value = $value; + } + + public static function fromRawCookie(string $rawCookie): self + { + $cookieParts = explode(self::COOKIE_DELIMITER, base64_decode($rawCookie), 4); + if (false === $cookieParts[1] = base64_decode($cookieParts[1], true)) { + throw new AuthenticationException('The user identifier contains a character from outside the base64 alphabet.'); + } + if (4 !== \count($cookieParts)) { + throw new AuthenticationException('The cookie contains invalid data.'); + } + + return new static(...$cookieParts); + } + + public static function fromPersistentToken(PersistentToken $persistentToken, int $expires): self + { + return new static($persistentToken->getClass(), $persistentToken->getUserIdentifier(), $expires, $persistentToken->getSeries().':'.$persistentToken->getTokenValue()); + } + + public function withValue(string $value): self + { + $details = clone $this; + $details->value = $value; + + return $details; + } + + public function getUserFqcn(): string + { + return $this->userFqcn; + } + + public function getUserIdentifier(): string + { + return $this->userIdentifier; + } + + public function getExpires(): int + { + return $this->expires; + } + + public function getValue(): string + { + return $this->value; + } + + public function toString(): string + { + // $userIdentifier is encoded because it might contain COOKIE_DELIMITER, we assume other values don't + return base64_encode(implode(self::COOKIE_DELIMITER, [$this->userFqcn, base64_encode($this->userIdentifier), $this->expires, $this->value])); + } +} diff --git a/vendor/symfony/security-http/RememberMe/RememberMeHandlerInterface.php b/vendor/symfony/security-http/RememberMe/RememberMeHandlerInterface.php new file mode 100644 index 0000000..046fddb --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/RememberMeHandlerInterface.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Handles creating and validating remember-me cookies. + * + * If you want to add a custom implementation, you want to extend from + * {@see AbstractRememberMeHandler} instead. + * + * @author Wouter de Jong + */ +interface RememberMeHandlerInterface +{ + /** + * Creates a remember-me cookie. + * + * The actual cookie should be set as an attribute on the main request, + * which is transformed into a response cookie by {@see ResponseListener}. + */ + public function createRememberMeCookie(UserInterface $user): void; + + /** + * Validates the remember-me cookie and returns the associated User. + * + * Every cookie should only be used once. This means that this method should also: + * - Create a new remember-me cookie to be sent with the response (using the + * {@see ResponseListener::COOKIE_ATTR_NAME} request attribute); + * - If you store the token somewhere else (e.g. in a database), invalidate the + * stored token. + * + * @throws AuthenticationException + */ + public function consumeRememberMeCookie(RememberMeDetails $rememberMeDetails): UserInterface; + + /** + * Clears the remember-me cookie. + * + * This should set a cookie with a `null` value on the request attribute. + */ + public function clearRememberMeCookie(): void; +} diff --git a/vendor/symfony/security-http/RememberMe/RememberMeServicesInterface.php b/vendor/symfony/security-http/RememberMe/RememberMeServicesInterface.php new file mode 100644 index 0000000..239cad7 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/RememberMeServicesInterface.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" interface is deprecated, use "%s" instead.', RememberMeServicesInterface::class, RememberMeHandlerInterface::class); + +/** + * Interface that needs to be implemented by classes which provide remember-me + * capabilities. + * + * We provide two implementations out-of-the-box: + * - TokenBasedRememberMeServices (does not require a TokenProvider) + * - PersistentTokenBasedRememberMeServices (requires a TokenProvider) + * + * @author Johannes M. Schmitt + * + * @method logout(Request $request, Response $response, TokenInterface $token) + * + * @deprecated since Symfony 5.4, use {@see RememberMeHandlerInterface} instead + */ +interface RememberMeServicesInterface +{ + /** + * This attribute name can be used by the implementation if it needs to set + * a cookie on the Request when there is no actual Response, yet. + */ + public const COOKIE_ATTR_NAME = '_security_remember_me_cookie'; + + /** + * This method will be called whenever the TokenStorage does not contain + * a TokenInterface object and the framework wishes to provide an implementation + * with an opportunity to authenticate the request using remember-me capabilities. + * + * No attempt whatsoever is made to determine whether the browser has requested + * remember-me services or presented a valid cookie. Any and all such determinations + * are left to the implementation of this method. + * + * If a browser has presented an unauthorised cookie for whatever reason, + * make sure to throw an AuthenticationException as this will consequentially + * result in a call to loginFail() and therefore an invalidation of the cookie. + * + * @return TokenInterface|null + */ + public function autoLogin(Request $request); + + /** + * Called whenever an interactive authentication attempt was made, but the + * credentials supplied by the user were missing or otherwise invalid. + * + * This method needs to take care of invalidating the cookie. + */ + public function loginFail(Request $request, \Exception $exception = null); + + /** + * Called whenever an interactive authentication attempt is successful + * (e.g. a form login). + * + * An implementation may always set a remember-me cookie in the Response, + * although this is not recommended. + * + * Instead, implementations should typically look for a request parameter + * (such as an HTTP POST parameter) that indicates the browser has explicitly + * requested for the authentication to be remembered. + */ + public function loginSuccess(Request $request, Response $response, TokenInterface $token); +} diff --git a/vendor/symfony/security-http/RememberMe/ResponseListener.php b/vendor/symfony/security-http/RememberMe/ResponseListener.php new file mode 100644 index 0000000..82eab69 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/ResponseListener.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\Event\ResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; + +/** + * Adds remember-me cookies to the Response. + * + * @author Johannes M. Schmitt + * + * @final + */ +class ResponseListener implements EventSubscriberInterface +{ + /** + * This attribute name can be used by the implementation if it needs to set + * a cookie on the Request when there is no actual Response, yet. + */ + public const COOKIE_ATTR_NAME = '_security_remember_me_cookie'; + + public function onKernelResponse(ResponseEvent $event) + { + if (!$event->isMainRequest()) { + return; + } + + $request = $event->getRequest(); + $response = $event->getResponse(); + + if ($request->attributes->has(self::COOKIE_ATTR_NAME)) { + $response->headers->setCookie($request->attributes->get(self::COOKIE_ATTR_NAME)); + } + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents(): array + { + return [KernelEvents::RESPONSE => 'onKernelResponse']; + } +} diff --git a/vendor/symfony/security-http/RememberMe/SignatureRememberMeHandler.php b/vendor/symfony/security-http/RememberMe/SignatureRememberMeHandler.php new file mode 100644 index 0000000..834b3e1 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/SignatureRememberMeHandler.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Signature\Exception\ExpiredSignatureException; +use Symfony\Component\Security\Core\Signature\Exception\InvalidSignatureException; +use Symfony\Component\Security\Core\Signature\SignatureHasher; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; + +/** + * Implements safe remember-me cookies using the {@see SignatureHasher}. + * + * This handler doesn't require a database for the remember-me tokens. + * However, it cannot invalidate a specific user session, all sessions for + * that user will be invalidated instead. Use {@see PersistentRememberMeHandler} + * if you need this. + * + * @author Wouter de Jong + */ +final class SignatureRememberMeHandler extends AbstractRememberMeHandler +{ + private $signatureHasher; + + public function __construct(SignatureHasher $signatureHasher, UserProviderInterface $userProvider, RequestStack $requestStack, array $options, LoggerInterface $logger = null) + { + parent::__construct($userProvider, $requestStack, $options, $logger); + + $this->signatureHasher = $signatureHasher; + } + + /** + * {@inheritdoc} + */ + public function createRememberMeCookie(UserInterface $user): void + { + $expires = time() + $this->options['lifetime']; + $value = $this->signatureHasher->computeSignatureHash($user, $expires); + + $details = new RememberMeDetails(\get_class($user), method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), $expires, $value); + $this->createCookie($details); + } + + /** + * {@inheritdoc} + */ + public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInterface $user): void + { + try { + $this->signatureHasher->verifySignatureHash($user, $rememberMeDetails->getExpires(), $rememberMeDetails->getValue()); + } catch (InvalidSignatureException $e) { + throw new AuthenticationException('The cookie\'s hash is invalid.', 0, $e); + } catch (ExpiredSignatureException $e) { + throw new AuthenticationException('The cookie has expired.', 0, $e); + } + + $this->createRememberMeCookie($user); + } +} diff --git a/vendor/symfony/security-http/RememberMe/TokenBasedRememberMeServices.php b/vendor/symfony/security-http/RememberMe/TokenBasedRememberMeServices.php new file mode 100644 index 0000000..2fa5966 --- /dev/null +++ b/vendor/symfony/security-http/RememberMe/TokenBasedRememberMeServices.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\RememberMe; + +use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserInterface; + +trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', TokenBasedRememberMeServices::class, SignatureRememberMeHandler::class); + +/** + * Concrete implementation of the RememberMeServicesInterface providing + * remember-me capabilities without requiring a TokenProvider. + * + * @author Johannes M. Schmitt + * + * @deprecated since Symfony 5.4, use {@see SignatureRememberMeHandler} instead + */ +class TokenBasedRememberMeServices extends AbstractRememberMeServices +{ + /** + * {@inheritdoc} + */ + protected function processAutoLoginCookie(array $cookieParts, Request $request) + { + if (4 !== \count($cookieParts)) { + throw new AuthenticationException('The cookie is invalid.'); + } + + [$class, $userIdentifier, $expires, $hash] = $cookieParts; + if (false === $userIdentifier = base64_decode($userIdentifier, true)) { + throw new AuthenticationException('$userIdentifier contains a character from outside the base64 alphabet.'); + } + try { + $userProvider = $this->getUserProvider($class); + // @deprecated since Symfony 5.3, change to $userProvider->loadUserByIdentifier() in 6.0 + if (method_exists($userProvider, 'loadUserByIdentifier')) { + $user = $userProvider->loadUserByIdentifier($userIdentifier); + } else { + trigger_deprecation('symfony/security-core', '5.3', 'Not implementing method "loadUserByIdentifier()" in user provider "%s" is deprecated. This method will replace "loadUserByUsername()" in Symfony 6.0.', get_debug_type($userProvider)); + + $user = $userProvider->loadUserByUsername($userIdentifier); + } + } catch (\Exception $e) { + if (!$e instanceof AuthenticationException) { + $e = new AuthenticationException($e->getMessage(), $e->getCode(), $e); + } + + throw $e; + } + + if (!$user instanceof UserInterface) { + throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_debug_type($user))); + } + + if (true !== hash_equals($this->generateCookieHash($class, $userIdentifier, $expires, $user->getPassword()), $hash)) { + throw new AuthenticationException('The cookie\'s hash is invalid.'); + } + + if ($expires < time()) { + throw new AuthenticationException('The cookie has expired.'); + } + + return $user; + } + + /** + * {@inheritdoc} + */ + protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token) + { + $user = $token->getUser(); + $expires = time() + $this->options['lifetime']; + // @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0 + $value = $this->generateCookieValue(\get_class($user), method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), $expires, $user->getPassword()); + + $response->headers->setCookie( + new Cookie( + $this->options['name'], + $value, + $expires, + $this->options['path'], + $this->options['domain'], + $this->options['secure'] ?? $request->isSecure(), + $this->options['httponly'], + false, + $this->options['samesite'] + ) + ); + } + + /** + * Generates the cookie value. + * + * @param int $expires The Unix timestamp when the cookie expires + * @param string|null $password The encoded password + * + * @return string + */ + protected function generateCookieValue(string $class, string $userIdentifier, int $expires, ?string $password) + { + // $userIdentifier is encoded because it might contain COOKIE_DELIMITER, + // we assume other values don't + return $this->encodeCookie([ + $class, + base64_encode($userIdentifier), + $expires, + $this->generateCookieHash($class, $userIdentifier, $expires, $password), + ]); + } + + /** + * Generates a hash for the cookie to ensure it is not being tampered with. + * + * @param int $expires The Unix timestamp when the cookie expires + * @param string|null $password The encoded password + * + * @return string + */ + protected function generateCookieHash(string $class, string $userIdentifier, int $expires, ?string $password) + { + return hash_hmac('sha256', $class.self::COOKIE_DELIMITER.$userIdentifier.self::COOKIE_DELIMITER.$expires.self::COOKIE_DELIMITER.$password, $this->getSecret()); + } +} diff --git a/vendor/symfony/security-http/SecurityEvents.php b/vendor/symfony/security-http/SecurityEvents.php new file mode 100644 index 0000000..2e3755e --- /dev/null +++ b/vendor/symfony/security-http/SecurityEvents.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Symfony\Component\Security\Http\Event\SwitchUserEvent; + +final class SecurityEvents +{ + /** + * The INTERACTIVE_LOGIN event occurs after a user has actively logged + * into your website. It is important to distinguish this action from + * non-interactive authentication methods, such as: + * - authentication based on your session. + * - authentication using an HTTP basic or HTTP digest header. + * + * @Event("Symfony\Component\Security\Http\Event\InteractiveLoginEvent") + */ + public const INTERACTIVE_LOGIN = 'security.interactive_login'; + + /** + * The SWITCH_USER event occurs before switch to another user and + * before exit from an already switched user. + * + * @Event("Symfony\Component\Security\Http\Event\SwitchUserEvent") + */ + public const SWITCH_USER = 'security.switch_user'; + + /** + * Event aliases. + * + * These aliases can be consumed by RegisterListenersPass. + */ + public const ALIASES = [ + InteractiveLoginEvent::class => self::INTERACTIVE_LOGIN, + SwitchUserEvent::class => self::SWITCH_USER, + ]; +} diff --git a/vendor/symfony/security-http/Session/SessionAuthenticationStrategy.php b/vendor/symfony/security-http/Session/SessionAuthenticationStrategy.php new file mode 100644 index 0000000..a4bb888 --- /dev/null +++ b/vendor/symfony/security-http/Session/SessionAuthenticationStrategy.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Session; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * The default session strategy implementation. + * + * Supports the following strategies: + * NONE: the session is not changed + * MIGRATE: the session id is updated, attributes are kept + * INVALIDATE: the session id is updated, attributes are lost + * + * @author Johannes M. Schmitt + */ +class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInterface +{ + public const NONE = 'none'; + public const MIGRATE = 'migrate'; + public const INVALIDATE = 'invalidate'; + + private $strategy; + + public function __construct(string $strategy) + { + $this->strategy = $strategy; + } + + /** + * {@inheritdoc} + */ + public function onAuthentication(Request $request, TokenInterface $token) + { + switch ($this->strategy) { + case self::NONE: + return; + + case self::MIGRATE: + // Note: this logic is duplicated in several authentication listeners + // until Symfony 5.0 due to a security fix with BC compat + $request->getSession()->migrate(true); + + return; + + case self::INVALIDATE: + $request->getSession()->invalidate(); + + return; + + default: + throw new \RuntimeException(sprintf('Invalid session authentication strategy "%s".', $this->strategy)); + } + } +} diff --git a/vendor/symfony/security-http/Session/SessionAuthenticationStrategyInterface.php b/vendor/symfony/security-http/Session/SessionAuthenticationStrategyInterface.php new file mode 100644 index 0000000..a45f852 --- /dev/null +++ b/vendor/symfony/security-http/Session/SessionAuthenticationStrategyInterface.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Session; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + +/** + * SessionAuthenticationStrategyInterface. + * + * Implementation are responsible for updating the session after an interactive + * authentication attempt was successful. + * + * @author Johannes M. Schmitt + */ +interface SessionAuthenticationStrategyInterface +{ + /** + * This performs any necessary changes to the session. + * + * This method should be called before the TokenStorage is populated with a + * Token. It should be used by authentication listeners when a session is used. + */ + public function onAuthentication(Request $request, TokenInterface $token); +} diff --git a/vendor/symfony/security-http/Util/TargetPathTrait.php b/vendor/symfony/security-http/Util/TargetPathTrait.php new file mode 100644 index 0000000..67dcc99 --- /dev/null +++ b/vendor/symfony/security-http/Util/TargetPathTrait.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Util; + +use Symfony\Component\HttpFoundation\Session\SessionInterface; + +/** + * Trait to get (and set) the URL the user last visited before being forced to authenticate. + */ +trait TargetPathTrait +{ + /** + * Sets the target path the user should be redirected to after authentication. + * + * Usually, you do not need to set this directly. + */ + private function saveTargetPath(SessionInterface $session, string $firewallName, string $uri) + { + $session->set('_security.'.$firewallName.'.target_path', $uri); + } + + /** + * Returns the URL (if any) the user visited that forced them to login. + */ + private function getTargetPath(SessionInterface $session, string $firewallName): ?string + { + return $session->get('_security.'.$firewallName.'.target_path'); + } + + /** + * Removes the target path from the session. + */ + private function removeTargetPath(SessionInterface $session, string $firewallName) + { + $session->remove('_security.'.$firewallName.'.target_path'); + } +} diff --git a/vendor/symfony/security-http/composer.json b/vendor/symfony/security-http/composer.json new file mode 100644 index 0000000..dc0deba --- /dev/null +++ b/vendor/symfony/security-http/composer.json @@ -0,0 +1,52 @@ +{ + "name": "symfony/security-http", + "type": "library", + "description": "Symfony Security Component - HTTP Integration", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/security-core": "^5.4|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/property-access": "^4.4|^5.0|^6.0" + }, + "require-dev": { + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/rate-limiter": "^5.2|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "psr/log": "^1|^2|^3" + }, + "conflict": { + "symfony/event-dispatcher": "<4.3", + "symfony/security-bundle": "<5.3", + "symfony/security-csrf": "<4.4" + }, + "suggest": { + "symfony/security-csrf": "For using tokens to protect authentication/logout attempts", + "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Security\\Http\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/translation-contracts/.gitignore b/vendor/symfony/translation-contracts/.gitignore new file mode 100644 index 0000000..c49a5d8 --- /dev/null +++ b/vendor/symfony/translation-contracts/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/translation-contracts/CHANGELOG.md b/vendor/symfony/translation-contracts/CHANGELOG.md new file mode 100644 index 0000000..7932e26 --- /dev/null +++ b/vendor/symfony/translation-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/vendor/symfony/translation-contracts/LICENSE b/vendor/symfony/translation-contracts/LICENSE new file mode 100644 index 0000000..74cdc2d --- /dev/null +++ b/vendor/symfony/translation-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018-2022 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/translation-contracts/LocaleAwareInterface.php b/vendor/symfony/translation-contracts/LocaleAwareInterface.php new file mode 100644 index 0000000..693f92b --- /dev/null +++ b/vendor/symfony/translation-contracts/LocaleAwareInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\Translation; + +interface LocaleAwareInterface +{ + /** + * Sets the current locale. + * + * @param string $locale The locale + * + * @throws \InvalidArgumentException If the locale contains invalid characters + */ + public function setLocale(string $locale); + + /** + * Returns the current locale. + * + * @return string + */ + public function getLocale(); +} diff --git a/vendor/symfony/translation-contracts/README.md b/vendor/symfony/translation-contracts/README.md new file mode 100644 index 0000000..42e5c51 --- /dev/null +++ b/vendor/symfony/translation-contracts/README.md @@ -0,0 +1,9 @@ +Symfony Translation Contracts +============================= + +A set of abstractions extracted out of the Symfony components. + +Can be used to build on semantics that the Symfony components proved useful - and +that already have battle tested implementations. + +See https://github.com/symfony/contracts/blob/main/README.md for more information. diff --git a/vendor/symfony/translation-contracts/Test/TranslatorTest.php b/vendor/symfony/translation-contracts/Test/TranslatorTest.php new file mode 100644 index 0000000..8903676 --- /dev/null +++ b/vendor/symfony/translation-contracts/Test/TranslatorTest.php @@ -0,0 +1,390 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\Translation\Test; + +use PHPUnit\Framework\TestCase; +use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorTrait; + +/** + * Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms + * and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms. + * + * See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms. + * The mozilla code is also interesting to check for. + * + * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199 + * + * The goal to cover all languages is to far fetched so this test case is smaller. + * + * @author Clemens Tolboom clemens@build2be.nl + */ +class TranslatorTest extends TestCase +{ + private $defaultLocale; + + protected function setUp(): void + { + $this->defaultLocale = \Locale::getDefault(); + \Locale::setDefault('en'); + } + + protected function tearDown(): void + { + \Locale::setDefault($this->defaultLocale); + } + + /** + * @return TranslatorInterface + */ + public function getTranslator() + { + return new class() implements TranslatorInterface { + use TranslatorTrait; + }; + } + + /** + * @dataProvider getTransTests + */ + public function testTrans($expected, $id, $parameters) + { + $translator = $this->getTranslator(); + + $this->assertEquals($expected, $translator->trans($id, $parameters)); + } + + /** + * @dataProvider getTransChoiceTests + */ + public function testTransChoiceWithExplicitLocale($expected, $id, $number) + { + $translator = $this->getTranslator(); + + $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number])); + } + + /** + * @requires extension intl + * + * @dataProvider getTransChoiceTests + */ + public function testTransChoiceWithDefaultLocale($expected, $id, $number) + { + $translator = $this->getTranslator(); + + $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number])); + } + + /** + * @dataProvider getTransChoiceTests + */ + public function testTransChoiceWithEnUsPosix($expected, $id, $number) + { + $translator = $this->getTranslator(); + $translator->setLocale('en_US_POSIX'); + + $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number])); + } + + public function testGetSetLocale() + { + $translator = $this->getTranslator(); + + $this->assertEquals('en', $translator->getLocale()); + } + + /** + * @requires extension intl + */ + public function testGetLocaleReturnsDefaultLocaleIfNotSet() + { + $translator = $this->getTranslator(); + + \Locale::setDefault('pt_BR'); + $this->assertEquals('pt_BR', $translator->getLocale()); + + \Locale::setDefault('en'); + $this->assertEquals('en', $translator->getLocale()); + } + + public function getTransTests() + { + return [ + ['Symfony is great!', 'Symfony is great!', []], + ['Symfony is awesome!', 'Symfony is %what%!', ['%what%' => 'awesome']], + ]; + } + + public function getTransChoiceTests() + { + return [ + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1], + ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], + ['There are 0 apples', 'There is 1 apple|There are %count% apples', 0], + ['There is 1 apple', 'There is 1 apple|There are %count% apples', 1], + ['There are 10 apples', 'There is 1 apple|There are %count% apples', 10], + // custom validation messages may be coded with a fixed value + ['There are 2 apples', 'There are 2 apples', 2], + ]; + } + + /** + * @dataProvider getInternal + */ + public function testInterval($expected, $number, $interval) + { + $translator = $this->getTranslator(); + + $this->assertEquals($expected, $translator->trans($interval.' foo|[1,Inf[ bar', ['%count%' => $number])); + } + + public function getInternal() + { + return [ + ['foo', 3, '{1,2, 3 ,4}'], + ['bar', 10, '{1,2, 3 ,4}'], + ['bar', 3, '[1,2]'], + ['foo', 1, '[1,2]'], + ['foo', 2, '[1,2]'], + ['bar', 1, ']1,2['], + ['bar', 2, ']1,2['], + ['foo', log(0), '[-Inf,2['], + ['foo', -log(0), '[-2,+Inf]'], + ]; + } + + /** + * @dataProvider getChooseTests + */ + public function testChoose($expected, $id, $number, $locale = null) + { + $translator = $this->getTranslator(); + + $this->assertEquals($expected, $translator->trans($id, ['%count%' => $number], null, $locale)); + } + + public function testReturnMessageIfExactlyOneStandardRuleIsGiven() + { + $translator = $this->getTranslator(); + + $this->assertEquals('There are two apples', $translator->trans('There are two apples', ['%count%' => 2])); + } + + /** + * @dataProvider getNonMatchingMessages + */ + public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number) + { + $this->expectException(\InvalidArgumentException::class); + $translator = $this->getTranslator(); + + $translator->trans($id, ['%count%' => $number]); + } + + public function getNonMatchingMessages() + { + return [ + ['{0} There are no apples|{1} There is one apple', 2], + ['{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['{1} There is one apple|]2,Inf] There are %count% apples', 2], + ['{0} There are no apples|There is one apple', 2], + ]; + } + + public function getChooseTests() + { + return [ + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + + ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1], + + ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], + ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10], + ['There are 10 apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], + + ['There are 0 apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are 10 apples', 'There is one apple|There are %count% apples', 10], + + ['There are 0 apples', 'one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', 'one: There is one apple|more: There are %count% apples', 1], + ['There are 10 apples', 'one: There is one apple|more: There are %count% apples', 10], + + ['There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1], + ['There are 10 apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10], + + ['', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1], + + // Indexed only tests which are Gettext PoFile* compatible strings. + ['There are 0 apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are 2 apples', 'There is one apple|There are %count% apples', 2], + + // Tests for float numbers + ['There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7], + ['There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1], + ['There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0], + ['There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], + + // Test texts with new-lines + // with double-quotes and \n in id & double-quotes and actual newlines in text + ["This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a + new-line in it. Selector = 0.|{1}This is a text with a + new-line in it. Selector = 1.|[1,Inf]This is a text with a + new-line in it. Selector > 1.', 0], + // with double-quotes and \n in id and single-quotes and actual newlines in text + ["This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a + new-line in it. Selector = 0.|{1}This is a text with a + new-line in it. Selector = 1.|[1,Inf]This is a text with a + new-line in it. Selector > 1.', 1], + ["This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a + new-line in it. Selector = 0.|{1}This is a text with a + new-line in it. Selector = 1.|[1,Inf]This is a text with a + new-line in it. Selector > 1.', 5], + // with double-quotes and id split accros lines + ['This is a text with a + new-line in it. Selector = 1.', '{0}This is a text with a + new-line in it. Selector = 0.|{1}This is a text with a + new-line in it. Selector = 1.|[1,Inf]This is a text with a + new-line in it. Selector > 1.', 1], + // with single-quotes and id split accros lines + ['This is a text with a + new-line in it. Selector > 1.', '{0}This is a text with a + new-line in it. Selector = 0.|{1}This is a text with a + new-line in it. Selector = 1.|[1,Inf]This is a text with a + new-line in it. Selector > 1.', 5], + // with single-quotes and \n in text + ['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0], + // with double-quotes and id split accros lines + ["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1], + // esacape pipe + ['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0], + // Empty plural set (2 plural forms) from a .PO file + ['', '|', 1], + // Empty plural set (3 plural forms) from a .PO file + ['', '||', 1], + + // Floating values + ['1.5 liters', '%count% liter|%count% liters', 1.5], + ['1.5 litre', '%count% litre|%count% litres', 1.5, 'fr'], + + // Negative values + ['-1 degree', '%count% degree|%count% degrees', -1], + ['-1 degré', '%count% degré|%count% degrés', -1], + ['-1.5 degrees', '%count% degree|%count% degrees', -1.5], + ['-1.5 degré', '%count% degré|%count% degrés', -1.5, 'fr'], + ['-2 degrees', '%count% degree|%count% degrees', -2], + ['-2 degrés', '%count% degré|%count% degrés', -2], + ]; + } + + /** + * @dataProvider failingLangcodes + */ + public function testFailedLangcodes($nplural, $langCodes) + { + $matrix = $this->generateTestData($langCodes); + $this->validateMatrix($nplural, $matrix, false); + } + + /** + * @dataProvider successLangcodes + */ + public function testLangcodes($nplural, $langCodes) + { + $matrix = $this->generateTestData($langCodes); + $this->validateMatrix($nplural, $matrix); + } + + /** + * This array should contain all currently known langcodes. + * + * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete. + * + * @return array + */ + public function successLangcodes() + { + return [ + ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], + ['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']], + ['3', ['be', 'bs', 'cs', 'hr']], + ['4', ['cy', 'mt', 'sl']], + ['6', ['ar']], + ]; + } + + /** + * This array should be at least empty within the near future. + * + * This both depends on a complete list trying to add above as understanding + * the plural rules of the current failing languages. + * + * @return array with nplural together with langcodes + */ + public function failingLangcodes() + { + return [ + ['1', ['fa']], + ['2', ['jbo']], + ['3', ['cbs']], + ['4', ['gd', 'kw']], + ['5', ['ga']], + ]; + } + + /** + * We validate only on the plural coverage. Thus the real rules is not tested. + * + * @param string $nplural Plural expected + * @param array $matrix Containing langcodes and their plural index values + * @param bool $expectSuccess + */ + protected function validateMatrix($nplural, $matrix, $expectSuccess = true) + { + foreach ($matrix as $langCode => $data) { + $indexes = array_flip($data); + if ($expectSuccess) { + $this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + } else { + $this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + } + } + } + + protected function generateTestData($langCodes) + { + $translator = new class() { + use TranslatorTrait { + getPluralizationRule as public; + } + }; + + $matrix = []; + foreach ($langCodes as $langCode) { + for ($count = 0; $count < 200; ++$count) { + $plural = $translator->getPluralizationRule($count, $langCode); + $matrix[$langCode][$count] = $plural; + } + } + + return $matrix; + } +} diff --git a/vendor/symfony/translation-contracts/TranslatableInterface.php b/vendor/symfony/translation-contracts/TranslatableInterface.php new file mode 100644 index 0000000..47fd6fa --- /dev/null +++ b/vendor/symfony/translation-contracts/TranslatableInterface.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\Translation; + +/** + * @author Nicolas Grekas + */ +interface TranslatableInterface +{ + public function trans(TranslatorInterface $translator, string $locale = null): string; +} diff --git a/vendor/symfony/translation-contracts/TranslatorInterface.php b/vendor/symfony/translation-contracts/TranslatorInterface.php new file mode 100644 index 0000000..77b7a9c --- /dev/null +++ b/vendor/symfony/translation-contracts/TranslatorInterface.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\Translation; + +/** + * @author Fabien Potencier + * + * @method string getLocale() Returns the default locale + */ +interface TranslatorInterface +{ + /** + * Translates the given message. + * + * When a number is provided as a parameter named "%count%", the message is parsed for plural + * forms and a translation is chosen according to this number using the following rules: + * + * Given a message with different plural translations separated by a + * pipe (|), this method returns the correct portion of the message based + * on the given number, locale and the pluralization rules in the message + * itself. + * + * The message supports two different types of pluralization rules: + * + * interval: {0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples + * indexed: There is one apple|There are %count% apples + * + * The indexed solution can also contain labels (e.g. one: There is one apple). + * This is purely for making the translations more clear - it does not + * affect the functionality. + * + * The two methods can also be mixed: + * {0} There are no apples|one: There is one apple|more: There are %count% apples + * + * An interval can represent a finite set of numbers: + * {1,2,3,4} + * + * An interval can represent numbers between two numbers: + * [1, +Inf] + * ]-1,2[ + * + * The left delimiter can be [ (inclusive) or ] (exclusive). + * The right delimiter can be [ (exclusive) or ] (inclusive). + * Beside numbers, you can use -Inf and +Inf for the infinite. + * + * @see https://en.wikipedia.org/wiki/ISO_31-11 + * + * @param string $id The message id (may also be an object that can be cast to string) + * @param array $parameters An array of parameters for the message + * @param string|null $domain The domain for the message or null to use the default + * @param string|null $locale The locale or null to use the default + * + * @return string + * + * @throws \InvalidArgumentException If the locale contains invalid characters + */ + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null); +} diff --git a/vendor/symfony/translation-contracts/TranslatorTrait.php b/vendor/symfony/translation-contracts/TranslatorTrait.php new file mode 100644 index 0000000..405ce8d --- /dev/null +++ b/vendor/symfony/translation-contracts/TranslatorTrait.php @@ -0,0 +1,262 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Contracts\Translation; + +use Symfony\Component\Translation\Exception\InvalidArgumentException; + +/** + * A trait to help implement TranslatorInterface and LocaleAwareInterface. + * + * @author Fabien Potencier + */ +trait TranslatorTrait +{ + private $locale; + + /** + * {@inheritdoc} + */ + public function setLocale(string $locale) + { + $this->locale = $locale; + } + + /** + * {@inheritdoc} + * + * @return string + */ + public function getLocale() + { + return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en'); + } + + /** + * {@inheritdoc} + */ + public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string + { + if (null === $id || '' === $id) { + return ''; + } + + if (!isset($parameters['%count%']) || !is_numeric($parameters['%count%'])) { + return strtr($id, $parameters); + } + + $number = (float) $parameters['%count%']; + $locale = $locale ?: $this->getLocale(); + + $parts = []; + if (preg_match('/^\|++$/', $id)) { + $parts = explode('|', $id); + } elseif (preg_match_all('/(?:\|\||[^\|])++/', $id, $matches)) { + $parts = $matches[0]; + } + + $intervalRegexp = <<<'EOF' +/^(?P + ({\s* + (\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*) + \s*}) + + | + + (?P[\[\]]) + \s* + (?P-Inf|\-?\d+(\.\d+)?) + \s*,\s* + (?P\+?Inf|\-?\d+(\.\d+)?) + \s* + (?P[\[\]]) +)\s*(?P.*?)$/xs +EOF; + + $standardRules = []; + foreach ($parts as $part) { + $part = trim(str_replace('||', '|', $part)); + + // try to match an explicit rule, then fallback to the standard ones + if (preg_match($intervalRegexp, $part, $matches)) { + if ($matches[2]) { + foreach (explode(',', $matches[3]) as $n) { + if ($number == $n) { + return strtr($matches['message'], $parameters); + } + } + } else { + $leftNumber = '-Inf' === $matches['left'] ? -\INF : (float) $matches['left']; + $rightNumber = is_numeric($matches['right']) ? (float) $matches['right'] : \INF; + + if (('[' === $matches['left_delimiter'] ? $number >= $leftNumber : $number > $leftNumber) + && (']' === $matches['right_delimiter'] ? $number <= $rightNumber : $number < $rightNumber) + ) { + return strtr($matches['message'], $parameters); + } + } + } elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) { + $standardRules[] = $matches[1]; + } else { + $standardRules[] = $part; + } + } + + $position = $this->getPluralizationRule($number, $locale); + + if (!isset($standardRules[$position])) { + // when there's exactly one rule given, and that rule is a standard + // rule, use this rule + if (1 === \count($parts) && isset($standardRules[0])) { + return strtr($standardRules[0], $parameters); + } + + $message = sprintf('Unable to choose a translation for "%s" with locale "%s" for value "%d". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %%count%% apples").', $id, $locale, $number); + + if (class_exists(InvalidArgumentException::class)) { + throw new InvalidArgumentException($message); + } + + throw new \InvalidArgumentException($message); + } + + return strtr($standardRules[$position], $parameters); + } + + /** + * Returns the plural position to use for the given locale and number. + * + * The plural rules are derived from code of the Zend Framework (2010-09-25), + * which is subject to the new BSD license (http://framework.zend.com/license/new-bsd). + * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + */ + private function getPluralizationRule(float $number, string $locale): int + { + $number = abs($number); + + switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { + case 'af': + case 'bn': + case 'bg': + case 'ca': + case 'da': + case 'de': + case 'el': + case 'en': + case 'en_US_POSIX': + case 'eo': + case 'es': + case 'et': + case 'eu': + case 'fa': + case 'fi': + case 'fo': + case 'fur': + case 'fy': + case 'gl': + case 'gu': + case 'ha': + case 'he': + case 'hu': + case 'is': + case 'it': + case 'ku': + case 'lb': + case 'ml': + case 'mn': + case 'mr': + case 'nah': + case 'nb': + case 'ne': + case 'nl': + case 'nn': + case 'no': + case 'oc': + case 'om': + case 'or': + case 'pa': + case 'pap': + case 'ps': + case 'pt': + case 'so': + case 'sq': + case 'sv': + case 'sw': + case 'ta': + case 'te': + case 'tk': + case 'ur': + case 'zu': + return (1 == $number) ? 0 : 1; + + case 'am': + case 'bh': + case 'fil': + case 'fr': + case 'gun': + case 'hi': + case 'hy': + case 'ln': + case 'mg': + case 'nso': + case 'pt_BR': + case 'ti': + case 'wa': + return ($number < 2) ? 0 : 1; + + case 'be': + case 'bs': + case 'hr': + case 'ru': + case 'sh': + case 'sr': + case 'uk': + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + + case 'cs': + case 'sk': + return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); + + case 'ga': + return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2); + + case 'lt': + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + + case 'sl': + return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)); + + case 'mk': + return (1 == $number % 10) ? 0 : 1; + + case 'mt': + return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); + + case 'lv': + return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2); + + case 'pl': + return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); + + case 'cy': + return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)); + + case 'ro': + return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); + + case 'ar': + return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); + + default: + return 0; + } + } +} diff --git a/vendor/symfony/translation-contracts/composer.json b/vendor/symfony/translation-contracts/composer.json new file mode 100644 index 0000000..65fe243 --- /dev/null +++ b/vendor/symfony/translation-contracts/composer.json @@ -0,0 +1,37 @@ +{ + "name": "symfony/translation-contracts", + "type": "library", + "description": "Generic abstractions related to translation", + "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "autoload": { + "psr-4": { "Symfony\\Contracts\\Translation\\": "" } + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/vendor/symfony/twig-bridge/AppVariable.php b/vendor/symfony/twig-bridge/AppVariable.php new file mode 100644 index 0000000..23683eb --- /dev/null +++ b/vendor/symfony/twig-bridge/AppVariable.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\User\UserInterface; + +/** + * Exposes some Symfony parameters and services as an "app" global variable. + * + * @author Fabien Potencier + */ +class AppVariable +{ + private $tokenStorage; + private $requestStack; + private $environment; + private $debug; + + public function setTokenStorage(TokenStorageInterface $tokenStorage) + { + $this->tokenStorage = $tokenStorage; + } + + public function setRequestStack(RequestStack $requestStack) + { + $this->requestStack = $requestStack; + } + + public function setEnvironment(string $environment) + { + $this->environment = $environment; + } + + public function setDebug(bool $debug) + { + $this->debug = $debug; + } + + /** + * Returns the current token. + * + * @return TokenInterface|null + * + * @throws \RuntimeException When the TokenStorage is not available + */ + public function getToken() + { + if (null === $tokenStorage = $this->tokenStorage) { + throw new \RuntimeException('The "app.token" variable is not available.'); + } + + return $tokenStorage->getToken(); + } + + /** + * Returns the current user. + * + * @return UserInterface|null + * + * @see TokenInterface::getUser() + */ + public function getUser() + { + if (null === $tokenStorage = $this->tokenStorage) { + throw new \RuntimeException('The "app.user" variable is not available.'); + } + + if (!$token = $tokenStorage->getToken()) { + return null; + } + + $user = $token->getUser(); + + // @deprecated since Symfony 5.4, $user will always be a UserInterface instance + return \is_object($user) ? $user : null; + } + + /** + * Returns the current request. + * + * @return Request|null + */ + public function getRequest() + { + if (null === $this->requestStack) { + throw new \RuntimeException('The "app.request" variable is not available.'); + } + + return $this->requestStack->getCurrentRequest(); + } + + /** + * Returns the current session. + * + * @return Session|null + */ + public function getSession() + { + if (null === $this->requestStack) { + throw new \RuntimeException('The "app.session" variable is not available.'); + } + $request = $this->getRequest(); + + return $request && $request->hasSession() ? $request->getSession() : null; + } + + /** + * Returns the current app environment. + * + * @return string + */ + public function getEnvironment() + { + if (null === $this->environment) { + throw new \RuntimeException('The "app.environment" variable is not available.'); + } + + return $this->environment; + } + + /** + * Returns the current app debug mode. + * + * @return bool + */ + public function getDebug() + { + if (null === $this->debug) { + throw new \RuntimeException('The "app.debug" variable is not available.'); + } + + return $this->debug; + } + + /** + * Returns some or all the existing flash messages: + * * getFlashes() returns all the flash messages + * * getFlashes('notice') returns a simple array with flash messages of that type + * * getFlashes(['notice', 'error']) returns a nested array of type => messages. + * + * @return array + */ + public function getFlashes($types = null) + { + try { + if (null === $session = $this->getSession()) { + return []; + } + } catch (\RuntimeException $e) { + return []; + } + + if (null === $types || '' === $types || [] === $types) { + return $session->getFlashBag()->all(); + } + + if (\is_string($types)) { + return $session->getFlashBag()->get($types); + } + + $result = []; + foreach ($types as $type) { + $result[$type] = $session->getFlashBag()->get($type); + } + + return $result; + } +} diff --git a/vendor/symfony/twig-bridge/CHANGELOG.md b/vendor/symfony/twig-bridge/CHANGELOG.md new file mode 100644 index 0000000..535df0c --- /dev/null +++ b/vendor/symfony/twig-bridge/CHANGELOG.md @@ -0,0 +1,169 @@ +CHANGELOG +========= + +5.4 +--- + +* Add `github` format & autodetection to render errors as annotations when + running the Twig linter command in a Github Actions environment. + +5.3 +--- + + * Add a new `markAsPublic` method on `NotificationEmail` to change the `importance` context option to null after creation + * Add a new `fragment_uri()` helper to generate the URI of a fragment + * Add support of Bootstrap 5 for form theming + * Add a new `serialize` filter to serialize objects using the Serializer component + +5.2.0 +----- + + * added the `impersonation_exit_url()` and `impersonation_exit_path()` functions. They return a URL that allows to switch back to the original user. + * added the `workflow_transition()` function to easily retrieve a specific transition object + * added support for translating `TranslatableInterface` objects + * added the `t()` function to easily create `TranslatableMessage` objects + * Added support for extracting messages from the `t()` function + * Added `field_*` Twig functions to access string values from Form fields + * changed the `importance` context option of `NotificationEmail` to allow `null` + +5.0.0 +----- + + * removed `TwigEngine` class, use `\Twig\Environment` instead. + * removed `transChoice` filter and token + * `HttpFoundationExtension` requires a `UrlHelper` on instantiation + * removed support for implicit STDIN usage in the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit. + * added form theme for Foundation 6 + * added support for Foundation 6 switches: add the `switch-input` class to the attributes of a `CheckboxType` + +4.4.0 +----- + + * added a new `TwigErrorRenderer` for `html` format, integrated with the `ErrorHandler` component + * marked all classes extending twig as `@final` + * deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the + `DebugCommand::__construct()` method, swap the variables position. + * the `LintCommand` lints all the templates stored in all configured Twig paths if none argument is provided + * deprecated accepting STDIN implicitly when using the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit. + * added `--show-deprecations` option to the `lint:twig` command + * added support for Bootstrap4 switches: add the `switch-custom` class to the label attributes of a `CheckboxType` + * Marked the `TwigDataCollector` class as `@final`. + +4.3.0 +----- + + * added the `form_parent()` function that allows to reliably retrieve the parent form in Twig templates + * added the `workflow_transition_blockers()` function + * deprecated the `$requestStack` and `$requestContext` arguments of the + `HttpFoundationExtension`, pass a `Symfony\Component\HttpFoundation\UrlHelper` + instance as the only argument instead + +4.2.0 +----- + + * add bundle name suggestion on wrongly overridden templates paths + * added `name` argument in `debug:twig` command and changed `filter` argument as `--filter` option + * deprecated the `transchoice` tag and filter, use the `trans` ones instead with a `%count%` parameter + +4.1.0 +----- + + * add a `workflow_metadata` function + +3.4.0 +----- + + * added an `only` keyword to `form_theme` tag to disable usage of default themes when rendering a form + * deprecated `Symfony\Bridge\Twig\Form\TwigRenderer` + * deprecated `DebugCommand::set/getTwigEnvironment`. Pass an instance of + `Twig\Environment` as first argument of the constructor instead + * deprecated `LintCommand::set/getTwigEnvironment`. Pass an instance of + `Twig\Environment` as first argument of the constructor instead + +3.3.0 +----- + + * added a `workflow_has_marked_place` function + * added a `workflow_marked_places` function + +3.2.0 +----- + + * added `AppVariable::getToken()` + * Deprecated the possibility to inject the Form `TwigRenderer` into the `FormExtension`. + * [BC BREAK] Registering the `FormExtension` without configuring a runtime loader for the `TwigRenderer` + doesn't work anymore. + + Before: + + ```php + use Symfony\Bridge\Twig\Extension\FormExtension; + use Symfony\Bridge\Twig\Form\TwigRenderer; + use Symfony\Bridge\Twig\Form\TwigRendererEngine; + + // ... + $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig']); + $rendererEngine->setEnvironment($twig); + $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager))); + ``` + + After: + + ```php + // ... + $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig'], $twig); + // require Twig 1.30+ + $twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader([ + TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) { + return new TwigRenderer($rendererEngine, $csrfTokenManager); + }, + ])); + $twig->addExtension(new FormExtension()); + ``` + * Deprecated the `TwigRendererEngineInterface` interface. + * added WorkflowExtension (provides `workflow_can` and `workflow_transitions`) + +2.7.0 +----- + + * added LogoutUrlExtension (provides `logout_url` and `logout_path`) + * added an HttpFoundation extension (provides the `absolute_url` and the `relative_path` functions) + * added AssetExtension (provides the `asset` and `asset_version` functions) + * Added possibility to extract translation messages from a file or files besides extracting from a directory + +2.5.0 +----- + + * moved command `twig:lint` from `TwigBundle` + +2.4.0 +----- + + * added stopwatch tag to time templates with the WebProfilerBundle + +2.3.0 +----- + + * added helpers form(), form_start() and form_end() + * deprecated form_enctype() in favor of form_start() + +2.2.0 +----- + + * added a `controller` function to help generating controller references + * added a `render_esi` and a `render_hinclude` function + * [BC BREAK] restricted the `render` tag to only accept URIs or ControllerReference instances (the signature changed) + * added a `render` function to render a request + * The `app` global variable is now injected even when using the twig service directly. + * Added an optional parameter to the `path` and `url` function which allows to generate + relative paths (e.g. "../parent-file") and scheme-relative URLs (e.g. "//example.com/dir/file"). + +2.1.0 +----- + + * added global variables access in a form theme + * added TwigEngine + * added TwigExtractor + * added a csrf_token function + * added a way to specify a default domain for a Twig template (via the + 'trans_default_domain' tag) diff --git a/vendor/symfony/twig-bridge/Command/DebugCommand.php b/vendor/symfony/twig-bridge/Command/DebugCommand.php new file mode 100644 index 0000000..d4c7821 --- /dev/null +++ b/vendor/symfony/twig-bridge/Command/DebugCommand.php @@ -0,0 +1,600 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Twig\Environment; +use Twig\Loader\ChainLoader; +use Twig\Loader\FilesystemLoader; + +/** + * Lists twig functions, filters, globals and tests present in the current project. + * + * @author Jordi Boggiano + */ +class DebugCommand extends Command +{ + protected static $defaultName = 'debug:twig'; + protected static $defaultDescription = 'Show a list of twig functions, filters, globals and tests'; + + private $twig; + private $projectDir; + private $bundlesMetadata; + private $twigDefaultPath; + private $filesystemLoaders; + private $fileLinkFormatter; + + public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, FileLinkFormatter $fileLinkFormatter = null) + { + parent::__construct(); + + $this->twig = $twig; + $this->projectDir = $projectDir; + $this->bundlesMetadata = $bundlesMetadata; + $this->twigDefaultPath = $twigDefaultPath; + $this->fileLinkFormatter = $fileLinkFormatter; + } + + protected function configure() + { + $this + ->setDefinition([ + new InputArgument('name', InputArgument::OPTIONAL, 'The template name'), + new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'Show details for all entries matching this filter'), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'), + ]) + ->setDescription(self::$defaultDescription) + ->setHelp(<<<'EOF' +The %command.name% command outputs a list of twig functions, +filters, globals and tests. + + php %command.full_name% + +The command lists all functions, filters, etc. + + php %command.full_name% @Twig/Exception/error.html.twig + +The command lists all paths that match the given template name. + + php %command.full_name% --filter=date + +The command lists everything that contains the word date. + + php %command.full_name% --format=json + +The command lists everything in a machine readable json format. +EOF + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + $name = $input->getArgument('name'); + $filter = $input->getOption('filter'); + + if (null !== $name && [] === $this->getFilesystemLoaders()) { + throw new InvalidArgumentException(sprintf('Argument "name" not supported, it requires the Twig loader "%s".', FilesystemLoader::class)); + } + + switch ($input->getOption('format')) { + case 'text': + $name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter); + break; + case 'json': + $name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter); + break; + default: + throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format'))); + } + + return 0; + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestArgumentValuesFor('name')) { + $suggestions->suggestValues(array_keys($this->getLoaderPaths())); + } + + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues(['text', 'json']); + } + } + + private function displayPathsText(SymfonyStyle $io, string $name) + { + $file = new \ArrayIterator($this->findTemplateFiles($name)); + $paths = $this->getLoaderPaths($name); + + $io->section('Matched File'); + if ($file->valid()) { + if ($fileLink = $this->getFileLink($file->key())) { + $io->block($file->current(), 'OK', sprintf('fg=black;bg=green;href=%s', $fileLink), ' ', true); + } else { + $io->success($file->current()); + } + $file->next(); + + if ($file->valid()) { + $io->section('Overridden Files'); + do { + if ($fileLink = $this->getFileLink($file->key())) { + $io->text(sprintf('* %s', $fileLink, $file->current())); + } else { + $io->text(sprintf('* %s', $file->current())); + } + $file->next(); + } while ($file->valid()); + } + } else { + $alternatives = []; + + if ($paths) { + $shortnames = []; + $dirs = []; + foreach (current($paths) as $path) { + $dirs[] = $this->isAbsolutePath($path) ? $path : $this->projectDir.'/'.$path; + } + foreach (Finder::create()->files()->followLinks()->in($dirs) as $file) { + $shortnames[] = str_replace('\\', '/', $file->getRelativePathname()); + } + + [$namespace, $shortname] = $this->parseTemplateName($name); + $alternatives = $this->findAlternatives($shortname, $shortnames); + if (FilesystemLoader::MAIN_NAMESPACE !== $namespace) { + $alternatives = array_map(function ($shortname) use ($namespace) { + return '@'.$namespace.'/'.$shortname; + }, $alternatives); + } + } + + $this->error($io, sprintf('Template name "%s" not found', $name), $alternatives); + } + + $io->section('Configured Paths'); + if ($paths) { + $io->table(['Namespace', 'Paths'], $this->buildTableRows($paths)); + } else { + $alternatives = []; + $namespace = $this->parseTemplateName($name)[0]; + + if (FilesystemLoader::MAIN_NAMESPACE === $namespace) { + $message = 'No template paths configured for your application'; + } else { + $message = sprintf('No template paths configured for "@%s" namespace', $namespace); + foreach ($this->getFilesystemLoaders() as $loader) { + $namespaces = $loader->getNamespaces(); + foreach ($this->findAlternatives($namespace, $namespaces) as $namespace) { + $alternatives[] = '@'.$namespace; + } + } + } + + $this->error($io, $message, $alternatives); + + if (!$alternatives && $paths = $this->getLoaderPaths()) { + $io->table(['Namespace', 'Paths'], $this->buildTableRows($paths)); + } + } + } + + private function displayPathsJson(SymfonyStyle $io, string $name) + { + $files = $this->findTemplateFiles($name); + $paths = $this->getLoaderPaths($name); + + if ($files) { + $data['matched_file'] = array_shift($files); + if ($files) { + $data['overridden_files'] = $files; + } + } else { + $data['matched_file'] = sprintf('Template name "%s" not found', $name); + } + $data['loader_paths'] = $paths; + + $io->writeln(json_encode($data)); + } + + private function displayGeneralText(SymfonyStyle $io, string $filter = null) + { + $decorated = $io->isDecorated(); + $types = ['functions', 'filters', 'tests', 'globals']; + foreach ($types as $index => $type) { + $items = []; + foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { + if (!$filter || str_contains($name, $filter)) { + $items[$name] = $name.$this->getPrettyMetadata($type, $entity, $decorated); + } + } + + if (!$items) { + continue; + } + + $io->section(ucfirst($type)); + + ksort($items); + $io->listing($items); + } + + if (!$filter && $paths = $this->getLoaderPaths()) { + $io->section('Loader Paths'); + $io->table(['Namespace', 'Paths'], $this->buildTableRows($paths)); + } + + if ($wrongBundles = $this->findWrongBundleOverrides()) { + foreach ($this->buildWarningMessages($wrongBundles) as $message) { + $io->warning($message); + } + } + } + + private function displayGeneralJson(SymfonyStyle $io, ?string $filter) + { + $decorated = $io->isDecorated(); + $types = ['functions', 'filters', 'tests', 'globals']; + $data = []; + foreach ($types as $type) { + foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { + if (!$filter || str_contains($name, $filter)) { + $data[$type][$name] = $this->getMetadata($type, $entity); + } + } + } + if (isset($data['tests'])) { + $data['tests'] = array_keys($data['tests']); + } + + if (!$filter && $paths = $this->getLoaderPaths($filter)) { + $data['loader_paths'] = $paths; + } + + if ($wrongBundles = $this->findWrongBundleOverrides()) { + $data['warnings'] = $this->buildWarningMessages($wrongBundles); + } + + $data = json_encode($data, \JSON_PRETTY_PRINT); + $io->writeln($decorated ? OutputFormatter::escape($data) : $data); + } + + private function getLoaderPaths(string $name = null): array + { + $loaderPaths = []; + foreach ($this->getFilesystemLoaders() as $loader) { + $namespaces = $loader->getNamespaces(); + if (null !== $name) { + $namespace = $this->parseTemplateName($name)[0]; + $namespaces = array_intersect([$namespace], $namespaces); + } + + foreach ($namespaces as $namespace) { + $paths = array_map([$this, 'getRelativePath'], $loader->getPaths($namespace)); + + if (FilesystemLoader::MAIN_NAMESPACE === $namespace) { + $namespace = '(None)'; + } else { + $namespace = '@'.$namespace; + } + + $loaderPaths[$namespace] = array_merge($loaderPaths[$namespace] ?? [], $paths); + } + } + + return $loaderPaths; + } + + private function getMetadata(string $type, $entity) + { + if ('globals' === $type) { + return $entity; + } + if ('tests' === $type) { + return null; + } + if ('functions' === $type || 'filters' === $type) { + $cb = $entity->getCallable(); + if (null === $cb) { + return null; + } + if (\is_array($cb)) { + if (!method_exists($cb[0], $cb[1])) { + return null; + } + $refl = new \ReflectionMethod($cb[0], $cb[1]); + } elseif (\is_object($cb) && method_exists($cb, '__invoke')) { + $refl = new \ReflectionMethod($cb, '__invoke'); + } elseif (\function_exists($cb)) { + $refl = new \ReflectionFunction($cb); + } elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) { + $refl = new \ReflectionMethod($m[1], $m[2]); + } else { + throw new \UnexpectedValueException('Unsupported callback type.'); + } + + $args = $refl->getParameters(); + + // filter out context/environment args + if ($entity->needsEnvironment()) { + array_shift($args); + } + if ($entity->needsContext()) { + array_shift($args); + } + + if ('filters' === $type) { + // remove the value the filter is applied on + array_shift($args); + } + + // format args + $args = array_map(function (\ReflectionParameter $param) { + if ($param->isDefaultValueAvailable()) { + return $param->getName().' = '.json_encode($param->getDefaultValue()); + } + + return $param->getName(); + }, $args); + + return $args; + } + + return null; + } + + private function getPrettyMetadata(string $type, $entity, bool $decorated): ?string + { + if ('tests' === $type) { + return ''; + } + + try { + $meta = $this->getMetadata($type, $entity); + if (null === $meta) { + return '(unknown?)'; + } + } catch (\UnexpectedValueException $e) { + return sprintf(' %s', $decorated ? OutputFormatter::escape($e->getMessage()) : $e->getMessage()); + } + + if ('globals' === $type) { + if (\is_object($meta)) { + return ' = object('.\get_class($meta).')'; + } + + $description = substr(@json_encode($meta), 0, 50); + + return sprintf(' = %s', $decorated ? OutputFormatter::escape($description) : $description); + } + + if ('functions' === $type) { + return '('.implode(', ', $meta).')'; + } + + if ('filters' === $type) { + return $meta ? '('.implode(', ', $meta).')' : ''; + } + + return null; + } + + private function findWrongBundleOverrides(): array + { + $alternatives = []; + $bundleNames = []; + + if ($this->twigDefaultPath && $this->projectDir) { + $folders = glob($this->twigDefaultPath.'/bundles/*', \GLOB_ONLYDIR); + $relativePath = ltrim(substr($this->twigDefaultPath.'/bundles/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); + $bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) { + if (str_starts_with($absolutePath, $this->projectDir)) { + $name = basename($absolutePath); + $path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR); + $carry[$name] = $path; + } + + return $carry; + }, $bundleNames); + } + + if ($notFoundBundles = array_diff_key($bundleNames, $this->bundlesMetadata)) { + $alternatives = []; + foreach ($notFoundBundles as $notFoundBundle => $path) { + $alternatives[$path] = $this->findAlternatives($notFoundBundle, array_keys($this->bundlesMetadata)); + } + } + + return $alternatives; + } + + private function buildWarningMessages(array $wrongBundles): array + { + $messages = []; + foreach ($wrongBundles as $path => $alternatives) { + $message = sprintf('Path "%s" not matching any bundle found', $path); + if ($alternatives) { + if (1 === \count($alternatives)) { + $message .= sprintf(", did you mean \"%s\"?\n", $alternatives[0]); + } else { + $message .= ", did you mean one of these:\n"; + foreach ($alternatives as $bundle) { + $message .= sprintf(" - %s\n", $bundle); + } + } + } + $messages[] = trim($message); + } + + return $messages; + } + + private function error(SymfonyStyle $io, string $message, array $alternatives = []): void + { + if ($alternatives) { + if (1 === \count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + $message .= implode("\n ", $alternatives); + } + + $io->block($message, null, 'fg=white;bg=red', ' ', true); + } + + private function findTemplateFiles(string $name): array + { + [$namespace, $shortname] = $this->parseTemplateName($name); + + $files = []; + foreach ($this->getFilesystemLoaders() as $loader) { + foreach ($loader->getPaths($namespace) as $path) { + if (!$this->isAbsolutePath($path)) { + $path = $this->projectDir.'/'.$path; + } + $filename = $path.'/'.$shortname; + + if (is_file($filename)) { + if (false !== $realpath = realpath($filename)) { + $files[$realpath] = $this->getRelativePath($realpath); + } else { + $files[$filename] = $this->getRelativePath($filename); + } + } + } + } + + return $files; + } + + private function parseTemplateName(string $name, string $default = FilesystemLoader::MAIN_NAMESPACE): array + { + if (isset($name[0]) && '@' === $name[0]) { + if (false === ($pos = strpos($name, '/')) || $pos === \strlen($name) - 1) { + throw new InvalidArgumentException(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); + } + + $namespace = substr($name, 1, $pos - 1); + $shortname = substr($name, $pos + 1); + + return [$namespace, $shortname]; + } + + return [$default, $name]; + } + + private function buildTableRows(array $loaderPaths): array + { + $rows = []; + $firstNamespace = true; + $prevHasSeparator = false; + + foreach ($loaderPaths as $namespace => $paths) { + if (!$firstNamespace && !$prevHasSeparator && \count($paths) > 1) { + $rows[] = ['', '']; + } + $firstNamespace = false; + foreach ($paths as $path) { + $rows[] = [$namespace, $path.\DIRECTORY_SEPARATOR]; + $namespace = ''; + } + if (\count($paths) > 1) { + $rows[] = ['', '']; + $prevHasSeparator = true; + } else { + $prevHasSeparator = false; + } + } + if ($prevHasSeparator) { + array_pop($rows); + } + + return $rows; + } + + private function findAlternatives(string $name, array $collection): array + { + $alternatives = []; + foreach ($collection as $item) { + $lev = levenshtein($name, $item); + if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) { + $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; + } + } + + $threshold = 1e3; + $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); + ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); + + return array_keys($alternatives); + } + + private function getRelativePath(string $path): string + { + if (null !== $this->projectDir && str_starts_with($path, $this->projectDir)) { + return ltrim(substr($path, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); + } + + return $path; + } + + private function isAbsolutePath(string $file): bool + { + return strspn($file, '/\\', 0, 1) || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1)) || null !== parse_url($file, \PHP_URL_SCHEME); + } + + /** + * @return FilesystemLoader[] + */ + private function getFilesystemLoaders(): array + { + if (null !== $this->filesystemLoaders) { + return $this->filesystemLoaders; + } + $this->filesystemLoaders = []; + + $loader = $this->twig->getLoader(); + if ($loader instanceof FilesystemLoader) { + $this->filesystemLoaders[] = $loader; + } elseif ($loader instanceof ChainLoader) { + foreach ($loader->getLoaders() as $l) { + if ($l instanceof FilesystemLoader) { + $this->filesystemLoaders[] = $l; + } + } + } + + return $this->filesystemLoaders; + } + + private function getFileLink(string $absolutePath): string + { + if (null === $this->fileLinkFormatter) { + return ''; + } + + return (string) $this->fileLinkFormatter->format($absolutePath, 1); + } +} diff --git a/vendor/symfony/twig-bridge/Command/LintCommand.php b/vendor/symfony/twig-bridge/Command/LintCommand.php new file mode 100644 index 0000000..b91110b --- /dev/null +++ b/vendor/symfony/twig-bridge/Command/LintCommand.php @@ -0,0 +1,296 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Command; + +use Symfony\Component\Console\CI\GithubActionReporter; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Finder\Finder; +use Twig\Environment; +use Twig\Error\Error; +use Twig\Loader\ArrayLoader; +use Twig\Loader\FilesystemLoader; +use Twig\Source; + +/** + * Command that will validate your template syntax and output encountered errors. + * + * @author Marc Weistroff + * @author Jérôme Tamarelle + */ +class LintCommand extends Command +{ + protected static $defaultName = 'lint:twig'; + protected static $defaultDescription = 'Lint a Twig template and outputs encountered errors'; + + private $twig; + + /** + * @var string|null + */ + private $format; + + public function __construct(Environment $twig) + { + parent::__construct(); + + $this->twig = $twig; + } + + protected function configure() + { + $this + ->setDescription(self::$defaultDescription) + ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format') + ->addOption('show-deprecations', null, InputOption::VALUE_NONE, 'Show deprecations as errors') + ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') + ->setHelp(<<<'EOF' +The %command.name% command lints a template and outputs to STDOUT +the first encountered syntax error. + +You can validate the syntax of contents passed from STDIN: + + cat filename | php %command.full_name% - + +Or the syntax of a file: + + php %command.full_name% filename + +Or of a whole directory: + + php %command.full_name% dirname + php %command.full_name% dirname --format=json + +EOF + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + $filenames = $input->getArgument('filename'); + $showDeprecations = $input->getOption('show-deprecations'); + $this->format = $input->getOption('format'); + + if (null === $this->format) { + $this->format = GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; + } + + if (['-'] === $filenames) { + return $this->display($input, $output, $io, [$this->validate(file_get_contents('php://stdin'), uniqid('sf_', true))]); + } + + if (!$filenames) { + $loader = $this->twig->getLoader(); + if ($loader instanceof FilesystemLoader) { + $paths = []; + foreach ($loader->getNamespaces() as $namespace) { + $paths[] = $loader->getPaths($namespace); + } + $filenames = array_merge(...$paths); + } + + if (!$filenames) { + throw new RuntimeException('Please provide a filename or pipe template content to STDIN.'); + } + } + + if ($showDeprecations) { + $prevErrorHandler = set_error_handler(static function ($level, $message, $file, $line) use (&$prevErrorHandler) { + if (\E_USER_DEPRECATED === $level) { + $templateLine = 0; + if (preg_match('/ at line (\d+)[ .]/', $message, $matches)) { + $templateLine = $matches[1]; + } + + throw new Error($message, $templateLine); + } + + return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; + }); + } + + try { + $filesInfo = $this->getFilesInfo($filenames); + } finally { + if ($showDeprecations) { + restore_error_handler(); + } + } + + return $this->display($input, $output, $io, $filesInfo); + } + + private function getFilesInfo(array $filenames): array + { + $filesInfo = []; + foreach ($filenames as $filename) { + foreach ($this->findFiles($filename) as $file) { + $filesInfo[] = $this->validate(file_get_contents($file), $file); + } + } + + return $filesInfo; + } + + protected function findFiles(string $filename) + { + if (is_file($filename)) { + return [$filename]; + } elseif (is_dir($filename)) { + return Finder::create()->files()->in($filename)->name('*.twig'); + } + + throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); + } + + private function validate(string $template, string $file): array + { + $realLoader = $this->twig->getLoader(); + try { + $temporaryLoader = new ArrayLoader([$file => $template]); + $this->twig->setLoader($temporaryLoader); + $nodeTree = $this->twig->parse($this->twig->tokenize(new Source($template, $file))); + $this->twig->compile($nodeTree); + $this->twig->setLoader($realLoader); + } catch (Error $e) { + $this->twig->setLoader($realLoader); + + return ['template' => $template, 'file' => $file, 'line' => $e->getTemplateLine(), 'valid' => false, 'exception' => $e]; + } + + return ['template' => $template, 'file' => $file, 'valid' => true]; + } + + private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, array $files) + { + switch ($this->format) { + case 'txt': + return $this->displayTxt($output, $io, $files); + case 'json': + return $this->displayJson($output, $files); + case 'github': + return $this->displayTxt($output, $io, $files, true); + default: + throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format'))); + } + } + + private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false) + { + $errors = 0; + $githubReporter = $errorAsGithubAnnotations ? new GithubActionReporter($output) : null; + + foreach ($filesInfo as $info) { + if ($info['valid'] && $output->isVerbose()) { + $io->comment('OK'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); + } elseif (!$info['valid']) { + ++$errors; + $this->renderException($io, $info['template'], $info['exception'], $info['file'], $githubReporter); + } + } + + if (0 === $errors) { + $io->success(sprintf('All %d Twig files contain valid syntax.', \count($filesInfo))); + } else { + $io->warning(sprintf('%d Twig files have valid syntax and %d contain errors.', \count($filesInfo) - $errors, $errors)); + } + + return min($errors, 1); + } + + private function displayJson(OutputInterface $output, array $filesInfo) + { + $errors = 0; + + array_walk($filesInfo, function (&$v) use (&$errors) { + $v['file'] = (string) $v['file']; + unset($v['template']); + if (!$v['valid']) { + $v['message'] = $v['exception']->getMessage(); + unset($v['exception']); + ++$errors; + } + }); + + $output->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); + + return min($errors, 1); + } + + private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null) + { + $line = $exception->getTemplateLine(); + + if ($githubReporter) { + $githubReporter->error($exception->getRawMessage(), $file, $line <= 0 ? null : $line); + } + + if ($file) { + $output->text(sprintf(' ERROR in %s (line %s)', $file, $line)); + } else { + $output->text(sprintf(' ERROR (line %s)', $line)); + } + + // If the line is not known (this might happen for deprecations if we fail at detecting the line for instance), + // we render the message without context, to ensure the message is displayed. + if ($line <= 0) { + $output->text(sprintf(' >> %s ', $exception->getRawMessage())); + + return; + } + + foreach ($this->getContext($template, $line) as $lineNumber => $code) { + $output->text(sprintf( + '%s %-6s %s', + $lineNumber === $line ? ' >> ' : ' ', + $lineNumber, + $code + )); + if ($lineNumber === $line) { + $output->text(sprintf(' >> %s ', $exception->getRawMessage())); + } + } + } + + private function getContext(string $template, int $line, int $context = 3) + { + $lines = explode("\n", $template); + + $position = max(0, $line - $context); + $max = min(\count($lines), $line - 1 + $context); + + $result = []; + while ($position < $max) { + $result[$position + 1] = $lines[$position]; + ++$position; + } + + return $result; + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues(['txt', 'json', 'github']); + } + } +} diff --git a/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php b/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php new file mode 100644 index 0000000..4a46978 --- /dev/null +++ b/vendor/symfony/twig-bridge/DataCollector/TwigDataCollector.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\DataCollector; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; +use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Markup; +use Twig\Profiler\Dumper\HtmlDumper; +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier + * + * @final + */ +class TwigDataCollector extends DataCollector implements LateDataCollectorInterface +{ + private $profile; + private $twig; + private $computed; + + public function __construct(Profile $profile, Environment $twig = null) + { + $this->profile = $profile; + $this->twig = $twig; + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + } + + /** + * {@inheritdoc} + */ + public function reset() + { + $this->profile->reset(); + $this->computed = null; + $this->data = []; + } + + /** + * {@inheritdoc} + */ + public function lateCollect() + { + $this->data['profile'] = serialize($this->profile); + $this->data['template_paths'] = []; + + if (null === $this->twig) { + return; + } + + $templateFinder = function (Profile $profile) use (&$templateFinder) { + if ($profile->isTemplate()) { + try { + $template = $this->twig->load($name = $profile->getName()); + } catch (LoaderError $e) { + $template = null; + } + + if (null !== $template && '' !== $path = $template->getSourceContext()->getPath()) { + $this->data['template_paths'][$name] = $path; + } + } + + foreach ($profile as $p) { + $templateFinder($p); + } + }; + $templateFinder($this->profile); + } + + public function getTime() + { + return $this->getProfile()->getDuration() * 1000; + } + + public function getTemplateCount() + { + return $this->getComputedData('template_count'); + } + + public function getTemplatePaths() + { + return $this->data['template_paths']; + } + + public function getTemplates() + { + return $this->getComputedData('templates'); + } + + public function getBlockCount() + { + return $this->getComputedData('block_count'); + } + + public function getMacroCount() + { + return $this->getComputedData('macro_count'); + } + + public function getHtmlCallGraph() + { + $dumper = new HtmlDumper(); + $dump = $dumper->dump($this->getProfile()); + + // needed to remove the hardcoded CSS styles + $dump = str_replace([ + '', + '', + '', + '', + ], [ + '', + '', + '', + '', + ], $dump); + + return new Markup($dump, 'UTF-8'); + } + + public function getProfile() + { + if (null === $this->profile) { + $this->profile = unserialize($this->data['profile'], ['allowed_classes' => ['Twig_Profiler_Profile', 'Twig\Profiler\Profile']]); + } + + return $this->profile; + } + + private function getComputedData(string $index) + { + if (null === $this->computed) { + $this->computed = $this->computeData($this->getProfile()); + } + + return $this->computed[$index]; + } + + private function computeData(Profile $profile) + { + $data = [ + 'template_count' => 0, + 'block_count' => 0, + 'macro_count' => 0, + ]; + + $templates = []; + foreach ($profile as $p) { + $d = $this->computeData($p); + + $data['template_count'] += ($p->isTemplate() ? 1 : 0) + $d['template_count']; + $data['block_count'] += ($p->isBlock() ? 1 : 0) + $d['block_count']; + $data['macro_count'] += ($p->isMacro() ? 1 : 0) + $d['macro_count']; + + if ($p->isTemplate()) { + if (!isset($templates[$p->getTemplate()])) { + $templates[$p->getTemplate()] = 1; + } else { + ++$templates[$p->getTemplate()]; + } + } + + foreach ($d['templates'] as $template => $count) { + if (!isset($templates[$template])) { + $templates[$template] = $count; + } else { + $templates[$template] += $count; + } + } + } + $data['templates'] = $templates; + + return $data; + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return 'twig'; + } +} diff --git a/vendor/symfony/twig-bridge/ErrorRenderer/TwigErrorRenderer.php b/vendor/symfony/twig-bridge/ErrorRenderer/TwigErrorRenderer.php new file mode 100644 index 0000000..b0ccd68 --- /dev/null +++ b/vendor/symfony/twig-bridge/ErrorRenderer/TwigErrorRenderer.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\ErrorRenderer; + +use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface; +use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer; +use Symfony\Component\ErrorHandler\Exception\FlattenException; +use Symfony\Component\HttpFoundation\RequestStack; +use Twig\Environment; + +/** + * Provides the ability to render custom Twig-based HTML error pages + * in non-debug mode, otherwise falls back to HtmlErrorRenderer. + * + * @author Yonel Ceruto + */ +class TwigErrorRenderer implements ErrorRendererInterface +{ + private $twig; + private $fallbackErrorRenderer; + private $debug; + + /** + * @param bool|callable $debug The debugging mode as a boolean or a callable that should return it + */ + public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false) + { + if (!\is_bool($debug) && !\is_callable($debug)) { + throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, get_debug_type($debug))); + } + + $this->twig = $twig; + $this->fallbackErrorRenderer = $fallbackErrorRenderer ?? new HtmlErrorRenderer(); + $this->debug = $debug; + } + + /** + * {@inheritdoc} + */ + public function render(\Throwable $exception): FlattenException + { + $exception = $this->fallbackErrorRenderer->render($exception); + $debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception); + + if ($debug || !$template = $this->findTemplate($exception->getStatusCode())) { + return $exception; + } + + return $exception->setAsString($this->twig->render($template, [ + 'exception' => $exception, + 'status_code' => $exception->getStatusCode(), + 'status_text' => $exception->getStatusText(), + ])); + } + + public static function isDebug(RequestStack $requestStack, bool $debug): \Closure + { + return static function () use ($requestStack, $debug): bool { + if (!$request = $requestStack->getCurrentRequest()) { + return $debug; + } + + return $debug && $request->attributes->getBoolean('showException', true); + }; + } + + private function findTemplate(int $statusCode): ?string + { + $template = sprintf('@Twig/Exception/error%s.html.twig', $statusCode); + if ($this->twig->getLoader()->exists($template)) { + return $template; + } + + $template = '@Twig/Exception/error.html.twig'; + if ($this->twig->getLoader()->exists($template)) { + return $template; + } + + return null; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/AssetExtension.php b/vendor/symfony/twig-bridge/Extension/AssetExtension.php new file mode 100644 index 0000000..694821f --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/AssetExtension.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Asset\Packages; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * Twig extension for the Symfony Asset component. + * + * @author Fabien Potencier + */ +final class AssetExtension extends AbstractExtension +{ + private $packages; + + public function __construct(Packages $packages) + { + $this->packages = $packages; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('asset', [$this, 'getAssetUrl']), + new TwigFunction('asset_version', [$this, 'getAssetVersion']), + ]; + } + + /** + * Returns the public url/path of an asset. + * + * If the package used to generate the path is an instance of + * UrlPackage, you will always get a URL and not a path. + */ + public function getAssetUrl(string $path, string $packageName = null): string + { + return $this->packages->getUrl($path, $packageName); + } + + /** + * Returns the version of an asset. + */ + public function getAssetVersion(string $path, string $packageName = null): string + { + return $this->packages->getVersion($path, $packageName); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/CodeExtension.php b/vendor/symfony/twig-bridge/Extension/CodeExtension.php new file mode 100644 index 0000000..15b7069 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/CodeExtension.php @@ -0,0 +1,246 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; + +/** + * Twig extension relate to PHP code and used by the profiler and the default exception templates. + * + * @author Fabien Potencier + */ +final class CodeExtension extends AbstractExtension +{ + private $fileLinkFormat; + private $charset; + private $projectDir; + + /** + * @param string|FileLinkFormatter $fileLinkFormat The format for links to source files + */ + public function __construct($fileLinkFormat, string $projectDir, string $charset) + { + $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); + $this->projectDir = str_replace('\\', '/', $projectDir).'/'; + $this->charset = $charset; + } + + /** + * {@inheritdoc} + */ + public function getFilters(): array + { + return [ + new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]), + new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html']]), + new TwigFilter('format_args', [$this, 'formatArgs'], ['is_safe' => ['html']]), + new TwigFilter('format_args_as_text', [$this, 'formatArgsAsText']), + new TwigFilter('file_excerpt', [$this, 'fileExcerpt'], ['is_safe' => ['html']]), + new TwigFilter('format_file', [$this, 'formatFile'], ['is_safe' => ['html']]), + new TwigFilter('format_file_from_text', [$this, 'formatFileFromText'], ['is_safe' => ['html']]), + new TwigFilter('format_log_message', [$this, 'formatLogMessage'], ['is_safe' => ['html']]), + new TwigFilter('file_link', [$this, 'getFileLink']), + new TwigFilter('file_relative', [$this, 'getFileRelative']), + ]; + } + + public function abbrClass(string $class): string + { + $parts = explode('\\', $class); + $short = array_pop($parts); + + return sprintf('%s', $class, $short); + } + + public function abbrMethod(string $method): string + { + if (str_contains($method, '::')) { + [$class, $method] = explode('::', $method, 2); + $result = sprintf('%s::%s()', $this->abbrClass($class), $method); + } elseif ('Closure' === $method) { + $result = sprintf('%1$s', $method); + } else { + $result = sprintf('%1$s()', $method); + } + + return $result; + } + + /** + * Formats an array as a string. + */ + public function formatArgs(array $args): string + { + $result = []; + foreach ($args as $key => $item) { + if ('object' === $item[0]) { + $parts = explode('\\', $item[1]); + $short = array_pop($parts); + $formattedValue = sprintf('object(%s)', $item[1], $short); + } elseif ('array' === $item[0]) { + $formattedValue = sprintf('array(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); + } elseif ('null' === $item[0]) { + $formattedValue = 'null'; + } elseif ('boolean' === $item[0]) { + $formattedValue = ''.strtolower(var_export($item[1], true)).''; + } elseif ('resource' === $item[0]) { + $formattedValue = 'resource'; + } else { + $formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)); + } + + $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); + } + + return implode(', ', $result); + } + + /** + * Formats an array as a string. + */ + public function formatArgsAsText(array $args): string + { + return strip_tags($this->formatArgs($args)); + } + + /** + * Returns an excerpt of a code file around the given line number. + */ + public function fileExcerpt(string $file, int $line, int $srcContext = 3): ?string + { + if (is_file($file) && is_readable($file)) { + // highlight_file could throw warnings + // see https://bugs.php.net/25725 + $code = @highlight_file($file, true); + // remove main code/span tags + $code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code); + // split multiline spans + $code = preg_replace_callback('#]++)>((?:[^<]*+
)++[^<]*+)
#', function ($m) { + return "".str_replace('
', "

", $m[2]).''; + }, $code); + $content = explode('
', $code); + + $lines = []; + if (0 > $srcContext) { + $srcContext = \count($content); + } + + for ($i = max($line - $srcContext, 1), $max = min($line + $srcContext, \count($content)); $i <= $max; ++$i) { + $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).''; + } + + return '
    '.implode("\n", $lines).'
'; + } + + return null; + } + + /** + * Formats a file path. + */ + public function formatFile(string $file, int $line, string $text = null): string + { + $file = trim($file); + + if (null === $text) { + $text = $file; + if (null !== $rel = $this->getFileRelative($text)) { + $rel = explode('/', $rel, 2); + $text = sprintf('%s%s', $this->projectDir, $rel[0], '/'.($rel[1] ?? '')); + } + } + + if (0 < $line) { + $text .= ' at line '.$line; + } + + if (false !== $link = $this->getFileLink($file, $line)) { + return sprintf('%s', htmlspecialchars($link, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $text); + } + + return $text; + } + + /** + * Returns the link for a given file/line pair. + * + * @return string|false + */ + public function getFileLink(string $file, int $line) + { + if ($fmt = $this->fileLinkFormat) { + return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line); + } + + return false; + } + + public function getFileRelative(string $file): ?string + { + $file = str_replace('\\', '/', $file); + + if (null !== $this->projectDir && str_starts_with($file, $this->projectDir)) { + return ltrim(substr($file, \strlen($this->projectDir)), '/'); + } + + return null; + } + + public function formatFileFromText(string $text): string + { + return preg_replace_callback('/in ("|")?(.+?)\1(?: +(?:on|at))? +line (\d+)/s', function ($match) { + return 'in '.$this->formatFile($match[2], $match[3]); + }, $text); + } + + /** + * @internal + */ + public function formatLogMessage(string $message, array $context): string + { + if ($context && str_contains($message, '{')) { + $replacements = []; + foreach ($context as $key => $val) { + if (is_scalar($val)) { + $replacements['{'.$key.'}'] = $val; + } + } + + if ($replacements) { + $message = strtr($message, $replacements); + } + } + + return htmlspecialchars($message, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); + } + + protected static function fixCodeMarkup(string $line): string + { + //
ending tag from previous line + $opening = strpos($line, ''); + if (false !== $closing && (false === $opening || $closing < $opening)) { + $line = substr_replace($line, '', $closing, 7); + } + + // missing
tag at the end of line + $opening = strpos($line, ''); + if (false !== $opening && (false === $closing || $closing > $opening)) { + $line .= '
'; + } + + return trim($line); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/CsrfExtension.php b/vendor/symfony/twig-bridge/Extension/CsrfExtension.php new file mode 100644 index 0000000..646a487 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/CsrfExtension.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * @author Christian Flothmann + * @author Titouan Galopin + */ +final class CsrfExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('csrf_token', [CsrfRuntime::class, 'getCsrfToken']), + ]; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/CsrfRuntime.php b/vendor/symfony/twig-bridge/Extension/CsrfRuntime.php new file mode 100644 index 0000000..c3d5da6 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/CsrfRuntime.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; + +/** + * @author Christian Flothmann + * @author Titouan Galopin + */ +final class CsrfRuntime +{ + private $csrfTokenManager; + + public function __construct(CsrfTokenManagerInterface $csrfTokenManager) + { + $this->csrfTokenManager = $csrfTokenManager; + } + + public function getCsrfToken(string $tokenId): string + { + return $this->csrfTokenManager->getToken($tokenId)->getValue(); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/DumpExtension.php b/vendor/symfony/twig-bridge/Extension/DumpExtension.php new file mode 100644 index 0000000..46ad8ea --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/DumpExtension.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Bridge\Twig\TokenParser\DumpTokenParser; +use Symfony\Component\VarDumper\Cloner\ClonerInterface; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Twig\Environment; +use Twig\Extension\AbstractExtension; +use Twig\Template; +use Twig\TwigFunction; + +/** + * Provides integration of the dump() function with Twig. + * + * @author Nicolas Grekas + */ +final class DumpExtension extends AbstractExtension +{ + private $cloner; + private $dumper; + + public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null) + { + $this->cloner = $cloner; + $this->dumper = $dumper; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]), + ]; + } + + /** + * {@inheritdoc} + */ + public function getTokenParsers(): array + { + return [new DumpTokenParser()]; + } + + public function dump(Environment $env, array $context): ?string + { + if (!$env->isDebug()) { + return null; + } + + if (2 === \func_num_args()) { + $vars = []; + foreach ($context as $key => $value) { + if (!$value instanceof Template) { + $vars[$key] = $value; + } + } + + $vars = [$vars]; + } else { + $vars = \func_get_args(); + unset($vars[0], $vars[1]); + } + + $dump = fopen('php://memory', 'r+'); + $this->dumper = $this->dumper ?? new HtmlDumper(); + $this->dumper->setCharset($env->getCharset()); + + foreach ($vars as $value) { + $this->dumper->dump($this->cloner->cloneVar($value), $dump); + } + + return stream_get_contents($dump, -1, 0); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php b/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php new file mode 100644 index 0000000..8d2a35c --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/ExpressionExtension.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\ExpressionLanguage\Expression; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * ExpressionExtension gives a way to create Expressions from a template. + * + * @author Fabien Potencier + */ +final class ExpressionExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('expression', [$this, 'createExpression']), + ]; + } + + public function createExpression(string $expression): Expression + { + return new Expression($expression); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/FormExtension.php b/vendor/symfony/twig-bridge/Extension/FormExtension.php new file mode 100644 index 0000000..7f0b1ed --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/FormExtension.php @@ -0,0 +1,219 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; +use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView; +use Symfony\Component\Form\ChoiceList\View\ChoiceView; +use Symfony\Component\Form\FormError; +use Symfony\Component\Form\FormView; +use Symfony\Contracts\Translation\TranslatorInterface; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; +use Twig\TwigFunction; +use Twig\TwigTest; + +/** + * FormExtension extends Twig with form capabilities. + * + * @author Fabien Potencier + * @author Bernhard Schussek + */ +final class FormExtension extends AbstractExtension +{ + private $translator; + + public function __construct(TranslatorInterface $translator = null) + { + $this->translator = $translator; + } + + /** + * {@inheritdoc} + */ + public function getTokenParsers(): array + { + return [ + // {% form_theme form "SomeBundle::widgets.twig" %} + new FormThemeTokenParser(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('form_widget', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_errors', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_label', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_help', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_row', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_rest', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_start', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('form_end', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]), + new TwigFunction('csrf_token', ['Symfony\Component\Form\FormRenderer', 'renderCsrfToken']), + new TwigFunction('form_parent', 'Symfony\Bridge\Twig\Extension\twig_get_form_parent'), + new TwigFunction('field_name', [$this, 'getFieldName']), + new TwigFunction('field_value', [$this, 'getFieldValue']), + new TwigFunction('field_label', [$this, 'getFieldLabel']), + new TwigFunction('field_help', [$this, 'getFieldHelp']), + new TwigFunction('field_errors', [$this, 'getFieldErrors']), + new TwigFunction('field_choices', [$this, 'getFieldChoices']), + ]; + } + + /** + * {@inheritdoc} + */ + public function getFilters(): array + { + return [ + new TwigFilter('humanize', ['Symfony\Component\Form\FormRenderer', 'humanize']), + new TwigFilter('form_encode_currency', ['Symfony\Component\Form\FormRenderer', 'encodeCurrency'], ['is_safe' => ['html'], 'needs_environment' => true]), + ]; + } + + /** + * {@inheritdoc} + */ + public function getTests(): array + { + return [ + new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'), + new TwigTest('rootform', 'Symfony\Bridge\Twig\Extension\twig_is_root_form'), + ]; + } + + public function getFieldName(FormView $view): string + { + $view->setRendered(); + + return $view->vars['full_name']; + } + + /** + * @return string|array + */ + public function getFieldValue(FormView $view) + { + return $view->vars['value']; + } + + public function getFieldLabel(FormView $view): ?string + { + if (false === $label = $view->vars['label']) { + return null; + } + + if (!$label && $labelFormat = $view->vars['label_format']) { + $label = str_replace(['%id%', '%name%'], [$view->vars['id'], $view->vars['name']], $labelFormat); + } elseif (!$label) { + $label = ucfirst(strtolower(trim(preg_replace(['/([A-Z])/', '/[_\s]+/'], ['_$1', ' '], $view->vars['name'])))); + } + + return $this->createFieldTranslation( + $label, + $view->vars['label_translation_parameters'] ?: [], + $view->vars['translation_domain'] + ); + } + + public function getFieldHelp(FormView $view): ?string + { + return $this->createFieldTranslation( + $view->vars['help'], + $view->vars['help_translation_parameters'] ?: [], + $view->vars['translation_domain'] + ); + } + + /** + * @return string[] + */ + public function getFieldErrors(FormView $view): iterable + { + /** @var FormError $error */ + foreach ($view->vars['errors'] as $error) { + yield $error->getMessage(); + } + } + + /** + * @return string[]|string[][] + */ + public function getFieldChoices(FormView $view): iterable + { + yield from $this->createFieldChoicesList($view->vars['choices'], $view->vars['choice_translation_domain']); + } + + private function createFieldChoicesList(iterable $choices, $translationDomain): iterable + { + foreach ($choices as $choice) { + $translatableLabel = $this->createFieldTranslation($choice->label, [], $translationDomain); + + if ($choice instanceof ChoiceGroupView) { + yield $translatableLabel => $this->createFieldChoicesList($choice, $translationDomain); + + continue; + } + + /* @var ChoiceView $choice */ + yield $translatableLabel => $choice->value; + } + } + + private function createFieldTranslation(?string $value, array $parameters, $domain): ?string + { + if (!$this->translator || !$value || false === $domain) { + return $value; + } + + return $this->translator->trans($value, $parameters, $domain); + } +} + +/** + * Returns whether a choice is selected for a given form value. + * + * This is a function and not callable due to performance reasons. + * + * @param string|array $selectedValue The selected value to compare + * + * @see ChoiceView::isSelected() + */ +function twig_is_selected_choice(ChoiceView $choice, $selectedValue): bool +{ + if (\is_array($selectedValue)) { + return \in_array($choice->value, $selectedValue, true); + } + + return $choice->value === $selectedValue; +} + +/** + * @internal + */ +function twig_is_root_form(FormView $formView): bool +{ + return null === $formView->parent; +} + +/** + * @internal + */ +function twig_get_form_parent(FormView $formView): ?FormView +{ + return $formView->parent; +} diff --git a/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php b/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php new file mode 100644 index 0000000..a9ee05c --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/HttpFoundationExtension.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\UrlHelper; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * Twig extension for the Symfony HttpFoundation component. + * + * @author Fabien Potencier + */ +final class HttpFoundationExtension extends AbstractExtension +{ + private $urlHelper; + + public function __construct(UrlHelper $urlHelper) + { + $this->urlHelper = $urlHelper; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('absolute_url', [$this, 'generateAbsoluteUrl']), + new TwigFunction('relative_path', [$this, 'generateRelativePath']), + ]; + } + + /** + * Returns the absolute URL for the given absolute or relative path. + * + * This method returns the path unchanged if no request is available. + * + * @see Request::getUriForPath() + */ + public function generateAbsoluteUrl(string $path): string + { + return $this->urlHelper->getAbsoluteUrl($path); + } + + /** + * Returns a relative path based on the current Request. + * + * This method returns the path unchanged if no request is available. + * + * @see Request::getRelativeUriForPath() + */ + public function generateRelativePath(string $path): string + { + return $this->urlHelper->getRelativePath($path); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php b/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php new file mode 100644 index 0000000..1af9ddb --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/HttpKernelExtension.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\HttpKernel\Controller\ControllerReference; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * Provides integration with the HttpKernel component. + * + * @author Fabien Potencier + */ +final class HttpKernelExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('render', [HttpKernelRuntime::class, 'renderFragment'], ['is_safe' => ['html']]), + new TwigFunction('render_*', [HttpKernelRuntime::class, 'renderFragmentStrategy'], ['is_safe' => ['html']]), + new TwigFunction('fragment_uri', [HttpKernelRuntime::class, 'generateFragmentUri']), + new TwigFunction('controller', static::class.'::controller'), + ]; + } + + public static function controller(string $controller, array $attributes = [], array $query = []): ControllerReference + { + return new ControllerReference($controller, $attributes, $query); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php b/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php new file mode 100644 index 0000000..ab83054 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\HttpKernel\Controller\ControllerReference; +use Symfony\Component\HttpKernel\Fragment\FragmentHandler; +use Symfony\Component\HttpKernel\Fragment\FragmentUriGeneratorInterface; + +/** + * Provides integration with the HttpKernel component. + * + * @author Fabien Potencier + */ +final class HttpKernelRuntime +{ + private $handler; + private $fragmentUriGenerator; + + public function __construct(FragmentHandler $handler, FragmentUriGeneratorInterface $fragmentUriGenerator = null) + { + $this->handler = $handler; + $this->fragmentUriGenerator = $fragmentUriGenerator; + } + + /** + * Renders a fragment. + * + * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance + * + * @see FragmentHandler::render() + */ + public function renderFragment($uri, array $options = []): string + { + $strategy = $options['strategy'] ?? 'inline'; + unset($options['strategy']); + + return $this->handler->render($uri, $strategy, $options); + } + + /** + * Renders a fragment. + * + * @param string|ControllerReference $uri A URI as a string or a ControllerReference instance + * + * @see FragmentHandler::render() + */ + public function renderFragmentStrategy(string $strategy, $uri, array $options = []): string + { + return $this->handler->render($uri, $strategy, $options); + } + + public function generateFragmentUri(ControllerReference $controller, bool $absolute = false, bool $strict = true, bool $sign = true): string + { + if (null === $this->fragmentUriGenerator) { + throw new \LogicException(sprintf('An instance of "%s" must be provided to use "%s()".', FragmentUriGeneratorInterface::class, __METHOD__)); + } + + return $this->fragmentUriGenerator->generate($controller, null, $absolute, $strict, $sign); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php b/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php new file mode 100644 index 0000000..071b9ff --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/LogoutUrlExtension.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * LogoutUrlHelper provides generator functions for the logout URL to Twig. + * + * @author Jeremy Mikola + */ +final class LogoutUrlExtension extends AbstractExtension +{ + private $generator; + + public function __construct(LogoutUrlGenerator $generator) + { + $this->generator = $generator; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('logout_url', [$this, 'getLogoutUrl']), + new TwigFunction('logout_path', [$this, 'getLogoutPath']), + ]; + } + + /** + * Generates the relative logout URL for the firewall. + * + * @param string|null $key The firewall key or null to use the current firewall key + */ + public function getLogoutPath(string $key = null): string + { + return $this->generator->getLogoutPath($key); + } + + /** + * Generates the absolute logout URL for the firewall. + * + * @param string|null $key The firewall key or null to use the current firewall key + */ + public function getLogoutUrl(string $key = null): string + { + return $this->generator->getLogoutUrl($key); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php b/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php new file mode 100644 index 0000000..51d6eba --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/ProfilerExtension.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Stopwatch\Stopwatch; +use Symfony\Component\Stopwatch\StopwatchEvent; +use Twig\Extension\ProfilerExtension as BaseProfilerExtension; +use Twig\Profiler\Profile; + +/** + * @author Fabien Potencier + */ +final class ProfilerExtension extends BaseProfilerExtension +{ + private $stopwatch; + + /** + * @var \SplObjectStorage + */ + private $events; + + public function __construct(Profile $profile, Stopwatch $stopwatch = null) + { + parent::__construct($profile); + + $this->stopwatch = $stopwatch; + $this->events = new \SplObjectStorage(); + } + + public function enter(Profile $profile): void + { + if ($this->stopwatch && $profile->isTemplate()) { + $this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template'); + } + + parent::enter($profile); + } + + public function leave(Profile $profile): void + { + parent::leave($profile); + + if ($this->stopwatch && $profile->isTemplate()) { + $this->events[$profile]->stop(); + unset($this->events[$profile]); + } + } +} diff --git a/vendor/symfony/twig-bridge/Extension/RoutingExtension.php b/vendor/symfony/twig-bridge/Extension/RoutingExtension.php new file mode 100644 index 0000000..800c22f --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/RoutingExtension.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Twig\Extension\AbstractExtension; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; +use Twig\TwigFunction; + +/** + * Provides integration of the Routing component with Twig. + * + * @author Fabien Potencier + */ +final class RoutingExtension extends AbstractExtension +{ + private $generator; + + public function __construct(UrlGeneratorInterface $generator) + { + $this->generator = $generator; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]), + ]; + } + + public function getPath(string $name, array $parameters = [], bool $relative = false): string + { + return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); + } + + public function getUrl(string $name, array $parameters = [], bool $schemeRelative = false): string + { + return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); + } + + /** + * Determines at compile time whether the generated URL will be safe and thus + * saving the unneeded automatic escaping for performance reasons. + * + * The URL generation process percent encodes non-alphanumeric characters. So there is no risk + * that malicious/invalid characters are part of the URL. The only character within an URL that + * must be escaped in html is the ampersand ("&") which separates query params. So we cannot mark + * the URL generation as always safe, but only when we are sure there won't be multiple query + * params. This is the case when there are none or only one constant parameter given. + * E.g. we know beforehand this will be safe: + * - path('route') + * - path('route', {'param': 'value'}) + * But the following may not: + * - path('route', var) + * - path('route', {'param': ['val1', 'val2'] }) // a sub-array + * - path('route', {'param1': 'value1', 'param2': 'value2'}) + * If param1 and param2 reference placeholder in the route, it would still be safe. But we don't know. + * + * @param Node $argsNode The arguments of the path/url function + * + * @return array An array with the contexts the URL is safe + */ + public function isUrlGenerationSafe(Node $argsNode): array + { + // support named arguments + $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( + $argsNode->hasNode(1) ? $argsNode->getNode(1) : null + ); + + if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 && + (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression) + ) { + return ['html']; + } + + return []; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/SecurityExtension.php b/vendor/symfony/twig-bridge/Extension/SecurityExtension.php new file mode 100644 index 0000000..0e58fc0 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/SecurityExtension.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Security\Acl\Voter\FieldVote; +use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; +use Symfony\Component\Security\Http\Impersonate\ImpersonateUrlGenerator; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * SecurityExtension exposes security context features. + * + * @author Fabien Potencier + */ +final class SecurityExtension extends AbstractExtension +{ + private $securityChecker; + + private $impersonateUrlGenerator; + + public function __construct(AuthorizationCheckerInterface $securityChecker = null, ImpersonateUrlGenerator $impersonateUrlGenerator = null) + { + $this->securityChecker = $securityChecker; + $this->impersonateUrlGenerator = $impersonateUrlGenerator; + } + + /** + * @param mixed $object + */ + public function isGranted($role, $object = null, string $field = null): bool + { + if (null === $this->securityChecker) { + return false; + } + + if (null !== $field) { + $object = new FieldVote($object, $field); + } + + try { + return $this->securityChecker->isGranted($role, $object); + } catch (AuthenticationCredentialsNotFoundException $e) { + return false; + } + } + + public function getImpersonateExitUrl(string $exitTo = null): string + { + if (null === $this->impersonateUrlGenerator) { + return ''; + } + + return $this->impersonateUrlGenerator->generateExitUrl($exitTo); + } + + public function getImpersonateExitPath(string $exitTo = null): string + { + if (null === $this->impersonateUrlGenerator) { + return ''; + } + + return $this->impersonateUrlGenerator->generateExitPath($exitTo); + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('is_granted', [$this, 'isGranted']), + new TwigFunction('impersonation_exit_url', [$this, 'getImpersonateExitUrl']), + new TwigFunction('impersonation_exit_path', [$this, 'getImpersonateExitPath']), + ]; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/SerializerExtension.php b/vendor/symfony/twig-bridge/Extension/SerializerExtension.php new file mode 100644 index 0000000..f38571e --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/SerializerExtension.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; + +/** + * @author Jesse Rushlow + */ +final class SerializerExtension extends AbstractExtension +{ + public function getFilters(): array + { + return [ + new TwigFilter('serialize', [SerializerRuntime::class, 'serialize']), + ]; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/SerializerRuntime.php b/vendor/symfony/twig-bridge/Extension/SerializerRuntime.php new file mode 100644 index 0000000..3a4087a --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/SerializerRuntime.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Serializer\SerializerInterface; +use Twig\Extension\RuntimeExtensionInterface; + +/** + * @author Jesse Rushlow + */ +final class SerializerRuntime implements RuntimeExtensionInterface +{ + private $serializer; + + public function __construct(SerializerInterface $serializer) + { + $this->serializer = $serializer; + } + + public function serialize($data, string $format = 'json', array $context = []): string + { + return $this->serializer->serialize($data, $format, $context); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php b/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php new file mode 100644 index 0000000..80a25a9 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/StopwatchExtension.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser; +use Symfony\Component\Stopwatch\Stopwatch; +use Twig\Extension\AbstractExtension; +use Twig\TokenParser\TokenParserInterface; + +/** + * Twig extension for the stopwatch helper. + * + * @author Wouter J + */ +final class StopwatchExtension extends AbstractExtension +{ + private $stopwatch; + private $enabled; + + public function __construct(Stopwatch $stopwatch = null, bool $enabled = true) + { + $this->stopwatch = $stopwatch; + $this->enabled = $enabled; + } + + public function getStopwatch(): Stopwatch + { + return $this->stopwatch; + } + + /** + * @return TokenParserInterface[] + */ + public function getTokenParsers(): array + { + return [ + /* + * {% stopwatch foo %} + * Some stuff which will be recorded on the timeline + * {% endstopwatch %} + */ + new StopwatchTokenParser(null !== $this->stopwatch && $this->enabled), + ]; + } +} diff --git a/vendor/symfony/twig-bridge/Extension/TranslationExtension.php b/vendor/symfony/twig-bridge/Extension/TranslationExtension.php new file mode 100644 index 0000000..c2797d8 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/TranslationExtension.php @@ -0,0 +1,145 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Bridge\Twig\NodeVisitor\TranslationDefaultDomainNodeVisitor; +use Symfony\Bridge\Twig\NodeVisitor\TranslationNodeVisitor; +use Symfony\Bridge\Twig\TokenParser\TransDefaultDomainTokenParser; +use Symfony\Bridge\Twig\TokenParser\TransTokenParser; +use Symfony\Component\Translation\TranslatableMessage; +use Symfony\Contracts\Translation\TranslatableInterface; +use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorTrait; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; +use Twig\TwigFunction; + +// Help opcache.preload discover always-needed symbols +class_exists(TranslatorInterface::class); +class_exists(TranslatorTrait::class); + +/** + * Provides integration of the Translation component with Twig. + * + * @author Fabien Potencier + */ +final class TranslationExtension extends AbstractExtension +{ + private $translator; + private $translationNodeVisitor; + + public function __construct(TranslatorInterface $translator = null, TranslationNodeVisitor $translationNodeVisitor = null) + { + $this->translator = $translator; + $this->translationNodeVisitor = $translationNodeVisitor; + } + + public function getTranslator(): TranslatorInterface + { + if (null === $this->translator) { + if (!interface_exists(TranslatorInterface::class)) { + throw new \LogicException(sprintf('You cannot use the "%s" if the Translation Contracts are not available. Try running "composer require symfony/translation".', __CLASS__)); + } + + $this->translator = new class() implements TranslatorInterface { + use TranslatorTrait; + }; + } + + return $this->translator; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('t', [$this, 'createTranslatable']), + ]; + } + + /** + * {@inheritdoc} + */ + public function getFilters(): array + { + return [ + new TwigFilter('trans', [$this, 'trans']), + ]; + } + + /** + * {@inheritdoc} + */ + public function getTokenParsers(): array + { + return [ + // {% trans %}Symfony is great!{% endtrans %} + new TransTokenParser(), + + // {% trans_default_domain "foobar" %} + new TransDefaultDomainTokenParser(), + ]; + } + + /** + * {@inheritdoc} + */ + public function getNodeVisitors(): array + { + return [$this->getTranslationNodeVisitor(), new TranslationDefaultDomainNodeVisitor()]; + } + + public function getTranslationNodeVisitor(): TranslationNodeVisitor + { + return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor(); + } + + /** + * @param string|\Stringable|TranslatableInterface|null $message + * @param array|string $arguments Can be the locale as a string when $message is a TranslatableInterface + */ + public function trans($message, $arguments = [], string $domain = null, string $locale = null, int $count = null): string + { + if ($message instanceof TranslatableInterface) { + if ([] !== $arguments && !\is_string($arguments)) { + throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be a locale passed as a string when the message is a "%s", "%s" given.', __METHOD__, TranslatableInterface::class, get_debug_type($arguments))); + } + + return $message->trans($this->getTranslator(), $locale ?? (\is_string($arguments) ? $arguments : null)); + } + + if (!\is_array($arguments)) { + throw new \TypeError(sprintf('Unless the message is a "%s", argument 2 passed to "%s()" must be an array of parameters, "%s" given.', TranslatableInterface::class, __METHOD__, get_debug_type($arguments))); + } + + if ('' === $message = (string) $message) { + return ''; + } + + if (null !== $count) { + $arguments['%count%'] = $count; + } + + return $this->getTranslator()->trans($message, $arguments, $domain, $locale); + } + + public function createTranslatable(string $message, array $parameters = [], string $domain = null): TranslatableMessage + { + if (!class_exists(TranslatableMessage::class)) { + throw new \LogicException(sprintf('You cannot use the "%s" as the Translation Component is not installed. Try running "composer require symfony/translation".', __CLASS__)); + } + + return new TranslatableMessage($message, $parameters, $domain); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php b/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php new file mode 100644 index 0000000..652a757 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/WebLinkExtension.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\WebLink\GenericLinkProvider; +use Symfony\Component\WebLink\Link; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * Twig extension for the Symfony WebLink component. + * + * @author Kévin Dunglas + */ +final class WebLinkExtension extends AbstractExtension +{ + private $requestStack; + + public function __construct(RequestStack $requestStack) + { + $this->requestStack = $requestStack; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('link', [$this, 'link']), + new TwigFunction('preload', [$this, 'preload']), + new TwigFunction('dns_prefetch', [$this, 'dnsPrefetch']), + new TwigFunction('preconnect', [$this, 'preconnect']), + new TwigFunction('prefetch', [$this, 'prefetch']), + new TwigFunction('prerender', [$this, 'prerender']), + ]; + } + + /** + * Adds a "Link" HTTP header. + * + * @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch") + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") + * + * @return string The relation URI + */ + public function link(string $uri, string $rel, array $attributes = []): string + { + if (!$request = $this->requestStack->getMainRequest()) { + return $uri; + } + + $link = new Link($rel, $uri); + foreach ($attributes as $key => $value) { + $link = $link->withAttribute($key, $value); + } + + $linkProvider = $request->attributes->get('_links', new GenericLinkProvider()); + $request->attributes->set('_links', $linkProvider->withLink($link)); + + return $uri; + } + + /** + * Preloads a resource. + * + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['crossorigin' => 'use-credentials']") + * + * @return string The path of the asset + */ + public function preload(string $uri, array $attributes = []): string + { + return $this->link($uri, 'preload', $attributes); + } + + /** + * Resolves a resource origin as early as possible. + * + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") + * + * @return string The path of the asset + */ + public function dnsPrefetch(string $uri, array $attributes = []): string + { + return $this->link($uri, 'dns-prefetch', $attributes); + } + + /** + * Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation). + * + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") + * + * @return string The path of the asset + */ + public function preconnect(string $uri, array $attributes = []): string + { + return $this->link($uri, 'preconnect', $attributes); + } + + /** + * Indicates to the client that it should prefetch this resource. + * + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") + * + * @return string The path of the asset + */ + public function prefetch(string $uri, array $attributes = []): string + { + return $this->link($uri, 'prefetch', $attributes); + } + + /** + * Indicates to the client that it should prerender this resource . + * + * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]") + * + * @return string The path of the asset + */ + public function prerender(string $uri, array $attributes = []): string + { + return $this->link($uri, 'prerender', $attributes); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php b/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php new file mode 100644 index 0000000..9b5911e --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/WorkflowExtension.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Workflow\Registry; +use Symfony\Component\Workflow\Transition; +use Symfony\Component\Workflow\TransitionBlockerList; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * WorkflowExtension. + * + * @author Grégoire Pineau + * @author Carlos Pereira De Amorim + */ +final class WorkflowExtension extends AbstractExtension +{ + private $workflowRegistry; + + public function __construct(Registry $workflowRegistry) + { + $this->workflowRegistry = $workflowRegistry; + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('workflow_can', [$this, 'canTransition']), + new TwigFunction('workflow_transitions', [$this, 'getEnabledTransitions']), + new TwigFunction('workflow_transition', [$this, 'getEnabledTransition']), + new TwigFunction('workflow_has_marked_place', [$this, 'hasMarkedPlace']), + new TwigFunction('workflow_marked_places', [$this, 'getMarkedPlaces']), + new TwigFunction('workflow_metadata', [$this, 'getMetadata']), + new TwigFunction('workflow_transition_blockers', [$this, 'buildTransitionBlockerList']), + ]; + } + + /** + * Returns true if the transition is enabled. + */ + public function canTransition(object $subject, string $transitionName, string $name = null): bool + { + return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName); + } + + /** + * Returns all enabled transitions. + * + * @return Transition[] + */ + public function getEnabledTransitions(object $subject, string $name = null): array + { + return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject); + } + + public function getEnabledTransition(object $subject, string $transition, string $name = null): ?Transition + { + return $this->workflowRegistry->get($subject, $name)->getEnabledTransition($subject, $transition); + } + + /** + * Returns true if the place is marked. + */ + public function hasMarkedPlace(object $subject, string $placeName, string $name = null): bool + { + return $this->workflowRegistry->get($subject, $name)->getMarking($subject)->has($placeName); + } + + /** + * Returns marked places. + * + * @return string[]|int[] + */ + public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, string $name = null): array + { + $places = $this->workflowRegistry->get($subject, $name)->getMarking($subject)->getPlaces(); + + if ($placesNameOnly) { + return array_keys($places); + } + + return $places; + } + + /** + * Returns the metadata for a specific subject. + * + * @param string|Transition|null $metadataSubject Use null to get workflow metadata + * Use a string (the place name) to get place metadata + * Use a Transition instance to get transition metadata + */ + public function getMetadata(object $subject, string $key, $metadataSubject = null, string $name = null) + { + return $this + ->workflowRegistry + ->get($subject, $name) + ->getMetadataStore() + ->getMetadata($key, $metadataSubject) + ; + } + + public function buildTransitionBlockerList(object $subject, string $transitionName, string $name = null): TransitionBlockerList + { + $workflow = $this->workflowRegistry->get($subject, $name); + + return $workflow->buildTransitionBlockerList($subject, $transitionName); + } +} diff --git a/vendor/symfony/twig-bridge/Extension/YamlExtension.php b/vendor/symfony/twig-bridge/Extension/YamlExtension.php new file mode 100644 index 0000000..63df133 --- /dev/null +++ b/vendor/symfony/twig-bridge/Extension/YamlExtension.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Extension; + +use Symfony\Component\Yaml\Dumper as YamlDumper; +use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; + +/** + * Provides integration of the Yaml component with Twig. + * + * @author Fabien Potencier + */ +final class YamlExtension extends AbstractExtension +{ + /** + * {@inheritdoc} + */ + public function getFilters(): array + { + return [ + new TwigFilter('yaml_encode', [$this, 'encode']), + new TwigFilter('yaml_dump', [$this, 'dump']), + ]; + } + + public function encode($input, int $inline = 0, int $dumpObjects = 0): string + { + static $dumper; + + if (null === $dumper) { + $dumper = new YamlDumper(); + } + + if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { + return $dumper->dump($input, $inline, 0, $dumpObjects); + } + + return $dumper->dump($input, $inline, 0, false, $dumpObjects); + } + + public function dump($value, int $inline = 0, int $dumpObjects = 0): string + { + if (\is_resource($value)) { + return '%Resource%'; + } + + if (\is_array($value) || \is_object($value)) { + return '%'.\gettype($value).'% '.$this->encode($value, $inline, $dumpObjects); + } + + return $this->encode($value, $inline, $dumpObjects); + } +} diff --git a/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php b/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php new file mode 100644 index 0000000..b17da34 --- /dev/null +++ b/vendor/symfony/twig-bridge/Form/TwigRendererEngine.php @@ -0,0 +1,182 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Form; + +use Symfony\Component\Form\AbstractRendererEngine; +use Symfony\Component\Form\FormView; +use Twig\Environment; +use Twig\Template; + +/** + * @author Bernhard Schussek + */ +class TwigRendererEngine extends AbstractRendererEngine +{ + /** + * @var Environment + */ + private $environment; + + /** + * @var Template + */ + private $template; + + public function __construct(array $defaultThemes, Environment $environment) + { + parent::__construct($defaultThemes); + $this->environment = $environment; + } + + /** + * {@inheritdoc} + */ + public function renderBlock(FormView $view, $resource, string $blockName, array $variables = []) + { + $cacheKey = $view->vars[self::CACHE_KEY_VAR]; + + $context = $this->environment->mergeGlobals($variables); + + ob_start(); + + // By contract,This method can only be called after getting the resource + // (which is passed to the method). Getting a resource for the first time + // (with an empty cache) is guaranteed to invoke loadResourcesFromTheme(), + // where the property $template is initialized. + + // We do not call renderBlock here to avoid too many nested level calls + // (XDebug limits the level to 100 by default) + $this->template->displayBlock($blockName, $context, $this->resources[$cacheKey]); + + return ob_get_clean(); + } + + /** + * Loads the cache with the resource for a given block name. + * + * This implementation eagerly loads all blocks of the themes assigned to the given view + * and all of its ancestors views. This is necessary, because Twig receives the + * list of blocks later. At that point, all blocks must already be loaded, for the + * case that the function "block()" is used in the Twig template. + * + * @see getResourceForBlock() + * + * @return bool + */ + protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName) + { + // The caller guarantees that $this->resources[$cacheKey][$block] is + // not set, but it doesn't have to check whether $this->resources[$cacheKey] + // is set. If $this->resources[$cacheKey] is set, all themes for this + // $cacheKey are already loaded (due to the eager population, see doc comment). + if (isset($this->resources[$cacheKey])) { + // As said in the previous, the caller guarantees that + // $this->resources[$cacheKey][$block] is not set. Since the themes are + // already loaded, it can only be a non-existing block. + $this->resources[$cacheKey][$blockName] = false; + + return false; + } + + // Recursively try to find the block in the themes assigned to $view, + // then of its parent view, then of the parent view of the parent and so on. + // When the root view is reached in this recursion, also the default + // themes are taken into account. + + // Check each theme whether it contains the searched block + if (isset($this->themes[$cacheKey])) { + for ($i = \count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) { + $this->loadResourcesFromTheme($cacheKey, $this->themes[$cacheKey][$i]); + // CONTINUE LOADING (see doc comment) + } + } + + // Check the default themes once we reach the root view without success + if (!$view->parent) { + if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) { + for ($i = \count($this->defaultThemes) - 1; $i >= 0; --$i) { + $this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]); + // CONTINUE LOADING (see doc comment) + } + } + } + + // Proceed with the themes of the parent view + if ($view->parent) { + $parentCacheKey = $view->parent->vars[self::CACHE_KEY_VAR]; + + if (!isset($this->resources[$parentCacheKey])) { + $this->loadResourceForBlockName($parentCacheKey, $view->parent, $blockName); + } + + // EAGER CACHE POPULATION (see doc comment) + foreach ($this->resources[$parentCacheKey] as $nestedBlockName => $resource) { + if (!isset($this->resources[$cacheKey][$nestedBlockName])) { + $this->resources[$cacheKey][$nestedBlockName] = $resource; + } + } + } + + // Even though we loaded the themes, it can happen that none of them + // contains the searched block + if (!isset($this->resources[$cacheKey][$blockName])) { + // Cache that we didn't find anything to speed up further accesses + $this->resources[$cacheKey][$blockName] = false; + } + + return false !== $this->resources[$cacheKey][$blockName]; + } + + /** + * Loads the resources for all blocks in a theme. + * + * @param mixed $theme The theme to load the block from. This parameter + * is passed by reference, because it might be necessary + * to initialize the theme first. Any changes made to + * this variable will be kept and be available upon + * further calls to this method using the same theme. + */ + protected function loadResourcesFromTheme(string $cacheKey, &$theme) + { + if (!$theme instanceof Template) { + /* @var Template $theme */ + $theme = $this->environment->load($theme)->unwrap(); + } + + if (null === $this->template) { + // Store the first Template instance that we find so that + // we can call displayBlock() later on. It doesn't matter *which* + // template we use for that, since we pass the used blocks manually + // anyway. + $this->template = $theme; + } + + // Use a separate variable for the inheritance traversal, because + // theme is a reference and we don't want to change it. + $currentTheme = $theme; + + $context = $this->environment->mergeGlobals([]); + + // The do loop takes care of template inheritance. + // Add blocks from all templates in the inheritance tree, but avoid + // overriding blocks already set. + do { + foreach ($currentTheme->getBlocks() as $block => $blockData) { + if (!isset($this->resources[$cacheKey][$block])) { + // The resource given back is the key to the bucket that + // contains this block. + $this->resources[$cacheKey][$block] = $blockData; + } + } + } while (false !== $currentTheme = $currentTheme->getParent($context)); + } +} diff --git a/vendor/symfony/twig-bridge/LICENSE b/vendor/symfony/twig-bridge/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/twig-bridge/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/twig-bridge/Mime/BodyRenderer.php b/vendor/symfony/twig-bridge/Mime/BodyRenderer.php new file mode 100644 index 0000000..47901d3 --- /dev/null +++ b/vendor/symfony/twig-bridge/Mime/BodyRenderer.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Mime; + +use League\HTMLToMarkdown\HtmlConverter; +use Symfony\Component\Mime\BodyRendererInterface; +use Symfony\Component\Mime\Exception\InvalidArgumentException; +use Symfony\Component\Mime\Message; +use Twig\Environment; + +/** + * @author Fabien Potencier + */ +final class BodyRenderer implements BodyRendererInterface +{ + private $twig; + private $context; + private $converter; + + public function __construct(Environment $twig, array $context = []) + { + $this->twig = $twig; + $this->context = $context; + if (class_exists(HtmlConverter::class)) { + $this->converter = new HtmlConverter([ + 'hard_break' => true, + 'strip_tags' => true, + 'remove_nodes' => 'head style', + ]); + } + } + + public function render(Message $message): void + { + if (!$message instanceof TemplatedEmail) { + return; + } + + $messageContext = $message->getContext(); + + $previousRenderingKey = $messageContext[__CLASS__] ?? null; + unset($messageContext[__CLASS__]); + $currentRenderingKey = $this->getFingerPrint($message); + if ($previousRenderingKey === $currentRenderingKey) { + return; + } + + if (isset($messageContext['email'])) { + throw new InvalidArgumentException(sprintf('A "%s" context cannot have an "email" entry as this is a reserved variable.', get_debug_type($message))); + } + + $vars = array_merge($this->context, $messageContext, [ + 'email' => new WrappedTemplatedEmail($this->twig, $message), + ]); + + if ($template = $message->getTextTemplate()) { + $message->text($this->twig->render($template, $vars)); + } + + if ($template = $message->getHtmlTemplate()) { + $message->html($this->twig->render($template, $vars)); + } + + // if text body is empty, compute one from the HTML body + if (!$message->getTextBody() && null !== $html = $message->getHtmlBody()) { + $message->text($this->convertHtmlToText(\is_resource($html) ? stream_get_contents($html) : $html)); + } + $message->context($message->getContext() + [__CLASS__ => $currentRenderingKey]); + } + + private function getFingerPrint(TemplatedEmail $message): string + { + $messageContext = $message->getContext(); + unset($messageContext[__CLASS__]); + + $payload = [$messageContext, $message->getTextTemplate(), $message->getHtmlTemplate()]; + try { + $serialized = serialize($payload); + } catch (\Exception $e) { + // Serialization of 'Closure' is not allowed + // Happens when context contain a closure, in that case, we assume that context always change. + $serialized = random_bytes(8); + } + + return md5($serialized); + } + + private function convertHtmlToText(string $html): string + { + if (null !== $this->converter) { + return $this->converter->convert($html); + } + + return strip_tags(preg_replace('{<(head|style)\b.*?}is', '', $html)); + } +} diff --git a/vendor/symfony/twig-bridge/Mime/NotificationEmail.php b/vendor/symfony/twig-bridge/Mime/NotificationEmail.php new file mode 100644 index 0000000..3bdcd71 --- /dev/null +++ b/vendor/symfony/twig-bridge/Mime/NotificationEmail.php @@ -0,0 +1,250 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Mime; + +use Symfony\Component\ErrorHandler\Exception\FlattenException; +use Symfony\Component\Mime\Header\Headers; +use Symfony\Component\Mime\Part\AbstractPart; +use Twig\Extra\CssInliner\CssInlinerExtension; +use Twig\Extra\Inky\InkyExtension; +use Twig\Extra\Markdown\MarkdownExtension; + +/** + * @author Fabien Potencier + */ +class NotificationEmail extends TemplatedEmail +{ + public const IMPORTANCE_URGENT = 'urgent'; + public const IMPORTANCE_HIGH = 'high'; + public const IMPORTANCE_MEDIUM = 'medium'; + public const IMPORTANCE_LOW = 'low'; + + private $theme = 'default'; + private $context = [ + 'importance' => self::IMPORTANCE_LOW, + 'content' => '', + 'exception' => false, + 'action_text' => null, + 'action_url' => null, + 'markdown' => false, + 'raw' => false, + 'footer_text' => 'Notification e-mail sent by Symfony', + ]; + + public function __construct(Headers $headers = null, AbstractPart $body = null) + { + $missingPackages = []; + if (!class_exists(CssInlinerExtension::class)) { + $missingPackages['twig/cssinliner-extra'] = 'CSS Inliner'; + } + + if (!class_exists(InkyExtension::class)) { + $missingPackages['twig/inky-extra'] = 'Inky'; + } + + if ($missingPackages) { + throw new \LogicException(sprintf('You cannot use "%s" if the "%s" Twig extension%s not available; try running "%s".', static::class, implode('" and "', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', 'composer require '.implode(' ', array_keys($missingPackages)))); + } + + parent::__construct($headers, $body); + } + + /** + * Creates a NotificationEmail instance that is appropriate to send to normal (non-admin) users. + */ + public static function asPublicEmail(Headers $headers = null, AbstractPart $body = null): self + { + $email = new static($headers, $body); + $email->markAsPublic(); + + return $email; + } + + /** + * @return $this + */ + public function markAsPublic(): self + { + $this->context['importance'] = null; + $this->context['footer_text'] = null; + + return $this; + } + + /** + * @return $this + */ + public function markdown(string $content) + { + if (!class_exists(MarkdownExtension::class)) { + throw new \LogicException(sprintf('You cannot use "%s" if the Markdown Twig extension is not available; try running "composer require twig/markdown-extra".', __METHOD__)); + } + + $this->context['markdown'] = true; + + return $this->content($content); + } + + /** + * @return $this + */ + public function content(string $content, bool $raw = false) + { + $this->context['content'] = $content; + $this->context['raw'] = $raw; + + return $this; + } + + /** + * @return $this + */ + public function action(string $text, string $url) + { + $this->context['action_text'] = $text; + $this->context['action_url'] = $url; + + return $this; + } + + /** + * @return $this + */ + public function importance(string $importance) + { + $this->context['importance'] = $importance; + + return $this; + } + + /** + * @param \Throwable|FlattenException $exception + * + * @return $this + */ + public function exception($exception) + { + if (!$exception instanceof \Throwable && !$exception instanceof FlattenException) { + throw new \LogicException(sprintf('"%s" accepts "%s" or "%s" instances.', __METHOD__, \Throwable::class, FlattenException::class)); + } + + $exceptionAsString = $this->getExceptionAsString($exception); + + $this->context['exception'] = true; + $this->attach($exceptionAsString, 'exception.txt', 'text/plain'); + $this->importance(self::IMPORTANCE_URGENT); + + if (!$this->getSubject()) { + $this->subject($exception->getMessage()); + } + + return $this; + } + + /** + * @return $this + */ + public function theme(string $theme) + { + $this->theme = $theme; + + return $this; + } + + public function getTextTemplate(): ?string + { + if ($template = parent::getTextTemplate()) { + return $template; + } + + return '@email/'.$this->theme.'/notification/body.txt.twig'; + } + + public function getHtmlTemplate(): ?string + { + if ($template = parent::getHtmlTemplate()) { + return $template; + } + + return '@email/'.$this->theme.'/notification/body.html.twig'; + } + + public function getContext(): array + { + return array_merge($this->context, parent::getContext()); + } + + public function getPreparedHeaders(): Headers + { + $headers = parent::getPreparedHeaders(); + + $importance = $this->context['importance'] ?? self::IMPORTANCE_LOW; + $this->priority($this->determinePriority($importance)); + if ($this->context['importance']) { + $headers->setHeaderBody('Text', 'Subject', sprintf('[%s] %s', strtoupper($importance), $this->getSubject())); + } + + return $headers; + } + + private function determinePriority(string $importance): int + { + switch ($importance) { + case self::IMPORTANCE_URGENT: + return self::PRIORITY_HIGHEST; + case self::IMPORTANCE_HIGH: + return self::PRIORITY_HIGH; + case self::IMPORTANCE_MEDIUM: + return self::PRIORITY_NORMAL; + case self::IMPORTANCE_LOW: + default: + return self::PRIORITY_LOW; + } + } + + private function getExceptionAsString($exception): string + { + if (class_exists(FlattenException::class)) { + $exception = $exception instanceof FlattenException ? $exception : FlattenException::createFromThrowable($exception); + + return $exception->getAsString(); + } + + $message = \get_class($exception); + if ('' !== $exception->getMessage()) { + $message .= ': '.$exception->getMessage(); + } + + $message .= ' in '.$exception->getFile().':'.$exception->getLine()."\n"; + $message .= "Stack trace:\n".$exception->getTraceAsString()."\n\n"; + + return rtrim($message); + } + + /** + * @internal + */ + public function __serialize(): array + { + return [$this->context, parent::__serialize()]; + } + + /** + * @internal + */ + public function __unserialize(array $data): void + { + [$this->context, $parentData] = $data; + + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/twig-bridge/Mime/TemplatedEmail.php b/vendor/symfony/twig-bridge/Mime/TemplatedEmail.php new file mode 100644 index 0000000..6dd9202 --- /dev/null +++ b/vendor/symfony/twig-bridge/Mime/TemplatedEmail.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Mime; + +use Symfony\Component\Mime\Email; + +/** + * @author Fabien Potencier + */ +class TemplatedEmail extends Email +{ + private $htmlTemplate; + private $textTemplate; + private $context = []; + + /** + * @return $this + */ + public function textTemplate(?string $template) + { + $this->textTemplate = $template; + + return $this; + } + + /** + * @return $this + */ + public function htmlTemplate(?string $template) + { + $this->htmlTemplate = $template; + + return $this; + } + + public function getTextTemplate(): ?string + { + return $this->textTemplate; + } + + public function getHtmlTemplate(): ?string + { + return $this->htmlTemplate; + } + + /** + * @return $this + */ + public function context(array $context) + { + $this->context = $context; + + return $this; + } + + public function getContext(): array + { + return $this->context; + } + + /** + * @internal + */ + public function __serialize(): array + { + return [$this->htmlTemplate, $this->textTemplate, $this->context, parent::__serialize()]; + } + + /** + * @internal + */ + public function __unserialize(array $data): void + { + [$this->htmlTemplate, $this->textTemplate, $this->context, $parentData] = $data; + + parent::__unserialize($parentData); + } +} diff --git a/vendor/symfony/twig-bridge/Mime/WrappedTemplatedEmail.php b/vendor/symfony/twig-bridge/Mime/WrappedTemplatedEmail.php new file mode 100644 index 0000000..f172691 --- /dev/null +++ b/vendor/symfony/twig-bridge/Mime/WrappedTemplatedEmail.php @@ -0,0 +1,194 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Mime; + +use Symfony\Component\Mime\Address; +use Twig\Environment; + +/** + * @internal + * + * @author Fabien Potencier + */ +final class WrappedTemplatedEmail +{ + private $twig; + private $message; + + public function __construct(Environment $twig, TemplatedEmail $message) + { + $this->twig = $twig; + $this->message = $message; + } + + public function toName(): string + { + return $this->message->getTo()[0]->getName(); + } + + public function image(string $image, string $contentType = null): string + { + $file = $this->twig->getLoader()->getSourceContext($image); + if ($path = $file->getPath()) { + $this->message->embedFromPath($path, $image, $contentType); + } else { + $this->message->embed($file->getCode(), $image, $contentType); + } + + return 'cid:'.$image; + } + + public function attach(string $file, string $name = null, string $contentType = null): void + { + $file = $this->twig->getLoader()->getSourceContext($file); + if ($path = $file->getPath()) { + $this->message->attachFromPath($path, $name, $contentType); + } else { + $this->message->attach($file->getCode(), $name, $contentType); + } + } + + /** + * @return $this + */ + public function setSubject(string $subject): self + { + $this->message->subject($subject); + + return $this; + } + + public function getSubject(): ?string + { + return $this->message->getSubject(); + } + + /** + * @return $this + */ + public function setReturnPath(string $address): self + { + $this->message->returnPath($address); + + return $this; + } + + public function getReturnPath(): string + { + return $this->message->getReturnPath(); + } + + /** + * @return $this + */ + public function addFrom(string $address, string $name = ''): self + { + $this->message->addFrom(new Address($address, $name)); + + return $this; + } + + /** + * @return Address[] + */ + public function getFrom(): array + { + return $this->message->getFrom(); + } + + /** + * @return $this + */ + public function addReplyTo(string $address): self + { + $this->message->addReplyTo($address); + + return $this; + } + + /** + * @return Address[] + */ + public function getReplyTo(): array + { + return $this->message->getReplyTo(); + } + + /** + * @return $this + */ + public function addTo(string $address, string $name = ''): self + { + $this->message->addTo(new Address($address, $name)); + + return $this; + } + + /** + * @return Address[] + */ + public function getTo(): array + { + return $this->message->getTo(); + } + + /** + * @return $this + */ + public function addCc(string $address, string $name = ''): self + { + $this->message->addCc(new Address($address, $name)); + + return $this; + } + + /** + * @return Address[] + */ + public function getCc(): array + { + return $this->message->getCc(); + } + + /** + * @return $this + */ + public function addBcc(string $address, string $name = ''): self + { + $this->message->addBcc(new Address($address, $name)); + + return $this; + } + + /** + * @return Address[] + */ + public function getBcc(): array + { + return $this->message->getBcc(); + } + + /** + * @return $this + */ + public function setPriority(int $priority): self + { + $this->message->priority($priority); + + return $this; + } + + public function getPriority(): int + { + return $this->message->getPriority(); + } +} diff --git a/vendor/symfony/twig-bridge/Node/DumpNode.php b/vendor/symfony/twig-bridge/Node/DumpNode.php new file mode 100644 index 0000000..68c0055 --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/DumpNode.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Node; + +/** + * @author Julien Galenski + */ +final class DumpNode extends Node +{ + private $varPrefix; + + public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null) + { + $nodes = []; + if (null !== $values) { + $nodes['values'] = $values; + } + + parent::__construct($nodes, [], $lineno, $tag); + $this->varPrefix = $varPrefix; + } + + public function compile(Compiler $compiler): void + { + $compiler + ->write("if (\$this->env->isDebug()) {\n") + ->indent(); + + if (!$this->hasNode('values')) { + // remove embedded templates (macros) from the context + $compiler + ->write(sprintf('$%svars = [];'."\n", $this->varPrefix)) + ->write(sprintf('foreach ($context as $%1$skey => $%1$sval) {'."\n", $this->varPrefix)) + ->indent() + ->write(sprintf('if (!$%sval instanceof \Twig\Template) {'."\n", $this->varPrefix)) + ->indent() + ->write(sprintf('$%1$svars[$%1$skey] = $%1$sval;'."\n", $this->varPrefix)) + ->outdent() + ->write("}\n") + ->outdent() + ->write("}\n") + ->addDebugInfo($this) + ->write(sprintf('\Symfony\Component\VarDumper\VarDumper::dump($%svars);'."\n", $this->varPrefix)); + } elseif (($values = $this->getNode('values')) && 1 === $values->count()) { + $compiler + ->addDebugInfo($this) + ->write('\Symfony\Component\VarDumper\VarDumper::dump(') + ->subcompile($values->getNode(0)) + ->raw(");\n"); + } else { + $compiler + ->addDebugInfo($this) + ->write('\Symfony\Component\VarDumper\VarDumper::dump(['."\n") + ->indent(); + foreach ($values as $node) { + $compiler->write(''); + if ($node->hasAttribute('name')) { + $compiler + ->string($node->getAttribute('name')) + ->raw(' => '); + } + $compiler + ->subcompile($node) + ->raw(",\n"); + } + $compiler + ->outdent() + ->write("]);\n"); + } + + $compiler + ->outdent() + ->write("}\n"); + } +} diff --git a/vendor/symfony/twig-bridge/Node/FormThemeNode.php b/vendor/symfony/twig-bridge/Node/FormThemeNode.php new file mode 100644 index 0000000..e373112 --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/FormThemeNode.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Symfony\Component\Form\FormRenderer; +use Twig\Compiler; +use Twig\Node\Node; + +/** + * @author Fabien Potencier + */ +final class FormThemeNode extends Node +{ + public function __construct(Node $form, Node $resources, int $lineno, string $tag = null, bool $only = false) + { + parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('$this->env->getRuntime(') + ->string(FormRenderer::class) + ->raw(')->setTheme(') + ->subcompile($this->getNode('form')) + ->raw(', ') + ->subcompile($this->getNode('resources')) + ->raw(', ') + ->raw(false === $this->getAttribute('only') ? 'true' : 'false') + ->raw(");\n"); + } +} diff --git a/vendor/symfony/twig-bridge/Node/RenderBlockNode.php b/vendor/symfony/twig-bridge/Node/RenderBlockNode.php new file mode 100644 index 0000000..4d4cf61 --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/RenderBlockNode.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Expression\FunctionExpression; + +/** + * Compiles a call to {@link \Symfony\Component\Form\FormRendererInterface::renderBlock()}. + * + * The function name is used as block name. For example, if the function name + * is "foo", the block "foo" will be rendered. + * + * @author Bernhard Schussek + */ +final class RenderBlockNode extends FunctionExpression +{ + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + $arguments = iterator_to_array($this->getNode('arguments')); + $compiler->write('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->renderBlock('); + + if (isset($arguments[0])) { + $compiler->subcompile($arguments[0]); + $compiler->raw(', \''.$this->getAttribute('name').'\''); + + if (isset($arguments[1])) { + $compiler->raw(', '); + $compiler->subcompile($arguments[1]); + } + } + + $compiler->raw(')'); + } +} diff --git a/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php b/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php new file mode 100644 index 0000000..9967639 --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FunctionExpression; + +/** + * @author Bernhard Schussek + */ +final class SearchAndRenderBlockNode extends FunctionExpression +{ + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + $compiler->raw('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock('); + + preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches); + + $arguments = iterator_to_array($this->getNode('arguments')); + $blockNameSuffix = $matches[1]; + + if (isset($arguments[0])) { + $compiler->subcompile($arguments[0]); + $compiler->raw(', \''.$blockNameSuffix.'\''); + + if (isset($arguments[1])) { + if ('label' === $blockNameSuffix) { + // The "label" function expects the label in the second and + // the variables in the third argument + $label = $arguments[1]; + $variables = $arguments[2] ?? null; + $lineno = $label->getTemplateLine(); + + if ($label instanceof ConstantExpression) { + // If the label argument is given as a constant, we can either + // strip it away if it is empty, or integrate it into the array + // of variables at compile time. + $labelIsExpression = false; + + // Only insert the label into the array if it is not empty + if (!twig_test_empty($label->getAttribute('value'))) { + $originalVariables = $variables; + $variables = new ArrayExpression([], $lineno); + $labelKey = new ConstantExpression('label', $lineno); + + if (null !== $originalVariables) { + foreach ($originalVariables->getKeyValuePairs() as $pair) { + // Don't copy the original label attribute over if it exists + if ((string) $labelKey !== (string) $pair['key']) { + $variables->addElement($pair['value'], $pair['key']); + } + } + } + + // Insert the label argument into the array + $variables->addElement($label, $labelKey); + } + } else { + // The label argument is not a constant, but some kind of + // expression. This expression needs to be evaluated at runtime. + // Depending on the result (whether it is null or not), the + // label in the arguments should take precedence over the label + // in the attributes or not. + $labelIsExpression = true; + } + } else { + // All other functions than "label" expect the variables + // in the second argument + $label = null; + $variables = $arguments[1]; + $labelIsExpression = false; + } + + if (null !== $variables || $labelIsExpression) { + $compiler->raw(', '); + + if (null !== $variables) { + $compiler->subcompile($variables); + } + + if ($labelIsExpression) { + if (null !== $variables) { + $compiler->raw(' + '); + } + + // Check at runtime whether the label is empty. + // If not, add it to the array at runtime. + $compiler->raw('(twig_test_empty($_label_ = '); + $compiler->subcompile($label); + $compiler->raw(') ? [] : ["label" => $_label_])'); + } + } + } + } + + $compiler->raw(')'); + } +} diff --git a/vendor/symfony/twig-bridge/Node/StopwatchNode.php b/vendor/symfony/twig-bridge/Node/StopwatchNode.php new file mode 100644 index 0000000..cfa4d8a --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/StopwatchNode.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Node; + +/** + * Represents a stopwatch node. + * + * @author Wouter J + */ +final class StopwatchNode extends Node +{ + public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, string $tag = null) + { + parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('') + ->subcompile($this->getNode('var')) + ->raw(' = ') + ->subcompile($this->getNode('name')) + ->write(";\n") + ->write("\$this->env->getExtension('Symfony\Bridge\Twig\Extension\StopwatchExtension')->getStopwatch()->start(") + ->subcompile($this->getNode('var')) + ->raw(", 'template');\n") + ->subcompile($this->getNode('body')) + ->write("\$this->env->getExtension('Symfony\Bridge\Twig\Extension\StopwatchExtension')->getStopwatch()->stop(") + ->subcompile($this->getNode('var')) + ->raw(");\n") + ; + } +} diff --git a/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php b/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php new file mode 100644 index 0000000..df29f0a --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/TransDefaultDomainNode.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Node; + +/** + * @author Fabien Potencier + */ +final class TransDefaultDomainNode extends Node +{ + public function __construct(AbstractExpression $expr, int $lineno = 0, string $tag = null) + { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + // noop as this node is just a marker for TranslationDefaultDomainNodeVisitor + } +} diff --git a/vendor/symfony/twig-bridge/Node/TransNode.php b/vendor/symfony/twig-bridge/Node/TransNode.php new file mode 100644 index 0000000..8a126ba --- /dev/null +++ b/vendor/symfony/twig-bridge/Node/TransNode.php @@ -0,0 +1,130 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Node; + +use Twig\Compiler; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\Node; +use Twig\Node\TextNode; + +/** + * @author Fabien Potencier + */ +final class TransNode extends Node +{ + public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, int $lineno = 0, string $tag = null) + { + $nodes = ['body' => $body]; + if (null !== $domain) { + $nodes['domain'] = $domain; + } + if (null !== $count) { + $nodes['count'] = $count; + } + if (null !== $vars) { + $nodes['vars'] = $vars; + } + if (null !== $locale) { + $nodes['locale'] = $locale; + } + + parent::__construct($nodes, [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + $defaults = new ArrayExpression([], -1); + if ($this->hasNode('vars') && ($vars = $this->getNode('vars')) instanceof ArrayExpression) { + $defaults = $this->getNode('vars'); + $vars = null; + } + [$msg, $defaults] = $this->compileString($this->getNode('body'), $defaults, (bool) $vars); + + $compiler + ->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(') + ->subcompile($msg) + ; + + $compiler->raw(', '); + + if (null !== $vars) { + $compiler + ->raw('array_merge(') + ->subcompile($defaults) + ->raw(', ') + ->subcompile($this->getNode('vars')) + ->raw(')') + ; + } else { + $compiler->subcompile($defaults); + } + + $compiler->raw(', '); + + if (!$this->hasNode('domain')) { + $compiler->repr('messages'); + } else { + $compiler->subcompile($this->getNode('domain')); + } + + if ($this->hasNode('locale')) { + $compiler + ->raw(', ') + ->subcompile($this->getNode('locale')) + ; + } elseif ($this->hasNode('count')) { + $compiler->raw(', null'); + } + + if ($this->hasNode('count')) { + $compiler + ->raw(', ') + ->subcompile($this->getNode('count')) + ; + } + + $compiler->raw(");\n"); + } + + private function compileString(Node $body, ArrayExpression $vars, bool $ignoreStrictCheck = false): array + { + if ($body instanceof ConstantExpression) { + $msg = $body->getAttribute('value'); + } elseif ($body instanceof TextNode) { + $msg = $body->getAttribute('data'); + } else { + return [$body, $vars]; + } + + preg_match_all('/(?getTemplateLine()); + if (!$vars->hasElement($key)) { + if ('count' === $var && $this->hasNode('count')) { + $vars->addElement($this->getNode('count'), $key); + } else { + $varExpr = new NameExpression($var, $body->getTemplateLine()); + $varExpr->setAttribute('ignore_strict_check', $ignoreStrictCheck); + $vars->addElement($varExpr, $key); + } + } + } + + return [new ConstantExpression(str_replace('%%', '%', trim($msg)), $body->getTemplateLine()), $vars]; + } +} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/Scope.php b/vendor/symfony/twig-bridge/NodeVisitor/Scope.php new file mode 100644 index 0000000..765b4b6 --- /dev/null +++ b/vendor/symfony/twig-bridge/NodeVisitor/Scope.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\Bridge\Twig\NodeVisitor; + +/** + * @author Jean-François Simon + */ +class Scope +{ + private $parent; + private $data = []; + private $left = false; + + public function __construct(self $parent = null) + { + $this->parent = $parent; + } + + /** + * Opens a new child scope. + * + * @return self + */ + public function enter() + { + return new self($this); + } + + /** + * Closes current scope and returns parent one. + * + * @return self|null + */ + public function leave() + { + $this->left = true; + + return $this->parent; + } + + /** + * Stores data into current scope. + * + * @return $this + * + * @throws \LogicException + */ + public function set(string $key, $value) + { + if ($this->left) { + throw new \LogicException('Left scope is not mutable.'); + } + + $this->data[$key] = $value; + + return $this; + } + + /** + * Tests if a data is visible from current scope. + * + * @return bool + */ + public function has(string $key) + { + if (\array_key_exists($key, $this->data)) { + return true; + } + + if (null === $this->parent) { + return false; + } + + return $this->parent->has($key); + } + + /** + * Returns data visible from current scope. + * + * @return mixed + */ + public function get(string $key, $default = null) + { + if (\array_key_exists($key, $this->data)) { + return $this->data[$key]; + } + + if (null === $this->parent) { + return $default; + } + + return $this->parent->get($key, $default); + } +} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php new file mode 100644 index 0000000..213365e --- /dev/null +++ b/vendor/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -0,0 +1,128 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\NodeVisitor; + +use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; +use Symfony\Bridge\Twig\Node\TransNode; +use Twig\Environment; +use Twig\Node\BlockNode; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\NameExpression; +use Twig\Node\ModuleNode; +use Twig\Node\Node; +use Twig\Node\SetNode; +use Twig\NodeVisitor\AbstractNodeVisitor; + +/** + * @author Fabien Potencier + */ +final class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor +{ + private $scope; + + public function __construct() + { + $this->scope = new Scope(); + } + + /** + * {@inheritdoc} + */ + protected function doEnterNode(Node $node, Environment $env): Node + { + if ($node instanceof BlockNode || $node instanceof ModuleNode) { + $this->scope = $this->scope->enter(); + } + + if ($node instanceof TransDefaultDomainNode) { + if ($node->getNode('expr') instanceof ConstantExpression) { + $this->scope->set('domain', $node->getNode('expr')); + + return $node; + } else { + $var = $this->getVarName(); + $name = new AssignNameExpression($var, $node->getTemplateLine()); + $this->scope->set('domain', new NameExpression($var, $node->getTemplateLine())); + + return new SetNode(false, new Node([$name]), new Node([$node->getNode('expr')]), $node->getTemplateLine()); + } + } + + if (!$this->scope->has('domain')) { + return $node; + } + + if ($node instanceof FilterExpression && 'trans' === $node->getNode('filter')->getAttribute('value')) { + $arguments = $node->getNode('arguments'); + if ($this->isNamedArguments($arguments)) { + if (!$arguments->hasNode('domain') && !$arguments->hasNode(1)) { + $arguments->setNode('domain', $this->scope->get('domain')); + } + } elseif (!$arguments->hasNode(1)) { + if (!$arguments->hasNode(0)) { + $arguments->setNode(0, new ArrayExpression([], $node->getTemplateLine())); + } + + $arguments->setNode(1, $this->scope->get('domain')); + } + } elseif ($node instanceof TransNode) { + if (!$node->hasNode('domain')) { + $node->setNode('domain', $this->scope->get('domain')); + } + } + + return $node; + } + + /** + * {@inheritdoc} + */ + protected function doLeaveNode(Node $node, Environment $env): ?Node + { + if ($node instanceof TransDefaultDomainNode) { + return null; + } + + if ($node instanceof BlockNode || $node instanceof ModuleNode) { + $this->scope = $this->scope->leave(); + } + + return $node; + } + + /** + * {@inheritdoc} + */ + public function getPriority(): int + { + return -10; + } + + private function isNamedArguments(Node $arguments): bool + { + foreach ($arguments as $name => $node) { + if (!\is_int($name)) { + return true; + } + } + + return false; + } + + private function getVarName(): string + { + return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); + } +} diff --git a/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php b/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php new file mode 100644 index 0000000..d42245e --- /dev/null +++ b/vendor/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php @@ -0,0 +1,187 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\NodeVisitor; + +use Symfony\Bridge\Twig\Node\TransNode; +use Twig\Environment; +use Twig\Node\Expression\Binary\ConcatBinary; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Expression\FilterExpression; +use Twig\Node\Expression\FunctionExpression; +use Twig\Node\Node; +use Twig\NodeVisitor\AbstractNodeVisitor; + +/** + * TranslationNodeVisitor extracts translation messages. + * + * @author Fabien Potencier + */ +final class TranslationNodeVisitor extends AbstractNodeVisitor +{ + public const UNDEFINED_DOMAIN = '_undefined'; + + private $enabled = false; + private $messages = []; + + public function enable(): void + { + $this->enabled = true; + $this->messages = []; + } + + public function disable(): void + { + $this->enabled = false; + $this->messages = []; + } + + public function getMessages(): array + { + return $this->messages; + } + + /** + * {@inheritdoc} + */ + protected function doEnterNode(Node $node, Environment $env): Node + { + if (!$this->enabled) { + return $node; + } + + if ( + $node instanceof FilterExpression && + 'trans' === $node->getNode('filter')->getAttribute('value') && + $node->getNode('node') instanceof ConstantExpression + ) { + // extract constant nodes with a trans filter + $this->messages[] = [ + $node->getNode('node')->getAttribute('value'), + $this->getReadDomainFromArguments($node->getNode('arguments'), 1), + ]; + } elseif ( + $node instanceof FunctionExpression && + 't' === $node->getAttribute('name') + ) { + $nodeArguments = $node->getNode('arguments'); + + if ($nodeArguments->getIterator()->current() instanceof ConstantExpression) { + $this->messages[] = [ + $this->getReadMessageFromArguments($nodeArguments, 0), + $this->getReadDomainFromArguments($nodeArguments, 2), + ]; + } + } elseif ($node instanceof TransNode) { + // extract trans nodes + $this->messages[] = [ + $node->getNode('body')->getAttribute('data'), + $node->hasNode('domain') ? $this->getReadDomainFromNode($node->getNode('domain')) : null, + ]; + } elseif ( + $node instanceof FilterExpression && + 'trans' === $node->getNode('filter')->getAttribute('value') && + $node->getNode('node') instanceof ConcatBinary && + $message = $this->getConcatValueFromNode($node->getNode('node'), null) + ) { + $this->messages[] = [ + $message, + $this->getReadDomainFromArguments($node->getNode('arguments'), 1), + ]; + } + + return $node; + } + + /** + * {@inheritdoc} + */ + protected function doLeaveNode(Node $node, Environment $env): ?Node + { + return $node; + } + + /** + * {@inheritdoc} + */ + public function getPriority(): int + { + return 0; + } + + private function getReadMessageFromArguments(Node $arguments, int $index): ?string + { + if ($arguments->hasNode('message')) { + $argument = $arguments->getNode('message'); + } elseif ($arguments->hasNode($index)) { + $argument = $arguments->getNode($index); + } else { + return null; + } + + return $this->getReadMessageFromNode($argument); + } + + private function getReadMessageFromNode(Node $node): ?string + { + if ($node instanceof ConstantExpression) { + return $node->getAttribute('value'); + } + + return null; + } + + private function getReadDomainFromArguments(Node $arguments, int $index): ?string + { + if ($arguments->hasNode('domain')) { + $argument = $arguments->getNode('domain'); + } elseif ($arguments->hasNode($index)) { + $argument = $arguments->getNode($index); + } else { + return null; + } + + return $this->getReadDomainFromNode($argument); + } + + private function getReadDomainFromNode(Node $node): ?string + { + if ($node instanceof ConstantExpression) { + return $node->getAttribute('value'); + } + + return self::UNDEFINED_DOMAIN; + } + + private function getConcatValueFromNode(Node $node, ?string $value): ?string + { + if ($node instanceof ConcatBinary) { + foreach ($node as $nextNode) { + if ($nextNode instanceof ConcatBinary) { + $nextValue = $this->getConcatValueFromNode($nextNode, $value); + if (null === $nextValue) { + return null; + } + $value .= $nextValue; + } elseif ($nextNode instanceof ConstantExpression) { + $value .= $nextNode->getAttribute('value'); + } else { + // this is a node we cannot process (variable, or translation in translation) + return null; + } + } + } elseif ($node instanceof ConstantExpression) { + $value .= $node->getAttribute('value'); + } + + return $value; + } +} diff --git a/vendor/symfony/twig-bridge/README.md b/vendor/symfony/twig-bridge/README.md new file mode 100644 index 0000000..533d573 --- /dev/null +++ b/vendor/symfony/twig-bridge/README.md @@ -0,0 +1,13 @@ +Twig Bridge +=========== + +The Twig bridge provides integration for [Twig](https://twig.symfony.com/) with +various Symfony components. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.html.twig b/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.html.twig new file mode 100644 index 0000000..9027546 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.html.twig @@ -0,0 +1 @@ +{% extends "@email/zurb_2/notification/body.html.twig" %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.txt.twig b/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.txt.twig new file mode 100644 index 0000000..37671b1 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/default/notification/body.txt.twig @@ -0,0 +1 @@ +{% extends "@email/zurb_2/notification/body.txt.twig" %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/main.css b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/main.css new file mode 100644 index 0000000..b826813 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/main.css @@ -0,0 +1,1667 @@ +/* + * Copyright (c) 2017 ZURB, inc. -- MIT License + * + * https://raw.githubusercontent.com/foundation/foundation-emails/v2.2.1/dist/foundation-emails.css + */ + +.wrapper { + width: 100%; +} + +#outlook a { + padding: 0; +} + +body { + width: 100% !important; + min-width: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + margin: 0; + Margin: 0; + padding: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.ExternalClass { + width: 100%; +} + +.ExternalClass, +.ExternalClass p, +.ExternalClass span, +.ExternalClass font, +.ExternalClass td, +.ExternalClass div { + line-height: 100%; +} + +#backgroundTable { + margin: 0; + Margin: 0; + padding: 0; + width: 100% !important; + line-height: 100% !important; +} + +img { + outline: none; + text-decoration: none; + -ms-interpolation-mode: bicubic; + width: auto; + max-width: 100%; + clear: both; + display: block; +} + +center { + width: 100%; + min-width: 580px; +} + +a img { + border: none; +} + +p { + margin: 0 0 0 10px; + Margin: 0 0 0 10px; +} + +table { + border-spacing: 0; + border-collapse: collapse; +} + +td { + word-wrap: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; + border-collapse: collapse !important; +} + +table, +tr, +td { + padding: 0; + vertical-align: top; + text-align: left; +} + +@media only screen { + html { + min-height: 100%; + background: #f3f3f3; + } +} + +table.body { + background: #f3f3f3; + height: 100%; + width: 100%; +} + +table.container { + background: #fefefe; + width: 580px; + margin: 0 auto; + Margin: 0 auto; + text-align: inherit; +} + +table.row { + padding: 0; + width: 100%; + position: relative; +} + +table.spacer { + width: 100%; +} + +table.spacer td { + mso-line-height-rule: exactly; +} + +table.container table.row { + display: table; +} + +td.columns, +td.column, +th.columns, +th.column { + margin: 0 auto; + Margin: 0 auto; + padding-left: 16px; + padding-bottom: 16px; +} + +td.columns .column, +td.columns .columns, +td.column .column, +td.column .columns, +th.columns .column, +th.columns .columns, +th.column .column, +th.column .columns { + padding-left: 0 !important; + padding-right: 0 !important; +} + +td.columns .column center, +td.columns .columns center, +td.column .column center, +td.column .columns center, +th.columns .column center, +th.columns .columns center, +th.column .column center, +th.column .columns center { + min-width: none !important; +} + +td.columns.last, +td.column.last, +th.columns.last, +th.column.last { + padding-right: 16px; +} + +td.columns table:not(.button), +td.column table:not(.button), +th.columns table:not(.button), +th.column table:not(.button) { + width: 100%; +} + +td.large-1, +th.large-1 { + width: 32.33333px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-1.first, +th.large-1.first { + padding-left: 16px; +} + +td.large-1.last, +th.large-1.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-1, +.collapse>tbody>tr>th.large-1 { + padding-right: 0; + padding-left: 0; + width: 48.33333px; +} + +.collapse td.large-1.first, +.collapse th.large-1.first, +.collapse td.large-1.last, +.collapse th.large-1.last { + width: 56.33333px; +} + +td.large-1 center, +th.large-1 center { + min-width: 0.33333px; +} + +.body .columns td.large-1, +.body .column td.large-1, +.body .columns th.large-1, +.body .column th.large-1 { + width: 8.33333%; +} + +td.large-2, +th.large-2 { + width: 80.66667px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-2.first, +th.large-2.first { + padding-left: 16px; +} + +td.large-2.last, +th.large-2.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-2, +.collapse>tbody>tr>th.large-2 { + padding-right: 0; + padding-left: 0; + width: 96.66667px; +} + +.collapse td.large-2.first, +.collapse th.large-2.first, +.collapse td.large-2.last, +.collapse th.large-2.last { + width: 104.66667px; +} + +td.large-2 center, +th.large-2 center { + min-width: 48.66667px; +} + +.body .columns td.large-2, +.body .column td.large-2, +.body .columns th.large-2, +.body .column th.large-2 { + width: 16.66667%; +} + +td.large-3, +th.large-3 { + width: 129px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-3.first, +th.large-3.first { + padding-left: 16px; +} + +td.large-3.last, +th.large-3.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-3, +.collapse>tbody>tr>th.large-3 { + padding-right: 0; + padding-left: 0; + width: 145px; +} + +.collapse td.large-3.first, +.collapse th.large-3.first, +.collapse td.large-3.last, +.collapse th.large-3.last { + width: 153px; +} + +td.large-3 center, +th.large-3 center { + min-width: 97px; +} + +.body .columns td.large-3, +.body .column td.large-3, +.body .columns th.large-3, +.body .column th.large-3 { + width: 25%; +} + +td.large-4, +th.large-4 { + width: 177.33333px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-4.first, +th.large-4.first { + padding-left: 16px; +} + +td.large-4.last, +th.large-4.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-4, +.collapse>tbody>tr>th.large-4 { + padding-right: 0; + padding-left: 0; + width: 193.33333px; +} + +.collapse td.large-4.first, +.collapse th.large-4.first, +.collapse td.large-4.last, +.collapse th.large-4.last { + width: 201.33333px; +} + +td.large-4 center, +th.large-4 center { + min-width: 145.33333px; +} + +.body .columns td.large-4, +.body .column td.large-4, +.body .columns th.large-4, +.body .column th.large-4 { + width: 33.33333%; +} + +td.large-5, +th.large-5 { + width: 225.66667px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-5.first, +th.large-5.first { + padding-left: 16px; +} + +td.large-5.last, +th.large-5.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-5, +.collapse>tbody>tr>th.large-5 { + padding-right: 0; + padding-left: 0; + width: 241.66667px; +} + +.collapse td.large-5.first, +.collapse th.large-5.first, +.collapse td.large-5.last, +.collapse th.large-5.last { + width: 249.66667px; +} + +td.large-5 center, +th.large-5 center { + min-width: 193.66667px; +} + +.body .columns td.large-5, +.body .column td.large-5, +.body .columns th.large-5, +.body .column th.large-5 { + width: 41.66667%; +} + +td.large-6, +th.large-6 { + width: 274px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-6.first, +th.large-6.first { + padding-left: 16px; +} + +td.large-6.last, +th.large-6.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-6, +.collapse>tbody>tr>th.large-6 { + padding-right: 0; + padding-left: 0; + width: 290px; +} + +.collapse td.large-6.first, +.collapse th.large-6.first, +.collapse td.large-6.last, +.collapse th.large-6.last { + width: 298px; +} + +td.large-6 center, +th.large-6 center { + min-width: 242px; +} + +.body .columns td.large-6, +.body .column td.large-6, +.body .columns th.large-6, +.body .column th.large-6 { + width: 50%; +} + +td.large-7, +th.large-7 { + width: 322.33333px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-7.first, +th.large-7.first { + padding-left: 16px; +} + +td.large-7.last, +th.large-7.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-7, +.collapse>tbody>tr>th.large-7 { + padding-right: 0; + padding-left: 0; + width: 338.33333px; +} + +.collapse td.large-7.first, +.collapse th.large-7.first, +.collapse td.large-7.last, +.collapse th.large-7.last { + width: 346.33333px; +} + +td.large-7 center, +th.large-7 center { + min-width: 290.33333px; +} + +.body .columns td.large-7, +.body .column td.large-7, +.body .columns th.large-7, +.body .column th.large-7 { + width: 58.33333%; +} + +td.large-8, +th.large-8 { + width: 370.66667px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-8.first, +th.large-8.first { + padding-left: 16px; +} + +td.large-8.last, +th.large-8.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-8, +.collapse>tbody>tr>th.large-8 { + padding-right: 0; + padding-left: 0; + width: 386.66667px; +} + +.collapse td.large-8.first, +.collapse th.large-8.first, +.collapse td.large-8.last, +.collapse th.large-8.last { + width: 394.66667px; +} + +td.large-8 center, +th.large-8 center { + min-width: 338.66667px; +} + +.body .columns td.large-8, +.body .column td.large-8, +.body .columns th.large-8, +.body .column th.large-8 { + width: 66.66667%; +} + +td.large-9, +th.large-9 { + width: 419px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-9.first, +th.large-9.first { + padding-left: 16px; +} + +td.large-9.last, +th.large-9.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-9, +.collapse>tbody>tr>th.large-9 { + padding-right: 0; + padding-left: 0; + width: 435px; +} + +.collapse td.large-9.first, +.collapse th.large-9.first, +.collapse td.large-9.last, +.collapse th.large-9.last { + width: 443px; +} + +td.large-9 center, +th.large-9 center { + min-width: 387px; +} + +.body .columns td.large-9, +.body .column td.large-9, +.body .columns th.large-9, +.body .column th.large-9 { + width: 75%; +} + +td.large-10, +th.large-10 { + width: 467.33333px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-10.first, +th.large-10.first { + padding-left: 16px; +} + +td.large-10.last, +th.large-10.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-10, +.collapse>tbody>tr>th.large-10 { + padding-right: 0; + padding-left: 0; + width: 483.33333px; +} + +.collapse td.large-10.first, +.collapse th.large-10.first, +.collapse td.large-10.last, +.collapse th.large-10.last { + width: 491.33333px; +} + +td.large-10 center, +th.large-10 center { + min-width: 435.33333px; +} + +.body .columns td.large-10, +.body .column td.large-10, +.body .columns th.large-10, +.body .column th.large-10 { + width: 83.33333%; +} + +td.large-11, +th.large-11 { + width: 515.66667px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-11.first, +th.large-11.first { + padding-left: 16px; +} + +td.large-11.last, +th.large-11.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-11, +.collapse>tbody>tr>th.large-11 { + padding-right: 0; + padding-left: 0; + width: 531.66667px; +} + +.collapse td.large-11.first, +.collapse th.large-11.first, +.collapse td.large-11.last, +.collapse th.large-11.last { + width: 539.66667px; +} + +td.large-11 center, +th.large-11 center { + min-width: 483.66667px; +} + +.body .columns td.large-11, +.body .column td.large-11, +.body .columns th.large-11, +.body .column th.large-11 { + width: 91.66667%; +} + +td.large-12, +th.large-12 { + width: 564px; + padding-left: 8px; + padding-right: 8px; +} + +td.large-12.first, +th.large-12.first { + padding-left: 16px; +} + +td.large-12.last, +th.large-12.last { + padding-right: 16px; +} + +.collapse>tbody>tr>td.large-12, +.collapse>tbody>tr>th.large-12 { + padding-right: 0; + padding-left: 0; + width: 580px; +} + +.collapse td.large-12.first, +.collapse th.large-12.first, +.collapse td.large-12.last, +.collapse th.large-12.last { + width: 588px; +} + +td.large-12 center, +th.large-12 center { + min-width: 532px; +} + +.body .columns td.large-12, +.body .column td.large-12, +.body .columns th.large-12, +.body .column th.large-12 { + width: 100%; +} + +td.large-offset-1, +td.large-offset-1.first, +td.large-offset-1.last, +th.large-offset-1, +th.large-offset-1.first, +th.large-offset-1.last { + padding-left: 64.33333px; +} + +td.large-offset-2, +td.large-offset-2.first, +td.large-offset-2.last, +th.large-offset-2, +th.large-offset-2.first, +th.large-offset-2.last { + padding-left: 112.66667px; +} + +td.large-offset-3, +td.large-offset-3.first, +td.large-offset-3.last, +th.large-offset-3, +th.large-offset-3.first, +th.large-offset-3.last { + padding-left: 161px; +} + +td.large-offset-4, +td.large-offset-4.first, +td.large-offset-4.last, +th.large-offset-4, +th.large-offset-4.first, +th.large-offset-4.last { + padding-left: 209.33333px; +} + +td.large-offset-5, +td.large-offset-5.first, +td.large-offset-5.last, +th.large-offset-5, +th.large-offset-5.first, +th.large-offset-5.last { + padding-left: 257.66667px; +} + +td.large-offset-6, +td.large-offset-6.first, +td.large-offset-6.last, +th.large-offset-6, +th.large-offset-6.first, +th.large-offset-6.last { + padding-left: 306px; +} + +td.large-offset-7, +td.large-offset-7.first, +td.large-offset-7.last, +th.large-offset-7, +th.large-offset-7.first, +th.large-offset-7.last { + padding-left: 354.33333px; +} + +td.large-offset-8, +td.large-offset-8.first, +td.large-offset-8.last, +th.large-offset-8, +th.large-offset-8.first, +th.large-offset-8.last { + padding-left: 402.66667px; +} + +td.large-offset-9, +td.large-offset-9.first, +td.large-offset-9.last, +th.large-offset-9, +th.large-offset-9.first, +th.large-offset-9.last { + padding-left: 451px; +} + +td.large-offset-10, +td.large-offset-10.first, +td.large-offset-10.last, +th.large-offset-10, +th.large-offset-10.first, +th.large-offset-10.last { + padding-left: 499.33333px; +} + +td.large-offset-11, +td.large-offset-11.first, +td.large-offset-11.last, +th.large-offset-11, +th.large-offset-11.first, +th.large-offset-11.last { + padding-left: 547.66667px; +} + +td.expander, +th.expander { + visibility: hidden; + width: 0; + padding: 0 !important; +} + +table.container.radius { + border-radius: 0; + border-collapse: separate; +} + +.block-grid { + width: 100%; + max-width: 580px; +} + +.block-grid td { + display: inline-block; + padding: 8px; +} + +.up-2 td { + width: 274px !important; +} + +.up-3 td { + width: 177px !important; +} + +.up-4 td { + width: 129px !important; +} + +.up-5 td { + width: 100px !important; +} + +.up-6 td { + width: 80px !important; +} + +.up-7 td { + width: 66px !important; +} + +.up-8 td { + width: 56px !important; +} + +table.text-center, +th.text-center, +td.text-center, +h1.text-center, +h2.text-center, +h3.text-center, +h4.text-center, +h5.text-center, +h6.text-center, +p.text-center, +span.text-center { + text-align: center; +} + +table.text-left, +th.text-left, +td.text-left, +h1.text-left, +h2.text-left, +h3.text-left, +h4.text-left, +h5.text-left, +h6.text-left, +p.text-left, +span.text-left { + text-align: left; +} + +table.text-right, +th.text-right, +td.text-right, +h1.text-right, +h2.text-right, +h3.text-right, +h4.text-right, +h5.text-right, +h6.text-right, +p.text-right, +span.text-right { + text-align: right; +} + +span.text-center { + display: block; + width: 100%; + text-align: center; +} + +@media only screen and (max-width: 596px) { + .small-float-center { + margin: 0 auto !important; + float: none !important; + text-align: center !important; + } + .small-text-center { + text-align: center !important; + } + .small-text-left { + text-align: left !important; + } + .small-text-right { + text-align: right !important; + } +} + +img.float-left { + float: left; + text-align: left; +} + +img.float-right { + float: right; + text-align: right; +} + +img.float-center, +img.text-center { + margin: 0 auto; + Margin: 0 auto; + float: none; + text-align: center; +} + +table.float-center, +td.float-center, +th.float-center { + margin: 0 auto; + Margin: 0 auto; + float: none; + text-align: center; +} + +.hide-for-large { + display: none !important; + mso-hide: all; + overflow: hidden; + max-height: 0; + font-size: 0; + width: 0; + line-height: 0; +} + +@media only screen and (max-width: 596px) { + .hide-for-large { + display: block !important; + width: auto !important; + overflow: visible !important; + max-height: none !important; + font-size: inherit !important; + line-height: inherit !important; + } +} + +table.body table.container .hide-for-large * { + mso-hide: all; +} + +@media only screen and (max-width: 596px) { + table.body table.container .hide-for-large, + table.body table.container .row.hide-for-large { + display: table !important; + width: 100% !important; + } +} + +@media only screen and (max-width: 596px) { + table.body table.container .callout-inner.hide-for-large { + display: table-cell !important; + width: 100% !important; + } +} + +@media only screen and (max-width: 596px) { + table.body table.container .show-for-large { + display: none !important; + width: 0; + mso-hide: all; + overflow: hidden; + } +} + +body, +table.body, +h1, +h2, +h3, +h4, +h5, +h6, +p, +td, +th, +a { + color: #0a0a0a; + font-family: Helvetica, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + Margin: 0; + text-align: left; + line-height: 1.3; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + color: inherit; + word-wrap: normal; + font-family: Helvetica, Arial, sans-serif; + font-weight: normal; + margin-bottom: 10px; + Margin-bottom: 10px; +} + +h1 { + font-size: 34px; +} + +h2 { + font-size: 30px; +} + +h3 { + font-size: 28px; +} + +h4 { + font-size: 24px; +} + +h5 { + font-size: 20px; +} + +h6 { + font-size: 18px; +} + +body, +table.body, +p, +td, +th { + font-size: 16px; + line-height: 1.3; +} + +p { + margin-bottom: 10px; + Margin-bottom: 10px; +} + +p.lead { + font-size: 20px; + line-height: 1.6; +} + +p.subheader { + margin-top: 4px; + margin-bottom: 8px; + Margin-top: 4px; + Margin-bottom: 8px; + font-weight: normal; + line-height: 1.4; + color: #8a8a8a; +} + +small { + font-size: 80%; + color: #cacaca; +} + +a { + color: #2199e8; + text-decoration: none; +} + +a:hover { + color: #147dc2; +} + +a:active { + color: #147dc2; +} + +a:visited { + color: #2199e8; +} + +h1 a, +h1 a:visited, +h2 a, +h2 a:visited, +h3 a, +h3 a:visited, +h4 a, +h4 a:visited, +h5 a, +h5 a:visited, +h6 a, +h6 a:visited { + color: #2199e8; +} + +pre { + background: #f3f3f3; + margin: 30px 0; + Margin: 30px 0; +} + +pre code { + color: #cacaca; +} + +pre code span.callout { + color: #8a8a8a; + font-weight: bold; +} + +pre code span.callout-strong { + color: #ff6908; + font-weight: bold; +} + +table.hr { + width: 100%; +} + +table.hr th { + height: 0; + max-width: 580px; + border-top: 0; + border-right: 0; + border-bottom: 1px solid #0a0a0a; + border-left: 0; + margin: 20px auto; + Margin: 20px auto; + clear: both; +} + +.stat { + font-size: 40px; + line-height: 1; +} + +p+.stat { + margin-top: -16px; + Margin-top: -16px; +} + +span.preheader { + display: none !important; + visibility: hidden; + mso-hide: all !important; + font-size: 1px; + color: #f3f3f3; + line-height: 1px; + max-height: 0px; + max-width: 0px; + opacity: 0; + overflow: hidden; +} + +table.button { + width: auto; + margin: 0 0 16px 0; + Margin: 0 0 16px 0; +} + +table.button table td { + text-align: left; + color: #fefefe; + background: #2199e8; + border: 2px solid #2199e8; +} + +table.button table td a { + font-family: Helvetica, Arial, sans-serif; + font-size: 16px; + font-weight: bold; + color: #fefefe; + text-decoration: none; + display: inline-block; + padding: 8px 16px 8px 16px; + border: 0 solid #2199e8; + border-radius: 3px; +} + +table.button.radius table td { + border-radius: 3px; + border: none; +} + +table.button.rounded table td { + border-radius: 500px; + border: none; +} + +table.button:hover table tr td a, +table.button:active table tr td a, +table.button table tr td a:visited, +table.button.tiny:hover table tr td a, +table.button.tiny:active table tr td a, +table.button.tiny table tr td a:visited, +table.button.small:hover table tr td a, +table.button.small:active table tr td a, +table.button.small table tr td a:visited, +table.button.large:hover table tr td a, +table.button.large:active table tr td a, +table.button.large table tr td a:visited { + color: #fefefe; +} + +table.button.tiny table td, +table.button.tiny table a { + padding: 4px 8px 4px 8px; +} + +table.button.tiny table a { + font-size: 10px; + font-weight: normal; +} + +table.button.small table td, +table.button.small table a { + padding: 5px 10px 5px 10px; + font-size: 12px; +} + +table.button.large table a { + padding: 10px 20px 10px 20px; + font-size: 20px; +} + +table.button.expand, +table.button.expanded { + width: 100% !important; +} + +table.button.expand table, +table.button.expanded table { + width: 100%; +} + +table.button.expand table a, +table.button.expanded table a { + text-align: center; + width: 100%; + padding-left: 0; + padding-right: 0; +} + +table.button.expand center, +table.button.expanded center { + min-width: 0; +} + +table.button:hover table td, +table.button:visited table td, +table.button:active table td { + background: #147dc2; + color: #fefefe; +} + +table.button:hover table a, +table.button:visited table a, +table.button:active table a { + border: 0 solid #147dc2; +} + +table.button.secondary table td { + background: #777777; + color: #fefefe; + border: 0px solid #777777; +} + +table.button.secondary table a { + color: #fefefe; + border: 0 solid #777777; +} + +table.button.secondary:hover table td { + background: #919191; + color: #fefefe; +} + +table.button.secondary:hover table a { + border: 0 solid #919191; +} + +table.button.secondary:hover table td a { + color: #fefefe; +} + +table.button.secondary:active table td a { + color: #fefefe; +} + +table.button.secondary table td a:visited { + color: #fefefe; +} + +table.button.success table td { + background: #3adb76; + border: 0px solid #3adb76; +} + +table.button.success table a { + border: 0 solid #3adb76; +} + +table.button.success:hover table td { + background: #23bf5d; +} + +table.button.success:hover table a { + border: 0 solid #23bf5d; +} + +table.button.alert table td { + background: #ec5840; + border: 0px solid #ec5840; +} + +table.button.alert table a { + border: 0 solid #ec5840; +} + +table.button.alert:hover table td { + background: #e23317; +} + +table.button.alert:hover table a { + border: 0 solid #e23317; +} + +table.button.warning table td { + background: #ffae00; + border: 0px solid #ffae00; +} + +table.button.warning table a { + border: 0px solid #ffae00; +} + +table.button.warning:hover table td { + background: #cc8b00; +} + +table.button.warning:hover table a { + border: 0px solid #cc8b00; +} + +table.callout { + margin-bottom: 16px; + Margin-bottom: 16px; +} + +th.callout-inner { + width: 100%; + border: 1px solid #cbcbcb; + padding: 10px; + background: #fefefe; +} + +th.callout-inner.primary { + background: #def0fc; + border: 1px solid #444444; + color: #0a0a0a; +} + +th.callout-inner.secondary { + background: #ebebeb; + border: 1px solid #444444; + color: #0a0a0a; +} + +th.callout-inner.success { + background: #e1faea; + border: 1px solid #1b9448; + color: #fefefe; +} + +th.callout-inner.warning { + background: #fff3d9; + border: 1px solid #996800; + color: #fefefe; +} + +th.callout-inner.alert { + background: #fce6e2; + border: 1px solid #b42912; + color: #fefefe; +} + +.thumbnail { + border: solid 4px #fefefe; + box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); + display: inline-block; + line-height: 0; + max-width: 100%; + transition: box-shadow 200ms ease-out; + border-radius: 3px; + margin-bottom: 16px; +} + +.thumbnail:hover, +.thumbnail:focus { + box-shadow: 0 0 6px 1px rgba(33, 153, 232, 0.5); +} + +table.menu { + width: 580px; +} + +table.menu td.menu-item, +table.menu th.menu-item { + padding: 10px; + padding-right: 10px; +} + +table.menu td.menu-item a, +table.menu th.menu-item a { + color: #2199e8; +} + +table.menu.vertical td.menu-item, +table.menu.vertical th.menu-item { + padding: 10px; + padding-right: 0; + display: block; +} + +table.menu.vertical td.menu-item a, +table.menu.vertical th.menu-item a { + width: 100%; +} + +table.menu.vertical td.menu-item table.menu.vertical td.menu-item, +table.menu.vertical td.menu-item table.menu.vertical th.menu-item, +table.menu.vertical th.menu-item table.menu.vertical td.menu-item, +table.menu.vertical th.menu-item table.menu.vertical th.menu-item { + padding-left: 10px; +} + +table.menu.text-center a { + text-align: center; +} + +.menu[align="center"] { + width: auto !important; +} + +body.outlook p { + display: inline !important; +} + +@media only screen and (max-width: 596px) { + table.body img { + width: auto; + height: auto; + } + table.body center { + min-width: 0 !important; + } + table.body .container { + width: 95% !important; + } + table.body .columns, + table.body .column { + height: auto !important; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + padding-left: 16px !important; + padding-right: 16px !important; + } + table.body .columns .column, + table.body .columns .columns, + table.body .column .column, + table.body .column .columns { + padding-left: 0 !important; + padding-right: 0 !important; + } + table.body .collapse .columns, + table.body .collapse .column { + padding-left: 0 !important; + padding-right: 0 !important; + } + td.small-1, + th.small-1 { + display: inline-block !important; + width: 8.33333% !important; + } + td.small-2, + th.small-2 { + display: inline-block !important; + width: 16.66667% !important; + } + td.small-3, + th.small-3 { + display: inline-block !important; + width: 25% !important; + } + td.small-4, + th.small-4 { + display: inline-block !important; + width: 33.33333% !important; + } + td.small-5, + th.small-5 { + display: inline-block !important; + width: 41.66667% !important; + } + td.small-6, + th.small-6 { + display: inline-block !important; + width: 50% !important; + } + td.small-7, + th.small-7 { + display: inline-block !important; + width: 58.33333% !important; + } + td.small-8, + th.small-8 { + display: inline-block !important; + width: 66.66667% !important; + } + td.small-9, + th.small-9 { + display: inline-block !important; + width: 75% !important; + } + td.small-10, + th.small-10 { + display: inline-block !important; + width: 83.33333% !important; + } + td.small-11, + th.small-11 { + display: inline-block !important; + width: 91.66667% !important; + } + td.small-12, + th.small-12 { + display: inline-block !important; + width: 100% !important; + } + .columns td.small-12, + .column td.small-12, + .columns th.small-12, + .column th.small-12 { + display: block !important; + width: 100% !important; + } + table.body td.small-offset-1, + table.body th.small-offset-1 { + margin-left: 8.33333% !important; + Margin-left: 8.33333% !important; + } + table.body td.small-offset-2, + table.body th.small-offset-2 { + margin-left: 16.66667% !important; + Margin-left: 16.66667% !important; + } + table.body td.small-offset-3, + table.body th.small-offset-3 { + margin-left: 25% !important; + Margin-left: 25% !important; + } + table.body td.small-offset-4, + table.body th.small-offset-4 { + margin-left: 33.33333% !important; + Margin-left: 33.33333% !important; + } + table.body td.small-offset-5, + table.body th.small-offset-5 { + margin-left: 41.66667% !important; + Margin-left: 41.66667% !important; + } + table.body td.small-offset-6, + table.body th.small-offset-6 { + margin-left: 50% !important; + Margin-left: 50% !important; + } + table.body td.small-offset-7, + table.body th.small-offset-7 { + margin-left: 58.33333% !important; + Margin-left: 58.33333% !important; + } + table.body td.small-offset-8, + table.body th.small-offset-8 { + margin-left: 66.66667% !important; + Margin-left: 66.66667% !important; + } + table.body td.small-offset-9, + table.body th.small-offset-9 { + margin-left: 75% !important; + Margin-left: 75% !important; + } + table.body td.small-offset-10, + table.body th.small-offset-10 { + margin-left: 83.33333% !important; + Margin-left: 83.33333% !important; + } + table.body td.small-offset-11, + table.body th.small-offset-11 { + margin-left: 91.66667% !important; + Margin-left: 91.66667% !important; + } + table.body table.columns td.expander, + table.body table.columns th.expander { + display: none !important; + } + table.body .right-text-pad, + table.body .text-pad-right { + padding-left: 10px !important; + } + table.body .left-text-pad, + table.body .text-pad-left { + padding-right: 10px !important; + } + table.menu { + width: 100% !important; + } + table.menu td, + table.menu th { + width: auto !important; + display: inline-block !important; + } + table.menu.vertical td, + table.menu.vertical th, + table.menu.small-vertical td, + table.menu.small-vertical th { + display: block !important; + } + table.menu[align="center"] { + width: auto !important; + } + table.button.small-expand, + table.button.small-expanded { + width: 100% !important; + } + table.button.small-expand table, + table.button.small-expanded table { + width: 100%; + } + table.button.small-expand table a, + table.button.small-expanded table a { + text-align: center !important; + width: 100% !important; + padding-left: 0 !important; + padding-right: 0 !important; + } + table.button.small-expand center, + table.button.small-expanded center { + min-width: 0; + } +} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig new file mode 100644 index 0000000..0a52d36 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.html.twig @@ -0,0 +1,67 @@ +{% apply inky_to_html|inline_css %} + + + + + + + + + + + + {% block lead %} + {% if importance is not null %}{{ importance|upper }}{% endif %} +

+ {{ email.subject }} +

+ {% endblock %} + + {% block content %} + {% if markdown %} + {{ include('@email/zurb_2/notification/content_markdown.html.twig') }} + {% else %} + {{ (raw ? content|raw : content)|nl2br }} + {% endif %} + {% endblock %} + + {% block action %} + {% if action_url %} + + + {% endif %} + {% endblock %} + + {% block exception %} + {% if exception %} + +

Exception stack trace attached.

+ {% endif %} + {% endblock %} +
+
+ + + + {% block footer %} + {% if footer_text is defined and footer_text is not null %} + + + {% block footer_content %} +

{{ footer_text }}

+ {% endblock %} +
+
+ {% endif %} + {% endblock %} +
+
+
+ + +{% endapply %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.txt.twig b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.txt.twig new file mode 100644 index 0000000..c98bb08 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/body.txt.twig @@ -0,0 +1,20 @@ +{% block lead %} +{{ email.subject }} +{% endblock %} + +{% block content %} +{{ content }} +{% endblock %} + +{% block action %} +{% if action_url %} +{{ action_text }}: {{ action_url }} +{% endif %} +{% endblock %} + +{% block exception %} +{% if exception %} +Exception stack trace attached. +{{ exception }} +{% endif %} +{% endblock %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/content_markdown.html.twig b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/content_markdown.html.twig new file mode 100644 index 0000000..120b2ca --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/content_markdown.html.twig @@ -0,0 +1 @@ +{{ content|markdown_to_html }} diff --git a/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/local.css b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/local.css new file mode 100644 index 0000000..2e68dcd --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Email/zurb_2/notification/local.css @@ -0,0 +1,19 @@ +body { + background: #f3f3f3; +} + +.wrapper.secondary { + background: #f3f3f3; +} + +.container.body_alert { + border-top: 8px solid #ec5840; +} + +.container.body_warning { + border-top: 8px solid #ffae00; +} + +.container.body_default { + border-top: 8px solid #aaaaaa; +} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig new file mode 100644 index 0000000..49cd804 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig @@ -0,0 +1,71 @@ +{% use "bootstrap_3_layout.html.twig" %} + +{% block form_start -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-horizontal')|trim}) %} + {{- parent() -}} +{%- endblock form_start %} + +{# Labels #} + +{% block form_label -%} + {%- if label is same as(false) -%} +
+ {%- else -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} + {{- parent() -}} + {%- endif -%} +{%- endblock form_label %} + +{% block form_label_class -%} +col-sm-2 +{%- endblock form_label_class %} + +{# Rows #} + +{% block form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + {{- form_label(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
+{##}
+{%- endblock form_row %} + +{% block submit_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock submit_row %} + +{% block reset_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock reset_row %} + +{% block form_group_class -%} +col-sm-10 +{%- endblock form_group_class %} + +{% block checkbox_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
{#--#} + +{%- endblock checkbox_row %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig new file mode 100644 index 0000000..865f907 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_3_layout.html.twig @@ -0,0 +1,216 @@ +{% use "bootstrap_base_layout.html.twig" %} + +{# Widgets #} + +{% block form_widget_simple -%} + {% if type is not defined or type not in ['file', 'hidden'] %} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} + {% endif %} + {{- parent() -}} +{%- endblock form_widget_simple %} + +{% block button_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) -%} + {{- parent() -}} +{%- endblock button_widget %} + +{% block money_widget -%} + {% set prepend = not (money_pattern starts with '{{') %} + {% set append = not (money_pattern ends with '}}') %} + {% if prepend or append %} +
+ {% if prepend %} + {{ money_pattern|form_encode_currency }} + {% endif %} + {{- block('form_widget_simple') -}} + {% if append %} + {{ money_pattern|form_encode_currency }} + {% endif %} +
+ {% else %} + {{- block('form_widget_simple') -}} + {% endif %} +{%- endblock money_widget %} + +{% block checkbox_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {% if 'checkbox-inline' in parent_label_class %} + {{- form_label(form, null, { widget: parent() }) -}} + {% else -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- endif -%} +{%- endblock checkbox_widget %} + +{% block radio_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- if 'radio-inline' in parent_label_class -%} + {{- form_label(form, null, { widget: parent() }) -}} + {%- else -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- endif -%} +{%- endblock radio_widget %} + +{% block choice_widget_collapsed -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} + {{- parent() -}} +{%- endblock choice_widget_collapsed %} + +{# Labels #} + +{% block form_label -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' control-label')|trim}) -%} + {{- parent() -}} +{%- endblock form_label %} + +{% block choice_label -%} + {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} + {%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%} + {{- block('form_label') -}} +{% endblock %} + +{% block checkbox_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + + {{- block('checkbox_radio_label') -}} +{%- endblock checkbox_label %} + +{% block radio_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + + {{- block('checkbox_radio_label') -}} +{%- endblock radio_label %} + +{% block checkbox_radio_label -%} + {# Do not display the label if widget is not defined in order to prevent double label rendering #} + {%- if widget is defined -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} + {%- if label_format is not empty -%} + {%- set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) -%} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} + {%- endif -%} + + {#- if statement must be kept on the same line, to force the space between widget and label -#} + {{- widget|raw }} {% if label is not same as(false) -%} + {%- if translation_domain is same as(false) -%} + {%- if label_html is same as(false) -%} + {{ label -}} + {%- else -%} + {{ label|raw -}} + {%- endif -%} + {%- else -%} + {%- if label_html is same as(false) -%} + {{ label|trans(label_translation_parameters, translation_domain) -}} + {%- else -%} + {{ label|trans(label_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + {%- endif -%} + + {%- endif -%} +{%- endblock checkbox_radio_label %} + +{# Rows #} + +{% block form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + {{- form_label(form) }} {# -#} + {{ form_widget(form, widget_attr) }} {# -#} + {{- form_help(form) -}} + {{ form_errors(form) }} {# -#} + {# -#} +{%- endblock form_row %} + +{% block button_row -%} + + {{- form_widget(form) -}} + +{%- endblock button_row %} + +{% block choice_row -%} + {% set force_error = true %} + {{- block('form_row') }} +{%- endblock choice_row %} + +{% block date_row -%} + {% set force_error = true %} + {{- block('form_row') }} +{%- endblock date_row %} + +{% block time_row -%} + {% set force_error = true %} + {{- block('form_row') }} +{%- endblock time_row %} + +{% block datetime_row -%} + {% set force_error = true %} + {{- block('form_row') }} +{%- endblock datetime_row %} + +{% block checkbox_row -%} + + {{- form_widget(form) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} + +{%- endblock checkbox_row %} + +{% block radio_row -%} + + {{- form_widget(form) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} + +{%- endblock radio_row %} + +{# Errors #} + +{% block form_errors -%} + {% if errors|length > 0 -%} + {% if form is not rootform %}{% else %}
{% endif %} +
    + {%- for error in errors -%} +
  • {{ error.message }}
  • + {%- endfor -%} +
+ {% if form is not rootform %}{% else %}
{% endif %} + {%- endif %} +{%- endblock form_errors %} + +{# Help #} + +{% block form_help -%} + {%- if help is not empty -%} + {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-block')|trim}) -%} + + {%- if translation_domain is same as(false) -%} + {%- if help_html is same as(false) -%} + {{- help -}} + {%- else -%} + {{- help|raw -}} + {%- endif -%} + {%- else -%} + {%- if help_html is same as(false) -%} + {{- help|trans(help_translation_parameters, translation_domain) -}} + {%- else -%} + {{- help|trans(help_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + + {%- endif -%} +{%- endblock form_help %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig new file mode 100644 index 0000000..a75e364 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig @@ -0,0 +1,87 @@ +{% use "bootstrap_4_layout.html.twig" %} + +{# Labels #} + +{% block form_label -%} + {%- if label is same as(false) -%} +
+ {%- else -%} + {%- if expanded is not defined or not expanded -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} + {%- endif -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} + {{- parent() -}} + {%- endif -%} +{%- endblock form_label %} + +{% block form_label_class -%} +col-sm-2 +{%- endblock form_label_class %} + +{# Rows #} + +{% block form_row -%} + {%- if expanded is defined and expanded -%} + {{ block('fieldset_form_row') }} + {%- else -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + {{- form_label(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} +
+ {##} + {%- endif -%} +{%- endblock form_row %} + +{% block fieldset_form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + +
+ {{- form_label(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} +
+
+{##} +{%- endblock fieldset_form_row %} + +{% block submit_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock submit_row %} + +{% block reset_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock reset_row %} + +{% block form_group_class -%} +col-sm-10 +{%- endblock form_group_class %} + +{% block checkbox_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} + {{- form_help(form) -}} +
{#--#} + +{%- endblock checkbox_row %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig new file mode 100644 index 0000000..0e80840 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig @@ -0,0 +1,371 @@ +{% use "bootstrap_base_layout.html.twig" %} + +{# Widgets #} + +{% block money_widget -%} + {%- set prepend = not (money_pattern starts with '{{') -%} + {%- set append = not (money_pattern ends with '}}') -%} + {%- if prepend or append -%} +
+ {%- if prepend -%} +
+ {{ money_pattern|form_encode_currency }} +
+ {%- endif -%} + {{- block('form_widget_simple') -}} + {%- if append -%} +
+ {{ money_pattern|form_encode_currency }} +
+ {%- endif -%} +
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock money_widget %} + +{% block datetime_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock datetime_widget %} + +{% block date_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock date_widget %} + +{% block time_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {{- parent() -}} +{%- endblock time_widget %} + +{% block dateinterval_widget -%} + {%- if widget != 'single_text' and not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%} + {% set valid = true %} + {%- endif -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} +
+ {%- if with_years -%} +
+ {{ form_label(form.years) }} + {{ form_widget(form.years) }} +
+ {%- endif -%} + {%- if with_months -%} +
+ {{ form_label(form.months) }} + {{ form_widget(form.months) }} +
+ {%- endif -%} + {%- if with_weeks -%} +
+ {{ form_label(form.weeks) }} + {{ form_widget(form.weeks) }} +
+ {%- endif -%} + {%- if with_days -%} +
+ {{ form_label(form.days) }} + {{ form_widget(form.days) }} +
+ {%- endif -%} + {%- if with_hours -%} +
+ {{ form_label(form.hours) }} + {{ form_widget(form.hours) }} +
+ {%- endif -%} + {%- if with_minutes -%} +
+ {{ form_label(form.minutes) }} + {{ form_widget(form.minutes) }} +
+ {%- endif -%} + {%- if with_seconds -%} +
+ {{ form_label(form.seconds) }} + {{ form_widget(form.seconds) }} +
+ {%- endif -%} + {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} +
+ {%- endif -%} +{%- endblock dateinterval_widget %} + +{% block percent_widget -%} + {%- if symbol -%} +
+ {{- block('form_widget_simple') -}} +
+ {{ symbol|default('%') }} +
+
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock percent_widget %} + +{% block file_widget -%} + <{{ element|default('div') }} class="custom-file"> + {%- set type = type|default('file') -%} + {%- set input_lang = 'en' -%} + {% if app is defined and app.request is defined %}{%- set input_lang = app.request.locale -%}{%- endif -%} + {%- set attr = {lang: input_lang} | merge(attr) -%} + {{- block('form_widget_simple') -}} + {%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim })|filter((value, key) => key != 'id') -%} + + +{% endblock %} + +{% block form_widget_simple -%} + {%- if type is not defined or type != 'hidden' -%} + {%- set className = ' form-control' -%} + {%- if type|default('') == 'file' -%} + {%- set className = ' custom-file-input' -%} + {%- elseif type|default('') == 'range' -%} + {%- set className = ' form-control-range' -%} + {%- endif -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ className)|trim}) -%} + {%- endif -%} + {%- if type is defined and (type == 'range' or type == 'color') %} + {# Attribute "required" is not supported #} + {%- set required = false -%} + {% endif %} + {{- parent() -}} +{%- endblock form_widget_simple %} + +{% block widget_attributes -%} + {%- if not valid -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) %} + {%- endif -%} + {{ parent() }} +{%- endblock widget_attributes %} + +{% block button_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-secondary') ~ ' btn')|trim}) -%} + {{- parent() -}} +{%- endblock button_widget %} + +{% block submit_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-primary'))|trim}) -%} + {{- parent() -}} +{%- endblock submit_widget %} + +{% block checkbox_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- if 'checkbox-custom' in parent_label_class -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- elseif 'switch-custom' in parent_label_class -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- endif -%} +{%- endblock checkbox_widget %} + +{% block radio_widget -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- if 'radio-custom' in parent_label_class -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+ {%- endif -%} +{%- endblock radio_widget %} + +{% block choice_widget_collapsed -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} + {{- parent() -}} +{%- endblock choice_widget_collapsed %} + +{% block choice_widget_expanded -%} +
+ {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + valid: valid, + }) -}} + {% endfor -%} +
+{%- endblock choice_widget_expanded %} + +{# Labels #} + +{% block form_label -%} + {% if label is not same as(false) -%} + {%- if compound is defined and compound -%} + {%- set element = 'legend' -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} + {%- else -%} + {%- set label_attr = label_attr|merge({for: id}) -%} + {%- endif -%} + {% if required -%} + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} + {%- endif -%} + {% if label is empty -%} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} + {%- endif -%} + <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}> + {%- if translation_domain is same as(false) -%} + {%- if label_html is same as(false) -%} + {{- label -}} + {%- else -%} + {{- label|raw -}} + {%- endif -%} + {%- else -%} + {%- if label_html is same as(false) -%} + {{- label|trans(label_translation_parameters, translation_domain) -}} + {%- else -%} + {{- label|trans(label_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + {% block form_label_errors %}{{- form_errors(form) -}}{% endblock form_label_errors %} + {%- else -%} + {%- if errors|length > 0 -%} +
+ {{- form_errors(form) -}} +
+ {%- endif -%} + {%- endif -%} +{%- endblock form_label %} + +{% block checkbox_radio_label -%} + {#- Do not display the label if widget is not defined in order to prevent double label rendering -#} + {%- if widget is defined -%} + {% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class or 'switch-custom' in parent_label_class) %} + {% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class or 'switch-custom' in label_attr.class) %} + {%- if is_parent_custom or is_custom -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%} + {%- else %} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} + {%- endif %} + {%- if not compound -%} + {% set label_attr = label_attr|merge({'for': id}) %} + {%- endif -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} + {%- if label_format is not empty -%} + {%- set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) -%} + {%- else -%} + {%- set label = name|humanize -%} + {%- endif -%} + {%- endif -%} + + {{ widget|raw }} + + {%- if label is not same as(false) -%} + {%- if translation_domain is same as(false) -%} + {%- if label_html is same as(false) -%} + {{- label -}} + {%- else -%} + {{- label|raw -}} + {%- endif -%} + {%- else -%} + {%- if label_html is same as(false) -%} + {{- label|trans(label_translation_parameters, translation_domain) -}} + {%- else -%} + {{- label|trans(label_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {{- form_errors(form) -}} + + {%- endif -%} +{%- endblock checkbox_radio_label %} + +{# Rows #} + +{% block form_row -%} + {%- if compound is defined and compound -%} + {%- set element = 'fieldset' -%} + {%- endif -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + <{{ element|default('div') }}{% with {attr: row_attr|merge({class: (row_attr.class|default('') ~ ' form-group')|trim})} %}{{ block('attributes') }}{% endwith %}> + {{- form_label(form) -}} + {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + +{%- endblock form_row %} + +{# Errors #} + +{% block form_errors -%} + {%- if errors|length > 0 -%} + + {%- for error in errors -%} + + {{ 'Error'|trans({}, 'validators') }} {{ error.message }} + + {%- endfor -%} + + {%- endif %} +{%- endblock form_errors %} + +{# Help #} + +{% block form_help -%} + {%- if help is not empty -%} + {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' form-text text-muted')|trim}) -%} + + {%- if translation_domain is same as(false) -%} + {%- if help_html is same as(false) -%} + {{- help -}} + {%- else -%} + {{- help|raw -}} + {%- endif -%} + {%- else -%} + {%- if help_html is same as(false) -%} + {{- help|trans(help_translation_parameters, translation_domain) -}} + {%- else -%} + {{- help|trans(help_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + + {%- endif -%} +{%- endblock form_help %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig new file mode 100644 index 0000000..3c24166 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_horizontal_layout.html.twig @@ -0,0 +1,130 @@ +{% use "bootstrap_5_layout.html.twig" %} + +{# Labels #} + +{% block form_label -%} + {%- if label is same as(false) -%} +
+ {%- else -%} + {%- set row_class = row_class|default(row_attr.class|default('')) -%} + {%- if 'form-floating' not in row_class and 'input-group' not in row_class -%} + {%- if expanded is not defined or not expanded -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} + {%- endif -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) -%} + {%- endif -%} + {{- parent() -}} + {%- endif -%} +{%- endblock form_label %} + +{% block form_label_class -%} + col-sm-2 +{%- endblock form_label_class %} + +{# Rows #} + +{% block form_row -%} + {%- if expanded is defined and expanded -%} + {{ block('fieldset_form_row') }} + {%- else -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + {%- set row_class = row_class|default(row_attr.class|default('mb-3')) -%} + {%- set is_form_floating = is_form_floating|default('form-floating' in row_class) -%} + {%- set is_input_group = is_input_group|default('input-group' in row_class) -%} + {#- Remove behavior class from the main container -#} + {%- set row_class = row_class|replace({'form-floating': '', 'input-group': ''}) -%} + + {%- if is_form_floating or is_input_group -%} +
+
+ {%- if is_form_floating -%} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_label(form) -}} +
+ {%- elseif is_input_group -%} +
+ {{- form_label(form) -}} + {{- form_widget(form, widget_attr) -}} + {#- Hack to properly display help with input group -#} + {{- form_help(form) -}} +
+ {%- endif -%} + {%- if not is_input_group -%} + {{- form_help(form) -}} + {%- endif -%} + {{- form_errors(form) -}} +
+ {%- else -%} + {{- form_label(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
+ {%- endif -%} + {##} + {%- endif -%} +{%- endblock form_row %} + +{% block fieldset_form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + +
+ {{- form_label(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
+
+ +{%- endblock fieldset_form_row %} + +{% block submit_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock submit_row %} + +{% block reset_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock reset_row %} + +{% block button_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} +
{#--#} + +{%- endblock button_row %} + +{% block checkbox_row -%} + {#--#} +
{#--#} +
+ {{- form_widget(form) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
{#--#} + +{%- endblock checkbox_row %} + +{% block form_group_class -%} + col-sm-10 +{%- endblock form_group_class %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_layout.html.twig new file mode 100644 index 0000000..eef6f60 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_layout.html.twig @@ -0,0 +1,374 @@ +{% use "bootstrap_base_layout.html.twig" %} + +{# Widgets #} + +{% block money_widget -%} + {%- set prepend = not (money_pattern starts with '{{') -%} + {%- set append = not (money_pattern ends with '}}') -%} + {%- if prepend or append -%} +
+ {%- if prepend -%} + {{ money_pattern|form_encode_currency }} + {%- endif -%} + {{- block('form_widget_simple') -}} + {%- if append -%} + {{ money_pattern|form_encode_currency }} + {%- endif -%} +
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock money_widget %} + +{% block date_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) -%} + {% set valid = true %} + {% endif %} + {%- if datetime is not defined or not datetime -%} +
+ {%- endif %} + {%- if label is not same as(false) -%} +
+ {{- form_label(form.year) -}} + {{- form_label(form.month) -}} + {{- form_label(form.day) -}} +
+ {%- endif -%} +
+ {{- date_pattern|replace({ + '{{ year }}': form_widget(form.year), + '{{ month }}': form_widget(form.month), + '{{ day }}': form_widget(form.day), + })|raw -}} +
+ {%- if datetime is not defined or not datetime -%} +
+ {%- endif -%} + {%- endif -%} +{%- endblock date_widget %} + +{% block time_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) -%} + {% set valid = true %} + {% endif %} + {%- if datetime is not defined or false == datetime -%} +
+ {%- endif -%} + {%- if label is not same as(false) -%} +
+ {{- form_label(form.hour) -}} + {%- if with_minutes -%}{{ form_label(form.minute) }}{%- endif -%} + {%- if with_seconds -%}{{ form_label(form.second) }}{%- endif -%} +
+ {%- endif -%} + {% if with_minutes or with_seconds %} +
+ {% endif %} + {{- form_widget(form.hour) -}} + {%- if with_minutes -%} + : + {{- form_widget(form.minute) -}} + {%- endif -%} + {%- if with_seconds -%} + : + {{- form_widget(form.second) -}} + {%- endif -%} + {% if with_minutes or with_seconds %} +
+ {% endif %} + {%- if datetime is not defined or false == datetime -%} +
+ {%- endif -%} + {%- endif -%} +{%- endblock time_widget %} + +{% block datetime_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) -%} + {% set valid = true %} + {% endif %} +
+ {{- form_widget(form.date, { datetime: true } ) -}} + {{- form_errors(form.date) -}} + {{- form_widget(form.time, { datetime: true } ) -}} + {{- form_errors(form.time) -}} +
+ {%- endif -%} +{%- endblock datetime_widget %} + +{% block dateinterval_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) -%} + {% set valid = true %} + {% endif %} +
+ {%- if with_years -%} +
+ {{ form_label(form.years) }} + {{ form_widget(form.years) }} +
+ {%- endif -%} + {%- if with_months -%} +
+ {{ form_label(form.months) }} + {{ form_widget(form.months) }} +
+ {%- endif -%} + {%- if with_weeks -%} +
+ {{ form_label(form.weeks) }} + {{ form_widget(form.weeks) }} +
+ {%- endif -%} + {%- if with_days -%} +
+ {{ form_label(form.days) }} + {{ form_widget(form.days) }} +
+ {%- endif -%} + {%- if with_hours -%} +
+ {{ form_label(form.hours) }} + {{ form_widget(form.hours) }} +
+ {%- endif -%} + {%- if with_minutes -%} +
+ {{ form_label(form.minutes) }} + {{ form_widget(form.minutes) }} +
+ {%- endif -%} + {%- if with_seconds -%} +
+ {{ form_label(form.seconds) }} + {{ form_widget(form.seconds) }} +
+ {%- endif -%} + {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} +
+ {%- endif -%} +{%- endblock dateinterval_widget %} + +{% block percent_widget -%} + {%- if symbol -%} +
+ {{- block('form_widget_simple') -}} + {{ symbol|default('%') }} +
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock percent_widget %} + +{% block form_widget_simple -%} + {%- if type is not defined or type != 'hidden' %} + {%- set widget_class = ' form-control' %} + {%- if type|default('') == 'color' -%} + {%- set widget_class = widget_class ~ ' form-control-color' -%} + {%- elseif type|default('') == 'range' -%} + {%- set widget_class = ' form-range' -%} + {%- endif -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ widget_class)|trim}) -%} + {% endif -%} + {%- if type is defined and type in ['range', 'color'] %} + {# Attribute "required" is not supported #} + {% set required = false %} + {% endif -%} + {{- parent() -}} +{%- endblock form_widget_simple %} + +{%- block widget_attributes -%} + {%- if not valid %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) %} + {% endif -%} + {{ parent() }} +{%- endblock widget_attributes -%} + +{%- block button_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-secondary') ~ ' btn')|trim}) -%} + {{- parent() -}} +{%- endblock button_widget %} + +{%- block submit_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('btn-primary'))|trim}) -%} + {{- parent() -}} +{%- endblock submit_widget %} + +{%- block checkbox_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- set row_class = 'form-check' -%} + {%- if 'checkbox-inline' in parent_label_class %} + {% set row_class = row_class ~ ' form-check-inline' %} + {% endif -%} + {%- if 'checkbox-switch' in parent_label_class %} + {% set row_class = row_class ~ ' form-switch' %} + {% endif -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+{%- endblock checkbox_widget %} + +{%- block radio_widget -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- set row_class = 'form-check' -%} + {%- if 'radio-inline' in parent_label_class -%} + {%- set row_class = row_class ~ ' form-check-inline' -%} + {%- endif -%} +
+ {{- form_label(form, null, { widget: parent() }) -}} +
+{%- endblock radio_widget %} + +{%- block choice_widget_collapsed -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%} + {{- parent() -}} +{%- endblock choice_widget_collapsed -%} + +{%- block choice_widget_expanded -%} +
+ {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + valid: valid, + }) -}} + {% endfor -%} +
+{%- endblock choice_widget_expanded %} + +{# Labels #} + +{%- block form_label -%} + {% if label is not same as(false) -%} + {%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%} + {%- if compound is defined and compound -%} + {%- set element = 'legend' -%} + {%- if 'col-form-label' not in parent_label_class -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label' )|trim}) -%} + {%- endif -%} + {%- else -%} + {%- set row_class = row_class|default(row_attr.class|default('')) -%} + {%- set label_attr = label_attr|merge({for: id}) -%} + {%- if 'col-form-label' not in parent_label_class -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ('input-group' in row_class ? ' input-group-text' : ' form-label') )|trim}) -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {{- parent() -}} +{%- endblock form_label %} + +{%- block checkbox_radio_label -%} + {#- Do not display the label if widget is not defined in order to prevent double label rendering -#} + {%- if widget is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} + {%- if not compound -%} + {% set label_attr = label_attr|merge({'for': id}) %} + {%- endif -%} + {%- if required -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%} + {%- endif -%} + {%- if parent_label_class is defined -%} + {%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%} + {%- endif -%} + {%- if label is not same as(false) and label is empty -%} + {%- if label_format is not empty -%} + {%- set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) -%} + {%- else -%} + {%- set label = name|humanize -%} + {%- endif -%} + {%- endif -%} + + {{ widget|raw }} + + {%- if label is not same as(false) -%} + {%- if translation_domain is same as(false) -%} + {%- if label_html is same as(false) -%} + {{- label -}} + {%- else -%} + {{- label|raw -}} + {%- endif -%} + {%- else -%} + {%- if label_html is same as(false) -%} + {{- label|trans(label_translation_parameters, translation_domain) -}} + {%- else -%} + {{- label|trans(label_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + {%- endif -%} + + {%- endif -%} +{%- endblock checkbox_radio_label %} + +{# Rows #} + +{%- block form_row -%} + {%- if compound is defined and compound -%} + {%- set element = 'fieldset' -%} + {%- endif -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + {%- set row_class = row_class|default(row_attr.class|default('mb-3')|trim) -%} + <{{ element|default('div') }}{% with {attr: row_attr|merge({class: row_class})} %}{{ block('attributes') }}{% endwith %}> + {%- if 'form-floating' in row_class -%} + {{- form_widget(form, widget_attr) -}} + {{- form_label(form) -}} + {%- else -%} + {{- form_label(form) -}} + {{- form_widget(form, widget_attr) -}} + {%- endif -%} + {{- form_help(form) -}} + {{- form_errors(form) -}} + +{%- endblock form_row %} + +{%- block button_row -%} + + {{- form_widget(form) -}} + +{%- endblock button_row %} + +{# Errors #} + +{%- block form_errors -%} + {%- if errors|length > 0 -%} + {%- for error in errors -%} +
{{ error.message }}
+ {%- endfor -%} + {%- endif %} +{%- endblock form_errors %} + +{# Help #} + +{%- block form_help -%} + {% set row_class = row_attr.class|default('') %} + {% set help_class = ' form-text' %} + {% if 'input-group' in row_class %} + {#- Hack to properly display help with input group -#} + {% set help_class = ' input-group-text' %} + {% endif %} + {%- if help is not empty -%} + {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ help_class ~ ' mb-0')|trim}) -%} + {%- endif -%} + {{- parent() -}} +{%- endblock form_help %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig new file mode 100644 index 0000000..b8cb8c4 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig @@ -0,0 +1,208 @@ +{% use "form_div_layout.html.twig" %} + +{# Widgets #} + +{% block textarea_widget -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} + {{- parent() -}} +{%- endblock textarea_widget %} + +{% block money_widget -%} + {% set prepend = not (money_pattern starts with '{{') %} + {% set append = not (money_pattern ends with '}}') %} + {% if prepend or append %} +
+ {% if prepend %} + {{ money_pattern|form_encode_currency }} + {% endif %} + {{- block('form_widget_simple') -}} + {% if append %} + {{ money_pattern|form_encode_currency }} + {% endif %} +
+ {% else %} + {{- block('form_widget_simple') -}} + {% endif %} +{%- endblock money_widget %} + +{% block percent_widget -%} + {%- if symbol -%} +
+ {{- block('form_widget_simple') -}} + {{ symbol|default('%') }} +
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock percent_widget %} + +{% block datetime_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} +
+ {{- form_errors(form.date) -}} + {{- form_errors(form.time) -}} + +
+ {%- if form.date.year is defined %}{{ form_label(form.date.year) }}{% endif -%} + {%- if form.date.month is defined %}{{ form_label(form.date.month) }}{% endif -%} + {%- if form.date.day is defined %}{{ form_label(form.date.day) }}{% endif -%} + {%- if form.time.hour is defined %}{{ form_label(form.time.hour) }}{% endif -%} + {%- if form.time.minute is defined %}{{ form_label(form.time.minute) }}{% endif -%} + {%- if form.time.second is defined %}{{ form_label(form.time.second) }}{% endif -%} +
+ + {{- form_widget(form.date, { datetime: true } ) -}} + {{- form_widget(form.time, { datetime: true } ) -}} +
+ {%- endif -%} +{%- endblock datetime_widget %} + +{% block date_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + {%- if datetime is not defined or not datetime -%} +
+ {%- endif %} + {%- if label is not same as(false) -%} +
+ {{ form_label(form.year) }} + {{ form_label(form.month) }} + {{ form_label(form.day) }} +
+ {%- endif -%} + + {{- date_pattern|replace({ + '{{ year }}': form_widget(form.year), + '{{ month }}': form_widget(form.month), + '{{ day }}': form_widget(form.day), + })|raw -}} + {%- if datetime is not defined or not datetime -%} +
+ {%- endif -%} + {%- endif -%} +{%- endblock date_widget %} + +{% block time_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} + {%- if datetime is not defined or false == datetime -%} +
+ {%- endif -%} + {%- if label is not same as(false) -%}
{{ form_label(form.hour) }}
{%- endif -%} + {{- form_widget(form.hour) -}} + {%- if with_minutes -%}:{%- if label is not same as(false) -%}
{{ form_label(form.minute) }}
{%- endif -%}{{ form_widget(form.minute) }}{%- endif -%} + {%- if with_seconds -%}:{%- if label is not same as(false) -%}
{{ form_label(form.second) }}
{%- endif -%}{{ form_widget(form.second) }}{%- endif -%} + {%- if datetime is not defined or false == datetime -%} +
+ {%- endif -%} + {%- endif -%} +{%- endblock time_widget %} + +{%- block dateinterval_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} +
+ {{- form_errors(form) -}} +
+ + + + {%- if with_years %}{% endif -%} + {%- if with_months %}{% endif -%} + {%- if with_weeks %}{% endif -%} + {%- if with_days %}{% endif -%} + {%- if with_hours %}{% endif -%} + {%- if with_minutes %}{% endif -%} + {%- if with_seconds %}{% endif -%} + + + + + {%- if with_years %}{% endif -%} + {%- if with_months %}{% endif -%} + {%- if with_weeks %}{% endif -%} + {%- if with_days %}{% endif -%} + {%- if with_hours %}{% endif -%} + {%- if with_minutes %}{% endif -%} + {%- if with_seconds %}{% endif -%} + + + +
+ {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} +
+ {%- endif -%} +{%- endblock dateinterval_widget -%} + +{% block choice_widget_expanded -%} + {%- if '-inline' in label_attr.class|default('') -%} + {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + }) -}} + {% endfor -%} + {%- else -%} +
+ {%- for child in form %} + {{- form_widget(child, { + parent_label_class: label_attr.class|default(''), + translation_domain: choice_translation_domain, + }) -}} + {%- endfor -%} +
+ {%- endif -%} +{%- endblock choice_widget_expanded %} + +{# Labels #} + +{% block choice_label -%} + {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} + {%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': '', 'switch-custom': ''})|trim}) -%} + {{- block('form_label') -}} +{% endblock choice_label %} + +{% block checkbox_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock checkbox_label %} + +{% block radio_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock radio_label %} + +{# Rows #} + +{% block button_row -%} + + {{- form_widget(form) -}} + +{%- endblock button_row %} + +{% block choice_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock choice_row %} + +{% block date_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock date_row %} + +{% block time_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock time_row %} + +{% block datetime_row -%} + {%- set force_error = true -%} + {{- block('form_row') -}} +{%- endblock datetime_row %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig new file mode 100644 index 0000000..94f87dc --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig @@ -0,0 +1,476 @@ +{# Widgets #} + +{%- block form_widget -%} + {% if compound %} + {{- block('form_widget_compound') -}} + {% else %} + {{- block('form_widget_simple') -}} + {% endif %} +{%- endblock form_widget -%} + +{%- block form_widget_simple -%} + {%- set type = type|default('text') -%} + {%- if type == 'range' or type == 'color' -%} + {# Attribute "required" is not supported #} + {%- set required = false -%} + {%- endif -%} + +{%- endblock form_widget_simple -%} + +{%- block form_widget_compound -%} +
+ {%- if form is rootform -%} + {{ form_errors(form) }} + {%- endif -%} + {{- block('form_rows') -}} + {{- form_rest(form) -}} +
+{%- endblock form_widget_compound -%} + +{%- block collection_widget -%} + {% if prototype is defined and not prototype.rendered %} + {%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%} + {% endif %} + {{- block('form_widget') -}} +{%- endblock collection_widget -%} + +{%- block textarea_widget -%} + +{%- endblock textarea_widget -%} + +{%- block choice_widget -%} + {% if expanded %} + {{- block('choice_widget_expanded') -}} + {% else %} + {{- block('choice_widget_collapsed') -}} + {% endif %} +{%- endblock choice_widget -%} + +{%- block choice_widget_expanded -%} +
+ {%- for child in form %} + {{- form_widget(child) -}} + {{- form_label(child, null, {translation_domain: choice_translation_domain}) -}} + {% endfor -%} +
+{%- endblock choice_widget_expanded -%} + +{%- block choice_widget_collapsed -%} + {%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%} + {% set required = false %} + {%- endif -%} + +{%- endblock choice_widget_collapsed -%} + +{%- block choice_widget_options -%} + {% for group_label, choice in options %} + {%- if choice is iterable -%} + + {% set options = choice %} + {{- block('choice_widget_options') -}} + + {%- else -%} + + {%- endif -%} + {% endfor %} +{%- endblock choice_widget_options -%} + +{%- block checkbox_widget -%} + +{%- endblock checkbox_widget -%} + +{%- block radio_widget -%} + +{%- endblock radio_widget -%} + +{%- block datetime_widget -%} + {% if widget == 'single_text' %} + {{- block('form_widget_simple') -}} + {%- else -%} +
+ {{- form_errors(form.date) -}} + {{- form_errors(form.time) -}} + {{- form_widget(form.date) -}} + {{- form_widget(form.time) -}} +
+ {%- endif -%} +{%- endblock datetime_widget -%} + +{%- block date_widget -%} + {%- if widget == 'single_text' -%} + {{ block('form_widget_simple') }} + {%- else -%} +
+ {{- date_pattern|replace({ + '{{ year }}': form_widget(form.year), + '{{ month }}': form_widget(form.month), + '{{ day }}': form_widget(form.day), + })|raw -}} +
+ {%- endif -%} +{%- endblock date_widget -%} + +{%- block time_widget -%} + {%- if widget == 'single_text' -%} + {{ block('form_widget_simple') }} + {%- else -%} + {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%} +
+ {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %} +
+ {%- endif -%} +{%- endblock time_widget -%} + +{%- block dateinterval_widget -%} + {%- if widget == 'single_text' -%} + {{- block('form_widget_simple') -}} + {%- else -%} +
+ {{- form_errors(form) -}} + + + + {%- if with_years %}{% endif -%} + {%- if with_months %}{% endif -%} + {%- if with_weeks %}{% endif -%} + {%- if with_days %}{% endif -%} + {%- if with_hours %}{% endif -%} + {%- if with_minutes %}{% endif -%} + {%- if with_seconds %}{% endif -%} + + + + + {%- if with_years %}{% endif -%} + {%- if with_months %}{% endif -%} + {%- if with_weeks %}{% endif -%} + {%- if with_days %}{% endif -%} + {%- if with_hours %}{% endif -%} + {%- if with_minutes %}{% endif -%} + {%- if with_seconds %}{% endif -%} + + + + {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%} +
+ {%- endif -%} +{%- endblock dateinterval_widget -%} + +{%- block number_widget -%} + {# type="number" doesn't work with floats in localized formats #} + {%- set type = type|default('text') -%} + {{ block('form_widget_simple') }} +{%- endblock number_widget -%} + +{%- block integer_widget -%} + {%- set type = type|default('number') -%} + {{ block('form_widget_simple') }} +{%- endblock integer_widget -%} + +{%- block money_widget -%} + {{ money_pattern|form_encode_currency(block('form_widget_simple')) }} +{%- endblock money_widget -%} + +{%- block url_widget -%} + {%- set type = type|default('url') -%} + {{ block('form_widget_simple') }} +{%- endblock url_widget -%} + +{%- block search_widget -%} + {%- set type = type|default('search') -%} + {{ block('form_widget_simple') }} +{%- endblock search_widget -%} + +{%- block percent_widget -%} + {%- set type = type|default('text') -%} + {{ block('form_widget_simple') }}{% if symbol %} {{ symbol|default('%') }}{% endif %} +{%- endblock percent_widget -%} + +{%- block password_widget -%} + {%- set type = type|default('password') -%} + {{ block('form_widget_simple') }} +{%- endblock password_widget -%} + +{%- block hidden_widget -%} + {%- set type = type|default('hidden') -%} + {{ block('form_widget_simple') }} +{%- endblock hidden_widget -%} + +{%- block email_widget -%} + {%- set type = type|default('email') -%} + {{ block('form_widget_simple') }} +{%- endblock email_widget -%} + +{%- block range_widget -%} + {% set type = type|default('range') %} + {{- block('form_widget_simple') -}} +{%- endblock range_widget %} + +{%- block button_widget -%} + {%- if label is empty -%} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- elseif label is not same as(false) -%} + {% set label = name|humanize %} + {%- endif -%} + {%- endif -%} + +{%- endblock button_widget -%} + +{%- block submit_widget -%} + {%- set type = type|default('submit') -%} + {{ block('button_widget') }} +{%- endblock submit_widget -%} + +{%- block reset_widget -%} + {%- set type = type|default('reset') -%} + {{ block('button_widget') }} +{%- endblock reset_widget -%} + +{%- block tel_widget -%} + {%- set type = type|default('tel') -%} + {{ block('form_widget_simple') }} +{%- endblock tel_widget -%} + +{%- block color_widget -%} + {%- set type = type|default('color') -%} + {{ block('form_widget_simple') }} +{%- endblock color_widget -%} + +{%- block week_widget -%} + {%- if widget == 'single_text' -%} + {{ block('form_widget_simple') }} + {%- else -%} + {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%} +
+ {{ form_widget(form.year, vars) }}-{{ form_widget(form.week, vars) }} +
+ {%- endif -%} +{%- endblock week_widget -%} + +{# Labels #} + +{%- block form_label -%} + {% if label is not same as(false) -%} + {% if not compound -%} + {% set label_attr = label_attr|merge({'for': id}) %} + {%- endif -%} + {% if required -%} + {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} + {%- endif -%} + {% if label is empty -%} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} + {%- endif -%} + <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}> + {%- if translation_domain is same as(false) -%} + {%- if label_html is same as(false) -%} + {{- label -}} + {%- else -%} + {{- label|raw -}} + {%- endif -%} + {%- else -%} + {%- if label_html is same as(false) -%} + {{- label|trans(label_translation_parameters, translation_domain) -}} + {%- else -%} + {{- label|trans(label_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} + + {%- endif -%} +{%- endblock form_label -%} + +{%- block button_label -%}{%- endblock -%} + +{# Help #} + +{% block form_help -%} + {%- if help is not empty -%} + {%- set help_attr = help_attr|merge({class: (help_attr.class|default('') ~ ' help-text')|trim}) -%} +

+ {%- if translation_domain is same as(false) -%} + {%- if help_html is same as(false) -%} + {{- help -}} + {%- else -%} + {{- help|raw -}} + {%- endif -%} + {%- else -%} + {%- if help_html is same as(false) -%} + {{- help|trans(help_translation_parameters, translation_domain) -}} + {%- else -%} + {{- help|trans(help_translation_parameters, translation_domain)|raw -}} + {%- endif -%} + {%- endif -%} +

+ {%- endif -%} +{%- endblock form_help %} + +{# Rows #} + +{%- block repeated_row -%} + {# + No need to render the errors here, as all errors are mapped + to the first child (see RepeatedTypeValidatorExtension). + #} + {{- block('form_rows') -}} +{%- endblock repeated_row -%} + +{%- block form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + {{- form_label(form) -}} + {{- form_errors(form) -}} + {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + +{%- endblock form_row -%} + +{%- block button_row -%} + + {{- form_widget(form) -}} + +{%- endblock button_row -%} + +{%- block hidden_row -%} + {{ form_widget(form) }} +{%- endblock hidden_row -%} + +{# Misc #} + +{%- block form -%} + {{ form_start(form) }} + {{- form_widget(form) -}} + {{ form_end(form) }} +{%- endblock form -%} + +{%- block form_start -%} + {%- do form.setMethodRendered() -%} + {% set method = method|upper %} + {%- if method in ["GET", "POST"] -%} + {% set form_method = method %} + {%- else -%} + {% set form_method = "POST" %} + {%- endif -%} + + {%- if form_method != method -%} + + {%- endif -%} +{%- endblock form_start -%} + +{%- block form_end -%} + {%- if not render_rest is defined or render_rest -%} + {{ form_rest(form) }} + {%- endif -%} + +{%- endblock form_end -%} + +{%- block form_errors -%} + {%- if errors|length > 0 -%} +
    + {%- for error in errors -%} +
  • {{ error.message }}
  • + {%- endfor -%} +
+ {%- endif -%} +{%- endblock form_errors -%} + +{%- block form_rest -%} + {% for child in form -%} + {% if not child.rendered %} + {{- form_row(child) -}} + {% endif %} + {%- endfor -%} + + {% if not form.methodRendered and form is rootform %} + {%- do form.setMethodRendered() -%} + {% set method = method|upper %} + {%- if method in ["GET", "POST"] -%} + {% set form_method = method %} + {%- else -%} + {% set form_method = "POST" %} + {%- endif -%} + + {%- if form_method != method -%} + + {%- endif -%} + {% endif -%} +{% endblock form_rest %} + +{# Support #} + +{%- block form_rows -%} + {% for child in form|filter(child => not child.rendered) %} + {{- form_row(child) -}} + {% endfor %} +{%- endblock form_rows -%} + +{%- block widget_attributes -%} + id="{{ id }}" name="{{ full_name }}" + {%- if disabled %} disabled="disabled"{% endif -%} + {%- if required %} required="required"{% endif -%} + {{ block('attributes') }} +{%- endblock widget_attributes -%} + +{%- block widget_container_attributes -%} + {%- if id is not empty %}id="{{ id }}"{% endif -%} + {{ block('attributes') }} +{%- endblock widget_container_attributes -%} + +{%- block button_attributes -%} + id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%} + {{ block('attributes') }} +{%- endblock button_attributes -%} + +{% block attributes -%} + {%- for attrname, attrvalue in attr -%} + {{- " " -}} + {%- if attrname in ['placeholder', 'title'] -%} + {{- attrname }}="{{ translation_domain is same as(false) or attrvalue is null ? attrvalue : attrvalue|trans(attr_translation_parameters, translation_domain) }}" + {%- elseif attrvalue is same as(true) -%} + {{- attrname }}="{{ attrname }}" + {%- elseif attrvalue is not same as(false) -%} + {{- attrname }}="{{ attrvalue }}" + {%- endif -%} + {%- endfor -%} +{%- endblock attributes -%} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig new file mode 100644 index 0000000..00a51ab --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/form_table_layout.html.twig @@ -0,0 +1,50 @@ +{% use "form_div_layout.html.twig" %} + +{%- block form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + + {{- form_label(form) -}} + + + {{- form_errors(form) -}} + {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + + +{%- endblock form_row -%} + +{%- block button_row -%} + + + + {{- form_widget(form) -}} + + +{%- endblock button_row -%} + +{%- block hidden_row -%} + {%- set style = row_attr.style is defined ? (row_attr.style ~ (row_attr.style|trim|last != ';' ? '; ')) -%} + + + {{- form_widget(form) -}} + + +{%- endblock hidden_row -%} + +{%- block form_widget_compound -%} + + {%- if form is rootform and errors|length > 0 -%} + + + + {%- endif -%} + {{- block('form_rows') -}} + {{- form_rest(form) -}} +
+ {{- form_errors(form) -}} +
+{%- endblock form_widget_compound -%} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig new file mode 100644 index 0000000..f8c51b8 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_5_layout.html.twig @@ -0,0 +1,340 @@ +{% extends "form_div_layout.html.twig" %} + +{# Based on Foundation 5 Doc #} +{# Widgets #} + +{% block form_widget_simple -%} + {% if errors|length > 0 -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {{- parent() -}} +{%- endblock form_widget_simple %} + +{% block textarea_widget -%} + {% if errors|length > 0 -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {{- parent() -}} +{%- endblock textarea_widget %} + +{% block button_widget -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} + {{- parent() -}} +{%- endblock button_widget %} + +{% block money_widget -%} +
+ {% set prepend = '{{' == money_pattern[0:2] %} + {% if not prepend %} +
+ {{ money_pattern|form_encode_currency }} +
+ {% endif %} +
+ {{- block('form_widget_simple') -}} +
+ {% if prepend %} +
+ {{ money_pattern|form_encode_currency }} +
+ {% endif %} +
+{%- endblock money_widget %} + +{% block percent_widget -%} +
+ {%- if symbol -%} +
+ {{- block('form_widget_simple') -}} +
+
+ {{ symbol|default('%') }} +
+ {%- else -%} +
+ {{- block('form_widget_simple') -}} +
+ {%- endif -%} +
+{%- endblock percent_widget %} + +{% block datetime_widget -%} + {% if widget == 'single_text' %} + {{- block('form_widget_simple') -}} + {% else %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} +
+
{{ form_errors(form.date) }}
+
{{ form_errors(form.time) }}
+
+
+
{{ form_widget(form.date, { datetime: true } ) }}
+
{{ form_widget(form.time, { datetime: true } ) }}
+
+ {% endif %} +{%- endblock datetime_widget %} + +{% block date_widget -%} + {% if widget == 'single_text' %} + {{- block('form_widget_simple') -}} + {% else %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} + {% if datetime is not defined or not datetime %} +
+ {% endif %} + {{- date_pattern|replace({ + '{{ year }}': '
' ~ form_widget(form.year) ~ '
', + '{{ month }}': '
' ~ form_widget(form.month) ~ '
', + '{{ day }}': '
' ~ form_widget(form.day) ~ '
', + })|raw -}} + {% if datetime is not defined or not datetime %} +
+ {% endif %} + {% endif %} +{%- endblock date_widget %} + +{% block time_widget -%} + {% if widget == 'single_text' %} + {{- block('form_widget_simple') -}} + {% else %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' row')|trim}) %} + {% if datetime is not defined or false == datetime %} +
+ {% endif %} + {% if with_seconds %} +
{{ form_widget(form.hour) }}
+
+
+
+ : +
+
+ {{ form_widget(form.minute) }} +
+
+
+
+
+
+ : +
+
+ {{ form_widget(form.second) }} +
+
+
+ {% else %} +
{{ form_widget(form.hour) }}
+
+
+
+ : +
+
+ {{ form_widget(form.minute) }} +
+
+
+ {% endif %} + {% if datetime is not defined or false == datetime %} +
+ {% endif %} + {% endif %} +{%- endblock time_widget %} + +{% block choice_widget_collapsed -%} + {% if errors|length > 0 -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + + {% if multiple -%} + {% set attr = attr|merge({style: (attr.style|default('') ~ ' height: auto; background-image: none;')|trim}) %} + {% endif %} + + {% if required and placeholder is none and not placeholder_in_choices and not multiple -%} + {% set required = false %} + {%- endif -%} + +{%- endblock choice_widget_collapsed %} + +{% block choice_widget_expanded -%} + {% if '-inline' in label_attr.class|default('') %} +
    + {% for child in form %} +
  • {{ form_widget(child, { + parent_label_class: label_attr.class|default(''), + }) }}
  • + {% endfor %} +
+ {% else %} +
+ {% for child in form %} + {{ form_widget(child, { + parent_label_class: label_attr.class|default(''), + }) }} + {% endfor %} +
+ {% endif %} +{%- endblock choice_widget_expanded %} + +{% block checkbox_widget -%} + {% set parent_label_class = parent_label_class|default('') %} + {% if errors|length > 0 -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {% if 'checkbox-inline' in parent_label_class %} + {{ form_label(form, null, { widget: parent() }) }} + {% else %} +
+ {{ form_label(form, null, { widget: parent() }) }} +
+ {% endif %} +{%- endblock checkbox_widget %} + +{% block radio_widget -%} + {% set parent_label_class = parent_label_class|default('') %} + {% if 'radio-inline' in parent_label_class %} + {{ form_label(form, null, { widget: parent() }) }} + {% else %} + {% if errors|length > 0 -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' error')|trim}) %} + {% endif %} +
+ {{ form_label(form, null, { widget: parent() }) }} +
+ {% endif %} +{%- endblock radio_widget %} + +{# Labels #} + +{% block form_label -%} + {% if errors|length > 0 -%} + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {{- parent() -}} +{%- endblock form_label %} + +{% block choice_label -%} + {% if errors|length > 0 -%} + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} + {% set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) %} + {{- block('form_label') -}} +{%- endblock choice_label %} + +{% block checkbox_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock checkbox_label %} + +{% block radio_label -%} + {{- block('checkbox_radio_label') -}} +{%- endblock radio_label %} + +{% block checkbox_radio_label -%} + {% if required %} + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} + {% endif %} + {% if errors|length > 0 -%} + {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' error')|trim}) %} + {% endif %} + {% if label is empty %} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} + {% endif %} + + {{ widget|raw }} + {{ translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain) }} + +{%- endblock checkbox_radio_label %} + +{# Rows #} + +{% block form_row -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + +
+ {{- form_label(form) -}} + {{- form_widget(form, widget_attr) -}} + {{- form_help(form) -}} + {{- form_errors(form) -}} +
+ +{%- endblock form_row %} + +{% block choice_row -%} + {% set force_error = true %} + {{ block('form_row') }} +{%- endblock choice_row %} + +{% block date_row -%} + {% set force_error = true %} + {{ block('form_row') }} +{%- endblock date_row %} + +{% block time_row -%} + {% set force_error = true %} + {{ block('form_row') }} +{%- endblock time_row %} + +{% block datetime_row -%} + {% set force_error = true %} + {{ block('form_row') }} +{%- endblock datetime_row %} + +{% block checkbox_row -%} + +
+ {{ form_widget(form) }} + {{- form_help(form) -}} + {{ form_errors(form) }} +
+ +{%- endblock checkbox_row %} + +{% block radio_row -%} + +
+ {{ form_widget(form) }} + {{- form_help(form) -}} + {{ form_errors(form) }} +
+ +{%- endblock radio_row %} + +{# Errors #} + +{% block form_errors -%} + {% if errors|length > 0 -%} + {% if form is not rootform %}{% else %}
{% endif %} + {%- for error in errors -%} + {{ error.message }} + {% if not loop.last %}, {% endif %} + {%- endfor -%} + {% if form is not rootform %}{% else %}
{% endif %} + {%- endif %} +{%- endblock form_errors %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/foundation_6_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_6_layout.html.twig new file mode 100644 index 0000000..04ed730 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/foundation_6_layout.html.twig @@ -0,0 +1,50 @@ +{% extends "form_div_layout.html.twig" %} + +{%- block checkbox_row -%} + {%- set parent_class = parent_class|default(attr.class|default('')) -%} + {%- if 'switch-input' in parent_class -%} + {{- form_label(form) -}} + {%- set attr = attr|merge({class: (attr.class|default('') ~ ' switch-input')|trim}) -%} + {{- form_widget(form) -}} + + {{- form_errors(form) -}} + {%- else -%} + {{- block('form_row') -}} + {%- endif -%} +{%- endblock checkbox_row -%} + +{% block money_widget -%} + {% set prepend = not (money_pattern starts with '{{') %} + {% set append = not (money_pattern ends with '}}') %} + {% if prepend or append %} +
+ {% if prepend %} + {{ money_pattern|form_encode_currency }} + {% endif %} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} + {{- block('form_widget_simple') -}} + {% if append %} + {{ money_pattern|form_encode_currency }} + {% endif %} +
+ {% else %} + {{- block('form_widget_simple') -}} + {% endif %} +{%- endblock money_widget %} + +{% block percent_widget -%} + {%- if symbol -%} +
+ {% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %} + {{- block('form_widget_simple') -}} + {{ symbol|default('%') }} +
+ {%- else -%} + {{- block('form_widget_simple') -}} + {%- endif -%} +{%- endblock percent_widget %} + +{% block button_widget -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %} + {{- parent() -}} +{%- endblock button_widget %} diff --git a/vendor/symfony/twig-bridge/Resources/views/Form/tailwind_2_layout.html.twig b/vendor/symfony/twig-bridge/Resources/views/Form/tailwind_2_layout.html.twig new file mode 100644 index 0000000..7f31e70 --- /dev/null +++ b/vendor/symfony/twig-bridge/Resources/views/Form/tailwind_2_layout.html.twig @@ -0,0 +1,69 @@ +{% use 'form_div_layout.html.twig' %} + +{%- block form_row -%} + {%- set row_attr = row_attr|merge({ class: row_attr.class|default(row_class|default('mb-6')) }) -%} + {{- parent() -}} +{%- endblock form_row -%} + +{%- block widget_attributes -%} + {%- set attr = attr|merge({ class: attr.class|default(widget_class|default('mt-1 w-full')) ~ (disabled ? ' ' ~ widget_disabled_class|default('border-gray-300 text-gray-500')) ~ (errors|length ? ' ' ~ widget_errors_class|default('border-red-700')) }) -%} + {{- parent() -}} +{%- endblock widget_attributes -%} + +{%- block form_label -%} + {%- set label_attr = label_attr|merge({ class: label_attr.class|default(label_class|default('block text-gray-800')) }) -%} + {{- parent() -}} +{%- endblock form_label -%} + +{%- block form_help -%} + {%- set help_attr = help_attr|merge({ class: help_attr.class|default(help_class|default('mt-1 text-gray-600')) }) -%} + {{- parent() -}} +{%- endblock form_help -%} + +{%- block form_errors -%} + {%- if errors|length > 0 -%} +
    + {%- for error in errors -%} +
  • {{ error.message }}
  • + {%- endfor -%} +
+ {%- endif -%} +{%- endblock form_errors -%} + +{%- block choice_widget_expanded -%} + {%- set attr = attr|merge({ class: attr.class|default('mt-2') }) -%} +
+ {%- for child in form %} +
+ {{- form_widget(child) -}} + {{- form_label(child, null, { translation_domain: choice_translation_domain }) -}} +
+ {% endfor -%} +
+{%- endblock choice_widget_expanded -%} + +{%- block checkbox_row -%} + {%- set row_attr = row_attr|merge({ class: row_attr.class|default(row_class|default('mb-6')) }) -%} + {%- set widget_attr = {} -%} + {%- if help is not empty -%} + {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} + {%- endif -%} + + {{- form_errors(form) -}} +
+ {{- form_widget(form, widget_attr) -}} + {{- form_label(form) -}} +
+ {{- form_help(form) -}} + +{%- endblock checkbox_row -%} + +{%- block checkbox_widget -%} + {%- set widget_class = widget_class|default('mr-2') -%} + {{- parent() -}} +{%- endblock checkbox_widget -%} + +{%- block radio_widget -%} + {%- set widget_class = widget_class|default('mr-2') -%} + {{- parent() -}} +{%- endblock radio_widget -%} diff --git a/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php new file mode 100644 index 0000000..341dc41 --- /dev/null +++ b/vendor/symfony/twig-bridge/TokenParser/DumpTokenParser.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\TokenParser; + +use Symfony\Bridge\Twig\Node\DumpNode; +use Twig\Node\Node; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; + +/** + * Token Parser for the 'dump' tag. + * + * Dump variables with: + * + * {% dump %} + * {% dump foo %} + * {% dump foo, bar %} + * + * @author Julien Galenski + */ +final class DumpTokenParser extends AbstractTokenParser +{ + /** + * {@inheritdoc} + */ + public function parse(Token $token): Node + { + $values = null; + if (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE)) { + $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); + } + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new DumpNode($this->parser->getVarName(), $values, $token->getLine(), $this->getTag()); + } + + /** + * {@inheritdoc} + */ + public function getTag(): string + { + return 'dump'; + } +} diff --git a/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php new file mode 100644 index 0000000..ef5dacb --- /dev/null +++ b/vendor/symfony/twig-bridge/TokenParser/FormThemeTokenParser.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\TokenParser; + +use Symfony\Bridge\Twig\Node\FormThemeNode; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Node; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; + +/** + * Token Parser for the 'form_theme' tag. + * + * @author Fabien Potencier + */ +final class FormThemeTokenParser extends AbstractTokenParser +{ + /** + * {@inheritdoc} + */ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + + $form = $this->parser->getExpressionParser()->parseExpression(); + $only = false; + + if ($this->parser->getStream()->test(Token::NAME_TYPE, 'with')) { + $this->parser->getStream()->next(); + $resources = $this->parser->getExpressionParser()->parseExpression(); + + if ($this->parser->getStream()->nextIf(Token::NAME_TYPE, 'only')) { + $only = true; + } + } else { + $resources = new ArrayExpression([], $stream->getCurrent()->getLine()); + do { + $resources->addElement($this->parser->getExpressionParser()->parseExpression()); + } while (!$stream->test(Token::BLOCK_END_TYPE)); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + return new FormThemeNode($form, $resources, $lineno, $this->getTag(), $only); + } + + /** + * {@inheritdoc} + */ + public function getTag(): string + { + return 'form_theme'; + } +} diff --git a/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php new file mode 100644 index 0000000..a70e94b --- /dev/null +++ b/vendor/symfony/twig-bridge/TokenParser/StopwatchTokenParser.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\TokenParser; + +use Symfony\Bridge\Twig\Node\StopwatchNode; +use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Node; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; + +/** + * Token Parser for the stopwatch tag. + * + * @author Wouter J + */ +final class StopwatchTokenParser extends AbstractTokenParser +{ + protected $stopwatchIsAvailable; + + public function __construct(bool $stopwatchIsAvailable) + { + $this->stopwatchIsAvailable = $stopwatchIsAvailable; + } + + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + + // {% stopwatch 'bar' %} + $name = $this->parser->getExpressionParser()->parseExpression(); + + $stream->expect(Token::BLOCK_END_TYPE); + + // {% endstopwatch %} + $body = $this->parser->subparse([$this, 'decideStopwatchEnd'], true); + $stream->expect(Token::BLOCK_END_TYPE); + + if ($this->stopwatchIsAvailable) { + return new StopwatchNode($name, $body, new AssignNameExpression($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag()); + } + + return $body; + } + + public function decideStopwatchEnd(Token $token): bool + { + return $token->test('endstopwatch'); + } + + public function getTag(): string + { + return 'stopwatch'; + } +} diff --git a/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php new file mode 100644 index 0000000..19b8204 --- /dev/null +++ b/vendor/symfony/twig-bridge/TokenParser/TransDefaultDomainTokenParser.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\TokenParser; + +use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; +use Twig\Node\Node; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; + +/** + * Token Parser for the 'trans_default_domain' tag. + * + * @author Fabien Potencier + */ +final class TransDefaultDomainTokenParser extends AbstractTokenParser +{ + /** + * {@inheritdoc} + */ + public function parse(Token $token): Node + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new TransDefaultDomainNode($expr, $token->getLine(), $this->getTag()); + } + + /** + * {@inheritdoc} + */ + public function getTag(): string + { + return 'trans_default_domain'; + } +} diff --git a/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php b/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php new file mode 100644 index 0000000..ffe8828 --- /dev/null +++ b/vendor/symfony/twig-bridge/TokenParser/TransTokenParser.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\TokenParser; + +use Symfony\Bridge\Twig\Node\TransNode; +use Twig\Error\SyntaxError; +use Twig\Node\Expression\AbstractExpression; +use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Node; +use Twig\Node\TextNode; +use Twig\Token; +use Twig\TokenParser\AbstractTokenParser; + +/** + * Token Parser for the 'trans' tag. + * + * @author Fabien Potencier + */ +final class TransTokenParser extends AbstractTokenParser +{ + /** + * {@inheritdoc} + */ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + + $count = null; + $vars = new ArrayExpression([], $lineno); + $domain = null; + $locale = null; + if (!$stream->test(Token::BLOCK_END_TYPE)) { + if ($stream->test('count')) { + // {% trans count 5 %} + $stream->next(); + $count = $this->parser->getExpressionParser()->parseExpression(); + } + + if ($stream->test('with')) { + // {% trans with vars %} + $stream->next(); + $vars = $this->parser->getExpressionParser()->parseExpression(); + } + + if ($stream->test('from')) { + // {% trans from "messages" %} + $stream->next(); + $domain = $this->parser->getExpressionParser()->parseExpression(); + } + + if ($stream->test('into')) { + // {% trans into "fr" %} + $stream->next(); + $locale = $this->parser->getExpressionParser()->parseExpression(); + } elseif (!$stream->test(Token::BLOCK_END_TYPE)) { + throw new SyntaxError('Unexpected token. Twig was looking for the "with", "from", or "into" keyword.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + + // {% trans %}message{% endtrans %} + $stream->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideTransFork'], true); + + if (!$body instanceof TextNode && !$body instanceof AbstractExpression) { + throw new SyntaxError('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()); + } + + $stream->expect(Token::BLOCK_END_TYPE); + + return new TransNode($body, $domain, $count, $vars, $locale, $lineno, $this->getTag()); + } + + public function decideTransFork(Token $token): bool + { + return $token->test(['endtrans']); + } + + /** + * {@inheritdoc} + */ + public function getTag(): string + { + return 'trans'; + } +} diff --git a/vendor/symfony/twig-bridge/Translation/TwigExtractor.php b/vendor/symfony/twig-bridge/Translation/TwigExtractor.php new file mode 100644 index 0000000..e79ec69 --- /dev/null +++ b/vendor/symfony/twig-bridge/Translation/TwigExtractor.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig\Translation; + +use Symfony\Component\Finder\Finder; +use Symfony\Component\Translation\Extractor\AbstractFileExtractor; +use Symfony\Component\Translation\Extractor\ExtractorInterface; +use Symfony\Component\Translation\MessageCatalogue; +use Twig\Environment; +use Twig\Error\Error; +use Twig\Source; + +/** + * TwigExtractor extracts translation messages from a twig template. + * + * @author Michel Salib + * @author Fabien Potencier + */ +class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface +{ + /** + * Default domain for found messages. + * + * @var string + */ + private $defaultDomain = 'messages'; + + /** + * Prefix for found message. + * + * @var string + */ + private $prefix = ''; + + private $twig; + + public function __construct(Environment $twig) + { + $this->twig = $twig; + } + + /** + * {@inheritdoc} + */ + public function extract($resource, MessageCatalogue $catalogue) + { + foreach ($this->extractFiles($resource) as $file) { + try { + $this->extractTemplate(file_get_contents($file->getPathname()), $catalogue); + } catch (Error $e) { + // ignore errors, these should be fixed by using the linter + } + } + } + + /** + * {@inheritdoc} + */ + public function setPrefix(string $prefix) + { + $this->prefix = $prefix; + } + + protected function extractTemplate(string $template, MessageCatalogue $catalogue) + { + $visitor = $this->twig->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslationNodeVisitor(); + $visitor->enable(); + + $this->twig->parse($this->twig->tokenize(new Source($template, ''))); + + foreach ($visitor->getMessages() as $message) { + $catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ?: $this->defaultDomain); + } + + $visitor->disable(); + } + + /** + * @return bool + */ + protected function canBeExtracted(string $file) + { + return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION); + } + + /** + * {@inheritdoc} + */ + protected function extractFromDirectory($directory) + { + $finder = new Finder(); + + return $finder->files()->name('*.twig')->in($directory); + } +} diff --git a/vendor/symfony/twig-bridge/UndefinedCallableHandler.php b/vendor/symfony/twig-bridge/UndefinedCallableHandler.php new file mode 100644 index 0000000..608bbaa --- /dev/null +++ b/vendor/symfony/twig-bridge/UndefinedCallableHandler.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Twig; + +use Symfony\Bundle\FullStack; +use Twig\Error\SyntaxError; +use Twig\TwigFilter; +use Twig\TwigFunction; + +/** + * @internal + */ +class UndefinedCallableHandler +{ + private const FILTER_COMPONENTS = [ + 'humanize' => 'form', + 'trans' => 'translation', + 'yaml_encode' => 'yaml', + 'yaml_dump' => 'yaml', + ]; + + private const FUNCTION_COMPONENTS = [ + 'asset' => 'asset', + 'asset_version' => 'asset', + 'dump' => 'debug-bundle', + 'encore_entry_link_tags' => 'webpack-encore-bundle', + 'encore_entry_script_tags' => 'webpack-encore-bundle', + 'expression' => 'expression-language', + 'form_widget' => 'form', + 'form_errors' => 'form', + 'form_label' => 'form', + 'form_help' => 'form', + 'form_row' => 'form', + 'form_rest' => 'form', + 'form' => 'form', + 'form_start' => 'form', + 'form_end' => 'form', + 'csrf_token' => 'form', + 'logout_url' => 'security-http', + 'logout_path' => 'security-http', + 'is_granted' => 'security-core', + 'link' => 'web-link', + 'preload' => 'web-link', + 'dns_prefetch' => 'web-link', + 'preconnect' => 'web-link', + 'prefetch' => 'web-link', + 'prerender' => 'web-link', + 'workflow_can' => 'workflow', + 'workflow_transitions' => 'workflow', + 'workflow_has_marked_place' => 'workflow', + 'workflow_marked_places' => 'workflow', + ]; + + private const FULL_STACK_ENABLE = [ + 'form' => 'enable "framework.form"', + 'security-core' => 'add the "SecurityBundle"', + 'security-http' => 'add the "SecurityBundle"', + 'web-link' => 'enable "framework.web_link"', + 'workflow' => 'enable "framework.workflows"', + ]; + + /** + * @return TwigFilter|false + */ + public static function onUndefinedFilter(string $name) + { + if (!isset(self::FILTER_COMPONENTS[$name])) { + return false; + } + + throw new SyntaxError(self::onUndefined($name, 'filter', self::FILTER_COMPONENTS[$name])); + } + + /** + * @return TwigFunction|false + */ + public static function onUndefinedFunction(string $name) + { + if (!isset(self::FUNCTION_COMPONENTS[$name])) { + return false; + } + + if ('webpack-encore-bundle' === self::FUNCTION_COMPONENTS[$name]) { + return new TwigFunction($name, static function () { return ''; }); + } + + throw new SyntaxError(self::onUndefined($name, 'function', self::FUNCTION_COMPONENTS[$name])); + } + + private static function onUndefined(string $name, string $type, string $component): string + { + if (class_exists(FullStack::class) && isset(self::FULL_STACK_ENABLE[$component])) { + return sprintf('Did you forget to %s? Unknown %s "%s".', self::FULL_STACK_ENABLE[$component], $type, $name); + } + + return sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name); + } +} diff --git a/vendor/symfony/twig-bridge/composer.json b/vendor/symfony/twig-bridge/composer.json new file mode 100644 index 0000000..63b0726 --- /dev/null +++ b/vendor/symfony/twig-bridge/composer.json @@ -0,0 +1,88 @@ +{ + "name": "symfony/twig-bridge", + "type": "symfony-bridge", + "description": "Provides integration for Twig with various Symfony components", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^1.1|^2|^3", + "twig/twig": "^2.13|^3.0.4" + }, + "require-dev": { + "doctrine/annotations": "^1.12", + "egulias/email-validator": "^2.1.10|^3", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^5.3|^6.0", + "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/mime": "^5.2|^6.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.2|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/security-acl": "^2.8|^3.0", + "symfony/security-core": "^4.4|^5.0|^6.0", + "symfony/security-csrf": "^4.4|^5.0|^6.0", + "symfony/security-http": "^4.4|^5.0|^6.0", + "symfony/serializer": "^5.2|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/console": "^5.3|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "symfony/workflow": "^5.2|^6.0", + "twig/cssinliner-extra": "^2.12|^3", + "twig/inky-extra": "^2.12|^3", + "twig/markdown-extra": "^2.12|^3" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/console": "<5.3", + "symfony/form": "<5.3", + "symfony/http-foundation": "<5.3", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<5.2", + "symfony/workflow": "<5.2" + }, + "suggest": { + "symfony/finder": "", + "symfony/asset": "For using the AssetExtension", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/translation": "For using the TranslationExtension", + "symfony/yaml": "For using the YamlExtension", + "symfony/security-core": "For using the SecurityExtension", + "symfony/security-csrf": "For using the CsrfExtension", + "symfony/security-http": "For using the LogoutUrlExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/web-link": "For using the WebLinkExtension" + }, + "autoload": { + "psr-4": { "Symfony\\Bridge\\Twig\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/twig-bundle/CHANGELOG.md b/vendor/symfony/twig-bundle/CHANGELOG.md new file mode 100644 index 0000000..83a6ccc --- /dev/null +++ b/vendor/symfony/twig-bundle/CHANGELOG.md @@ -0,0 +1,94 @@ +CHANGELOG +========= + +5.3 +--- + + * Add support for the new `serialize` filter (from Twig Bridge) + +5.2.0 +----- + + * deprecated the public `twig` service to private + +5.0.0 +----- + + * updated default value for the `strict_variables` option to `%kernel.debug%` parameter + * removed support to load templates from the legacy directories `src/Resources/views/` and `src/Resources//views/` + * removed `TwigEngine` class, use `Twig\Environment` instead + * removed `FilesystemLoader` and `NativeFilesystemLoader`, use Twig notation for templates instead + * removed `twig.exception_controller` configuration option, use `framework.error_controller` option instead + * removed `ExceptionController`, `PreviewErrorController` and all built-in error templates in favor of the new error renderer mechanism + +4.4.0 +----- + + * marked the `TemplateIterator` as `internal` + * added HTML comment to beginning and end of `exception_full.html.twig` + * deprecated `ExceptionController` and `PreviewErrorController` controllers, use `ErrorController` from the `HttpKernel` component instead + * deprecated all built-in error templates in favor of the new error renderer mechanism + * deprecated `twig.exception_controller` configuration option, set it to "null" and use `framework.error_controller` configuration instead + +4.2.0 +----- + + * deprecated support for legacy templates directories `src/Resources/views/` and `src/Resources//views/`, use `templates/` and `templates/bundles//` instead. + +4.1.0 +----- + + * added priority to Twig extensions + * deprecated relying on the default value (`false`) of the `twig.strict_variables` configuration option. The `%kernel.debug%` parameter will be the new default in 5.0 + +4.0.0 +----- + + * removed `ContainerAwareRuntimeLoader` + +3.4.0 +----- + + * added exclusive Twig namespace only for root bundles + * deprecated `Symfony\Bundle\TwigBundle\Command\DebugCommand`, use `Symfony\Bridge\Twig\Command\DebugCommand` instead + * deprecated relying on the `ContainerAwareInterface` implementation for `Symfony\Bundle\TwigBundle\Command\LintCommand` + * added option to configure default path templates (via `default_path`) + +3.3.0 +----- + + * Deprecated `ContainerAwareRuntimeLoader` + +2.7.0 +----- + + * made it possible to configure the default formats for both the `date` and the `number_format` filter + * added support for the new Asset component (from Twig bridge) + * deprecated the assets extension (use the one from the Twig bridge instead) + +2.6.0 +----- + + * [BC BREAK] changed exception.json.twig to match same structure as error.json.twig making clients independent of runtime environment. + +2.3.0 +----- + + * added option to configure a custom template escaping guesser (via `autoescape_service` and `autoescape_service_method`) + +2.2.0 +----- + + * moved the exception controller to be a service (`twig.controller.exception:showAction` vs `Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController::showAction`) + * added support for multiple loaders via the "twig.loader" tag. + * added automatic registration of namespaced paths for registered bundles + * added support for namespaced paths + +2.1.0 +----- + + * added a new setting ("paths") to configure more paths for the Twig filesystem loader + * added contextual escaping based on the template file name (disabled if you explicitly pass an autoescape option) + * added a command that extracts translation messages from templates + * added the real template name when an error occurs in a Twig template + * added the twig:lint command that will validate a Twig template syntax. diff --git a/vendor/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php b/vendor/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php new file mode 100644 index 0000000..4a15dcf --- /dev/null +++ b/vendor/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\CacheWarmer; + +use Psr\Container\ContainerInterface; +use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; +use Twig\Environment; +use Twig\Error\Error; + +/** + * Generates the Twig cache for all templates. + * + * @author Fabien Potencier + */ +class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface +{ + private $container; + private $twig; + private $iterator; + + public function __construct(ContainerInterface $container, iterable $iterator) + { + // As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected. + $this->container = $container; + $this->iterator = $iterator; + } + + /** + * {@inheritdoc} + * + * @return string[] A list of template files to preload on PHP 7.4+ + */ + public function warmUp(string $cacheDir) + { + if (null === $this->twig) { + $this->twig = $this->container->get('twig'); + } + + $files = []; + + foreach ($this->iterator as $template) { + try { + $template = $this->twig->load($template); + + if (\is_callable([$template, 'unwrap'])) { + $files[] = (new \ReflectionClass($template->unwrap()))->getFileName(); + } + } catch (Error $e) { + /* + * Problem during compilation, give up for this template (e.g. syntax errors). + * Failing silently here allows to ignore templates that rely on functions that aren't available in + * the current environment. For example, the WebProfilerBundle shouldn't be available in the prod + * environment, but some templates that are never used in prod might rely on functions the bundle provides. + * As we can't detect which templates are "really" important, we try to load all of them and ignore + * errors. Error checks may be performed by calling the lint:twig command. + */ + } + } + + return $files; + } + + /** + * {@inheritdoc} + */ + public function isOptional() + { + return true; + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedServices() + { + return [ + 'twig' => Environment::class, + ]; + } +} diff --git a/vendor/symfony/twig-bundle/Command/LintCommand.php b/vendor/symfony/twig-bundle/Command/LintCommand.php new file mode 100644 index 0000000..a0a52e2 --- /dev/null +++ b/vendor/symfony/twig-bundle/Command/LintCommand.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\Command; + +use Symfony\Bridge\Twig\Command\LintCommand as BaseLintCommand; +use Symfony\Component\Finder\Finder; + +/** + * Command that will validate your template syntax and output encountered errors. + * + * @author Marc Weistroff + * @author Jérôme Tamarelle + */ +final class LintCommand extends BaseLintCommand +{ + protected static $defaultName = 'lint:twig'; + protected static $defaultDescription = 'Lint a Twig template and outputs encountered errors'; + + /** + * {@inheritdoc} + */ + protected function configure() + { + parent::configure(); + + $this + ->setHelp( + $this->getHelp().<<<'EOF' + +Or all template files in a bundle: + + php %command.full_name% @AcmeDemoBundle + +EOF + ) + ; + } + + protected function findFiles(string $filename): iterable + { + if (str_starts_with($filename, '@')) { + $dir = $this->getApplication()->getKernel()->locateResource($filename); + + return Finder::create()->files()->in($dir)->name('*.twig'); + } + + return parent::findFiles($filename); + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php new file mode 100644 index 0000000..12724e0 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/ExtensionPass.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\Asset\Packages; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\ExpressionLanguage\Expression; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Workflow\Workflow; +use Symfony\Component\Yaml\Yaml; + +/** + * @author Jean-François Simon + */ +class ExtensionPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (!class_exists(Packages::class)) { + $container->removeDefinition('twig.extension.assets'); + } + + if (!class_exists(Expression::class)) { + $container->removeDefinition('twig.extension.expression'); + } + + if (!interface_exists(UrlGeneratorInterface::class)) { + $container->removeDefinition('twig.extension.routing'); + } + + if (!class_exists(Yaml::class)) { + $container->removeDefinition('twig.extension.yaml'); + } + + $viewDir = \dirname((new \ReflectionClass(\Symfony\Bridge\Twig\Extension\FormExtension::class))->getFileName(), 2).'/Resources/views'; + $templateIterator = $container->getDefinition('twig.template_iterator'); + $templatePaths = $templateIterator->getArgument(1); + $loader = $container->getDefinition('twig.loader.native_filesystem'); + + if ($container->has('mailer')) { + $emailPath = $viewDir.'/Email'; + $loader->addMethodCall('addPath', [$emailPath, 'email']); + $loader->addMethodCall('addPath', [$emailPath, '!email']); + $templatePaths[$emailPath] = 'email'; + } + + if ($container->has('form.extension')) { + $container->getDefinition('twig.extension.form')->addTag('twig.extension'); + + $coreThemePath = $viewDir.'/Form'; + $loader->addMethodCall('addPath', [$coreThemePath]); + $templatePaths[$coreThemePath] = null; + } + + $templateIterator->replaceArgument(1, $templatePaths); + + if ($container->has('router')) { + $container->getDefinition('twig.extension.routing')->addTag('twig.extension'); + } + + if ($container->has('fragment.handler')) { + $container->getDefinition('twig.extension.httpkernel')->addTag('twig.extension'); + $container->getDefinition('twig.runtime.httpkernel')->addTag('twig.runtime'); + + if ($container->hasDefinition('fragment.renderer.hinclude')) { + $container->getDefinition('fragment.renderer.hinclude') + ->addTag('kernel.fragment_renderer', ['alias' => 'hinclude']) + ; + } + } + + if ($container->has('request_stack')) { + $container->getDefinition('twig.extension.httpfoundation')->addTag('twig.extension'); + } + + if ($container->getParameter('kernel.debug')) { + $container->getDefinition('twig.extension.profiler')->addTag('twig.extension'); + + // only register if the improved version from DebugBundle is *not* present + if (!$container->has('twig.extension.dump')) { + $container->getDefinition('twig.extension.debug')->addTag('twig.extension'); + } + } + + if ($container->has('web_link.add_link_header_listener')) { + $container->getDefinition('twig.extension.weblink')->addTag('twig.extension'); + } + + $container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false)); + + if ($container->has('assets.packages')) { + $container->getDefinition('twig.extension.assets')->addTag('twig.extension'); + } + + if ($container->hasDefinition('twig.extension.yaml')) { + $container->getDefinition('twig.extension.yaml')->addTag('twig.extension'); + } + + if (class_exists(\Symfony\Component\Stopwatch\Stopwatch::class)) { + $container->getDefinition('twig.extension.debug.stopwatch')->addTag('twig.extension'); + } + + if ($container->hasDefinition('twig.extension.expression')) { + $container->getDefinition('twig.extension.expression')->addTag('twig.extension'); + } + + if (!class_exists(Workflow::class) || !$container->has('workflow.registry')) { + $container->removeDefinition('workflow.twig_extension'); + } else { + $container->getDefinition('workflow.twig_extension')->addTag('twig.extension'); + } + + if ($container->has('serializer')) { + $container->getDefinition('twig.runtime.serializer')->addTag('twig.runtime'); + $container->getDefinition('twig.extension.serializer')->addTag('twig.extension'); + } + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php new file mode 100644 index 0000000..82cf1c1 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/RuntimeLoaderPass.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Registers Twig runtime services. + */ +class RuntimeLoaderPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('twig.runtime_loader')) { + return; + } + + $definition = $container->getDefinition('twig.runtime_loader'); + $mapping = []; + foreach ($container->findTaggedServiceIds('twig.runtime', true) as $id => $attributes) { + $def = $container->getDefinition($id); + $mapping[$def->getClass()] = new Reference($id); + } + + $definition->replaceArgument(0, ServiceLocatorTagPass::register($container, $mapping)); + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php new file mode 100644 index 0000000..45413dc --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigEnvironmentPass.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Adds tagged twig.extension services to twig service. + * + * @author Fabien Potencier + */ +class TwigEnvironmentPass implements CompilerPassInterface +{ + use PriorityTaggedServiceTrait; + + public function process(ContainerBuilder $container) + { + if (false === $container->hasDefinition('twig')) { + return; + } + + $definition = $container->getDefinition('twig'); + + // Extensions must always be registered before everything else. + // For instance, global variable definitions must be registered + // afterward. If not, the globals from the extensions will never + // be registered. + $currentMethodCalls = $definition->getMethodCalls(); + $twigBridgeExtensionsMethodCalls = []; + $othersExtensionsMethodCalls = []; + foreach ($this->findAndSortTaggedServices('twig.extension', $container) as $extension) { + $methodCall = ['addExtension', [$extension]]; + $extensionClass = $container->getDefinition((string) $extension)->getClass(); + + if (\is_string($extensionClass) && str_starts_with($extensionClass, 'Symfony\Bridge\Twig\Extension')) { + $twigBridgeExtensionsMethodCalls[] = $methodCall; + } else { + $othersExtensionsMethodCalls[] = $methodCall; + } + } + + if (!empty($twigBridgeExtensionsMethodCalls) || !empty($othersExtensionsMethodCalls)) { + $definition->setMethodCalls(array_merge($twigBridgeExtensionsMethodCalls, $othersExtensionsMethodCalls, $currentMethodCalls)); + } + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php new file mode 100644 index 0000000..a422f66 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Compiler/TwigLoaderPass.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\LogicException; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Adds services tagged twig.loader as Twig loaders. + * + * @author Daniel Leech + */ +class TwigLoaderPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (false === $container->hasDefinition('twig')) { + return; + } + + $prioritizedLoaders = []; + $found = 0; + + foreach ($container->findTaggedServiceIds('twig.loader', true) as $id => $attributes) { + $priority = $attributes[0]['priority'] ?? 0; + $prioritizedLoaders[$priority][] = $id; + ++$found; + } + + if (!$found) { + throw new LogicException('No twig loaders found. You need to tag at least one loader with "twig.loader".'); + } + + if (1 === $found) { + $container->setAlias('twig.loader', $id); + } else { + $chainLoader = $container->getDefinition('twig.loader.chain'); + krsort($prioritizedLoaders); + + foreach ($prioritizedLoaders as $loaders) { + foreach ($loaders as $loader) { + $chainLoader->addMethodCall('addLoader', [new Reference($loader)]); + } + } + + $container->setAlias('twig.loader', 'twig.loader.chain'); + } + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Configuration.php b/vendor/symfony/twig-bundle/DependencyInjection/Configuration.php new file mode 100644 index 0000000..76faa01 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Configuration.php @@ -0,0 +1,206 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; + +/** + * TwigExtension configuration structure. + * + * @author Jeremy Mikola + */ +class Configuration implements ConfigurationInterface +{ + /** + * Generates the configuration tree builder. + * + * @return TreeBuilder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder('twig'); + $rootNode = $treeBuilder->getRootNode(); + + $rootNode->beforeNormalization() + ->ifTrue(function ($v) { return \is_array($v) && \array_key_exists('exception_controller', $v); }) + ->then(function ($v) { + if (isset($v['exception_controller'])) { + throw new InvalidConfigurationException('Option "exception_controller" under "twig" must be null or unset, use "error_controller" under "framework" instead.'); + } + + unset($v['exception_controller']); + + return $v; + }) + ->end(); + + $this->addFormThemesSection($rootNode); + $this->addGlobalsSection($rootNode); + $this->addTwigOptions($rootNode); + $this->addTwigFormatOptions($rootNode); + + return $treeBuilder; + } + + private function addFormThemesSection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('form_theme') + ->children() + ->arrayNode('form_themes') + ->addDefaultChildrenIfNoneSet() + ->prototype('scalar')->defaultValue('form_div_layout.html.twig')->end() + ->example(['@My/form.html.twig']) + ->validate() + ->ifTrue(function ($v) { return !\in_array('form_div_layout.html.twig', $v); }) + ->then(function ($v) { + return array_merge(['form_div_layout.html.twig'], $v); + }) + ->end() + ->end() + ->end() + ; + } + + private function addGlobalsSection(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('global') + ->children() + ->arrayNode('globals') + ->normalizeKeys(false) + ->useAttributeAsKey('key') + ->example(['foo' => '@bar', 'pi' => 3.14]) + ->prototype('array') + ->normalizeKeys(false) + ->beforeNormalization() + ->ifTrue(function ($v) { return \is_string($v) && str_starts_with($v, '@'); }) + ->then(function ($v) { + if (str_starts_with($v, '@@')) { + return substr($v, 1); + } + + return ['id' => substr($v, 1), 'type' => 'service']; + }) + ->end() + ->beforeNormalization() + ->ifTrue(function ($v) { + if (\is_array($v)) { + $keys = array_keys($v); + sort($keys); + + return $keys !== ['id', 'type'] && $keys !== ['value']; + } + + return true; + }) + ->then(function ($v) { return ['value' => $v]; }) + ->end() + ->children() + ->scalarNode('id')->end() + ->scalarNode('type') + ->validate() + ->ifNotInArray(['service']) + ->thenInvalid('The %s type is not supported') + ->end() + ->end() + ->variableNode('value')->end() + ->end() + ->end() + ->end() + ->end() + ; + } + + private function addTwigOptions(ArrayNodeDefinition $rootNode) + { + $rootNode + ->fixXmlConfig('path') + ->children() + ->variableNode('autoescape')->defaultValue('name')->end() + ->scalarNode('autoescape_service')->defaultNull()->end() + ->scalarNode('autoescape_service_method')->defaultNull()->end() + ->scalarNode('base_template_class')->example('Twig\Template')->cannotBeEmpty()->end() + ->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end() + ->scalarNode('charset')->defaultValue('%kernel.charset%')->end() + ->booleanNode('debug')->defaultValue('%kernel.debug%')->end() + ->booleanNode('strict_variables')->defaultValue('%kernel.debug%')->end() + ->scalarNode('auto_reload')->end() + ->integerNode('optimizations')->min(-1)->end() + ->scalarNode('default_path') + ->info('The default path used to load templates') + ->defaultValue('%kernel.project_dir%/templates') + ->end() + ->arrayNode('paths') + ->normalizeKeys(false) + ->useAttributeAsKey('paths') + ->beforeNormalization() + ->always() + ->then(function ($paths) { + $normalized = []; + foreach ($paths as $path => $namespace) { + if (\is_array($namespace)) { + // xml + $path = $namespace['value']; + $namespace = $namespace['namespace']; + } + + // path within the default namespace + if (ctype_digit((string) $path)) { + $path = $namespace; + $namespace = null; + } + + $normalized[$path] = $namespace; + } + + return $normalized; + }) + ->end() + ->prototype('variable')->end() + ->end() + ->end() + ; + } + + private function addTwigFormatOptions(ArrayNodeDefinition $rootNode) + { + $rootNode + ->children() + ->arrayNode('date') + ->info('The default format options used by the date filter') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('format')->defaultValue('F j, Y H:i')->end() + ->scalarNode('interval_format')->defaultValue('%d days')->end() + ->scalarNode('timezone') + ->info('The timezone used when formatting dates, when set to null, the timezone returned by date_default_timezone_get() is used') + ->defaultNull() + ->end() + ->end() + ->end() + ->arrayNode('number_format') + ->info('The default format options for the number_format filter') + ->addDefaultsIfNotSet() + ->children() + ->integerNode('decimals')->defaultValue(0)->end() + ->scalarNode('decimal_point')->defaultValue('.')->end() + ->scalarNode('thousands_separator')->defaultValue(',')->end() + ->end() + ->end() + ->end() + ; + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/Configurator/EnvironmentConfigurator.php b/vendor/symfony/twig-bundle/DependencyInjection/Configurator/EnvironmentConfigurator.php new file mode 100644 index 0000000..07ec691 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/Configurator/EnvironmentConfigurator.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection\Configurator; + +use Symfony\Bridge\Twig\UndefinedCallableHandler; +use Twig\Environment; + +// BC/FC with namespaced Twig +class_exists(Environment::class); + +/** + * Twig environment configurator. + * + * @author Christian Flothmann + */ +class EnvironmentConfigurator +{ + private $dateFormat; + private $intervalFormat; + private $timezone; + private $decimals; + private $decimalPoint; + private $thousandsSeparator; + + public function __construct(string $dateFormat, string $intervalFormat, ?string $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator) + { + $this->dateFormat = $dateFormat; + $this->intervalFormat = $intervalFormat; + $this->timezone = $timezone; + $this->decimals = $decimals; + $this->decimalPoint = $decimalPoint; + $this->thousandsSeparator = $thousandsSeparator; + } + + public function configure(Environment $environment) + { + $environment->getExtension('Twig\Extension\CoreExtension')->setDateFormat($this->dateFormat, $this->intervalFormat); + + if (null !== $this->timezone) { + $environment->getExtension('Twig\Extension\CoreExtension')->setTimezone($this->timezone); + } + + $environment->getExtension('Twig\Extension\CoreExtension')->setNumberFormat($this->decimals, $this->decimalPoint, $this->thousandsSeparator); + + // wrap UndefinedCallableHandler in closures for lazy-autoloading + $environment->registerUndefinedFilterCallback(function ($name) { return UndefinedCallableHandler::onUndefinedFilter($name); }); + $environment->registerUndefinedFunctionCallback(function ($name) { return UndefinedCallableHandler::onUndefinedFunction($name); }); + } +} diff --git a/vendor/symfony/twig-bundle/DependencyInjection/TwigExtension.php b/vendor/symfony/twig-bundle/DependencyInjection/TwigExtension.php new file mode 100644 index 0000000..4cec780 --- /dev/null +++ b/vendor/symfony/twig-bundle/DependencyInjection/TwigExtension.php @@ -0,0 +1,208 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection; + +use Composer\InstalledVersions; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileExistenceResource; +use Symfony\Component\Console\Application; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Form\AbstractRendererEngine; +use Symfony\Component\Form\Form; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\Mailer\Mailer; +use Symfony\Component\Translation\Translator; +use Symfony\Contracts\Service\ResetInterface; +use Twig\Extension\ExtensionInterface; +use Twig\Extension\RuntimeExtensionInterface; +use Twig\Loader\LoaderInterface; + +/** + * TwigExtension. + * + * @author Fabien Potencier + * @author Jeremy Mikola + */ +class TwigExtension extends Extension +{ + public function load(array $configs, ContainerBuilder $container) + { + if (!class_exists(InstalledVersions::class)) { + trigger_deprecation('symfony/twig-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.1 or later.'); + } + + $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('twig.php'); + + if ($container::willBeAvailable('symfony/form', Form::class, ['symfony/twig-bundle'], true)) { + $loader->load('form.php'); + + if (is_subclass_of(AbstractRendererEngine::class, ResetInterface::class)) { + $container->getDefinition('twig.form.engine')->addTag('kernel.reset', [ + 'method' => 'reset', + ]); + } + } + + if ($container::willBeAvailable('symfony/console', Application::class, ['symfony/twig-bundle'], true)) { + $loader->load('console.php'); + } + + if ($container::willBeAvailable('symfony/mailer', Mailer::class, ['symfony/twig-bundle'], true)) { + $loader->load('mailer.php'); + } + + if (!$container::willBeAvailable('symfony/translation', Translator::class, ['symfony/twig-bundle'], true)) { + $container->removeDefinition('twig.translation.extractor'); + } + + foreach ($configs as $key => $config) { + if (isset($config['globals'])) { + foreach ($config['globals'] as $name => $value) { + if (\is_array($value) && isset($value['key'])) { + $configs[$key]['globals'][$name] = [ + 'key' => $name, + 'value' => $value, + ]; + } + } + } + } + + $configuration = $this->getConfiguration($configs, $container); + + $config = $this->processConfiguration($configuration, $configs); + + $container->setParameter('twig.form.resources', $config['form_themes']); + $container->setParameter('twig.default_path', $config['default_path']); + $defaultTwigPath = $container->getParameterBag()->resolveValue($config['default_path']); + + $envConfiguratorDefinition = $container->getDefinition('twig.configurator.environment'); + $envConfiguratorDefinition->replaceArgument(0, $config['date']['format']); + $envConfiguratorDefinition->replaceArgument(1, $config['date']['interval_format']); + $envConfiguratorDefinition->replaceArgument(2, $config['date']['timezone']); + $envConfiguratorDefinition->replaceArgument(3, $config['number_format']['decimals']); + $envConfiguratorDefinition->replaceArgument(4, $config['number_format']['decimal_point']); + $envConfiguratorDefinition->replaceArgument(5, $config['number_format']['thousands_separator']); + + $twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.native_filesystem'); + + // register user-configured paths + foreach ($config['paths'] as $path => $namespace) { + if (!$namespace) { + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path]); + } else { + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path, $namespace]); + } + } + + // paths are modified in ExtensionPass if forms are enabled + $container->getDefinition('twig.template_iterator')->replaceArgument(1, $config['paths']); + + foreach ($this->getBundleTemplatePaths($container, $config) as $name => $paths) { + $namespace = $this->normalizeBundleName($name); + foreach ($paths as $path) { + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path, $namespace]); + } + + if ($paths) { + // the last path must be the bundle views directory + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$path, '!'.$namespace]); + } + } + + if (file_exists($defaultTwigPath)) { + $twigFilesystemLoaderDefinition->addMethodCall('addPath', [$defaultTwigPath]); + } + $container->addResource(new FileExistenceResource($defaultTwigPath)); + + if (!empty($config['globals'])) { + $def = $container->getDefinition('twig'); + foreach ($config['globals'] as $key => $global) { + if (isset($global['type']) && 'service' === $global['type']) { + $def->addMethodCall('addGlobal', [$key, new Reference($global['id'])]); + } else { + $def->addMethodCall('addGlobal', [$key, $global['value']]); + } + } + } + + if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) { + $config['autoescape'] = [new Reference($config['autoescape_service']), $config['autoescape_service_method']]; + } + + $container->getDefinition('twig')->replaceArgument(1, array_intersect_key($config, [ + 'debug' => true, + 'charset' => true, + 'base_template_class' => true, + 'strict_variables' => true, + 'autoescape' => true, + 'cache' => true, + 'auto_reload' => true, + 'optimizations' => true, + ])); + + $container->registerForAutoconfiguration(\Twig_ExtensionInterface::class)->addTag('twig.extension'); + $container->registerForAutoconfiguration(\Twig_LoaderInterface::class)->addTag('twig.loader'); + $container->registerForAutoconfiguration(ExtensionInterface::class)->addTag('twig.extension'); + $container->registerForAutoconfiguration(LoaderInterface::class)->addTag('twig.loader'); + $container->registerForAutoconfiguration(RuntimeExtensionInterface::class)->addTag('twig.runtime'); + + if (false === $config['cache']) { + $container->removeDefinition('twig.template_cache_warmer'); + } + } + + private function getBundleTemplatePaths(ContainerBuilder $container, array $config): array + { + $bundleHierarchy = []; + foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) { + $defaultOverrideBundlePath = $container->getParameterBag()->resolveValue($config['default_path']).'/bundles/'.$name; + + if (file_exists($defaultOverrideBundlePath)) { + $bundleHierarchy[$name][] = $defaultOverrideBundlePath; + } + $container->addResource(new FileExistenceResource($defaultOverrideBundlePath)); + + if (file_exists($dir = $bundle['path'].'/Resources/views') || file_exists($dir = $bundle['path'].'/templates')) { + $bundleHierarchy[$name][] = $dir; + } + $container->addResource(new FileExistenceResource($dir)); + } + + return $bundleHierarchy; + } + + private function normalizeBundleName(string $name): string + { + if (str_ends_with($name, 'Bundle')) { + $name = substr($name, 0, -6); + } + + return $name; + } + + /** + * {@inheritdoc} + */ + public function getXsdValidationBasePath() + { + return __DIR__.'/../Resources/config/schema'; + } + + public function getNamespace() + { + return 'http://symfony.com/schema/dic/twig'; + } +} diff --git a/vendor/symfony/twig-bundle/LICENSE b/vendor/symfony/twig-bundle/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/twig-bundle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/twig-bundle/README.md b/vendor/symfony/twig-bundle/README.md new file mode 100644 index 0000000..3ae2985 --- /dev/null +++ b/vendor/symfony/twig-bundle/README.md @@ -0,0 +1,13 @@ +TwigBundle +========== + +TwigBundle provides a tight integration of Twig into the Symfony full-stack +framework. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/twig-bundle/Resources/config/console.php b/vendor/symfony/twig-bundle/Resources/config/console.php new file mode 100644 index 0000000..0dc7ebd --- /dev/null +++ b/vendor/symfony/twig-bundle/Resources/config/console.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bridge\Twig\Command\DebugCommand; +use Symfony\Bundle\TwigBundle\Command\LintCommand; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('twig.command.debug', DebugCommand::class) + ->args([ + service('twig'), + param('kernel.project_dir'), + param('kernel.bundles_metadata'), + param('twig.default_path'), + service('debug.file_link_formatter')->nullOnInvalid(), + ]) + ->tag('console.command') + + ->set('twig.command.lint', LintCommand::class) + ->args([service('twig')]) + ->tag('console.command') + ; +}; diff --git a/vendor/symfony/twig-bundle/Resources/config/form.php b/vendor/symfony/twig-bundle/Resources/config/form.php new file mode 100644 index 0000000..9f2efdf --- /dev/null +++ b/vendor/symfony/twig-bundle/Resources/config/form.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bridge\Twig\Extension\FormExtension; +use Symfony\Bridge\Twig\Form\TwigRendererEngine; +use Symfony\Component\Form\FormRenderer; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('twig.extension.form', FormExtension::class) + ->args([service('translator')->nullOnInvalid()]) + + ->set('twig.form.engine', TwigRendererEngine::class) + ->args([param('twig.form.resources'), service('twig')]) + + ->set('twig.form.renderer', FormRenderer::class) + ->args([service('twig.form.engine'), service('security.csrf.token_manager')->nullOnInvalid()]) + ->tag('twig.runtime') + ; +}; diff --git a/vendor/symfony/twig-bundle/Resources/config/mailer.php b/vendor/symfony/twig-bundle/Resources/config/mailer.php new file mode 100644 index 0000000..1444481 --- /dev/null +++ b/vendor/symfony/twig-bundle/Resources/config/mailer.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bridge\Twig\Mime\BodyRenderer; +use Symfony\Component\Mailer\EventListener\MessageListener; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('twig.mailer.message_listener', MessageListener::class) + ->args([null, service('twig.mime_body_renderer')]) + ->tag('kernel.event_subscriber') + + ->set('twig.mime_body_renderer', BodyRenderer::class) + ->args([service('twig')]) + ; +}; diff --git a/vendor/symfony/twig-bundle/Resources/config/schema/twig-1.0.xsd b/vendor/symfony/twig-bundle/Resources/config/schema/twig-1.0.xsd new file mode 100644 index 0000000..429c91d --- /dev/null +++ b/vendor/symfony/twig-bundle/Resources/config/schema/twig-1.0.xsd @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/twig-bundle/Resources/config/twig.php b/vendor/symfony/twig-bundle/Resources/config/twig.php new file mode 100644 index 0000000..3bc7f66 --- /dev/null +++ b/vendor/symfony/twig-bundle/Resources/config/twig.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Psr\Container\ContainerInterface; +use Symfony\Bridge\Twig\AppVariable; +use Symfony\Bridge\Twig\DataCollector\TwigDataCollector; +use Symfony\Bridge\Twig\ErrorRenderer\TwigErrorRenderer; +use Symfony\Bridge\Twig\Extension\AssetExtension; +use Symfony\Bridge\Twig\Extension\CodeExtension; +use Symfony\Bridge\Twig\Extension\ExpressionExtension; +use Symfony\Bridge\Twig\Extension\HttpFoundationExtension; +use Symfony\Bridge\Twig\Extension\HttpKernelExtension; +use Symfony\Bridge\Twig\Extension\HttpKernelRuntime; +use Symfony\Bridge\Twig\Extension\ProfilerExtension; +use Symfony\Bridge\Twig\Extension\RoutingExtension; +use Symfony\Bridge\Twig\Extension\SerializerExtension; +use Symfony\Bridge\Twig\Extension\SerializerRuntime; +use Symfony\Bridge\Twig\Extension\StopwatchExtension; +use Symfony\Bridge\Twig\Extension\TranslationExtension; +use Symfony\Bridge\Twig\Extension\WebLinkExtension; +use Symfony\Bridge\Twig\Extension\WorkflowExtension; +use Symfony\Bridge\Twig\Extension\YamlExtension; +use Symfony\Bridge\Twig\Translation\TwigExtractor; +use Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheWarmer; +use Symfony\Bundle\TwigBundle\DependencyInjection\Configurator\EnvironmentConfigurator; +use Symfony\Bundle\TwigBundle\TemplateIterator; +use Twig\Cache\FilesystemCache; +use Twig\Environment; +use Twig\Extension\CoreExtension; +use Twig\Extension\DebugExtension; +use Twig\Extension\EscaperExtension; +use Twig\Extension\OptimizerExtension; +use Twig\Extension\StagingExtension; +use Twig\ExtensionSet; +use Twig\Loader\ChainLoader; +use Twig\Loader\FilesystemLoader; +use Twig\Profiler\Profile; +use Twig\RuntimeLoader\ContainerRuntimeLoader; +use Twig\Template; +use Twig\TemplateWrapper; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('twig', Environment::class) + ->public() + ->args([service('twig.loader'), abstract_arg('Twig options')]) + ->call('addGlobal', ['app', service('twig.app_variable')]) + ->call('addRuntimeLoader', [service('twig.runtime_loader')]) + ->configurator([service('twig.configurator.environment'), 'configure']) + ->tag('container.preload', ['class' => FilesystemCache::class]) + ->tag('container.preload', ['class' => CoreExtension::class]) + ->tag('container.preload', ['class' => EscaperExtension::class]) + ->tag('container.preload', ['class' => OptimizerExtension::class]) + ->tag('container.preload', ['class' => StagingExtension::class]) + ->tag('container.preload', ['class' => ExtensionSet::class]) + ->tag('container.preload', ['class' => Template::class]) + ->tag('container.preload', ['class' => TemplateWrapper::class]) + ->tag('container.private', ['package' => 'symfony/twig-bundle', 'version' => '5.2']) + + ->alias('Twig_Environment', 'twig') + ->alias(Environment::class, 'twig') + + ->set('twig.app_variable', AppVariable::class) + ->call('setEnvironment', [param('kernel.environment')]) + ->call('setDebug', [param('kernel.debug')]) + ->call('setTokenStorage', [service('security.token_storage')->ignoreOnInvalid()]) + ->call('setRequestStack', [service('request_stack')->ignoreOnInvalid()]) + + ->set('twig.template_iterator', TemplateIterator::class) + ->args([service('kernel'), abstract_arg('Twig paths'), param('twig.default_path')]) + + ->set('twig.template_cache_warmer', TemplateCacheWarmer::class) + ->args([service(ContainerInterface::class), service('twig.template_iterator')]) + ->tag('kernel.cache_warmer') + ->tag('container.service_subscriber', ['id' => 'twig']) + + ->set('twig.loader.native_filesystem', FilesystemLoader::class) + ->args([[], param('kernel.project_dir')]) + ->tag('twig.loader') + + ->set('twig.loader.chain', ChainLoader::class) + + ->set('twig.extension.profiler', ProfilerExtension::class) + ->args([service('twig.profile'), service('debug.stopwatch')->ignoreOnInvalid()]) + + ->set('twig.profile', Profile::class) + + ->set('data_collector.twig', TwigDataCollector::class) + ->args([service('twig.profile'), service('twig')]) + ->tag('data_collector', ['template' => '@WebProfiler/Collector/twig.html.twig', 'id' => 'twig', 'priority' => 257]) + + ->set('twig.extension.trans', TranslationExtension::class) + ->args([service('translator')->nullOnInvalid()]) + ->tag('twig.extension') + + ->set('twig.extension.assets', AssetExtension::class) + ->args([service('assets.packages')]) + + ->set('twig.extension.code', CodeExtension::class) + ->args([service('debug.file_link_formatter')->ignoreOnInvalid(), param('kernel.project_dir'), param('kernel.charset')]) + ->tag('twig.extension') + + ->set('twig.extension.routing', RoutingExtension::class) + ->args([service('router')]) + + ->set('twig.extension.yaml', YamlExtension::class) + + ->set('twig.extension.debug.stopwatch', StopwatchExtension::class) + ->args([service('debug.stopwatch')->ignoreOnInvalid(), param('kernel.debug')]) + + ->set('twig.extension.expression', ExpressionExtension::class) + + ->set('twig.extension.httpkernel', HttpKernelExtension::class) + + ->set('twig.runtime.httpkernel', HttpKernelRuntime::class) + ->args([service('fragment.handler'), service('fragment.uri_generator')->ignoreOnInvalid()]) + + ->set('twig.extension.httpfoundation', HttpFoundationExtension::class) + ->args([service('url_helper')]) + + ->set('twig.extension.debug', DebugExtension::class) + + ->set('twig.extension.weblink', WebLinkExtension::class) + ->args([service('request_stack')]) + + ->set('twig.translation.extractor', TwigExtractor::class) + ->args([service('twig')]) + ->tag('translation.extractor', ['alias' => 'twig']) + + ->set('workflow.twig_extension', WorkflowExtension::class) + ->args([service('workflow.registry')]) + + ->set('twig.configurator.environment', EnvironmentConfigurator::class) + ->args([ + abstract_arg('date format, set in TwigExtension'), + abstract_arg('interval format, set in TwigExtension'), + abstract_arg('timezone, set in TwigExtension'), + abstract_arg('decimals, set in TwigExtension'), + abstract_arg('decimal point, set in TwigExtension'), + abstract_arg('thousands separator, set in TwigExtension'), + ]) + + ->set('twig.runtime_loader', ContainerRuntimeLoader::class) + ->args([abstract_arg('runtime locator')]) + + ->set('twig.error_renderer.html', TwigErrorRenderer::class) + ->decorate('error_renderer.html') + ->args([ + service('twig'), + service('twig.error_renderer.html.inner'), + inline_service('bool') + ->factory([TwigErrorRenderer::class, 'isDebug']) + ->args([service('request_stack'), param('kernel.debug')]), + ]) + + ->set('twig.runtime.serializer', SerializerRuntime::class) + ->args([service('serializer')]) + + ->set('twig.extension.serializer', SerializerExtension::class) + ; +}; diff --git a/vendor/symfony/twig-bundle/TemplateIterator.php b/vendor/symfony/twig-bundle/TemplateIterator.php new file mode 100644 index 0000000..8cc0ffc --- /dev/null +++ b/vendor/symfony/twig-bundle/TemplateIterator.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle; + +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpKernel\KernelInterface; + +/** + * Iterator for all templates in bundles and in the application Resources directory. + * + * @author Fabien Potencier + * + * @internal + * + * @implements \IteratorAggregate + */ +class TemplateIterator implements \IteratorAggregate +{ + private $kernel; + private $templates; + private $paths; + private $defaultPath; + + /** + * @param array $paths Additional Twig paths to warm + * @param string|null $defaultPath The directory where global templates can be stored + */ + public function __construct(KernelInterface $kernel, array $paths = [], string $defaultPath = null) + { + $this->kernel = $kernel; + $this->paths = $paths; + $this->defaultPath = $defaultPath; + } + + public function getIterator(): \Traversable + { + if (null !== $this->templates) { + return $this->templates; + } + + $templates = null !== $this->defaultPath ? [$this->findTemplatesInDirectory($this->defaultPath, null, ['bundles'])] : []; + + foreach ($this->kernel->getBundles() as $bundle) { + $name = $bundle->getName(); + if (str_ends_with($name, 'Bundle')) { + $name = substr($name, 0, -6); + } + + $bundleTemplatesDir = is_dir($bundle->getPath().'/Resources/views') ? $bundle->getPath().'/Resources/views' : $bundle->getPath().'/templates'; + + $templates[] = $this->findTemplatesInDirectory($bundleTemplatesDir, $name); + if (null !== $this->defaultPath) { + $templates[] = $this->findTemplatesInDirectory($this->defaultPath.'/bundles/'.$bundle->getName(), $name); + } + } + + foreach ($this->paths as $dir => $namespace) { + $templates[] = $this->findTemplatesInDirectory($dir, $namespace); + } + + return $this->templates = new \ArrayIterator(array_unique(array_merge([], ...$templates))); + } + + /** + * Find templates in the given directory. + * + * @return string[] + */ + private function findTemplatesInDirectory(string $dir, string $namespace = null, array $excludeDirs = []): array + { + if (!is_dir($dir)) { + return []; + } + + $templates = []; + foreach (Finder::create()->files()->followLinks()->in($dir)->exclude($excludeDirs) as $file) { + $templates[] = (null !== $namespace ? '@'.$namespace.'/' : '').str_replace('\\', '/', $file->getRelativePathname()); + } + + return $templates; + } +} diff --git a/vendor/symfony/twig-bundle/TwigBundle.php b/vendor/symfony/twig-bundle/TwigBundle.php new file mode 100644 index 0000000..3910dd5 --- /dev/null +++ b/vendor/symfony/twig-bundle/TwigBundle.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle; + +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass; +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass; +use Symfony\Component\Console\Application; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\Bundle; + +/** + * Bundle. + * + * @author Fabien Potencier + */ +class TwigBundle extends Bundle +{ + public function build(ContainerBuilder $container) + { + parent::build($container); + + // ExtensionPass must be run before the FragmentRendererPass as it adds tags that are processed later + $container->addCompilerPass(new ExtensionPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); + $container->addCompilerPass(new TwigEnvironmentPass()); + $container->addCompilerPass(new TwigLoaderPass()); + $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING); + } + + public function registerCommands(Application $application) + { + // noop + } +} diff --git a/vendor/symfony/twig-bundle/composer.json b/vendor/symfony/twig-bundle/composer.json new file mode 100644 index 0000000..5635bb4 --- /dev/null +++ b/vendor/symfony/twig-bundle/composer.json @@ -0,0 +1,56 @@ +{ + "name": "symfony/twig-bundle", + "type": "symfony-bundle", + "description": "Provides a tight integration of Twig into the Symfony full-stack framework", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/twig-bridge": "^5.3|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16", + "twig/twig": "^2.13|^3.0.4" + }, + "require-dev": { + "symfony/asset": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/form": "^4.4|^5.0|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/translation": "^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.0|^6.0", + "symfony/web-link": "^4.4|^5.0|^6.0", + "doctrine/annotations": "^1.10.4", + "doctrine/cache": "^1.0|^2.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.3", + "symfony/framework-bundle": "<5.0", + "symfony/service-contracts": ">=3.0", + "symfony/translation": "<5.0" + }, + "autoload": { + "psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/validator/CHANGELOG.md b/vendor/symfony/validator/CHANGELOG.md new file mode 100644 index 0000000..35f7a3e --- /dev/null +++ b/vendor/symfony/validator/CHANGELOG.md @@ -0,0 +1,355 @@ +CHANGELOG +========= + +5.4 +--- + + * Add a `Cidr` constraint to validate CIDR notations + * Add a `CssColor` constraint to validate CSS colors + * Add support for `ConstraintViolationList::createFromMessage()` + * Add error's uid to `Count` and `Length` constraints with "exactly" option enabled + +5.3 +--- + + * Add the `normalizer` option to the `Unique` constraint + * Add `Validation::createIsValidCallable()` that returns true/false instead of throwing exceptions + +5.2.0 +----- + + * added a `Cascade` constraint to ease validating nested typed object properties + * deprecated the `allowEmptyString` option of the `Length` constraint + + Before: + + ```php + use Symfony\Component\Validator\Constraints as Assert; + + /** + * @Assert\Length(min=5, allowEmptyString=true) + */ + ``` + + After: + + ```php + use Symfony\Component\Validator\Constraints as Assert; + + /** + * @Assert\AtLeastOneOf({ + * @Assert\Blank(), + * @Assert\Length(min=5) + * }) + */ + ``` + * added the `Isin` constraint and validator + * added the `ULID` constraint and validator + * added support for UUIDv6 in `Uuid` constraint + * enabled the validator to load constraints from PHP attributes + * deprecated the `NumberConstraintTrait` trait + * deprecated setting or creating a Doctrine annotation reader via `ValidatorBuilder::enableAnnotationMapping()`, pass `true` as first parameter and additionally call `setDoctrineAnnotationReader()` or `addDefaultDoctrineAnnotationReader()` to set up the annotation reader + +5.1.0 +----- + + * added the `Hostname` constraint and validator + * added the `alpha3` option to the `Country` and `Language` constraints + * allow to define a reusable set of constraints by extending the `Compound` constraint + * added `Sequentially` constraint, to sequentially validate a set of constraints (any violation raised will prevent further validation of the nested constraints) + * added the `divisibleBy` option to the `Count` constraint + * added the `ExpressionLanguageSyntax` constraint + +5.0.0 +----- + + * an `ExpressionLanguage` instance or null must be passed as the first argument of `ExpressionValidator::__construct()` + * removed the `checkDNS` and `dnsMessage` options of the `Url` constraint + * removed the `checkMX`, `checkHost` and `strict` options of the `Email` constraint + * removed support for validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator` + * removed support for using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl` + * removed support for using the `Email` constraint without `egulias/email-validator` + * removed support for using the `Expression` constraint without `symfony/expression-language` + * changed default value of `canonicalize` option of `Locale` constraint to `true` + * removed `ValidatorBuilderInterface` + * passing a null message when instantiating a `ConstraintViolation` is not allowed + * changed the default value of `Length::$allowEmptyString` to `false` and made it optional + * removed `Symfony\Component\Validator\Mapping\Cache\CacheInterface` in favor of PSR-6. + * removed `ValidatorBuilder::setMetadataCache`, use `ValidatorBuilder::setMappingCache` instead. + +4.4.0 +----- + + * [BC BREAK] using null as `$classValidatorRegexp` value in `PropertyInfoLoader::__construct` will not enable auto-mapping for all classes anymore, use `'{.*}'` instead. + * added `EnableAutoMapping` and `DisableAutoMapping` constraints to enable or disable auto mapping for class or a property + * using anything else than a `string` as the code of a `ConstraintViolation` is deprecated, a `string` type-hint will + be added to the constructor of the `ConstraintViolation` class and to the `ConstraintViolationBuilder::setCode()` + method in 5.0 + * deprecated passing an `ExpressionLanguage` instance as the second argument of `ExpressionValidator::__construct()`. Pass it as the first argument instead. + * added the `compared_value_path` parameter in violations when using any + comparison constraint with the `propertyPath` option. + * added support for checking an array of types in `TypeValidator` + * added a new `allowEmptyString` option to the `Length` constraint to allow rejecting empty strings when `min` is set, by setting it to `false`. + * Added new `minPropertyPath` and `maxPropertyPath` options + to `Range` constraint in order to get the value to compare + from an array or object + * added the `min_limit_path` and `max_limit_path` parameters in violations when using + `Range` constraint with respectively the `minPropertyPath` and + `maxPropertyPath` options + * added a new `notInRangeMessage` option to the `Range` constraint that will + be used in the violation builder when both `min` and `max` are not null + * added ability to use stringable objects as violation messages + * Overriding the methods `ConstraintValidatorTestCase::setUp()` and `ConstraintValidatorTestCase::tearDown()` without the `void` return-type is deprecated. + * deprecated `Symfony\Component\Validator\Mapping\Cache\CacheInterface` in favor of PSR-6. + * deprecated `ValidatorBuilder::setMetadataCache`, use `ValidatorBuilder::setMappingCache` instead. + * Marked the `ValidatorDataCollector` class as `@final`. + +4.3.0 +----- + + * added `Timezone` constraint + * added `NotCompromisedPassword` constraint + * added options `iban` and `ibanPropertyPath` to Bic constraint + * added UATP cards support to `CardSchemeValidator` + * added option `allowNull` to NotBlank constraint + * added `Json` constraint + * added `Unique` constraint + * added a new `normalizer` option to the string constraints and to the `NotBlank` constraint + * added `Positive` constraint + * added `PositiveOrZero` constraint + * added `Negative` constraint + * added `NegativeOrZero` constraint + +4.2.0 +----- + + * added a new `UnexpectedValueException` that can be thrown by constraint validators, these exceptions are caught by + the validator and are converted into constraint violations + * added `DivisibleBy` constraint + * decoupled from `symfony/translation` by using `Symfony\Contracts\Translation\TranslatorInterface` + * deprecated `ValidatorBuilderInterface` + * made `ValidatorBuilder::setTranslator()` final + * marked `format` the default option in `DateTime` constraint + * deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. + * deprecated using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl` + * deprecated using the `Email` constraint without `egulias/email-validator` + * deprecated using the `Expression` constraint without `symfony/expression-language` + +4.1.0 +----- + + * Deprecated the `checkDNS` and `dnsMessage` options of the `Url` constraint. + * added a `values` option to the `Expression` constraint + * Deprecated use of `Locale` constraint without setting `true` at "canonicalize" option, which will be the default value in 5.0 + +4.0.0 +----- + + * Setting the `strict` option of the `Choice` constraint to anything but `true` + is not supported anymore. + * removed the `DateTimeValidator::PATTERN` constant + * removed the `AbstractConstraintValidatorTest` class + * removed support for setting the `checkDNS` option of the `Url` constraint to `true` + +3.4.0 +----- + + * added support for validation groups to the `Valid` constraint + * not setting the `strict` option of the `Choice` constraint to `true` is + deprecated and will throw an exception in Symfony 4.0 + * setting the `checkDNS` option of the `Url` constraint to `true` is deprecated in favor of + the `Url::CHECK_DNS_TYPE_*` constants values and will throw an exception in Symfony 4.0 + * added min/max amount of pixels check to `Image` constraint via `minPixels` and `maxPixels` + * added a new "propertyPath" option to comparison constraints in order to get the value to compare from an array or object + +3.3.0 +----- + + * added `AddValidatorInitializersPass` + * added `AddConstraintValidatorsPass` + * added `ContainerConstraintValidatorFactory` + +3.2.0 +----- + + * deprecated `Tests\Constraints\AbstractConstraintValidatorTest` in favor of `Test\ConstraintValidatorTestCase` + * added support for PHP constants in YAML configuration files + +3.1.0 +----- + + * deprecated `DateTimeValidator::PATTERN` constant + * added a `format` option to the `DateTime` constraint + +2.8.0 +----- + + * added the BIC (SWIFT-Code) validator + +2.7.0 +----- + + * deprecated `DefaultTranslator` in favor of `Symfony\Component\Translation\IdentityTranslator` + * deprecated PHP7-incompatible constraints (Null, True, False) and related validators (NullValidator, TrueValidator, FalseValidator) in favor of their `Is`-prefixed equivalent + +2.6.0 +----- + + * [BC BREAK] `FileValidator` disallow empty files + * [BC BREAK] `UserPasswordValidator` source message change + * [BC BREAK] added internal `ExecutionContextInterface::setConstraint()` + * added `ConstraintViolation::getConstraint()` + * [BC BREAK] The `ExpressionValidator` will now evaluate the Expression even when the property value is null or an empty string + * deprecated `ClassMetadata::hasMemberMetadatas()` + * deprecated `ClassMetadata::getMemberMetadatas()` + * deprecated `ClassMetadata::addMemberMetadata()` + * [BC BREAK] added `Mapping\MetadataInterface::getConstraints()` + * added generic "payload" option to all constraints for attaching domain-specific data + * [BC BREAK] added `ConstraintViolationBuilderInterface::setCause()` + +2.5.0 +----- + + * deprecated `ApcCache` in favor of `DoctrineCache` + * added `DoctrineCache` to adapt any Doctrine cache + * `GroupSequence` now implements `ArrayAccess`, `Countable` and `Traversable` + * [BC BREAK] changed `ClassMetadata::getGroupSequence()` to return a `GroupSequence` instance instead of an array + * `Callback` can now be put onto properties (useful when you pass a closure to the constraint) + * deprecated `ClassBasedInterface` + * deprecated `MetadataInterface` + * deprecated `PropertyMetadataInterface` + * deprecated `PropertyMetadataContainerInterface` + * deprecated `Mapping\ElementMetadata` + * added `Mapping\MetadataInterface` + * added `Mapping\ClassMetadataInterface` + * added `Mapping\PropertyMetadataInterface` + * added `Mapping\GenericMetadata` + * added `Mapping\CascadingStrategy` + * added `Mapping\TraversalStrategy` + * deprecated `Mapping\ClassMetadata::accept()` + * deprecated `Mapping\MemberMetadata::accept()` + * removed array type hint of `Mapping\ClassMetadata::setGroupSequence()` + * deprecated `MetadataFactoryInterface` + * deprecated `Mapping\BlackholeMetadataFactory` + * deprecated `Mapping\ClassMetadataFactory` + * added `Mapping\Factory\MetadataFactoryInterface` + * added `Mapping\Factory\BlackHoleMetadataFactory` + * added `Mapping\Factory\LazyLoadingMetadataFactory` + * deprecated `ExecutionContextInterface` + * deprecated `ExecutionContext` + * deprecated `GlobalExecutionContextInterface` + * added `Context\ExecutionContextInterface` + * added `Context\ExecutionContext` + * added `Context\ExecutionContextFactoryInterface` + * added `Context\ExecutionContextFactory` + * deprecated `ValidatorInterface` + * deprecated `Validator` + * deprecated `ValidationVisitorInterface` + * deprecated `ValidationVisitor` + * added `Validator\ValidatorInterface` + * added `Validator\RecursiveValidator` + * added `Validator\ContextualValidatorInterface` + * added `Validator\RecursiveContextualValidator` + * added `Violation\ConstraintViolationBuilderInterface` + * added `Violation\ConstraintViolationBuilder` + * added `ConstraintViolation::getParameters()` + * added `ConstraintViolation::getPlural()` + * added `Constraints\Traverse` + * deprecated `$deep` property in `Constraints\Valid` + * added `ValidatorBuilderInterface::setApiVersion()` + * added `Validation::API_VERSION_2_4` + * added `Validation::API_VERSION_2_5` + * added `Exception\OutOfBoundsException` + * added `Exception\UnsupportedMetadataException` + * made `Exception\ValidatorException` extend `Exception\RuntimeException` + * added `Util\PropertyPath` + * made the PropertyAccess component an optional dependency + * deprecated `ValidatorBuilder::setPropertyAccessor()` + * deprecated `validate` and `validateValue` on `Validator\Context\ExecutionContext` use `getValidator()` together with `inContext()` instead + +2.4.0 +----- + + * added a constraint the uses the expression language + * added `minRatio`, `maxRatio`, `allowSquare`, `allowLandscape`, and `allowPortrait` to Image validator + +2.3.29 +------ + + * fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator) + +2.3.0 +----- + + * added the ISBN, ISSN, and IBAN validators + * copied the constraints `Optional` and `Required` to the + `Symfony\Component\Validator\Constraints\` namespace and deprecated the original + classes. + * added comparison validators (EqualTo, NotEqualTo, LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, IdenticalTo, NotIdenticalTo) + +2.2.0 +----- + + * added a CardScheme validator + * added a Luhn validator + * moved @api-tags from `Validator` to `ValidatorInterface` + * moved @api-tags from `ConstraintViolation` to the new `ConstraintViolationInterface` + * moved @api-tags from `ConstraintViolationList` to the new `ConstraintViolationListInterface` + * moved @api-tags from `ExecutionContext` to the new `ExecutionContextInterface` + * [BC BREAK] `ConstraintValidatorInterface::initialize` is now type hinted against `ExecutionContextInterface` instead of `ExecutionContext` + * [BC BREAK] changed the visibility of the properties in `Validator` from protected to private + * deprecated `ClassMetadataFactoryInterface` in favor of the new `MetadataFactoryInterface` + * deprecated `ClassMetadataFactory::getClassMetadata` in favor of `getMetadataFor` + * created `MetadataInterface`, `PropertyMetadataInterface`, `ClassBasedInterface` and `PropertyMetadataContainerInterface` + * deprecated `GraphWalker` in favor of the new `ValidationVisitorInterface` + * deprecated `ExecutionContext::addViolationAtPath` + * deprecated `ExecutionContext::addViolationAtSubPath` in favor of `ExecutionContextInterface::addViolationAt` + * deprecated `ExecutionContext::getCurrentClass` in favor of `ExecutionContextInterface::getClassName` + * deprecated `ExecutionContext::getCurrentProperty` in favor of `ExecutionContextInterface::getPropertyName` + * deprecated `ExecutionContext::getCurrentValue` in favor of `ExecutionContextInterface::getValue` + * deprecated `ExecutionContext::getGraphWalker` in favor of `ExecutionContextInterface::validate` and `ExecutionContextInterface::validateValue` + * improved `ValidatorInterface::validateValue` to accept arrays of constraints + * changed `ValidatorInterface::getMetadataFactory` to return a `MetadataFactoryInterface` instead of a `ClassMetadataFactoryInterface` + * removed `ClassMetadataFactoryInterface` type hint from `ValidatorBuilderInterface::setMetadataFactory`. + As of Symfony 2.3, this method will be typed against `MetadataFactoryInterface` instead. + * [BC BREAK] the switches `traverse` and `deep` in the `Valid` constraint and in `GraphWalker::walkReference` + are ignored for arrays now. Arrays are always traversed recursively. + * added dependency to Translation component + * violation messages are now translated with a TranslatorInterface implementation + * [BC BREAK] inserted argument `$message` in the constructor of `ConstraintViolation` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ExecutionContext` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `GraphWalker` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `ValidationVisitor` + * [BC BREAK] inserted arguments `$translator` and `$translationDomain` in the constructor of `Validator` + * [BC BREAK] added `setTranslator()` and `setTranslationDomain()` to `ValidatorBuilderInterface` + * improved the Validator to support pluralized messages by default + * [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version + * added ExceptionInterface, BadMethodCallException and InvalidArgumentException + +2.1.0 +----- + + * added support for `ctype_*` assertions in `TypeValidator` + * improved the ImageValidator with min width, max width, min height, and max height constraints + * added support for MIME with wildcard in FileValidator + * changed Collection validator to add "missing" and "extra" errors to + individual fields + * changed default value for `extraFieldsMessage` and `missingFieldsMessage` + in Collection constraint + * made ExecutionContext immutable + * deprecated Constraint methods `setMessage`, `getMessageTemplate` and + `getMessageParameters` + * added support for dynamic group sequences with the GroupSequenceProvider pattern + * [BC BREAK] ConstraintValidatorInterface method `isValid` has been renamed to + `validate`, its return value was dropped. ConstraintValidator still contains + `isValid` for BC + * [BC BREAK] collections in fields annotated with `Valid` are not traversed + recursively anymore by default. `Valid` contains a new property `deep` + which enables the BC behavior. + * added Count constraint + * added Length constraint + * added Range constraint + * deprecated the Min and Max constraints + * deprecated the MinLength and MaxLength constraints + * added Validation and ValidatorBuilderInterface + * deprecated ValidatorContext, ValidatorContextInterface and ValidatorFactory diff --git a/vendor/symfony/validator/Command/DebugCommand.php b/vendor/symfony/validator/Command/DebugCommand.php new file mode 100644 index 0000000..ad0ebba --- /dev/null +++ b/vendor/symfony/validator/Command/DebugCommand.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Command; + +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\Dumper; +use Symfony\Component\Console\Helper\Table; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Finder\Exception\DirectoryNotFoundException; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; + +/** + * A console command to debug Validators information. + * + * @author Loïc Frémont + */ +class DebugCommand extends Command +{ + protected static $defaultName = 'debug:validator'; + protected static $defaultDescription = 'Display validation constraints for classes'; + + private $validator; + + public function __construct(MetadataFactoryInterface $validator) + { + parent::__construct(); + + $this->validator = $validator; + } + + protected function configure() + { + $this + ->addArgument('class', InputArgument::REQUIRED, 'A fully qualified class name or a path') + ->addOption('show-all', null, InputOption::VALUE_NONE, 'Show all classes even if they have no validation constraints') + ->setDescription(self::$defaultDescription) + ->setHelp(<<<'EOF' +The %command.name% 'App\Entity\Dummy' command dumps the validators for the dummy class. + +The %command.name% src/ command dumps the validators for the `src` directory. +EOF + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $class = $input->getArgument('class'); + + if (class_exists($class)) { + $this->dumpValidatorsForClass($input, $output, $class); + + return 0; + } + + try { + foreach ($this->getResourcesByPath($class) as $class) { + $this->dumpValidatorsForClass($input, $output, $class); + } + } catch (DirectoryNotFoundException $exception) { + $io = new SymfonyStyle($input, $output); + $io->error(sprintf('Neither class nor path were found with "%s" argument.', $input->getArgument('class'))); + + return 1; + } + + return 0; + } + + private function dumpValidatorsForClass(InputInterface $input, OutputInterface $output, string $class): void + { + $io = new SymfonyStyle($input, $output); + $title = sprintf('%s', $class); + $rows = []; + $dump = new Dumper($output); + + foreach ($this->getConstrainedPropertiesData($class) as $propertyName => $constraintsData) { + foreach ($constraintsData as $data) { + $rows[] = [ + $propertyName, + $data['class'], + implode(', ', $data['groups']), + $dump($data['options']), + ]; + } + } + + if (!$rows) { + if (false === $input->getOption('show-all')) { + return; + } + + $io->section($title); + $io->text('No validators were found for this class.'); + + return; + } + + $io->section($title); + + $table = new Table($output); + $table->setHeaders(['Property', 'Name', 'Groups', 'Options']); + $table->setRows($rows); + $table->setColumnMaxWidth(3, 80); + $table->render(); + } + + private function getConstrainedPropertiesData(string $class): array + { + $data = []; + + /** @var ClassMetadataInterface $classMetadata */ + $classMetadata = $this->validator->getMetadataFor($class); + + foreach ($classMetadata->getConstrainedProperties() as $constrainedProperty) { + $data[$constrainedProperty] = $this->getPropertyData($classMetadata, $constrainedProperty); + } + + return $data; + } + + private function getPropertyData(ClassMetadataInterface $classMetadata, string $constrainedProperty): array + { + $data = []; + + $propertyMetadata = $classMetadata->getPropertyMetadata($constrainedProperty); + foreach ($propertyMetadata as $metadata) { + foreach ($metadata->getConstraints() as $constraint) { + $data[] = [ + 'class' => \get_class($constraint), + 'groups' => $constraint->groups, + 'options' => $this->getConstraintOptions($constraint), + ]; + } + } + + return $data; + } + + private function getConstraintOptions(Constraint $constraint): array + { + $options = []; + + foreach (array_keys(get_object_vars($constraint)) as $propertyName) { + // Groups are dumped on a specific column. + if ('groups' === $propertyName) { + continue; + } + + $options[$propertyName] = $constraint->$propertyName; + } + + ksort($options); + + return $options; + } + + private function getResourcesByPath(string $path): array + { + $finder = new Finder(); + $finder->files()->in($path)->name('*.php')->sortByName(true); + $classes = []; + + foreach ($finder as $file) { + $fileContent = file_get_contents($file->getRealPath()); + + preg_match('/namespace (.+);/', $fileContent, $matches); + + $namespace = $matches[1] ?? null; + + if (!preg_match('/class +([^{ ]+)/', $fileContent, $matches)) { + // no class found + continue; + } + + $className = trim($matches[1]); + + if (null !== $namespace) { + $classes[] = $namespace.'\\'.$className; + } else { + $classes[] = $className; + } + } + + return $classes; + } +} diff --git a/vendor/symfony/validator/Constraint.php b/vendor/symfony/validator/Constraint.php new file mode 100644 index 0000000..27ddcb8 --- /dev/null +++ b/vendor/symfony/validator/Constraint.php @@ -0,0 +1,313 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\InvalidArgumentException; +use Symfony\Component\Validator\Exception\InvalidOptionsException; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * Contains the properties of a constraint definition. + * + * A constraint can be defined on a class, a property or a getter method. + * The Constraint class encapsulates all the configuration required for + * validating this class, property or getter result successfully. + * + * Constraint instances are immutable and serializable. + * + * @author Bernhard Schussek + */ +abstract class Constraint +{ + /** + * The name of the group given to all constraints with no explicit group. + */ + public const DEFAULT_GROUP = 'Default'; + + /** + * Marks a constraint that can be put onto classes. + */ + public const CLASS_CONSTRAINT = 'class'; + + /** + * Marks a constraint that can be put onto properties. + */ + public const PROPERTY_CONSTRAINT = 'property'; + + /** + * Maps error codes to the names of their constants. + */ + protected static $errorNames = []; + + /** + * Domain-specific data attached to a constraint. + * + * @var mixed + */ + public $payload; + + /** + * The groups that the constraint belongs to. + * + * @var string[] + */ + public $groups; + + /** + * Returns the name of the given error code. + * + * @return string + * + * @throws InvalidArgumentException If the error code does not exist + */ + public static function getErrorName(string $errorCode) + { + if (!isset(static::$errorNames[$errorCode])) { + throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class)); + } + + return static::$errorNames[$errorCode]; + } + + /** + * Initializes the constraint with options. + * + * You should pass an associative array. The keys should be the names of + * existing properties in this class. The values should be the value for these + * properties. + * + * Alternatively you can override the method getDefaultOption() to return the + * name of an existing property. If no associative array is passed, this + * property is set instead. + * + * You can force that certain options are set by overriding + * getRequiredOptions() to return the names of these options. If any + * option is not set here, an exception is thrown. + * + * @param mixed $options The options (as associative array) + * or the value for the default + * option (any other type) + * @param string[] $groups An array of validation groups + * @param mixed $payload Domain-specific data attached to a constraint + * + * @throws InvalidOptionsException When you pass the names of non-existing + * options + * @throws MissingOptionsException When you don't pass any of the options + * returned by getRequiredOptions() + * @throws ConstraintDefinitionException When you don't pass an associative + * array, but getDefaultOption() returns + * null + */ + public function __construct($options = null, array $groups = null, $payload = null) + { + unset($this->groups); // enable lazy initialization + + $options = $this->normalizeOptions($options); + if (null !== $groups) { + $options['groups'] = $groups; + } + $options['payload'] = $payload ?? $options['payload'] ?? null; + + foreach ($options as $name => $value) { + $this->$name = $value; + } + } + + protected function normalizeOptions($options): array + { + $normalizedOptions = []; + $defaultOption = $this->getDefaultOption(); + $invalidOptions = []; + $missingOptions = array_flip((array) $this->getRequiredOptions()); + $knownOptions = get_class_vars(static::class); + + if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) { + if (null === $defaultOption) { + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class)); + } + + $options[$defaultOption] = $options['value']; + unset($options['value']); + } + + if (\is_array($options)) { + reset($options); + } + if ($options && \is_array($options) && \is_string(key($options))) { + foreach ($options as $option => $value) { + if (\array_key_exists($option, $knownOptions)) { + $normalizedOptions[$option] = $value; + unset($missingOptions[$option]); + } else { + $invalidOptions[] = $option; + } + } + } elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) { + if (null === $defaultOption) { + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class)); + } + + if (\array_key_exists($defaultOption, $knownOptions)) { + $normalizedOptions[$defaultOption] = $options; + unset($missingOptions[$defaultOption]); + } else { + $invalidOptions[] = $defaultOption; + } + } + + if (\count($invalidOptions) > 0) { + throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint "%s".', implode('", "', $invalidOptions), static::class), $invalidOptions); + } + + if (\count($missingOptions) > 0) { + throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint "%s".', implode('", "', array_keys($missingOptions)), static::class), array_keys($missingOptions)); + } + + return $normalizedOptions; + } + + /** + * Sets the value of a lazily initialized option. + * + * Corresponding properties are added to the object on first access. Hence + * this method will be called at most once per constraint instance and + * option name. + * + * @param mixed $value The value to set + * + * @throws InvalidOptionsException If an invalid option name is given + */ + public function __set(string $option, $value) + { + if ('groups' === $option) { + $this->groups = (array) $value; + + return; + } + + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]); + } + + /** + * Returns the value of a lazily initialized option. + * + * Corresponding properties are added to the object on first access. Hence + * this method will be called at most once per constraint instance and + * option name. + * + * @return mixed + * + * @throws InvalidOptionsException If an invalid option name is given + */ + public function __get(string $option) + { + if ('groups' === $option) { + $this->groups = [self::DEFAULT_GROUP]; + + return $this->groups; + } + + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint "%s".', $option, static::class), [$option]); + } + + /** + * @return bool + */ + public function __isset(string $option) + { + return 'groups' === $option; + } + + /** + * Adds the given group if this constraint is in the Default group. + */ + public function addImplicitGroupName(string $group) + { + if (null === $this->groups && \array_key_exists('groups', (array) $this)) { + throw new \LogicException(sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class)); + } + + if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) { + $this->groups[] = $group; + } + } + + /** + * Returns the name of the default option. + * + * Override this method to define a default option. + * + * @return string|null + * + * @see __construct() + */ + public function getDefaultOption() + { + return null; + } + + /** + * Returns the name of the required options. + * + * Override this method if you want to define required options. + * + * @return string[] + * + * @see __construct() + */ + public function getRequiredOptions() + { + return []; + } + + /** + * Returns the name of the class that validates this constraint. + * + * By default, this is the fully qualified name of the constraint class + * suffixed with "Validator". You can override this method to change that + * behavior. + * + * @return string + */ + public function validatedBy() + { + return static::class.'Validator'; + } + + /** + * Returns whether the constraint can be put onto classes, properties or + * both. + * + * This method should return one or more of the constants + * Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT. + * + * @return string|string[] One or more constant values + */ + public function getTargets() + { + return self::PROPERTY_CONSTRAINT; + } + + /** + * Optimizes the serialized value to minimize storage space. + * + * @internal + */ + public function __sleep(): array + { + // Initialize "groups" option if it is not set + $this->groups; + + return array_keys(get_object_vars($this)); + } +} diff --git a/vendor/symfony/validator/ConstraintValidator.php b/vendor/symfony/validator/ConstraintValidator.php new file mode 100644 index 0000000..1473c69 --- /dev/null +++ b/vendor/symfony/validator/ConstraintValidator.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; + +/** + * Base class for constraint validators. + * + * @author Bernhard Schussek + */ +abstract class ConstraintValidator implements ConstraintValidatorInterface +{ + /** + * Whether to format {@link \DateTime} objects, either with the {@link \IntlDateFormatter} + * (if it is available) or as RFC-3339 dates ("Y-m-d H:i:s"). + */ + public const PRETTY_DATE = 1; + + /** + * Whether to cast objects with a "__toString()" method to strings. + */ + public const OBJECT_TO_STRING = 2; + + /** + * @var ExecutionContextInterface + */ + protected $context; + + /** + * {@inheritdoc} + */ + public function initialize(ExecutionContextInterface $context) + { + $this->context = $context; + } + + /** + * Returns a string representation of the type of the value. + * + * This method should be used if you pass the type of a value as + * message parameter to a constraint violation. Note that such + * parameters should usually not be included in messages aimed at + * non-technical people. + * + * @param mixed $value The value to return the type of + * + * @return string + */ + protected function formatTypeOf($value) + { + return get_debug_type($value); + } + + /** + * Returns a string representation of the value. + * + * This method returns the equivalent PHP tokens for most scalar types + * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped + * in double quotes ("). Objects, arrays and resources are formatted as + * "object", "array" and "resource". If the $format bitmask contains + * the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted + * with the {@link \IntlDateFormatter}. If it is not available, they will be + * formatted as RFC-3339 dates ("Y-m-d H:i:s"). + * + * Be careful when passing message parameters to a constraint violation + * that (may) contain objects, arrays or resources. These parameters + * should only be displayed for technical users. Non-technical users + * won't know what an "object", "array" or "resource" is and will be + * confused by the violation message. + * + * @param mixed $value The value to format as string + * @param int $format A bitwise combination of the format + * constants in this class + * + * @return string + */ + protected function formatValue($value, int $format = 0) + { + if (($format & self::PRETTY_DATE) && $value instanceof \DateTimeInterface) { + if (class_exists(\IntlDateFormatter::class)) { + $formatter = new \IntlDateFormatter(\Locale::getDefault(), \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT, 'UTC'); + + return $formatter->format(new \DateTime( + $value->format('Y-m-d H:i:s.u'), + new \DateTimeZone('UTC') + )); + } + + return $value->format('Y-m-d H:i:s'); + } + + if (\is_object($value)) { + if (($format & self::OBJECT_TO_STRING) && method_exists($value, '__toString')) { + return $value->__toString(); + } + + return 'object'; + } + + if (\is_array($value)) { + return 'array'; + } + + if (\is_string($value)) { + return '"'.$value.'"'; + } + + if (\is_resource($value)) { + return 'resource'; + } + + if (null === $value) { + return 'null'; + } + + if (false === $value) { + return 'false'; + } + + if (true === $value) { + return 'true'; + } + + return (string) $value; + } + + /** + * Returns a string representation of a list of values. + * + * Each of the values is converted to a string using + * {@link formatValue()}. The values are then concatenated with commas. + * + * @param array $values A list of values + * @param int $format A bitwise combination of the format + * constants in this class + * + * @return string + * + * @see formatValue() + */ + protected function formatValues(array $values, int $format = 0) + { + foreach ($values as $key => $value) { + $values[$key] = $this->formatValue($value, $format); + } + + return implode(', ', $values); + } +} diff --git a/vendor/symfony/validator/ConstraintValidatorFactory.php b/vendor/symfony/validator/ConstraintValidatorFactory.php new file mode 100644 index 0000000..45f3ca9 --- /dev/null +++ b/vendor/symfony/validator/ConstraintValidatorFactory.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Constraints\ExpressionValidator; + +/** + * Default implementation of the ConstraintValidatorFactoryInterface. + * + * This enforces the convention that the validatedBy() method on any + * Constraint will return the class name of the ConstraintValidator that + * should validate the Constraint. + * + * @author Bernhard Schussek + */ +class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface +{ + protected $validators = []; + + public function __construct() + { + } + + /** + * {@inheritdoc} + */ + public function getInstance(Constraint $constraint) + { + $className = $constraint->validatedBy(); + + if (!isset($this->validators[$className])) { + $this->validators[$className] = 'validator.expression' === $className + ? new ExpressionValidator() + : new $className(); + } + + return $this->validators[$className]; + } +} diff --git a/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php b/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php new file mode 100644 index 0000000..b647645 --- /dev/null +++ b/vendor/symfony/validator/ConstraintValidatorFactoryInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Specifies an object able to return the correct ConstraintValidatorInterface + * instance given a Constraint object. + */ +interface ConstraintValidatorFactoryInterface +{ + /** + * Given a Constraint, this returns the ConstraintValidatorInterface + * object that should be used to verify its validity. + * + * @return ConstraintValidatorInterface + */ + public function getInstance(Constraint $constraint); +} diff --git a/vendor/symfony/validator/ConstraintValidatorInterface.php b/vendor/symfony/validator/ConstraintValidatorInterface.php new file mode 100644 index 0000000..308c1e6 --- /dev/null +++ b/vendor/symfony/validator/ConstraintValidatorInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; + +/** + * @author Bernhard Schussek + */ +interface ConstraintValidatorInterface +{ + /** + * Initializes the constraint validator. + */ + public function initialize(ExecutionContextInterface $context); + + /** + * Checks if the passed value is valid. + * + * @param mixed $value The value that should be validated + */ + public function validate($value, Constraint $constraint); +} diff --git a/vendor/symfony/validator/ConstraintViolation.php b/vendor/symfony/validator/ConstraintViolation.php new file mode 100644 index 0000000..33aa42a --- /dev/null +++ b/vendor/symfony/validator/ConstraintViolation.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Default implementation of {@ConstraintViolationInterface}. + * + * @author Bernhard Schussek + */ +class ConstraintViolation implements ConstraintViolationInterface +{ + private $message; + private $messageTemplate; + private $parameters; + private $plural; + private $root; + private $propertyPath; + private $invalidValue; + private $constraint; + private $code; + private $cause; + + /** + * Creates a new constraint violation. + * + * @param string|\Stringable $message The violation message as a string or a stringable object + * @param string|null $messageTemplate The raw violation message + * @param array $parameters The parameters to substitute in the + * raw violation message + * @param mixed $root The value originally passed to the + * validator + * @param string|null $propertyPath The property path from the root + * value to the invalid value + * @param mixed $invalidValue The invalid value that caused this + * violation + * @param int|null $plural The number for determining the plural + * form when translating the message + * @param string|null $code The error code of the violation + * @param Constraint|null $constraint The constraint whose validation + * caused the violation + * @param mixed $cause The cause of the violation + */ + public function __construct($message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, string $code = null, Constraint $constraint = null, $cause = null) + { + if (!\is_string($message) && !(\is_object($message) && method_exists($message, '__toString'))) { + throw new \TypeError('Constraint violation message should be a string or an object which implements the __toString() method.'); + } + + $this->message = $message; + $this->messageTemplate = $messageTemplate; + $this->parameters = $parameters; + $this->plural = $plural; + $this->root = $root; + $this->propertyPath = $propertyPath; + $this->invalidValue = $invalidValue; + $this->constraint = $constraint; + $this->code = $code; + $this->cause = $cause; + } + + /** + * Converts the violation into a string for debugging purposes. + * + * @return string + */ + public function __toString() + { + if (\is_object($this->root)) { + $class = 'Object('.\get_class($this->root).')'; + } elseif (\is_array($this->root)) { + $class = 'Array'; + } else { + $class = (string) $this->root; + } + + $propertyPath = (string) $this->propertyPath; + + if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) { + $class .= '.'; + } + + if (null !== ($code = $this->code) && '' !== $code) { + $code = ' (code '.$code.')'; + } + + return $class.$propertyPath.":\n ".$this->getMessage().$code; + } + + /** + * {@inheritdoc} + */ + public function getMessageTemplate() + { + return (string) $this->messageTemplate; + } + + /** + * {@inheritdoc} + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * {@inheritdoc} + */ + public function getPlural() + { + return $this->plural; + } + + /** + * {@inheritdoc} + */ + public function getMessage() + { + return $this->message; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->root; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath() + { + return (string) $this->propertyPath; + } + + /** + * {@inheritdoc} + */ + public function getInvalidValue() + { + return $this->invalidValue; + } + + /** + * Returns the constraint whose validation caused the violation. + * + * @return Constraint|null + */ + public function getConstraint() + { + return $this->constraint; + } + + /** + * Returns the cause of the violation. + * + * @return mixed + */ + public function getCause() + { + return $this->cause; + } + + /** + * {@inheritdoc} + */ + public function getCode() + { + return $this->code; + } +} diff --git a/vendor/symfony/validator/ConstraintViolationInterface.php b/vendor/symfony/validator/ConstraintViolationInterface.php new file mode 100644 index 0000000..fd7d414 --- /dev/null +++ b/vendor/symfony/validator/ConstraintViolationInterface.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A violation of a constraint that happened during validation. + * + * For each constraint that fails during validation one or more violations are + * created. The violations store the violation message, the path to the failing + * element in the validation graph and the root element that was originally + * passed to the validator. For example, take the following graph: + * + * (Person)---(firstName: string) + * \ + * (address: Address)---(street: string) + * + * If the Person object is validated and validation fails for the + * "firstName" property, the generated violation has the Person + * instance as root and the property path "firstName". If validation fails + * for the "street" property of the related Address instance, the root + * element is still the person, but the property path is "address.street". + * + * @author Bernhard Schussek + */ +interface ConstraintViolationInterface +{ + /** + * Returns the violation message. + * + * @return string|\Stringable + */ + public function getMessage(); + + /** + * Returns the raw violation message. + * + * The raw violation message contains placeholders for the parameters + * returned by {@link getParameters}. Typically you'll pass the + * message template and parameters to a translation engine. + * + * @return string The raw violation message + */ + public function getMessageTemplate(); + + /** + * Returns the parameters to be inserted into the raw violation message. + * + * @return array a possibly empty list of parameters indexed by the names + * that appear in the message template + * + * @see getMessageTemplate() + */ + public function getParameters(); + + /** + * Returns a number for pluralizing the violation message. + * + * For example, the message template could have different translation based + * on a parameter "choices": + * + *
    + *
  • Please select exactly one entry. (choices=1)
  • + *
  • Please select two entries. (choices=2)
  • + *
+ * + * This method returns the value of the parameter for choosing the right + * pluralization form (in this case "choices"). + * + * @return int|null The number to use to pluralize of the message + */ + public function getPlural(); + + /** + * Returns the root element of the validation. + * + * @return mixed The value that was passed originally to the validator when + * the validation was started. Because the validator traverses + * the object graph, the value at which the violation occurs + * is not necessarily the value that was originally validated. + */ + public function getRoot(); + + /** + * Returns the property path from the root element to the violation. + * + * @return string The property path indicates how the validator reached + * the invalid value from the root element. If the root + * element is a Person instance with a property + * "address" that contains an Address instance + * with an invalid property "street", the generated property + * path is "address.street". Property access is denoted by + * dots, while array access is denoted by square brackets, + * for example "addresses[1].street". + */ + public function getPropertyPath(); + + /** + * Returns the value that caused the violation. + * + * @return mixed the invalid value that caused the validated constraint to + * fail + */ + public function getInvalidValue(); + + /** + * Returns a machine-digestible error code for the violation. + * + * @return string|null + */ + public function getCode(); +} diff --git a/vendor/symfony/validator/ConstraintViolationList.php b/vendor/symfony/validator/ConstraintViolationList.php new file mode 100644 index 0000000..3d459b2 --- /dev/null +++ b/vendor/symfony/validator/ConstraintViolationList.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Default implementation of {@ConstraintViolationListInterface}. + * + * @author Bernhard Schussek + * + * @implements \IteratorAggregate + */ +class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface +{ + /** + * @var list + */ + private $violations = []; + + /** + * Creates a new constraint violation list. + * + * @param iterable $violations The constraint violations to add to the list + */ + public function __construct(iterable $violations = []) + { + foreach ($violations as $violation) { + $this->add($violation); + } + } + + public static function createFromMessage(string $message): self + { + $self = new self(); + $self->add(new ConstraintViolation($message, '', [], null, '', null)); + + return $self; + } + + /** + * Converts the violation into a string for debugging purposes. + * + * @return string + */ + public function __toString() + { + $string = ''; + + foreach ($this->violations as $violation) { + $string .= $violation."\n"; + } + + return $string; + } + + /** + * {@inheritdoc} + */ + public function add(ConstraintViolationInterface $violation) + { + $this->violations[] = $violation; + } + + /** + * {@inheritdoc} + */ + public function addAll(ConstraintViolationListInterface $otherList) + { + foreach ($otherList as $violation) { + $this->violations[] = $violation; + } + } + + /** + * {@inheritdoc} + */ + public function get(int $offset) + { + if (!isset($this->violations[$offset])) { + throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset)); + } + + return $this->violations[$offset]; + } + + /** + * {@inheritdoc} + */ + public function has(int $offset) + { + return isset($this->violations[$offset]); + } + + /** + * {@inheritdoc} + */ + public function set(int $offset, ConstraintViolationInterface $violation) + { + $this->violations[$offset] = $violation; + } + + /** + * {@inheritdoc} + */ + public function remove(int $offset) + { + unset($this->violations[$offset]); + } + + /** + * {@inheritdoc} + * + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new \ArrayIterator($this->violations); + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->violations); + } + + /** + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return $this->has($offset); + } + + /** + * {@inheritdoc} + * + * @return ConstraintViolationInterface + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * {@inheritdoc} + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $violation) + { + if (null === $offset) { + $this->add($violation); + } else { + $this->set($offset, $violation); + } + } + + /** + * {@inheritdoc} + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + $this->remove($offset); + } + + /** + * Creates iterator for errors with specific codes. + * + * @param string|string[] $codes The codes to find + * + * @return static + */ + public function findByCodes($codes) + { + $codes = (array) $codes; + $violations = []; + foreach ($this as $violation) { + if (\in_array($violation->getCode(), $codes, true)) { + $violations[] = $violation; + } + } + + return new static($violations); + } +} diff --git a/vendor/symfony/validator/ConstraintViolationListInterface.php b/vendor/symfony/validator/ConstraintViolationListInterface.php new file mode 100644 index 0000000..f994668 --- /dev/null +++ b/vendor/symfony/validator/ConstraintViolationListInterface.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * A list of constraint violations. + * + * @author Bernhard Schussek + * + * @extends \ArrayAccess + * @extends \Traversable + */ +interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess +{ + /** + * Adds a constraint violation to this list. + */ + public function add(ConstraintViolationInterface $violation); + + /** + * Merges an existing violation list into this list. + */ + public function addAll(self $otherList); + + /** + * Returns the violation at a given offset. + * + * @param int $offset The offset of the violation + * + * @return ConstraintViolationInterface + * + * @throws \OutOfBoundsException if the offset does not exist + */ + public function get(int $offset); + + /** + * Returns whether the given offset exists. + * + * @param int $offset The violation offset + * + * @return bool + */ + public function has(int $offset); + + /** + * Sets a violation at a given offset. + * + * @param int $offset The violation offset + */ + public function set(int $offset, ConstraintViolationInterface $violation); + + /** + * Removes a violation at a given offset. + * + * @param int $offset The offset to remove + */ + public function remove(int $offset); +} diff --git a/vendor/symfony/validator/Constraints/AbstractComparison.php b/vendor/symfony/validator/Constraints/AbstractComparison.php new file mode 100644 index 0000000..d492655 --- /dev/null +++ b/vendor/symfony/validator/Constraints/AbstractComparison.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * Used for the comparison of values. + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +abstract class AbstractComparison extends Constraint +{ + public $message; + public $value; + public $propertyPath; + + /** + * {@inheritdoc} + * + * @param mixed $value the value to compare or a set of options + */ + public function __construct($value = null, $propertyPath = null, string $message = null, array $groups = null, $payload = null, array $options = []) + { + if (\is_array($value)) { + $options = array_merge($value, $options); + } elseif (null !== $value) { + $options['value'] = $value; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->propertyPath = $propertyPath ?? $this->propertyPath; + + if (null === $this->value && null === $this->propertyPath) { + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', static::class)); + } + + if (null !== $this->value && null !== $this->propertyPath) { + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', static::class)); + } + + if (null !== $this->propertyPath && !class_exists(PropertyAccess::class)) { + throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "propertyPath" option.', static::class)); + } + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'value'; + } +} diff --git a/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php b/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php new file mode 100644 index 0000000..c3a117d --- /dev/null +++ b/vendor/symfony/validator/Constraints/AbstractComparisonValidator.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Provides a base class for the validation of property comparisons. + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +abstract class AbstractComparisonValidator extends ConstraintValidator +{ + private $propertyAccessor; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof AbstractComparison) { + throw new UnexpectedTypeException($constraint, AbstractComparison::class); + } + + if (null === $value) { + return; + } + + if ($path = $constraint->propertyPath) { + if (null === $object = $this->context->getObject()) { + return; + } + + try { + $comparedValue = $this->getPropertyAccessor()->getValue($object, $path); + } catch (NoSuchPropertyException $e) { + throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } + } else { + $comparedValue = $constraint->value; + } + + // Convert strings to DateTimes if comparing another DateTime + // This allows to compare with any date/time value supported by + // the DateTime constructor: + // https://php.net/datetime.formats + if (\is_string($comparedValue) && $value instanceof \DateTimeInterface) { + // If $value is immutable, convert the compared value to a DateTimeImmutable too, otherwise use DateTime + $dateTimeClass = $value instanceof \DateTimeImmutable ? \DateTimeImmutable::class : \DateTime::class; + + try { + $comparedValue = new $dateTimeClass($comparedValue); + } catch (\Exception $e) { + throw new ConstraintDefinitionException(sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, $dateTimeClass, get_debug_type($constraint))); + } + } + + if (!$this->compareValues($value, $comparedValue)) { + $violationBuilder = $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value }}', $this->formatValue($comparedValue, self::OBJECT_TO_STRING | self::PRETTY_DATE)) + ->setParameter('{{ compared_value_type }}', $this->formatTypeOf($comparedValue)) + ->setCode($this->getErrorCode()); + + if (null !== $path) { + $violationBuilder->setParameter('{{ compared_value_path }}', $path); + } + + $violationBuilder->addViolation(); + } + } + + private function getPropertyAccessor(): PropertyAccessorInterface + { + if (null === $this->propertyAccessor) { + $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + return $this->propertyAccessor; + } + + /** + * Compares the two given values to find if their relationship is valid. + * + * @param mixed $value1 The first value to compare + * @param mixed $value2 The second value to compare + * + * @return bool + */ + abstract protected function compareValues($value1, $value2); + + /** + * Returns the error code used if the comparison fails. + * + * @return string|null + */ + protected function getErrorCode() + { + return null; + } +} diff --git a/vendor/symfony/validator/Constraints/All.php b/vendor/symfony/validator/Constraints/All.php new file mode 100644 index 0000000..5b42976 --- /dev/null +++ b/vendor/symfony/validator/Constraints/All.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class All extends Composite +{ + public $constraints = []; + + public function __construct($constraints = null, array $groups = null, $payload = null) + { + parent::__construct($constraints ?? [], $groups, $payload); + } + + public function getDefaultOption() + { + return 'constraints'; + } + + public function getRequiredOptions() + { + return ['constraints']; + } + + protected function getCompositeOption() + { + return 'constraints'; + } +} diff --git a/vendor/symfony/validator/Constraints/AllValidator.php b/vendor/symfony/validator/Constraints/AllValidator.php new file mode 100644 index 0000000..611ac8d --- /dev/null +++ b/vendor/symfony/validator/Constraints/AllValidator.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class AllValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof All) { + throw new UnexpectedTypeException($constraint, All::class); + } + + if (null === $value) { + return; + } + + if (!\is_array($value) && !$value instanceof \Traversable) { + throw new UnexpectedValueException($value, 'iterable'); + } + + $context = $this->context; + + $validator = $context->getValidator()->inContext($context); + + foreach ($value as $key => $element) { + $validator->atPath('['.$key.']')->validate($element, $constraint->constraints); + } + } +} diff --git a/vendor/symfony/validator/Constraints/AtLeastOneOf.php b/vendor/symfony/validator/Constraints/AtLeastOneOf.php new file mode 100644 index 0000000..f01ed9c --- /dev/null +++ b/vendor/symfony/validator/Constraints/AtLeastOneOf.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Przemysław Bogusz + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class AtLeastOneOf extends Composite +{ + public const AT_LEAST_ONE_OF_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c'; + + protected static $errorNames = [ + self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR', + ]; + + public $constraints = []; + public $message = 'This value should satisfy at least one of the following constraints:'; + public $messageCollection = 'Each element of this collection should satisfy its own set of constraints.'; + public $includeInternalMessages = true; + + public function __construct($constraints = null, array $groups = null, $payload = null, string $message = null, string $messageCollection = null, bool $includeInternalMessages = null) + { + parent::__construct($constraints ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + $this->messageCollection = $messageCollection ?? $this->messageCollection; + $this->includeInternalMessages = $includeInternalMessages ?? $this->includeInternalMessages; + } + + public function getDefaultOption() + { + return 'constraints'; + } + + public function getRequiredOptions() + { + return ['constraints']; + } + + protected function getCompositeOption() + { + return 'constraints'; + } +} diff --git a/vendor/symfony/validator/Constraints/AtLeastOneOfValidator.php b/vendor/symfony/validator/Constraints/AtLeastOneOfValidator.php new file mode 100644 index 0000000..9555851 --- /dev/null +++ b/vendor/symfony/validator/Constraints/AtLeastOneOfValidator.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Przemysław Bogusz + */ +class AtLeastOneOfValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof AtLeastOneOf) { + throw new UnexpectedTypeException($constraint, AtLeastOneOf::class); + } + + $validator = $this->context->getValidator(); + + $messages = [$constraint->message]; + + foreach ($constraint->constraints as $key => $item) { + $executionContext = clone $this->context; + $executionContext->setNode($value, $this->context->getObject(), $this->context->getMetadata(), $this->context->getPropertyPath()); + $violations = $validator->inContext($executionContext)->validate($value, $item, $this->context->getGroup())->getViolations(); + + if (\count($this->context->getViolations()) === \count($violations)) { + return; + } + + if ($constraint->includeInternalMessages) { + $message = ' ['.($key + 1).'] '; + + if ($item instanceof All || $item instanceof Collection) { + $message .= $constraint->messageCollection; + } else { + $message .= $violations->get(\count($violations) - 1)->getMessage(); + } + + $messages[] = $message; + } + } + + $this->context->buildViolation(implode('', $messages)) + ->setCode(AtLeastOneOf::AT_LEAST_ONE_OF_ERROR) + ->addViolation() + ; + } +} diff --git a/vendor/symfony/validator/Constraints/Bic.php b/vendor/symfony/validator/Constraints/Bic.php new file mode 100644 index 0000000..1cd98b4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Bic.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Countries; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyPathInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Michael Hirschler + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Bic extends Constraint +{ + public const INVALID_LENGTH_ERROR = '66dad313-af0b-4214-8566-6c799be9789c'; + public const INVALID_CHARACTERS_ERROR = 'f424c529-7add-4417-8f2d-4b656e4833e2'; + public const INVALID_BANK_CODE_ERROR = '00559357-6170-4f29-aebd-d19330aa19cf'; + public const INVALID_COUNTRY_CODE_ERROR = '1ce76f8d-3c1f-451c-9e62-fe9c3ed486ae'; + public const INVALID_CASE_ERROR = '11884038-3312-4ae5-9d04-699f782130c7'; + public const INVALID_IBAN_COUNTRY_CODE_ERROR = '29a2c3bb-587b-4996-b6f5-53081364cea5'; + + protected static $errorNames = [ + self::INVALID_LENGTH_ERROR => 'INVALID_LENGTH_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_BANK_CODE_ERROR => 'INVALID_BANK_CODE_ERROR', + self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', + self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', + ]; + + public $message = 'This is not a valid Business Identifier Code (BIC).'; + public $ibanMessage = 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.'; + public $iban; + public $ibanPropertyPath; + + /** + * {@inheritdoc} + * + * @param string|PropertyPathInterface|null $ibanPropertyPath + */ + public function __construct(array $options = null, string $message = null, string $iban = null, $ibanPropertyPath = null, string $ibanMessage = null, array $groups = null, $payload = null) + { + if (!class_exists(Countries::class)) { + throw new LogicException('The Intl component is required to use the Bic constraint. Try running "composer require symfony/intl".'); + } + if (null !== $ibanPropertyPath && !\is_string($ibanPropertyPath) && !$ibanPropertyPath instanceof PropertyPathInterface) { + throw new \TypeError(sprintf('"%s": Expected argument $ibanPropertyPath to be either null, a string or an instance of "%s", got "%s".', __METHOD__, PropertyPathInterface::class, get_debug_type($ibanPropertyPath))); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->ibanMessage = $ibanMessage ?? $this->ibanMessage; + $this->iban = $iban ?? $this->iban; + $this->ibanPropertyPath = $ibanPropertyPath ?? $this->ibanPropertyPath; + + if (null !== $this->iban && null !== $this->ibanPropertyPath) { + throw new ConstraintDefinitionException('The "iban" and "ibanPropertyPath" options of the Iban constraint cannot be used at the same time.'); + } + + if (null !== $this->ibanPropertyPath && !class_exists(PropertyAccess::class)) { + throw new LogicException(sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option.', self::class)); + } + } +} diff --git a/vendor/symfony/validator/Constraints/BicValidator.php b/vendor/symfony/validator/Constraints/BicValidator.php new file mode 100644 index 0000000..ff87b6e --- /dev/null +++ b/vendor/symfony/validator/Constraints/BicValidator.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Countries; +use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessor; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\LogicException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Michael Hirschler + * + * @see https://en.wikipedia.org/wiki/ISO_9362#Structure + */ +class BicValidator extends ConstraintValidator +{ + private const BIC_COUNTRY_TO_IBAN_COUNTRY_MAP = [ + // Reference: https://www.ecbs.org/iban/france-bank-account-number.html + 'GF' => 'FR', // French Guiana + 'PF' => 'FR', // French Polynesia + 'TF' => 'FR', // French Southern Territories + 'GP' => 'FR', // Guadeloupe + 'MQ' => 'FR', // Martinique + 'YT' => 'FR', // Mayotte + 'NC' => 'FR', // New Caledonia + 'RE' => 'FR', // Reunion + 'PM' => 'FR', // Saint Pierre and Miquelon + 'WF' => 'FR', // Wallis and Futuna Islands + // Reference: https://www.ecbs.org/iban/united-kingdom-uk-bank-account-number.html + 'JE' => 'GB', // Jersey + 'IM' => 'GB', // Isle of Man + 'GG' => 'GB', // Guernsey + 'VG' => 'GB', // British Virgin Islands + ]; + + private $propertyAccessor; + + public function __construct(PropertyAccessor $propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Bic) { + throw new UnexpectedTypeException($constraint, Bic::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $canonicalize = str_replace(' ', '', $value); + + // the bic must be either 8 or 11 characters long + if (!\in_array(\strlen($canonicalize), [8, 11])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Bic::INVALID_LENGTH_ERROR) + ->addViolation(); + + return; + } + + // must contain alphanumeric values only + if (!ctype_alnum($canonicalize)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Bic::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + // first 4 letters must be alphabetic (bank code) + if (!ctype_alpha(substr($canonicalize, 0, 4))) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Bic::INVALID_BANK_CODE_ERROR) + ->addViolation(); + + return; + } + + if (!Countries::exists(substr($canonicalize, 4, 2))) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Bic::INVALID_COUNTRY_CODE_ERROR) + ->addViolation(); + + return; + } + + // should contain uppercase characters only + if (strtoupper($canonicalize) !== $canonicalize) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Bic::INVALID_CASE_ERROR) + ->addViolation(); + + return; + } + + // check against an IBAN + $iban = $constraint->iban; + $path = $constraint->ibanPropertyPath; + if ($path && null !== $object = $this->context->getObject()) { + try { + $iban = $this->getPropertyAccessor()->getValue($object, $path); + } catch (NoSuchPropertyException $e) { + throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } + } + if (!$iban) { + return; + } + $ibanCountryCode = substr($iban, 0, 2); + if (ctype_alpha($ibanCountryCode) && !$this->bicAndIbanCountriesMatch(substr($canonicalize, 4, 2), $ibanCountryCode)) { + $this->context->buildViolation($constraint->ibanMessage) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ iban }}', $iban) + ->setCode(Bic::INVALID_IBAN_COUNTRY_CODE_ERROR) + ->addViolation(); + } + } + + private function getPropertyAccessor(): PropertyAccessor + { + if (null === $this->propertyAccessor) { + if (!class_exists(PropertyAccess::class)) { + throw new LogicException('Unable to use property path as the Symfony PropertyAccess component is not installed.'); + } + $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + return $this->propertyAccessor; + } + + private function bicAndIbanCountriesMatch(string $bicCountryCode, string $ibanCountryCode): bool + { + return $ibanCountryCode === $bicCountryCode || $ibanCountryCode === (self::BIC_COUNTRY_TO_IBAN_COUNTRY_MAP[$bicCountryCode] ?? null); + } +} diff --git a/vendor/symfony/validator/Constraints/Blank.php b/vendor/symfony/validator/Constraints/Blank.php new file mode 100644 index 0000000..a9ee525 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Blank.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Blank extends Constraint +{ + public const NOT_BLANK_ERROR = '183ad2de-533d-4796-a439-6d3c3852b549'; + + protected static $errorNames = [ + self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR', + ]; + + public $message = 'This value should be blank.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/BlankValidator.php b/vendor/symfony/validator/Constraints/BlankValidator.php new file mode 100644 index 0000000..3fd7fcc --- /dev/null +++ b/vendor/symfony/validator/Constraints/BlankValidator.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class BlankValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Blank) { + throw new UnexpectedTypeException($constraint, Blank::class); + } + + if ('' !== $value && null !== $value) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Blank::NOT_BLANK_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Callback.php b/vendor/symfony/validator/Constraints/Callback.php new file mode 100644 index 0000000..7b9c3c3 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Callback.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Callback extends Constraint +{ + /** + * @var string|callable + */ + public $callback; + + /** + * {@inheritdoc} + * + * @param array|string|callable $callback The callback or a set of options + */ + public function __construct($callback = null, array $groups = null, $payload = null, array $options = []) + { + // Invocation through annotations with an array parameter only + if (\is_array($callback) && 1 === \count($callback) && isset($callback['value'])) { + $callback = $callback['value']; + } + + if (!\is_array($callback) || (!isset($callback['callback']) && !isset($callback['groups']) && !isset($callback['payload']))) { + $options['callback'] = $callback; + } else { + $options = array_merge($callback, $options); + } + + parent::__construct($options, $groups, $payload); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'callback'; + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; + } +} diff --git a/vendor/symfony/validator/Constraints/CallbackValidator.php b/vendor/symfony/validator/Constraints/CallbackValidator.php new file mode 100644 index 0000000..71cff2a --- /dev/null +++ b/vendor/symfony/validator/Constraints/CallbackValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validator for Callback constraint. + * + * @author Bernhard Schussek + */ +class CallbackValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($object, Constraint $constraint) + { + if (!$constraint instanceof Callback) { + throw new UnexpectedTypeException($constraint, Callback::class); + } + + $method = $constraint->callback; + if ($method instanceof \Closure) { + $method($object, $this->context, $constraint->payload); + } elseif (\is_array($method)) { + if (!\is_callable($method)) { + if (isset($method[0]) && \is_object($method[0])) { + $method[0] = \get_class($method[0]); + } + throw new ConstraintDefinitionException(json_encode($method).' targeted by Callback constraint is not a valid callable.'); + } + + $method($object, $this->context, $constraint->payload); + } elseif (null !== $object) { + if (!method_exists($object, $method)) { + throw new ConstraintDefinitionException(sprintf('Method "%s" targeted by Callback constraint does not exist in class "%s".', $method, get_debug_type($object))); + } + + $reflMethod = new \ReflectionMethod($object, $method); + + if ($reflMethod->isStatic()) { + $reflMethod->invoke(null, $object, $this->context, $constraint->payload); + } else { + $reflMethod->invoke($object, $this->context, $constraint->payload); + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/CardScheme.php b/vendor/symfony/validator/Constraints/CardScheme.php new file mode 100644 index 0000000..e9d66b9 --- /dev/null +++ b/vendor/symfony/validator/Constraints/CardScheme.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * Metadata for the CardSchemeValidator. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Tim Nagel + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class CardScheme extends Constraint +{ + public const AMEX = 'AMEX'; + public const CHINA_UNIONPAY = 'CHINA_UNIONPAY'; + public const DINERS = 'DINERS'; + public const DISCOVER = 'DISCOVER'; + public const INSTAPAYMENT = 'INSTAPAYMENT'; + public const JCB = 'JCB'; + public const LASER = 'LASER'; + public const MAESTRO = 'MAESTRO'; + public const MASTERCARD = 'MASTERCARD'; + public const MIR = 'MIR'; + public const UATP = 'UATP'; + public const VISA = 'VISA'; + + public const NOT_NUMERIC_ERROR = 'a2ad9231-e827-485f-8a1e-ef4d9a6d5c2e'; + public const INVALID_FORMAT_ERROR = 'a8faedbf-1c2f-4695-8d22-55783be8efed'; + + protected static $errorNames = [ + self::NOT_NUMERIC_ERROR => 'NOT_NUMERIC_ERROR', + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + ]; + + public $message = 'Unsupported card type or invalid card number.'; + public $schemes; + + /** + * {@inheritdoc} + * + * @param array|string $schemes The schemes to validate against or a set of options + */ + public function __construct($schemes, string $message = null, array $groups = null, $payload = null, array $options = []) + { + if (\is_array($schemes) && \is_string(key($schemes))) { + $options = array_merge($schemes, $options); + } else { + $options['value'] = $schemes; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } + + public function getDefaultOption() + { + return 'schemes'; + } + + public function getRequiredOptions() + { + return ['schemes']; + } +} diff --git a/vendor/symfony/validator/Constraints/CardSchemeValidator.php b/vendor/symfony/validator/Constraints/CardSchemeValidator.php new file mode 100644 index 0000000..faef7ec --- /dev/null +++ b/vendor/symfony/validator/Constraints/CardSchemeValidator.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates that a card number belongs to a specified scheme. + * + * @author Tim Nagel + * @author Bernhard Schussek + * + * @see https://en.wikipedia.org/wiki/Payment_card_number + * @see https://www.regular-expressions.info/creditcard.html + */ +class CardSchemeValidator extends ConstraintValidator +{ + protected $schemes = [ + // American Express card numbers start with 34 or 37 and have 15 digits. + CardScheme::AMEX => [ + '/^3[47][0-9]{13}$/', + ], + // China UnionPay cards start with 62 and have between 16 and 19 digits. + // Please note that these cards do not follow Luhn Algorithm as a checksum. + CardScheme::CHINA_UNIONPAY => [ + '/^62[0-9]{14,17}$/', + ], + // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. + // There are Diners Club cards that begin with 5 and have 16 digits. + // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard. + CardScheme::DINERS => [ + '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', + ], + // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. + // All have 16 digits. + CardScheme::DISCOVER => [ + '/^6011[0-9]{12}$/', + '/^64[4-9][0-9]{13}$/', + '/^65[0-9]{14}$/', + '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', + ], + // InstaPayment cards begin with 637 through 639 and have 16 digits. + CardScheme::INSTAPAYMENT => [ + '/^63[7-9][0-9]{13}$/', + ], + // JCB cards beginning with 2131 or 1800 have 15 digits. + // JCB cards beginning with 35 have 16 digits. + CardScheme::JCB => [ + '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', + ], + // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits. + CardScheme::LASER => [ + '/^(6304|670[69]|6771)[0-9]{12,15}$/', + ], + // Maestro international cards begin with 675900..675999 and have between 12 and 19 digits. + // Maestro UK cards begin with either 500000..509999 or 560000..699999 and have between 12 and 19 digits. + CardScheme::MAESTRO => [ + '/^(6759[0-9]{2})[0-9]{6,13}$/', + '/^(50[0-9]{4})[0-9]{6,13}$/', + '/^5[6-9][0-9]{10,17}$/', + '/^6[0-9]{11,18}$/', + ], + // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. + // October 2016 MasterCard numbers can also start with 222100 through 272099. + CardScheme::MASTERCARD => [ + '/^5[1-5][0-9]{14}$/', + '/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/', + ], + // Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then between 12 and 15 digits + CardScheme::MIR => [ + '/^220[0-4][0-9]{12,15}$/', + ], + // All UATP card numbers start with a 1 and have a length of 15 digits. + CardScheme::UATP => [ + '/^1[0-9]{14}$/', + ], + // All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits. + CardScheme::VISA => [ + '/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/', + ], + ]; + + /** + * Validates a creditcard belongs to a specified scheme. + * + * @param mixed $value + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof CardScheme) { + throw new UnexpectedTypeException($constraint, CardScheme::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_numeric($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::NOT_NUMERIC_ERROR) + ->addViolation(); + + return; + } + + $schemes = array_flip((array) $constraint->schemes); + $schemeRegexes = array_intersect_key($this->schemes, $schemes); + + foreach ($schemeRegexes as $regexes) { + foreach ($regexes as $regex) { + if (preg_match($regex, $value)) { + return; + } + } + } + + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CardScheme::INVALID_FORMAT_ERROR) + ->addViolation(); + } +} diff --git a/vendor/symfony/validator/Constraints/Cascade.php b/vendor/symfony/validator/Constraints/Cascade.php new file mode 100644 index 0000000..2458d5c --- /dev/null +++ b/vendor/symfony/validator/Constraints/Cascade.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"CLASS"}) + * + * @author Jules Pietri + */ +#[\Attribute(\Attribute::TARGET_CLASS)] +class Cascade extends Constraint +{ + public function __construct(array $options = null) + { + if (\is_array($options) && \array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__)); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/vendor/symfony/validator/Constraints/Choice.php b/vendor/symfony/validator/Constraints/Choice.php new file mode 100644 index 0000000..b5bcc6d --- /dev/null +++ b/vendor/symfony/validator/Constraints/Choice.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Choice extends Constraint +{ + public const NO_SUCH_CHOICE_ERROR = '8e179f1b-97aa-4560-a02f-2a8b42e49df7'; + public const TOO_FEW_ERROR = '11edd7eb-5872-4b6e-9f12-89923999fd0e'; + public const TOO_MANY_ERROR = '9bd98e49-211c-433f-8630-fd1c2d0f08c3'; + + protected static $errorNames = [ + self::NO_SUCH_CHOICE_ERROR => 'NO_SUCH_CHOICE_ERROR', + self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', + self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', + ]; + + public $choices; + public $callback; + public $multiple = false; + public $strict = true; + public $min; + public $max; + public $message = 'The value you selected is not a valid choice.'; + public $multipleMessage = 'One or more of the given values is invalid.'; + public $minMessage = 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.'; + public $maxMessage = 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.'; + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'choices'; + } + + public function __construct( + $options = [], + array $choices = null, + $callback = null, + bool $multiple = null, + bool $strict = null, + int $min = null, + int $max = null, + string $message = null, + string $multipleMessage = null, + string $minMessage = null, + string $maxMessage = null, + $groups = null, + $payload = null + ) { + if (\is_array($options) && $options && array_is_list($options)) { + $choices = $choices ?? $options; + $options = []; + } + if (null !== $choices) { + $options['value'] = $choices; + } + + parent::__construct($options, $groups, $payload); + + $this->callback = $callback ?? $this->callback; + $this->multiple = $multiple ?? $this->multiple; + $this->strict = $strict ?? $this->strict; + $this->min = $min ?? $this->min; + $this->max = $max ?? $this->max; + $this->message = $message ?? $this->message; + $this->multipleMessage = $multipleMessage ?? $this->multipleMessage; + $this->minMessage = $minMessage ?? $this->minMessage; + $this->maxMessage = $maxMessage ?? $this->maxMessage; + } +} diff --git a/vendor/symfony/validator/Constraints/ChoiceValidator.php b/vendor/symfony/validator/Constraints/ChoiceValidator.php new file mode 100644 index 0000000..a1c47a6 --- /dev/null +++ b/vendor/symfony/validator/Constraints/ChoiceValidator.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * ChoiceValidator validates that the value is one of the expected values. + * + * @author Fabien Potencier + * @author Florian Eckerstorfer + * @author Bernhard Schussek + */ +class ChoiceValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Choice) { + throw new UnexpectedTypeException($constraint, Choice::class); + } + + if (!\is_array($constraint->choices) && !$constraint->callback) { + throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice.'); + } + + if (null === $value) { + return; + } + + if ($constraint->multiple && !\is_array($value)) { + throw new UnexpectedValueException($value, 'array'); + } + + if ($constraint->callback) { + if (!\is_callable($choices = [$this->context->getObject(), $constraint->callback]) + && !\is_callable($choices = [$this->context->getClassName(), $constraint->callback]) + && !\is_callable($choices = $constraint->callback) + ) { + throw new ConstraintDefinitionException('The Choice constraint expects a valid callback.'); + } + $choices = $choices(); + } else { + $choices = $constraint->choices; + } + + if (true !== $constraint->strict) { + throw new \RuntimeException('The "strict" option of the Choice constraint should not be used.'); + } + + if ($constraint->multiple) { + foreach ($value as $_value) { + if (!\in_array($_value, $choices, true)) { + $this->context->buildViolation($constraint->multipleMessage) + ->setParameter('{{ value }}', $this->formatValue($_value)) + ->setParameter('{{ choices }}', $this->formatValues($choices)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->setInvalidValue($_value) + ->addViolation(); + + return; + } + } + + $count = \count($value); + + if (null !== $constraint->min && $count < $constraint->min) { + $this->context->buildViolation($constraint->minMessage) + ->setParameter('{{ limit }}', $constraint->min) + ->setPlural((int) $constraint->min) + ->setCode(Choice::TOO_FEW_ERROR) + ->addViolation(); + + return; + } + + if (null !== $constraint->max && $count > $constraint->max) { + $this->context->buildViolation($constraint->maxMessage) + ->setParameter('{{ limit }}', $constraint->max) + ->setPlural((int) $constraint->max) + ->setCode(Choice::TOO_MANY_ERROR) + ->addViolation(); + + return; + } + } elseif (!\in_array($value, $choices, true)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ choices }}', $this->formatValues($choices)) + ->setCode(Choice::NO_SUCH_CHOICE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Cidr.php b/vendor/symfony/validator/Constraints/Cidr.php new file mode 100644 index 0000000..387c599 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Cidr.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Validates that a value is a valid CIDR notation. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Sorin Pop + * @author Calin Bolea + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Cidr extends Constraint +{ + public const INVALID_CIDR_ERROR = '5649e53a-5afb-47c5-a360-ffbab3be8567'; + public const OUT_OF_RANGE_ERROR = 'b9f14a51-acbd-401a-a078-8c6b204ab32f'; + + protected static $errorNames = [ + self::INVALID_CIDR_ERROR => 'INVALID_CIDR_ERROR', + self::OUT_OF_RANGE_ERROR => 'OUT_OF_RANGE_VIOLATION', + ]; + + private const NET_MAXES = [ + Ip::ALL => 128, + Ip::V4 => 32, + Ip::V6 => 128, + ]; + + public $version = Ip::ALL; + + public $message = 'This value is not a valid CIDR notation.'; + + public $netmaskRangeViolationMessage = 'The value of the netmask should be between {{ min }} and {{ max }}.'; + + public $netmaskMin = 0; + + public $netmaskMax; + + public function __construct( + array $options = null, + string $version = null, + int $netmaskMin = null, + int $netmaskMax = null, + string $message = null, + array $groups = null, + $payload = null + ) { + $this->version = $version ?? $options['version'] ?? $this->version; + + if (!\in_array($this->version, array_keys(self::NET_MAXES))) { + throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s".', implode('", "', array_keys(self::NET_MAXES)))); + } + + $this->netmaskMin = $netmaskMin ?? $options['netmaskMin'] ?? $this->netmaskMin; + $this->netmaskMax = $netmaskMax ?? $options['netmaskMax'] ?? self::NET_MAXES[$this->version]; + $this->message = $message ?? $this->message; + + unset($options['netmaskMin'], $options['netmaskMax'], $options['version']); + + if ($this->netmaskMin < 0 || $this->netmaskMax > self::NET_MAXES[$this->version] || $this->netmaskMin > $this->netmaskMax) { + throw new ConstraintDefinitionException(sprintf('The netmask range must be between 0 and %d.', self::NET_MAXES[$this->version])); + } + + parent::__construct($options, $groups, $payload); + } +} diff --git a/vendor/symfony/validator/Constraints/CidrValidator.php b/vendor/symfony/validator/Constraints/CidrValidator.php new file mode 100644 index 0000000..c90ebcf --- /dev/null +++ b/vendor/symfony/validator/Constraints/CidrValidator.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +class CidrValidator extends ConstraintValidator +{ + public function validate($value, Constraint $constraint): void + { + if (!$constraint instanceof Cidr) { + throw new UnexpectedTypeException($constraint, Cidr::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!\is_string($value)) { + throw new UnexpectedValueException($value, 'string'); + } + + $cidrParts = explode('/', $value, 2); + + if (!isset($cidrParts[1]) + || !ctype_digit($cidrParts[1]) + || '' === $cidrParts[0] + ) { + $this->context + ->buildViolation($constraint->message) + ->setCode(Cidr::INVALID_CIDR_ERROR) + ->addViolation(); + + return; + } + + $ipAddress = $cidrParts[0]; + $netmask = (int) $cidrParts[1]; + + $validV4 = Ip::V6 !== $constraint->version + && filter_var($ipAddress, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4) + && $netmask <= 32; + + $validV6 = Ip::V4 !== $constraint->version + && filter_var($ipAddress, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6); + + if (!$validV4 && !$validV6) { + $this->context + ->buildViolation($constraint->message) + ->setCode(Cidr::INVALID_CIDR_ERROR) + ->addViolation(); + + return; + } + + if ($netmask < $constraint->netmaskMin || $netmask > $constraint->netmaskMax) { + $this->context + ->buildViolation($constraint->netmaskRangeViolationMessage) + ->setParameter('{{ min }}', $constraint->netmaskMin) + ->setParameter('{{ max }}', $constraint->netmaskMax) + ->setCode(Cidr::OUT_OF_RANGE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Collection.php b/vendor/symfony/validator/Constraints/Collection.php new file mode 100644 index 0000000..3f4adb5 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Collection.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Collection extends Composite +{ + public const MISSING_FIELD_ERROR = '2fa2158c-2a7f-484b-98aa-975522539ff8'; + public const NO_SUCH_FIELD_ERROR = '7703c766-b5d5-4cef-ace7-ae0dd82304e9'; + + protected static $errorNames = [ + self::MISSING_FIELD_ERROR => 'MISSING_FIELD_ERROR', + self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', + ]; + + public $fields = []; + public $allowExtraFields = false; + public $allowMissingFields = false; + public $extraFieldsMessage = 'This field was not expected.'; + public $missingFieldsMessage = 'This field is missing.'; + + /** + * {@inheritdoc} + */ + public function __construct($fields = null, array $groups = null, $payload = null, bool $allowExtraFields = null, bool $allowMissingFields = null, string $extraFieldsMessage = null, string $missingFieldsMessage = null) + { + // no known options set? $fields is the fields array + if (\is_array($fields) + && !array_intersect(array_keys($fields), ['groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'])) { + $fields = ['fields' => $fields]; + } + + parent::__construct($fields, $groups, $payload); + + $this->allowExtraFields = $allowExtraFields ?? $this->allowExtraFields; + $this->allowMissingFields = $allowMissingFields ?? $this->allowMissingFields; + $this->extraFieldsMessage = $extraFieldsMessage ?? $this->extraFieldsMessage; + $this->missingFieldsMessage = $missingFieldsMessage ?? $this->missingFieldsMessage; + } + + /** + * {@inheritdoc} + */ + protected function initializeNestedConstraints() + { + parent::initializeNestedConstraints(); + + if (!\is_array($this->fields)) { + throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint "%s".', __CLASS__)); + } + + foreach ($this->fields as $fieldName => $field) { + // the XmlFileLoader and YamlFileLoader pass the field Optional + // and Required constraint as an array with exactly one element + if (\is_array($field) && 1 == \count($field)) { + $this->fields[$fieldName] = $field = $field[0]; + } + + if (!$field instanceof Optional && !$field instanceof Required) { + $this->fields[$fieldName] = new Required($field); + } + } + } + + public function getRequiredOptions() + { + return ['fields']; + } + + protected function getCompositeOption() + { + return 'fields'; + } +} diff --git a/vendor/symfony/validator/Constraints/CollectionValidator.php b/vendor/symfony/validator/Constraints/CollectionValidator.php new file mode 100644 index 0000000..7cea7d0 --- /dev/null +++ b/vendor/symfony/validator/Constraints/CollectionValidator.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class CollectionValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Collection) { + throw new UnexpectedTypeException($constraint, Collection::class); + } + + if (null === $value) { + return; + } + + if (!\is_array($value) && !($value instanceof \Traversable && $value instanceof \ArrayAccess)) { + throw new UnexpectedValueException($value, 'array|(Traversable&ArrayAccess)'); + } + + // We need to keep the initialized context when CollectionValidator + // calls itself recursively (Collection constraints can be nested). + // Since the context of the validator is overwritten when initialize() + // is called for the nested constraint, the outer validator is + // acting on the wrong context when the nested validation terminates. + // + // A better solution - which should be approached in Symfony 3.0 - is to + // remove the initialize() method and pass the context as last argument + // to validate() instead. + $context = $this->context; + + foreach ($constraint->fields as $field => $fieldConstraint) { + // bug fix issue #2779 + $existsInArray = \is_array($value) && \array_key_exists($field, $value); + $existsInArrayAccess = $value instanceof \ArrayAccess && $value->offsetExists($field); + + if ($existsInArray || $existsInArrayAccess) { + if (\count($fieldConstraint->constraints) > 0) { + $context->getValidator() + ->inContext($context) + ->atPath('['.$field.']') + ->validate($value[$field], $fieldConstraint->constraints); + } + } elseif (!$fieldConstraint instanceof Optional && !$constraint->allowMissingFields) { + $context->buildViolation($constraint->missingFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue(null) + ->setCode(Collection::MISSING_FIELD_ERROR) + ->addViolation(); + } + } + + if (!$constraint->allowExtraFields) { + foreach ($value as $field => $fieldValue) { + if (!isset($constraint->fields[$field])) { + $context->buildViolation($constraint->extraFieldsMessage) + ->atPath('['.$field.']') + ->setParameter('{{ field }}', $this->formatValue($field)) + ->setInvalidValue($fieldValue) + ->setCode(Collection::NO_SUCH_FIELD_ERROR) + ->addViolation(); + } + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/Composite.php b/vendor/symfony/validator/Constraints/Composite.php new file mode 100644 index 0000000..2f6eadf --- /dev/null +++ b/vendor/symfony/validator/Constraints/Composite.php @@ -0,0 +1,159 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * A constraint that is composed of other constraints. + * + * You should never use the nested constraint instances anywhere else, because + * their groups are adapted when passed to the constructor of this class. + * + * If you want to create your own composite constraint, extend this class and + * let {@link getCompositeOption()} return the name of the property which + * contains the nested constraints. + * + * @author Bernhard Schussek + */ +abstract class Composite extends Constraint +{ + /** + * {@inheritdoc} + * + * The groups of the composite and its nested constraints are made + * consistent using the following strategy: + * + * - If groups are passed explicitly to the composite constraint, but + * not to the nested constraints, the options of the composite + * constraint are copied to the nested constraints; + * + * - If groups are passed explicitly to the nested constraints, but not + * to the composite constraint, the groups of all nested constraints + * are merged and used as groups for the composite constraint; + * + * - If groups are passed explicitly to both the composite and its nested + * constraints, the groups of the nested constraints must be a subset + * of the groups of the composite constraint. If not, a + * {@link ConstraintDefinitionException} is thrown. + * + * All this is done in the constructor, because constraints can then be + * cached. When constraints are loaded from the cache, no more group + * checks need to be done. + */ + public function __construct($options = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->initializeNestedConstraints(); + + /* @var Constraint[] $nestedConstraints */ + $compositeOption = $this->getCompositeOption(); + $nestedConstraints = $this->$compositeOption; + + if (!\is_array($nestedConstraints)) { + $nestedConstraints = [$nestedConstraints]; + } + + foreach ($nestedConstraints as $constraint) { + if (!$constraint instanceof Constraint) { + if (\is_object($constraint)) { + $constraint = \get_class($constraint); + } + + throw new ConstraintDefinitionException(sprintf('The value "%s" is not an instance of Constraint in constraint "%s".', $constraint, static::class)); + } + + if ($constraint instanceof Valid) { + throw new ConstraintDefinitionException(sprintf('The constraint Valid cannot be nested inside constraint "%s". You can only declare the Valid constraint directly on a field or method.', static::class)); + } + } + + if (!isset(((array) $this)['groups'])) { + $mergedGroups = []; + + foreach ($nestedConstraints as $constraint) { + foreach ($constraint->groups as $group) { + $mergedGroups[$group] = true; + } + } + + // prevent empty composite constraint to have empty groups + $this->groups = array_keys($mergedGroups) ?: [self::DEFAULT_GROUP]; + $this->$compositeOption = $nestedConstraints; + + return; + } + + foreach ($nestedConstraints as $constraint) { + if (isset(((array) $constraint)['groups'])) { + $excessGroups = array_diff($constraint->groups, $this->groups); + + if (\count($excessGroups) > 0) { + throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint "%s" should also be passed to its containing constraint "%s".', implode('", "', $excessGroups), get_debug_type($constraint), static::class)); + } + } else { + $constraint->groups = $this->groups; + } + } + + $this->$compositeOption = $nestedConstraints; + } + + /** + * {@inheritdoc} + * + * Implicit group names are forwarded to nested constraints. + */ + public function addImplicitGroupName(string $group) + { + parent::addImplicitGroupName($group); + + /** @var Constraint[] $nestedConstraints */ + $nestedConstraints = $this->{$this->getCompositeOption()}; + + foreach ($nestedConstraints as $constraint) { + $constraint->addImplicitGroupName($group); + } + } + + /** + * Returns the name of the property that contains the nested constraints. + * + * @return string + */ + abstract protected function getCompositeOption(); + + /** + * @internal Used by metadata + * + * @return Constraint[] + */ + public function getNestedConstraints() + { + /* @var Constraint[] $nestedConstraints */ + return $this->{$this->getCompositeOption()}; + } + + /** + * Initializes the nested constraints. + * + * This method can be overwritten in subclasses to clean up the nested + * constraints passed to the constructor. + * + * @see Collection::initializeNestedConstraints() + */ + protected function initializeNestedConstraints() + { + } +} diff --git a/vendor/symfony/validator/Constraints/Compound.php b/vendor/symfony/validator/Constraints/Compound.php new file mode 100644 index 0000000..54dcd6c --- /dev/null +++ b/vendor/symfony/validator/Constraints/Compound.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Extend this class to create a reusable set of constraints. + * + * @author Maxime Steinhausser + */ +abstract class Compound extends Composite +{ + /** @var Constraint[] */ + public $constraints = []; + + public function __construct($options = null) + { + if (isset($options[$this->getCompositeOption()])) { + throw new ConstraintDefinitionException(sprintf('You can\'t redefine the "%s" option. Use the "%s::getConstraints()" method instead.', $this->getCompositeOption(), __CLASS__)); + } + + $this->constraints = $this->getConstraints($this->normalizeOptions($options)); + + parent::__construct($options); + } + + final protected function getCompositeOption(): string + { + return 'constraints'; + } + + final public function validatedBy(): string + { + return CompoundValidator::class; + } + + /** + * @return Constraint[] + */ + abstract protected function getConstraints(array $options): array; +} diff --git a/vendor/symfony/validator/Constraints/CompoundValidator.php b/vendor/symfony/validator/Constraints/CompoundValidator.php new file mode 100644 index 0000000..2ba993f --- /dev/null +++ b/vendor/symfony/validator/Constraints/CompoundValidator.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Maxime Steinhausser + */ +class CompoundValidator extends ConstraintValidator +{ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Compound) { + throw new UnexpectedTypeException($constraint, Compound::class); + } + + $context = $this->context; + + $validator = $context->getValidator()->inContext($context); + + $validator->validate($value, $constraint->constraints); + } +} diff --git a/vendor/symfony/validator/Constraints/Count.php b/vendor/symfony/validator/Constraints/Count.php new file mode 100644 index 0000000..0d75903 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Count.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Count extends Constraint +{ + public const TOO_FEW_ERROR = 'bef8e338-6ae5-4caf-b8e2-50e7b0579e69'; + public const TOO_MANY_ERROR = '756b1212-697c-468d-a9ad-50dd783bb169'; + public const NOT_EQUAL_COUNT_ERROR = '9fe5d43f-3784-4ece-a0e1-473fc02dadbc'; + public const NOT_DIVISIBLE_BY_ERROR = DivisibleBy::NOT_DIVISIBLE_BY; + + protected static $errorNames = [ + self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', + self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', + self::NOT_EQUAL_COUNT_ERROR => 'NOT_EQUAL_COUNT_ERROR', + self::NOT_DIVISIBLE_BY_ERROR => 'NOT_DIVISIBLE_BY_ERROR', + ]; + + public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; + public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; + public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; + public $divisibleByMessage = 'The number of elements in this collection should be a multiple of {{ compared_value }}.'; + public $min; + public $max; + public $divisibleBy; + + /** + * {@inheritdoc} + * + * @param int|array|null $exactly The expected exact count or a set of options + */ + public function __construct( + $exactly = null, + int $min = null, + int $max = null, + int $divisibleBy = null, + string $exactMessage = null, + string $minMessage = null, + string $maxMessage = null, + string $divisibleByMessage = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (\is_array($exactly)) { + $options = array_merge($exactly, $options); + $exactly = $options['value'] ?? null; + } + + $min = $min ?? $options['min'] ?? null; + $max = $max ?? $options['max'] ?? null; + + unset($options['value'], $options['min'], $options['max']); + + if (null !== $exactly && null === $min && null === $max) { + $min = $max = $exactly; + } + + parent::__construct($options, $groups, $payload); + + $this->min = $min; + $this->max = $max; + $this->divisibleBy = $divisibleBy ?? $this->divisibleBy; + $this->exactMessage = $exactMessage ?? $this->exactMessage; + $this->minMessage = $minMessage ?? $this->minMessage; + $this->maxMessage = $maxMessage ?? $this->maxMessage; + $this->divisibleByMessage = $divisibleByMessage ?? $this->divisibleByMessage; + + if (null === $this->min && null === $this->max && null === $this->divisibleBy) { + throw new MissingOptionsException(sprintf('Either option "min", "max" or "divisibleBy" must be given for constraint "%s".', __CLASS__), ['min', 'max', 'divisibleBy']); + } + } +} diff --git a/vendor/symfony/validator/Constraints/CountValidator.php b/vendor/symfony/validator/Constraints/CountValidator.php new file mode 100644 index 0000000..ff991ac --- /dev/null +++ b/vendor/symfony/validator/Constraints/CountValidator.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class CountValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Count) { + throw new UnexpectedTypeException($constraint, Count::class); + } + + if (null === $value) { + return; + } + + if (!\is_array($value) && !$value instanceof \Countable) { + throw new UnexpectedValueException($value, 'array|\Countable'); + } + + $count = \count($value); + + if (null !== $constraint->max && $count > $constraint->max) { + $exactlyOptionEnabled = $constraint->min == $constraint->max; + + $this->context->buildViolation($exactlyOptionEnabled ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode($exactlyOptionEnabled ? Count::NOT_EQUAL_COUNT_ERROR : Count::TOO_MANY_ERROR) + ->addViolation(); + + return; + } + + if (null !== $constraint->min && $count < $constraint->min) { + $exactlyOptionEnabled = $constraint->min == $constraint->max; + + $this->context->buildViolation($exactlyOptionEnabled ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ count }}', $count) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode($exactlyOptionEnabled ? Count::NOT_EQUAL_COUNT_ERROR : Count::TOO_FEW_ERROR) + ->addViolation(); + + return; + } + + if (null !== $constraint->divisibleBy) { + $this->context + ->getValidator() + ->inContext($this->context) + ->validate($count, [ + new DivisibleBy([ + 'value' => $constraint->divisibleBy, + 'message' => $constraint->divisibleByMessage, + ]), + ], $this->context->getGroup()); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Country.php b/vendor/symfony/validator/Constraints/Country.php new file mode 100644 index 0000000..ccd815c --- /dev/null +++ b/vendor/symfony/validator/Constraints/Country.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Countries; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Country extends Constraint +{ + public const NO_SUCH_COUNTRY_ERROR = '8f900c12-61bd-455d-9398-996cd040f7f0'; + + protected static $errorNames = [ + self::NO_SUCH_COUNTRY_ERROR => 'NO_SUCH_COUNTRY_ERROR', + ]; + + public $message = 'This value is not a valid country.'; + public $alpha3 = false; + + public function __construct( + array $options = null, + string $message = null, + bool $alpha3 = null, + array $groups = null, + $payload = null + ) { + if (!class_exists(Countries::class)) { + throw new LogicException('The Intl component is required to use the Country constraint. Try running "composer require symfony/intl".'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->alpha3 = $alpha3 ?? $this->alpha3; + } +} diff --git a/vendor/symfony/validator/Constraints/CountryValidator.php b/vendor/symfony/validator/Constraints/CountryValidator.php new file mode 100644 index 0000000..895cca3 --- /dev/null +++ b/vendor/symfony/validator/Constraints/CountryValidator.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Countries; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid country code. + * + * @author Bernhard Schussek + */ +class CountryValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Country) { + throw new UnexpectedTypeException($constraint, Country::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if ($constraint->alpha3 ? !Countries::alpha3CodeExists($value) : !Countries::exists($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Country::NO_SUCH_COUNTRY_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/CssColor.php b/vendor/symfony/validator/Constraints/CssColor.php new file mode 100644 index 0000000..e1510da --- /dev/null +++ b/vendor/symfony/validator/Constraints/CssColor.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Mathieu Santostefano + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class CssColor extends Constraint +{ + public const HEX_LONG = 'hex_long'; + public const HEX_LONG_WITH_ALPHA = 'hex_long_with_alpha'; + public const HEX_SHORT = 'hex_short'; + public const HEX_SHORT_WITH_ALPHA = 'hex_short_with_alpha'; + public const BASIC_NAMED_COLORS = 'basic_named_colors'; + public const EXTENDED_NAMED_COLORS = 'extended_named_colors'; + public const SYSTEM_COLORS = 'system_colors'; + public const KEYWORDS = 'keywords'; + public const RGB = 'rgb'; + public const RGBA = 'rgba'; + public const HSL = 'hsl'; + public const HSLA = 'hsla'; + public const INVALID_FORMAT_ERROR = '454ab47b-aacf-4059-8f26-184b2dc9d48d'; + + protected static $errorNames = [ + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + ]; + + /** + * @var string[] + */ + private static $validationModes = [ + self::HEX_LONG, + self::HEX_LONG_WITH_ALPHA, + self::HEX_SHORT, + self::HEX_SHORT_WITH_ALPHA, + self::BASIC_NAMED_COLORS, + self::EXTENDED_NAMED_COLORS, + self::SYSTEM_COLORS, + self::KEYWORDS, + self::RGB, + self::RGBA, + self::HSL, + self::HSLA, + ]; + + public $message = 'This value is not a valid CSS color.'; + public $formats; + + /** + * @param array|string $formats The types of CSS colors allowed (e.g. hexadecimal only, RGB and HSL only, etc.). + */ + public function __construct($formats = [], string $message = null, array $groups = null, $payload = null, array $options = null) + { + $validationModesAsString = implode(', ', self::$validationModes); + + if (!$formats) { + $options['value'] = self::$validationModes; + } elseif (\is_array($formats) && \is_string(key($formats))) { + $options = array_merge($formats, $options ?? []); + } elseif (\is_array($formats)) { + if ([] === array_intersect(self::$validationModes, $formats)) { + throw new InvalidArgumentException(sprintf('The "formats" parameter value is not valid. It must contain one or more of the following values: "%s".', $validationModesAsString)); + } + + $options['value'] = $formats; + } elseif (\is_string($formats)) { + if (!\in_array($formats, self::$validationModes)) { + throw new InvalidArgumentException(sprintf('The "formats" parameter value is not valid. It must contain one or more of the following values: "%s".', $validationModesAsString)); + } + + $options['value'] = [$formats]; + } else { + throw new InvalidArgumentException('The "formats" parameter type is not valid. It should be a string or an array.'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } + + public function getDefaultOption(): string + { + return 'formats'; + } + + public function getRequiredOptions(): array + { + return ['formats']; + } +} diff --git a/vendor/symfony/validator/Constraints/CssColorValidator.php b/vendor/symfony/validator/Constraints/CssColorValidator.php new file mode 100644 index 0000000..b34ef93 --- /dev/null +++ b/vendor/symfony/validator/Constraints/CssColorValidator.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Mathieu Santostefano + */ +class CssColorValidator extends ConstraintValidator +{ + private const PATTERN_HEX_LONG = '/^#[0-9a-f]{6}$/i'; + private const PATTERN_HEX_LONG_WITH_ALPHA = '/^#[0-9a-f]{8}$/i'; + private const PATTERN_HEX_SHORT = '/^#[0-9a-f]{3}$/i'; + private const PATTERN_HEX_SHORT_WITH_ALPHA = '/^#[0-9a-f]{4}$/i'; + // List comes from https://www.w3.org/wiki/CSS/Properties/color/keywords#Basic_Colors + private const PATTERN_BASIC_NAMED_COLORS = '/^(black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua)$/i'; + // List comes from https://www.w3.org/wiki/CSS/Properties/color/keywords#Extended_colors + private const PATTERN_EXTENDED_NAMED_COLORS = '/^(aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)$/i'; + // List comes from https://drafts.csswg.org/css-color/#css-system-colors + private const PATTERN_SYSTEM_COLORS = '/^(Canvas|CanvasText|LinkText|VisitedText|ActiveText|ButtonFace|ButtonText|ButtonBorder|Field|FieldText|Highlight|HighlightText|SelectedItem|SelectedItemText|Mark|MarkText|GrayText)$/i'; + private const PATTERN_KEYWORDS = '/^(transparent|currentColor)$/i'; + private const PATTERN_RGB = '/^rgb\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d)\s*\)$/i'; + private const PATTERN_RGBA = '/^rgba\(\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i'; + private const PATTERN_HSL = '/^hsl\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%\s*\)$/i'; + private const PATTERN_HSLA = '/^hsla\(\s*(0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),\s*(0|100|\d{1,2})%,\s*(0|100|\d{1,2})%,\s*(0|0?\.\d+|1(\.0)?)\s*\)$/i'; + + private const COLOR_PATTERNS = [ + CssColor::HEX_LONG => self::PATTERN_HEX_LONG, + CssColor::HEX_LONG_WITH_ALPHA => self::PATTERN_HEX_LONG_WITH_ALPHA, + CssColor::HEX_SHORT => self::PATTERN_HEX_SHORT, + CssColor::HEX_SHORT_WITH_ALPHA => self::PATTERN_HEX_SHORT_WITH_ALPHA, + CssColor::BASIC_NAMED_COLORS => self::PATTERN_BASIC_NAMED_COLORS, + CssColor::EXTENDED_NAMED_COLORS => self::PATTERN_EXTENDED_NAMED_COLORS, + CssColor::SYSTEM_COLORS => self::PATTERN_SYSTEM_COLORS, + CssColor::KEYWORDS => self::PATTERN_KEYWORDS, + CssColor::RGB => self::PATTERN_RGB, + CssColor::RGBA => self::PATTERN_RGBA, + CssColor::HSL => self::PATTERN_HSL, + CssColor::HSLA => self::PATTERN_HSLA, + ]; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint): void + { + if (!$constraint instanceof CssColor) { + throw new UnexpectedTypeException($constraint, CssColor::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!\is_string($value)) { + throw new UnexpectedValueException($value, 'string'); + } + + $formats = array_flip((array) $constraint->formats); + $formatRegexes = array_intersect_key(self::COLOR_PATTERNS, $formats); + + foreach ($formatRegexes as $regex) { + if (preg_match($regex, (string) $value)) { + return; + } + } + + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(CssColor::INVALID_FORMAT_ERROR) + ->addViolation(); + } +} diff --git a/vendor/symfony/validator/Constraints/Currency.php b/vendor/symfony/validator/Constraints/Currency.php new file mode 100644 index 0000000..cac2dff --- /dev/null +++ b/vendor/symfony/validator/Constraints/Currency.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Currencies; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Miha Vrhovnik + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Currency extends Constraint +{ + public const NO_SUCH_CURRENCY_ERROR = '69945ac1-2db4-405f-bec7-d2772f73df52'; + + protected static $errorNames = [ + self::NO_SUCH_CURRENCY_ERROR => 'NO_SUCH_CURRENCY_ERROR', + ]; + + public $message = 'This value is not a valid currency.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + if (!class_exists(Currencies::class)) { + throw new LogicException('The Intl component is required to use the Currency constraint. Try running "composer require symfony/intl".'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/CurrencyValidator.php b/vendor/symfony/validator/Constraints/CurrencyValidator.php new file mode 100644 index 0000000..4f294e4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/CurrencyValidator.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Currencies; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid currency. + * + * @author Miha Vrhovnik + * @author Bernhard Schussek + */ +class CurrencyValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Currency) { + throw new UnexpectedTypeException($constraint, Currency::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (!Currencies::exists($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Currency::NO_SUCH_CURRENCY_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Date.php b/vendor/symfony/validator/Constraints/Date.php new file mode 100644 index 0000000..7c9666f --- /dev/null +++ b/vendor/symfony/validator/Constraints/Date.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Date extends Constraint +{ + public const INVALID_FORMAT_ERROR = '69819696-02ac-4a99-9ff0-14e127c4d1bc'; + public const INVALID_DATE_ERROR = '3c184ce5-b31d-4de7-8b76-326da7b2be93'; + + protected static $errorNames = [ + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', + ]; + + public $message = 'This value is not a valid date.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/DateTime.php b/vendor/symfony/validator/Constraints/DateTime.php new file mode 100644 index 0000000..94c3dd6 --- /dev/null +++ b/vendor/symfony/validator/Constraints/DateTime.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class DateTime extends Constraint +{ + public const INVALID_FORMAT_ERROR = '1a9da513-2640-4f84-9b6a-4d99dcddc628'; + public const INVALID_DATE_ERROR = 'd52afa47-620d-4d99-9f08-f4d85b36e33c'; + public const INVALID_TIME_ERROR = '5e797c9d-74f7-4098-baa3-94390c447b27'; + + protected static $errorNames = [ + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', + self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', + ]; + + public $format = 'Y-m-d H:i:s'; + public $message = 'This value is not a valid datetime.'; + + /** + * {@inheritdoc} + * + * @param string|array|null $format + */ + public function __construct($format = null, string $message = null, array $groups = null, $payload = null, array $options = []) + { + if (\is_array($format)) { + $options = array_merge($format, $options); + } elseif (null !== $format) { + $options['value'] = $format; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } + + public function getDefaultOption() + { + return 'format'; + } +} diff --git a/vendor/symfony/validator/Constraints/DateTimeValidator.php b/vendor/symfony/validator/Constraints/DateTimeValidator.php new file mode 100644 index 0000000..e93f795 --- /dev/null +++ b/vendor/symfony/validator/Constraints/DateTimeValidator.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + * @author Diego Saint Esteben + */ +class DateTimeValidator extends DateValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof DateTime) { + throw new UnexpectedTypeException($constraint, DateTime::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + \DateTime::createFromFormat($constraint->format, $value); + + $errors = \DateTime::getLastErrors(); + + if (0 < $errors['error_count']) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + + if (str_ends_with($constraint->format, '+')) { + $errors['warnings'] = array_filter($errors['warnings'], function ($warning) { + return 'Trailing data' !== $warning; + }); + } + + foreach ($errors['warnings'] as $warning) { + if ('The parsed date was invalid' === $warning) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_DATE_ERROR) + ->addViolation(); + } elseif ('The parsed time was invalid' === $warning) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_TIME_ERROR) + ->addViolation(); + } else { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(DateTime::INVALID_FORMAT_ERROR) + ->addViolation(); + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/DateValidator.php b/vendor/symfony/validator/Constraints/DateValidator.php new file mode 100644 index 0000000..3f18cac --- /dev/null +++ b/vendor/symfony/validator/Constraints/DateValidator.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class DateValidator extends ConstraintValidator +{ + public const PATTERN = '/^(?\d{4})-(?\d{2})-(?\d{2})$/'; + + /** + * Checks whether a date is valid. + * + * @internal + */ + public static function checkDate(int $year, int $month, int $day): bool + { + return checkdate($month, $day, $year); + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Date) { + throw new UnexpectedTypeException($constraint, Date::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (!preg_match(static::PATTERN, $value, $matches)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + + if (!self::checkDate( + $matches['year'] ?? $matches[1], + $matches['month'] ?? $matches[2], + $matches['day'] ?? $matches[3] + )) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Date::INVALID_DATE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/DisableAutoMapping.php b/vendor/symfony/validator/Constraints/DisableAutoMapping.php new file mode 100644 index 0000000..9a91f00 --- /dev/null +++ b/vendor/symfony/validator/Constraints/DisableAutoMapping.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Disables auto mapping. + * + * Using the annotations on a property has higher precedence than using it on a class, + * which has higher precedence than any configuration that might be defined outside the class. + * + * @Annotation + * + * @author Kévin Dunglas + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)] +class DisableAutoMapping extends Constraint +{ + public function __construct(array $options = null) + { + if (\is_array($options) && \array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__)); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; + } +} diff --git a/vendor/symfony/validator/Constraints/DivisibleBy.php b/vendor/symfony/validator/Constraints/DivisibleBy.php new file mode 100644 index 0000000..d3f5cd7 --- /dev/null +++ b/vendor/symfony/validator/Constraints/DivisibleBy.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Colin O'Dell + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class DivisibleBy extends AbstractComparison +{ + public const NOT_DIVISIBLE_BY = '6d99d6c3-1464-4ccf-bdc7-14d083cf455c'; + + protected static $errorNames = [ + self::NOT_DIVISIBLE_BY => 'NOT_DIVISIBLE_BY', + ]; + + public $message = 'This value should be a multiple of {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/DivisibleByValidator.php b/vendor/symfony/validator/Constraints/DivisibleByValidator.php new file mode 100644 index 0000000..de77430 --- /dev/null +++ b/vendor/symfony/validator/Constraints/DivisibleByValidator.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates that values are a multiple of the given number. + * + * @author Colin O'Dell + */ +class DivisibleByValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + if (!is_numeric($value1)) { + throw new UnexpectedValueException($value1, 'numeric'); + } + + if (!is_numeric($value2)) { + throw new UnexpectedValueException($value2, 'numeric'); + } + + if (!$value2 = abs($value2)) { + return false; + } + if (\is_int($value1 = abs($value1)) && \is_int($value2)) { + return 0 === ($value1 % $value2); + } + if (!$remainder = fmod($value1, $value2)) { + return true; + } + if (\is_float($value2) && \INF !== $value2) { + $quotient = $value1 / $value2; + $rounded = round($quotient); + + return sprintf('%.12e', $quotient) === sprintf('%.12e', $rounded); + } + + return sprintf('%.12e', $value2) === sprintf('%.12e', $remainder); + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return DivisibleBy::NOT_DIVISIBLE_BY; + } +} diff --git a/vendor/symfony/validator/Constraints/Email.php b/vendor/symfony/validator/Constraints/Email.php new file mode 100644 index 0000000..7976cc4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Email.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Egulias\EmailValidator\EmailValidator as StrictEmailValidator; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Email extends Constraint +{ + public const VALIDATION_MODE_HTML5 = 'html5'; + public const VALIDATION_MODE_STRICT = 'strict'; + public const VALIDATION_MODE_LOOSE = 'loose'; + + public const INVALID_FORMAT_ERROR = 'bd79c0ab-ddba-46cc-a703-a7a4b08de310'; + + protected static $errorNames = [ + self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR', + ]; + + /** + * @var string[] + * + * @internal + */ + public static $validationModes = [ + self::VALIDATION_MODE_HTML5, + self::VALIDATION_MODE_STRICT, + self::VALIDATION_MODE_LOOSE, + ]; + + public $message = 'This value is not a valid email address.'; + public $mode; + public $normalizer; + + public function __construct( + array $options = null, + string $message = null, + string $mode = null, + callable $normalizer = null, + array $groups = null, + $payload = null + ) { + if (\is_array($options) && \array_key_exists('mode', $options) && !\in_array($options['mode'], self::$validationModes, true)) { + throw new InvalidArgumentException('The "mode" parameter value is not valid.'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->mode = $mode ?? $this->mode; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (self::VALIDATION_MODE_STRICT === $this->mode && !class_exists(StrictEmailValidator::class)) { + throw new LogicException(sprintf('The "egulias/email-validator" component is required to use the "%s" constraint in strict mode.', __CLASS__)); + } + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/EmailValidator.php b/vendor/symfony/validator/Constraints/EmailValidator.php new file mode 100644 index 0000000..c879ee4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/EmailValidator.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Egulias\EmailValidator\EmailValidator as EguliasEmailValidator; +use Egulias\EmailValidator\Validation\EmailValidation; +use Egulias\EmailValidator\Validation\NoRFCWarningsValidation; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class EmailValidator extends ConstraintValidator +{ + private const PATTERN_HTML5 = '/^[a-zA-Z0-9.!#$%&\'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/'; + private const PATTERN_LOOSE = '/^.+\@\S+\.\S+$/'; + + private const EMAIL_PATTERNS = [ + Email::VALIDATION_MODE_LOOSE => self::PATTERN_LOOSE, + Email::VALIDATION_MODE_HTML5 => self::PATTERN_HTML5, + ]; + + private $defaultMode; + + public function __construct(string $defaultMode = Email::VALIDATION_MODE_LOOSE) + { + if (!\in_array($defaultMode, Email::$validationModes, true)) { + throw new \InvalidArgumentException('The "defaultMode" parameter value is not valid.'); + } + + $this->defaultMode = $defaultMode; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Email) { + throw new UnexpectedTypeException($constraint, Email::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + if ('' === $value) { + return; + } + + if (null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + if (null === $constraint->mode) { + $constraint->mode = $this->defaultMode; + } + + if (!\in_array($constraint->mode, Email::$validationModes, true)) { + throw new \InvalidArgumentException(sprintf('The "%s::$mode" parameter value is not valid.', get_debug_type($constraint))); + } + + if (Email::VALIDATION_MODE_STRICT === $constraint->mode) { + $strictValidator = new EguliasEmailValidator(); + + if (interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, new NoRFCWarningsValidation())) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } elseif (!interface_exists(EmailValidation::class) && !$strictValidator->isValid($value, false, true)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + } elseif (!preg_match(self::EMAIL_PATTERNS[$constraint->mode], $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Email::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + } +} diff --git a/vendor/symfony/validator/Constraints/EnableAutoMapping.php b/vendor/symfony/validator/Constraints/EnableAutoMapping.php new file mode 100644 index 0000000..3136fd3 --- /dev/null +++ b/vendor/symfony/validator/Constraints/EnableAutoMapping.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Enables auto mapping. + * + * Using the annotations on a property has higher precedence than using it on a class, + * which has higher precedence than any configuration that might be defined outside the class. + * + * @Annotation + * + * @author Kévin Dunglas + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)] +class EnableAutoMapping extends Constraint +{ + public function __construct(array $options = null) + { + if (\is_array($options) && \array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__)); + } + + parent::__construct($options); + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT]; + } +} diff --git a/vendor/symfony/validator/Constraints/EqualTo.php b/vendor/symfony/validator/Constraints/EqualTo.php new file mode 100644 index 0000000..09ab4f0 --- /dev/null +++ b/vendor/symfony/validator/Constraints/EqualTo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class EqualTo extends AbstractComparison +{ + public const NOT_EQUAL_ERROR = '478618a7-95ba-473d-9101-cabd45e49115'; + + protected static $errorNames = [ + self::NOT_EQUAL_ERROR => 'NOT_EQUAL_ERROR', + ]; + + public $message = 'This value should be equal to {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/EqualToValidator.php b/vendor/symfony/validator/Constraints/EqualToValidator.php new file mode 100644 index 0000000..fe1f362 --- /dev/null +++ b/vendor/symfony/validator/Constraints/EqualToValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are equal (==). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class EqualToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 == $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return EqualTo::NOT_EQUAL_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/Existence.php b/vendor/symfony/validator/Constraints/Existence.php new file mode 100644 index 0000000..903cf63 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Existence.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @author Bernhard Schussek + */ +abstract class Existence extends Composite +{ + public $constraints = []; + + public function getDefaultOption() + { + return 'constraints'; + } + + protected function getCompositeOption() + { + return 'constraints'; + } +} diff --git a/vendor/symfony/validator/Constraints/Expression.php b/vendor/symfony/validator/Constraints/Expression.php new file mode 100644 index 0000000..01cf429 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Expression.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\ExpressionLanguage\Expression as ExpressionObject; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Fabien Potencier + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] +class Expression extends Constraint +{ + public const EXPRESSION_FAILED_ERROR = '6b3befbc-2f01-4ddf-be21-b57898905284'; + + protected static $errorNames = [ + self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR', + ]; + + public $message = 'This value is not valid.'; + public $expression; + public $values = []; + + /** + * {@inheritdoc} + * + * @param string|ExpressionObject|array $expression The expression to evaluate or an array of options + */ + public function __construct( + $expression, + string $message = null, + array $values = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (!class_exists(ExpressionLanguage::class)) { + throw new LogicException(sprintf('The "symfony/expression-language" component is required to use the "%s" constraint.', __CLASS__)); + } + + if (\is_array($expression)) { + $options = array_merge($expression, $options); + } elseif (!\is_string($expression) && !$expression instanceof ExpressionObject) { + throw new \TypeError(sprintf('"%s": Expected argument $expression to be either a string, an instance of "%s" or an array, got "%s".', __METHOD__, ExpressionObject::class, get_debug_type($expression))); + } else { + $options['value'] = $expression; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->values = $values ?? $this->values; + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'expression'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return ['expression']; + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; + } + + /** + * {@inheritdoc} + */ + public function validatedBy() + { + return 'validator.expression'; + } +} diff --git a/vendor/symfony/validator/Constraints/ExpressionLanguageSyntax.php b/vendor/symfony/validator/Constraints/ExpressionLanguageSyntax.php new file mode 100644 index 0000000..d5c1f6f --- /dev/null +++ b/vendor/symfony/validator/Constraints/ExpressionLanguageSyntax.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Andrey Sevastianov + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class ExpressionLanguageSyntax extends Constraint +{ + public const EXPRESSION_LANGUAGE_SYNTAX_ERROR = '1766a3f3-ff03-40eb-b053-ab7aa23d988a'; + + protected static $errorNames = [ + self::EXPRESSION_LANGUAGE_SYNTAX_ERROR => 'EXPRESSION_LANGUAGE_SYNTAX_ERROR', + ]; + + public $message = 'This value should be a valid expression.'; + public $service; + public $allowedVariables; + + public function __construct(array $options = null, string $message = null, string $service = null, array $allowedVariables = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->service = $service ?? $this->service; + $this->allowedVariables = $allowedVariables ?? $this->allowedVariables; + } + + /** + * {@inheritdoc} + */ + public function validatedBy() + { + return $this->service ?? static::class.'Validator'; + } +} diff --git a/vendor/symfony/validator/Constraints/ExpressionLanguageSyntaxValidator.php b/vendor/symfony/validator/Constraints/ExpressionLanguageSyntaxValidator.php new file mode 100644 index 0000000..4b67da2 --- /dev/null +++ b/vendor/symfony/validator/Constraints/ExpressionLanguageSyntaxValidator.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\ExpressionLanguage\SyntaxError; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Andrey Sevastianov + */ +class ExpressionLanguageSyntaxValidator extends ConstraintValidator +{ + private $expressionLanguage; + + public function __construct(ExpressionLanguage $expressionLanguage = null) + { + $this->expressionLanguage = $expressionLanguage; + } + + /** + * {@inheritdoc} + */ + public function validate($expression, Constraint $constraint): void + { + if (!$constraint instanceof ExpressionLanguageSyntax) { + throw new UnexpectedTypeException($constraint, ExpressionLanguageSyntax::class); + } + + if (!\is_string($expression)) { + throw new UnexpectedValueException($expression, 'string'); + } + + if (null === $this->expressionLanguage) { + $this->expressionLanguage = new ExpressionLanguage(); + } + + try { + $this->expressionLanguage->lint($expression, $constraint->allowedVariables); + } catch (SyntaxError $exception) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ syntax_error }}', $this->formatValue($exception->getMessage())) + ->setInvalidValue((string) $expression) + ->setCode(ExpressionLanguageSyntax::EXPRESSION_LANGUAGE_SYNTAX_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/ExpressionValidator.php b/vendor/symfony/validator/Constraints/ExpressionValidator.php new file mode 100644 index 0000000..3ae47f4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/ExpressionValidator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Fabien Potencier + * @author Bernhard Schussek + */ +class ExpressionValidator extends ConstraintValidator +{ + private $expressionLanguage; + + public function __construct(ExpressionLanguage $expressionLanguage = null) + { + $this->expressionLanguage = $expressionLanguage; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Expression) { + throw new UnexpectedTypeException($constraint, Expression::class); + } + + $variables = $constraint->values; + $variables['value'] = $value; + $variables['this'] = $this->context->getObject(); + + if (!$this->getExpressionLanguage()->evaluate($constraint->expression, $variables)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value, self::OBJECT_TO_STRING)) + ->setCode(Expression::EXPRESSION_FAILED_ERROR) + ->addViolation(); + } + } + + private function getExpressionLanguage(): ExpressionLanguage + { + if (null === $this->expressionLanguage) { + $this->expressionLanguage = new ExpressionLanguage(); + } + + return $this->expressionLanguage; + } +} diff --git a/vendor/symfony/validator/Constraints/File.php b/vendor/symfony/validator/Constraints/File.php new file mode 100644 index 0000000..b5a446e --- /dev/null +++ b/vendor/symfony/validator/Constraints/File.php @@ -0,0 +1,174 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @property int $maxSize + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class File extends Constraint +{ + // Check the Image constraint for clashes if adding new constants here + + public const NOT_FOUND_ERROR = 'd2a3fb6e-7ddc-4210-8fbf-2ab345ce1998'; + public const NOT_READABLE_ERROR = 'c20c92a4-5bfa-4202-9477-28e800e0f6ff'; + public const EMPTY_ERROR = '5d743385-9775-4aa5-8ff5-495fb1e60137'; + public const TOO_LARGE_ERROR = 'df8637af-d466-48c6-a59d-e7126250a654'; + public const INVALID_MIME_TYPE_ERROR = '744f00bc-4389-4c74-92de-9a43cde55534'; + + protected static $errorNames = [ + self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', + self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', + self::EMPTY_ERROR => 'EMPTY_ERROR', + self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', + self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', + ]; + + public $binaryFormat; + public $mimeTypes = []; + public $notFoundMessage = 'The file could not be found.'; + public $notReadableMessage = 'The file is not readable.'; + public $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; + public $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'; + public $disallowEmptyMessage = 'An empty file is not allowed.'; + + public $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; + public $uploadFormSizeErrorMessage = 'The file is too large.'; + public $uploadPartialErrorMessage = 'The file was only partially uploaded.'; + public $uploadNoFileErrorMessage = 'No file was uploaded.'; + public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'; + public $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'; + public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'; + public $uploadErrorMessage = 'The file could not be uploaded.'; + + protected $maxSize; + + /** + * {@inheritdoc} + * + * @param int|string|null $maxSize + * @param string[]|string|null $mimeTypes + */ + public function __construct( + array $options = null, + $maxSize = null, + bool $binaryFormat = null, + $mimeTypes = null, + string $notFoundMessage = null, + string $notReadableMessage = null, + string $maxSizeMessage = null, + string $mimeTypesMessage = null, + string $disallowEmptyMessage = null, + + string $uploadIniSizeErrorMessage = null, + string $uploadFormSizeErrorMessage = null, + string $uploadPartialErrorMessage = null, + string $uploadNoFileErrorMessage = null, + string $uploadNoTmpDirErrorMessage = null, + string $uploadCantWriteErrorMessage = null, + string $uploadExtensionErrorMessage = null, + string $uploadErrorMessage = null, + array $groups = null, + $payload = null + ) { + if (null !== $maxSize && !\is_int($maxSize) && !\is_string($maxSize)) { + throw new \TypeError(sprintf('"%s": Expected argument $maxSize to be either null, an integer or a string, got "%s".', __METHOD__, get_debug_type($maxSize))); + } + if (null !== $mimeTypes && !\is_array($mimeTypes) && !\is_string($mimeTypes)) { + throw new \TypeError(sprintf('"%s": Expected argument $mimeTypes to be either null, an array or a string, got "%s".', __METHOD__, get_debug_type($mimeTypes))); + } + + parent::__construct($options, $groups, $payload); + + $this->maxSize = $maxSize ?? $this->maxSize; + $this->binaryFormat = $binaryFormat ?? $this->binaryFormat; + $this->mimeTypes = $mimeTypes ?? $this->mimeTypes; + $this->notFoundMessage = $notFoundMessage ?? $this->notFoundMessage; + $this->notReadableMessage = $notReadableMessage ?? $this->notReadableMessage; + $this->maxSizeMessage = $maxSizeMessage ?? $this->maxSizeMessage; + $this->mimeTypesMessage = $mimeTypesMessage ?? $this->mimeTypesMessage; + $this->disallowEmptyMessage = $disallowEmptyMessage ?? $this->disallowEmptyMessage; + $this->uploadIniSizeErrorMessage = $uploadIniSizeErrorMessage ?? $this->uploadIniSizeErrorMessage; + $this->uploadFormSizeErrorMessage = $uploadFormSizeErrorMessage ?? $this->uploadFormSizeErrorMessage; + $this->uploadPartialErrorMessage = $uploadPartialErrorMessage ?? $this->uploadPartialErrorMessage; + $this->uploadNoFileErrorMessage = $uploadNoFileErrorMessage ?? $this->uploadNoFileErrorMessage; + $this->uploadNoTmpDirErrorMessage = $uploadNoTmpDirErrorMessage ?? $this->uploadNoTmpDirErrorMessage; + $this->uploadCantWriteErrorMessage = $uploadCantWriteErrorMessage ?? $this->uploadCantWriteErrorMessage; + $this->uploadExtensionErrorMessage = $uploadExtensionErrorMessage ?? $this->uploadExtensionErrorMessage; + $this->uploadErrorMessage = $uploadErrorMessage ?? $this->uploadErrorMessage; + + if (null !== $this->maxSize) { + $this->normalizeBinaryFormat($this->maxSize); + } + } + + public function __set(string $option, $value) + { + if ('maxSize' === $option) { + $this->normalizeBinaryFormat($value); + + return; + } + + parent::__set($option, $value); + } + + public function __get(string $option) + { + if ('maxSize' === $option) { + return $this->maxSize; + } + + return parent::__get($option); + } + + public function __isset(string $option) + { + if ('maxSize' === $option) { + return true; + } + + return parent::__isset($option); + } + + /** + * @param int|string $maxSize + */ + private function normalizeBinaryFormat($maxSize) + { + $factors = [ + 'k' => 1000, + 'ki' => 1 << 10, + 'm' => 1000 * 1000, + 'mi' => 1 << 20, + 'g' => 1000 * 1000 * 1000, + 'gi' => 1 << 30, + ]; + if (ctype_digit((string) $maxSize)) { + $this->maxSize = (int) $maxSize; + $this->binaryFormat = $this->binaryFormat ?? false; + } elseif (preg_match('/^(\d++)('.implode('|', array_keys($factors)).')$/i', $maxSize, $matches)) { + $this->maxSize = $matches[1] * $factors[$unit = strtolower($matches[2])]; + $this->binaryFormat = $this->binaryFormat ?? (2 === \strlen($unit)); + } else { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size.', $maxSize)); + } + } +} diff --git a/vendor/symfony/validator/Constraints/FileValidator.php b/vendor/symfony/validator/Constraints/FileValidator.php new file mode 100644 index 0000000..cebb6ed --- /dev/null +++ b/vendor/symfony/validator/Constraints/FileValidator.php @@ -0,0 +1,252 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\HttpFoundation\File\File as FileObject; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\Mime\MimeTypes; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\LogicException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class FileValidator extends ConstraintValidator +{ + public const KB_BYTES = 1000; + public const MB_BYTES = 1000000; + public const KIB_BYTES = 1024; + public const MIB_BYTES = 1048576; + + private const SUFFICES = [ + 1 => 'bytes', + self::KB_BYTES => 'kB', + self::MB_BYTES => 'MB', + self::KIB_BYTES => 'KiB', + self::MIB_BYTES => 'MiB', + ]; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof File) { + throw new UnexpectedTypeException($constraint, File::class); + } + + if (null === $value || '' === $value) { + return; + } + + if ($value instanceof UploadedFile && !$value->isValid()) { + switch ($value->getError()) { + case \UPLOAD_ERR_INI_SIZE: + $iniLimitSize = UploadedFile::getMaxFilesize(); + if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { + $limitInBytes = $constraint->maxSize; + $binaryFormat = $constraint->binaryFormat; + } else { + $limitInBytes = $iniLimitSize; + $binaryFormat = $constraint->binaryFormat ?? true; + } + + [, $limitAsString, $suffix] = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); + $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode((string) \UPLOAD_ERR_INI_SIZE) + ->addViolation(); + + return; + case \UPLOAD_ERR_FORM_SIZE: + $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) + ->setCode((string) \UPLOAD_ERR_FORM_SIZE) + ->addViolation(); + + return; + case \UPLOAD_ERR_PARTIAL: + $this->context->buildViolation($constraint->uploadPartialErrorMessage) + ->setCode((string) \UPLOAD_ERR_PARTIAL) + ->addViolation(); + + return; + case \UPLOAD_ERR_NO_FILE: + $this->context->buildViolation($constraint->uploadNoFileErrorMessage) + ->setCode((string) \UPLOAD_ERR_NO_FILE) + ->addViolation(); + + return; + case \UPLOAD_ERR_NO_TMP_DIR: + $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) + ->setCode((string) \UPLOAD_ERR_NO_TMP_DIR) + ->addViolation(); + + return; + case \UPLOAD_ERR_CANT_WRITE: + $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) + ->setCode((string) \UPLOAD_ERR_CANT_WRITE) + ->addViolation(); + + return; + case \UPLOAD_ERR_EXTENSION: + $this->context->buildViolation($constraint->uploadExtensionErrorMessage) + ->setCode((string) \UPLOAD_ERR_EXTENSION) + ->addViolation(); + + return; + default: + $this->context->buildViolation($constraint->uploadErrorMessage) + ->setCode((string) $value->getError()) + ->addViolation(); + + return; + } + } + + if (!is_scalar($value) && !$value instanceof FileObject && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $path = $value instanceof FileObject ? $value->getPathname() : (string) $value; + + if (!is_file($path)) { + $this->context->buildViolation($constraint->notFoundMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_FOUND_ERROR) + ->addViolation(); + + return; + } + + if (!is_readable($path)) { + $this->context->buildViolation($constraint->notReadableMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setCode(File::NOT_READABLE_ERROR) + ->addViolation(); + + return; + } + + $sizeInBytes = filesize($path); + $basename = $value instanceof UploadedFile ? $value->getClientOriginalName() : basename($path); + + if (0 === $sizeInBytes) { + $this->context->buildViolation($constraint->disallowEmptyMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ name }}', $this->formatValue($basename)) + ->setCode(File::EMPTY_ERROR) + ->addViolation(); + + return; + } + + if ($constraint->maxSize) { + $limitInBytes = $constraint->maxSize; + + if ($sizeInBytes > $limitInBytes) { + [$sizeAsString, $limitAsString, $suffix] = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat); + $this->context->buildViolation($constraint->maxSizeMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ size }}', $sizeAsString) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setParameter('{{ name }}', $this->formatValue($basename)) + ->setCode(File::TOO_LARGE_ERROR) + ->addViolation(); + + return; + } + } + + if ($constraint->mimeTypes) { + if ($value instanceof FileObject) { + $mime = $value->getMimeType(); + } elseif (class_exists(MimeTypes::class)) { + $mime = MimeTypes::getDefault()->guessMimeType($path); + } elseif (!class_exists(FileObject::class)) { + throw new LogicException('You cannot validate the mime-type of files as the Mime component is not installed. Try running "composer require symfony/mime".'); + } else { + $mime = (new FileObject($value))->getMimeType(); + } + + $mimeTypes = (array) $constraint->mimeTypes; + + foreach ($mimeTypes as $mimeType) { + if ($mimeType === $mime) { + return; + } + + if ($discrete = strstr($mimeType, '/*', true)) { + if (strstr($mime, '/', true) === $discrete) { + return; + } + } + } + + $this->context->buildViolation($constraint->mimeTypesMessage) + ->setParameter('{{ file }}', $this->formatValue($path)) + ->setParameter('{{ type }}', $this->formatValue($mime)) + ->setParameter('{{ types }}', $this->formatValues($mimeTypes)) + ->setParameter('{{ name }}', $this->formatValue($basename)) + ->setCode(File::INVALID_MIME_TYPE_ERROR) + ->addViolation(); + } + } + + private static function moreDecimalsThan(string $double, int $numberOfDecimals): bool + { + return \strlen($double) > \strlen(round($double, $numberOfDecimals)); + } + + /** + * Convert the limit to the smallest possible number + * (i.e. try "MB", then "kB", then "bytes"). + * + * @param int|float $limit + */ + private function factorizeSizes(int $size, $limit, bool $binaryFormat): array + { + if ($binaryFormat) { + $coef = self::MIB_BYTES; + $coefFactor = self::KIB_BYTES; + } else { + $coef = self::MB_BYTES; + $coefFactor = self::KB_BYTES; + } + + $limitAsString = (string) ($limit / $coef); + + // Restrict the limit to 2 decimals (without rounding! we + // need the precise value) + while (self::moreDecimalsThan($limitAsString, 2)) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + } + + // Convert size to the same measure, but round to 2 decimals + $sizeAsString = (string) round($size / $coef, 2); + + // If the size and limit produce the same string output + // (due to rounding), reduce the coefficient + while ($sizeAsString === $limitAsString) { + $coef /= $coefFactor; + $limitAsString = (string) ($limit / $coef); + $sizeAsString = (string) round($size / $coef, 2); + } + + return [$sizeAsString, $limitAsString, self::SUFFICES[$coef]]; + } +} diff --git a/vendor/symfony/validator/Constraints/GreaterThan.php b/vendor/symfony/validator/Constraints/GreaterThan.php new file mode 100644 index 0000000..4164875 --- /dev/null +++ b/vendor/symfony/validator/Constraints/GreaterThan.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class GreaterThan extends AbstractComparison +{ + public const TOO_LOW_ERROR = '778b7ae0-84d3-481a-9dec-35fdb64b1d78'; + + protected static $errorNames = [ + self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', + ]; + + public $message = 'This value should be greater than {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php b/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php new file mode 100644 index 0000000..86ff44e --- /dev/null +++ b/vendor/symfony/validator/Constraints/GreaterThanOrEqual.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class GreaterThanOrEqual extends AbstractComparison +{ + public const TOO_LOW_ERROR = 'ea4e51d1-3342-48bd-87f1-9e672cd90cad'; + + protected static $errorNames = [ + self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', + ]; + + public $message = 'This value should be greater than or equal to {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php b/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php new file mode 100644 index 0000000..290408a --- /dev/null +++ b/vendor/symfony/validator/Constraints/GreaterThanOrEqualValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are greater than or equal to the previous (>=). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class GreaterThanOrEqualValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return null === $value2 || $value1 >= $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return GreaterThanOrEqual::TOO_LOW_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/GreaterThanValidator.php b/vendor/symfony/validator/Constraints/GreaterThanValidator.php new file mode 100644 index 0000000..062503a --- /dev/null +++ b/vendor/symfony/validator/Constraints/GreaterThanValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are greater than the previous (>). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class GreaterThanValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return null === $value2 || $value1 > $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return GreaterThan::TOO_LOW_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/GroupSequence.php b/vendor/symfony/validator/Constraints/GroupSequence.php new file mode 100644 index 0000000..522c5fd --- /dev/null +++ b/vendor/symfony/validator/Constraints/GroupSequence.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * A sequence of validation groups. + * + * When validating a group sequence, each group will only be validated if all + * of the previous groups in the sequence succeeded. For example: + * + * $validator->validate($address, null, new GroupSequence(['Basic', 'Strict'])); + * + * In the first step, all constraints that belong to the group "Basic" will be + * validated. If none of the constraints fail, the validator will then validate + * the constraints in group "Strict". This is useful, for example, if "Strict" + * contains expensive checks that require a lot of CPU or slow, external + * services. You usually don't want to run expensive checks if any of the cheap + * checks fail. + * + * When adding metadata to a class, you can override the "Default" group of + * that class with a group sequence: + * /** + * * @GroupSequence({"Address", "Strict"}) + * *\/ + * class Address + * { + * // ... + * } + * + * Whenever you validate that object in the "Default" group, the group sequence + * will be validated: + * + * $validator->validate($address); + * + * If you want to execute the constraints of the "Default" group for a class + * with an overridden default group, pass the class name as group name instead: + * + * $validator->validate($address, null, "Address") + * + * @Annotation + * @Target({"CLASS", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_CLASS)] +class GroupSequence +{ + /** + * The groups in the sequence. + * + * @var array + */ + public $groups; + + /** + * The group in which cascaded objects are validated when validating + * this sequence. + * + * By default, cascaded objects are validated in each of the groups of + * the sequence. + * + * If a class has a group sequence attached, that sequence replaces the + * "Default" group. When validating that class in the "Default" group, the + * group sequence is used instead, but still the "Default" group should be + * cascaded to other objects. + * + * @var string|GroupSequence + */ + public $cascadedGroup; + + /** + * Creates a new group sequence. + * + * @param array $groups The groups in the sequence + */ + public function __construct(array $groups) + { + // Support for Doctrine annotations + $this->groups = $groups['value'] ?? $groups; + } +} diff --git a/vendor/symfony/validator/Constraints/GroupSequenceProvider.php b/vendor/symfony/validator/Constraints/GroupSequenceProvider.php new file mode 100644 index 0000000..489a449 --- /dev/null +++ b/vendor/symfony/validator/Constraints/GroupSequenceProvider.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Annotation to define a group sequence provider. + * + * @Annotation + * @Target({"CLASS", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_CLASS)] +class GroupSequenceProvider +{ +} diff --git a/vendor/symfony/validator/Constraints/Hostname.php b/vendor/symfony/validator/Constraints/Hostname.php new file mode 100644 index 0000000..d0d02d1 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Hostname.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Dmitrii Poddubnyi + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Hostname extends Constraint +{ + public const INVALID_HOSTNAME_ERROR = '7057ffdb-0af4-4f7e-bd5e-e9acfa6d7a2d'; + + protected static $errorNames = [ + self::INVALID_HOSTNAME_ERROR => 'INVALID_HOSTNAME_ERROR', + ]; + + public $message = 'This value is not a valid hostname.'; + public $requireTld = true; + + public function __construct( + array $options = null, + string $message = null, + bool $requireTld = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->requireTld = $requireTld ?? $this->requireTld; + } +} diff --git a/vendor/symfony/validator/Constraints/HostnameValidator.php b/vendor/symfony/validator/Constraints/HostnameValidator.php new file mode 100644 index 0000000..144d57e --- /dev/null +++ b/vendor/symfony/validator/Constraints/HostnameValidator.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Dmitrii Poddubnyi + */ +class HostnameValidator extends ConstraintValidator +{ + /** + * https://tools.ietf.org/html/rfc2606. + */ + private const RESERVED_TLDS = [ + 'example', + 'invalid', + 'localhost', + 'test', + ]; + + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Hostname) { + throw new UnexpectedTypeException($constraint, Hostname::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + if ('' === $value) { + return; + } + if (!$this->isValid($value) || ($constraint->requireTld && !$this->hasValidTld($value))) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Hostname::INVALID_HOSTNAME_ERROR) + ->addViolation(); + } + } + + private function isValid(string $domain): bool + { + return false !== filter_var($domain, \FILTER_VALIDATE_DOMAIN, \FILTER_FLAG_HOSTNAME); + } + + private function hasValidTld(string $domain): bool + { + return false !== strpos($domain, '.') && !\in_array(substr($domain, strrpos($domain, '.') + 1), self::RESERVED_TLDS, true); + } +} diff --git a/vendor/symfony/validator/Constraints/Iban.php b/vendor/symfony/validator/Constraints/Iban.php new file mode 100644 index 0000000..2f7a61e --- /dev/null +++ b/vendor/symfony/validator/Constraints/Iban.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Manuel Reinhard + * @author Michael Schummel + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Iban extends Constraint +{ + public const INVALID_COUNTRY_CODE_ERROR = 'de78ee2c-bd50-44e2-aec8-3d8228aeadb9'; + public const INVALID_CHARACTERS_ERROR = '8d3d85e4-784f-4719-a5bc-d9e40d45a3a5'; + public const CHECKSUM_FAILED_ERROR = 'b9401321-f9bf-4dcb-83c1-f31094440795'; + public const INVALID_FORMAT_ERROR = 'c8d318f1-2ecc-41ba-b983-df70d225cf5a'; + public const NOT_SUPPORTED_COUNTRY_CODE_ERROR = 'e2c259f3-4b46-48e6-b72e-891658158ec8'; + + protected static $errorNames = [ + self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::NOT_SUPPORTED_COUNTRY_CODE_ERROR => 'NOT_SUPPORTED_COUNTRY_CODE_ERROR', + ]; + + public $message = 'This is not a valid International Bank Account Number (IBAN).'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/IbanValidator.php b/vendor/symfony/validator/Constraints/IbanValidator.php new file mode 100644 index 0000000..0f39a3a --- /dev/null +++ b/vendor/symfony/validator/Constraints/IbanValidator.php @@ -0,0 +1,259 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Manuel Reinhard + * @author Michael Schummel + * @author Bernhard Schussek + * + * @see http://www.michael-schummel.de/2007/10/05/iban-prufung-mit-php/ + */ +class IbanValidator extends ConstraintValidator +{ + /** + * IBAN country specific formats. + * + * The first 2 characters from an IBAN format are the two-character ISO country code. + * The following 2 characters represent the check digits calculated from the rest of the IBAN characters. + * The rest are up to thirty alphanumeric characters for + * a BBAN (Basic Bank Account Number) which has a fixed length per country and, + * included within it, a bank identifier with a fixed position and a fixed length per country + * + * @see https://www.swift.com/sites/default/files/resources/iban_registry.pdf + */ + private const FORMATS = [ + 'AD' => 'AD\d{2}\d{4}\d{4}[\dA-Z]{12}', // Andorra + 'AE' => 'AE\d{2}\d{3}\d{16}', // United Arab Emirates + 'AL' => 'AL\d{2}\d{8}[\dA-Z]{16}', // Albania + 'AO' => 'AO\d{2}\d{21}', // Angola + 'AT' => 'AT\d{2}\d{5}\d{11}', // Austria + 'AX' => 'FI\d{2}\d{6}\d{7}\d{1}', // Aland Islands + 'AZ' => 'AZ\d{2}[A-Z]{4}[\dA-Z]{20}', // Azerbaijan + 'BA' => 'BA\d{2}\d{3}\d{3}\d{8}\d{2}', // Bosnia and Herzegovina + 'BE' => 'BE\d{2}\d{3}\d{7}\d{2}', // Belgium + 'BF' => 'BF\d{2}\d{23}', // Burkina Faso + 'BG' => 'BG\d{2}[A-Z]{4}\d{4}\d{2}[\dA-Z]{8}', // Bulgaria + 'BH' => 'BH\d{2}[A-Z]{4}[\dA-Z]{14}', // Bahrain + 'BI' => 'BI\d{2}\d{12}', // Burundi + 'BJ' => 'BJ\d{2}[A-Z]{1}\d{23}', // Benin + 'BY' => 'BY\d{2}[\dA-Z]{4}\d{4}[\dA-Z]{16}', // Belarus - https://bank.codes/iban/structure/belarus/ + 'BL' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Barthelemy + 'BR' => 'BR\d{2}\d{8}\d{5}\d{10}[A-Z][\dA-Z]', // Brazil + 'CG' => 'CG\d{2}\d{23}', // Congo + 'CH' => 'CH\d{2}\d{5}[\dA-Z]{12}', // Switzerland + 'CI' => 'CI\d{2}[A-Z]{1}\d{23}', // Ivory Coast + 'CM' => 'CM\d{2}\d{23}', // Cameron + 'CR' => 'CR\d{2}0\d{3}\d{14}', // Costa Rica + 'CV' => 'CV\d{2}\d{21}', // Cape Verde + 'CY' => 'CY\d{2}\d{3}\d{5}[\dA-Z]{16}', // Cyprus + 'CZ' => 'CZ\d{2}\d{20}', // Czech Republic + 'DE' => 'DE\d{2}\d{8}\d{10}', // Germany + 'DO' => 'DO\d{2}[\dA-Z]{4}\d{20}', // Dominican Republic + 'DK' => 'DK\d{2}\d{4}\d{10}', // Denmark + 'DZ' => 'DZ\d{2}\d{20}', // Algeria + 'EE' => 'EE\d{2}\d{2}\d{2}\d{11}\d{1}', // Estonia + 'ES' => 'ES\d{2}\d{4}\d{4}\d{1}\d{1}\d{10}', // Spain (also includes Canary Islands, Ceuta and Melilla) + 'FI' => 'FI\d{2}\d{6}\d{7}\d{1}', // Finland + 'FO' => 'FO\d{2}\d{4}\d{9}\d{1}', // Faroe Islands + 'FR' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // France + 'GF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Guyana + 'GB' => 'GB\d{2}[A-Z]{4}\d{6}\d{8}', // United Kingdom of Great Britain and Northern Ireland + 'GE' => 'GE\d{2}[A-Z]{2}\d{16}', // Georgia + 'GI' => 'GI\d{2}[A-Z]{4}[\dA-Z]{15}', // Gibraltar + 'GL' => 'GL\d{2}\d{4}\d{9}\d{1}', // Greenland + 'GP' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Guadeloupe + 'GR' => 'GR\d{2}\d{3}\d{4}[\dA-Z]{16}', // Greece + 'GT' => 'GT\d{2}[\dA-Z]{4}[\dA-Z]{20}', // Guatemala + 'HR' => 'HR\d{2}\d{7}\d{10}', // Croatia + 'HU' => 'HU\d{2}\d{3}\d{4}\d{1}\d{15}\d{1}', // Hungary + 'IE' => 'IE\d{2}[A-Z]{4}\d{6}\d{8}', // Ireland + 'IL' => 'IL\d{2}\d{3}\d{3}\d{13}', // Israel + 'IR' => 'IR\d{2}\d{22}', // Iran + 'IS' => 'IS\d{2}\d{4}\d{2}\d{6}\d{10}', // Iceland + 'IT' => 'IT\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // Italy + 'JO' => 'JO\d{2}[A-Z]{4}\d{4}[\dA-Z]{18}', // Jordan + 'KW' => 'KW\d{2}[A-Z]{4}\d{22}', // KUWAIT + 'KZ' => 'KZ\d{2}\d{3}[\dA-Z]{13}', // Kazakhstan + 'LB' => 'LB\d{2}\d{4}[\dA-Z]{20}', // LEBANON + 'LI' => 'LI\d{2}\d{5}[\dA-Z]{12}', // Liechtenstein (Principality of) + 'LT' => 'LT\d{2}\d{5}\d{11}', // Lithuania + 'LU' => 'LU\d{2}\d{3}[\dA-Z]{13}', // Luxembourg + 'LV' => 'LV\d{2}[A-Z]{4}[\dA-Z]{13}', // Latvia + 'MC' => 'MC\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Monaco + 'MD' => 'MD\d{2}[\dA-Z]{2}[\dA-Z]{18}', // Moldova + 'ME' => 'ME\d{2}\d{3}\d{13}\d{2}', // Montenegro + 'MF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Martin (French part) + 'MG' => 'MG\d{2}\d{23}', // Madagascar + 'MK' => 'MK\d{2}\d{3}[\dA-Z]{10}\d{2}', // Macedonia, Former Yugoslav Republic of + 'ML' => 'ML\d{2}[A-Z]{1}\d{23}', // Mali + 'MQ' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Martinique + 'MR' => 'MR13\d{5}\d{5}\d{11}\d{2}', // Mauritania + 'MT' => 'MT\d{2}[A-Z]{4}\d{5}[\dA-Z]{18}', // Malta + 'MU' => 'MU\d{2}[A-Z]{4}\d{2}\d{2}\d{12}\d{3}[A-Z]{3}', // Mauritius + 'MZ' => 'MZ\d{2}\d{21}', // Mozambique + 'NC' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // New Caledonia + 'NL' => 'NL\d{2}[A-Z]{4}\d{10}', // The Netherlands + 'NO' => 'NO\d{2}\d{4}\d{6}\d{1}', // Norway + 'PF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Polynesia + 'PK' => 'PK\d{2}[A-Z]{4}[\dA-Z]{16}', // Pakistan + 'PL' => 'PL\d{2}\d{8}\d{16}', // Poland + 'PM' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Saint Pierre et Miquelon + 'PS' => 'PS\d{2}[A-Z]{4}[\dA-Z]{21}', // Palestine, State of + 'PT' => 'PT\d{2}\d{4}\d{4}\d{11}\d{2}', // Portugal (plus Azores and Madeira) + 'QA' => 'QA\d{2}[A-Z]{4}[\dA-Z]{21}', // Qatar + 'RE' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Reunion + 'RO' => 'RO\d{2}[A-Z]{4}[\dA-Z]{16}', // Romania + 'RS' => 'RS\d{2}\d{3}\d{13}\d{2}', // Serbia + 'SA' => 'SA\d{2}\d{2}[\dA-Z]{18}', // Saudi Arabia + 'SE' => 'SE\d{2}\d{3}\d{16}\d{1}', // Sweden + 'SI' => 'SI\d{2}\d{5}\d{8}\d{2}', // Slovenia + 'SK' => 'SK\d{2}\d{4}\d{6}\d{10}', // Slovak Republic + 'SM' => 'SM\d{2}[A-Z]{1}\d{5}\d{5}[\dA-Z]{12}', // San Marino + 'SN' => 'SN\d{2}[A-Z]{1}\d{23}', // Senegal + 'TF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // French Southern Territories + 'TL' => 'TL\d{2}\d{3}\d{14}\d{2}', // Timor-Leste + 'TN' => 'TN59\d{2}\d{3}\d{13}\d{2}', // Tunisia + 'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey + 'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine + 'VA' => 'VA\d{2}\d{3}\d{15}', // Vatican City State + 'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands, British + 'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Wallis and Futuna Islands + 'XK' => 'XK\d{2}\d{4}\d{10}\d{2}', // Republic of Kosovo + 'YT' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Mayotte + ]; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Iban) { + throw new UnexpectedTypeException($constraint, Iban::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + // Remove spaces and convert to uppercase + $canonicalized = str_replace(' ', '', strtoupper($value)); + + // The IBAN must contain only digits and characters... + if (!ctype_alnum($canonicalized)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + // ...start with a two-letter country code + $countryCode = substr($canonicalized, 0, 2); + + if (!ctype_alpha($countryCode)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_COUNTRY_CODE_ERROR) + ->addViolation(); + + return; + } + + // ...have a format available + if (!\array_key_exists($countryCode, self::FORMATS)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::NOT_SUPPORTED_COUNTRY_CODE_ERROR) + ->addViolation(); + + return; + } + + // ...and have a valid format + if (!preg_match('/^'.self::FORMATS[$countryCode].'$/', $canonicalized) + ) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + + // Move the first four characters to the end + // e.g. CH93 0076 2011 6238 5295 7 + // -> 0076 2011 6238 5295 7 CH93 + $canonicalized = substr($canonicalized, 4).substr($canonicalized, 0, 4); + + // Convert all remaining letters to their ordinals + // The result is an integer, which is too large for PHP's int + // data type, so we store it in a string instead. + // e.g. 0076 2011 6238 5295 7 CH93 + // -> 0076 2011 6238 5295 7 121893 + $checkSum = self::toBigInt($canonicalized); + + // Do a modulo-97 operation on the large integer + // We cannot use PHP's modulo operator, so we calculate the + // modulo step-wisely instead + if (1 !== self::bigModulo97($checkSum)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Iban::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } + + private static function toBigInt(string $string): string + { + $chars = str_split($string); + $bigInt = ''; + + foreach ($chars as $char) { + // Convert uppercase characters to ordinals, starting with 10 for "A" + if (ctype_upper($char)) { + $bigInt .= (\ord($char) - 55); + + continue; + } + + // Simply append digits + $bigInt .= $char; + } + + return $bigInt; + } + + private static function bigModulo97(string $bigInt): int + { + $parts = str_split($bigInt, 7); + $rest = 0; + + foreach ($parts as $part) { + $rest = ($rest.$part) % 97; + } + + return $rest; + } +} diff --git a/vendor/symfony/validator/Constraints/IdenticalTo.php b/vendor/symfony/validator/Constraints/IdenticalTo.php new file mode 100644 index 0000000..b3d6b92 --- /dev/null +++ b/vendor/symfony/validator/Constraints/IdenticalTo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class IdenticalTo extends AbstractComparison +{ + public const NOT_IDENTICAL_ERROR = '2a8cc50f-58a2-4536-875e-060a2ce69ed5'; + + protected static $errorNames = [ + self::NOT_IDENTICAL_ERROR => 'NOT_IDENTICAL_ERROR', + ]; + + public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/IdenticalToValidator.php b/vendor/symfony/validator/Constraints/IdenticalToValidator.php new file mode 100644 index 0000000..304f71f --- /dev/null +++ b/vendor/symfony/validator/Constraints/IdenticalToValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are identical (===). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class IdenticalToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 === $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return IdenticalTo::NOT_IDENTICAL_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/Image.php b/vendor/symfony/validator/Constraints/Image.php new file mode 100644 index 0000000..83fc9f9 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Image.php @@ -0,0 +1,193 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Benjamin Dulau + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Image extends File +{ + public const SIZE_NOT_DETECTED_ERROR = '6d55c3f4-e58e-4fe3-91ee-74b492199956'; + public const TOO_WIDE_ERROR = '7f87163d-878f-47f5-99ba-a8eb723a1ab2'; + public const TOO_NARROW_ERROR = '9afbd561-4f90-4a27-be62-1780fc43604a'; + public const TOO_HIGH_ERROR = '7efae81c-4877-47ba-aa65-d01ccb0d4645'; + public const TOO_LOW_ERROR = 'aef0cb6a-c07f-4894-bc08-1781420d7b4c'; + public const TOO_FEW_PIXEL_ERROR = '1b06b97d-ae48-474e-978f-038a74854c43'; + public const TOO_MANY_PIXEL_ERROR = 'ee0804e8-44db-4eac-9775-be91aaf72ce1'; + public const RATIO_TOO_BIG_ERROR = '70cafca6-168f-41c9-8c8c-4e47a52be643'; + public const RATIO_TOO_SMALL_ERROR = '59b8c6ef-bcf2-4ceb-afff-4642ed92f12e'; + public const SQUARE_NOT_ALLOWED_ERROR = '5d41425b-facb-47f7-a55a-de9fbe45cb46'; + public const LANDSCAPE_NOT_ALLOWED_ERROR = '6f895685-7cf2-4d65-b3da-9029c5581d88'; + public const PORTRAIT_NOT_ALLOWED_ERROR = '65608156-77da-4c79-a88c-02ef6d18c782'; + public const CORRUPTED_IMAGE_ERROR = '5d4163f3-648f-4e39-87fd-cc5ea7aad2d1'; + + // Include the mapping from the base class + + protected static $errorNames = [ + self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR', + self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR', + self::EMPTY_ERROR => 'EMPTY_ERROR', + self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', + self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR', + self::SIZE_NOT_DETECTED_ERROR => 'SIZE_NOT_DETECTED_ERROR', + self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR', + self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR', + self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', + self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', + self::TOO_FEW_PIXEL_ERROR => 'TOO_FEW_PIXEL_ERROR', + self::TOO_MANY_PIXEL_ERROR => 'TOO_MANY_PIXEL_ERROR', + self::RATIO_TOO_BIG_ERROR => 'RATIO_TOO_BIG_ERROR', + self::RATIO_TOO_SMALL_ERROR => 'RATIO_TOO_SMALL_ERROR', + self::SQUARE_NOT_ALLOWED_ERROR => 'SQUARE_NOT_ALLOWED_ERROR', + self::LANDSCAPE_NOT_ALLOWED_ERROR => 'LANDSCAPE_NOT_ALLOWED_ERROR', + self::PORTRAIT_NOT_ALLOWED_ERROR => 'PORTRAIT_NOT_ALLOWED_ERROR', + self::CORRUPTED_IMAGE_ERROR => 'CORRUPTED_IMAGE_ERROR', + ]; + + public $mimeTypes = 'image/*'; + public $minWidth; + public $maxWidth; + public $maxHeight; + public $minHeight; + public $maxRatio; + public $minRatio; + public $minPixels; + public $maxPixels; + public $allowSquare = true; + public $allowLandscape = true; + public $allowPortrait = true; + public $detectCorrupted = false; + + // The constant for a wrong MIME type is taken from the parent class. + public $mimeTypesMessage = 'This file is not a valid image.'; + public $sizeNotDetectedMessage = 'The size of the image could not be detected.'; + public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.'; + public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.'; + public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.'; + public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.'; + public $minPixelsMessage = 'The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.'; + public $maxPixelsMessage = 'The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.'; + public $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.'; + public $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.'; + public $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.'; + public $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.'; + public $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.'; + public $corruptedMessage = 'The image file is corrupted.'; + + /** + * {@inheritdoc} + * + * @param int|float $maxRatio + * @param int|float $minRatio + * @param int|float $minPixels + * @param int|float $maxPixels + */ + public function __construct( + array $options = null, + $maxSize = null, + bool $binaryFormat = null, + array $mimeTypes = null, + int $minWidth = null, + int $maxWidth = null, + int $maxHeight = null, + int $minHeight = null, + $maxRatio = null, + $minRatio = null, + $minPixels = null, + $maxPixels = null, + bool $allowSquare = null, + bool $allowLandscape = null, + bool $allowPortrait = null, + bool $detectCorrupted = null, + string $notFoundMessage = null, + string $notReadableMessage = null, + string $maxSizeMessage = null, + string $mimeTypesMessage = null, + string $disallowEmptyMessage = null, + string $uploadIniSizeErrorMessage = null, + string $uploadFormSizeErrorMessage = null, + string $uploadPartialErrorMessage = null, + string $uploadNoFileErrorMessage = null, + string $uploadNoTmpDirErrorMessage = null, + string $uploadCantWriteErrorMessage = null, + string $uploadExtensionErrorMessage = null, + string $uploadErrorMessage = null, + string $sizeNotDetectedMessage = null, + string $maxWidthMessage = null, + string $minWidthMessage = null, + string $maxHeightMessage = null, + string $minHeightMessage = null, + string $minPixelsMessage = null, + string $maxPixelsMessage = null, + string $maxRatioMessage = null, + string $minRatioMessage = null, + string $allowSquareMessage = null, + string $allowLandscapeMessage = null, + string $allowPortraitMessage = null, + string $corruptedMessage = null, + array $groups = null, + $payload = null + ) { + parent::__construct( + $options, + $maxSize, + $binaryFormat, + $mimeTypes, + $notFoundMessage, + $notReadableMessage, + $maxSizeMessage, + $mimeTypesMessage, + $disallowEmptyMessage, + $uploadIniSizeErrorMessage, + $uploadFormSizeErrorMessage, + $uploadPartialErrorMessage, + $uploadNoFileErrorMessage, + $uploadNoTmpDirErrorMessage, + $uploadCantWriteErrorMessage, + $uploadExtensionErrorMessage, + $uploadErrorMessage, + $groups, + $payload + ); + + $this->minWidth = $minWidth ?? $this->minWidth; + $this->maxWidth = $maxWidth ?? $this->maxWidth; + $this->maxHeight = $maxHeight ?? $this->maxHeight; + $this->minHeight = $minHeight ?? $this->minHeight; + $this->maxRatio = $maxRatio ?? $this->maxRatio; + $this->minRatio = $minRatio ?? $this->minRatio; + $this->minPixels = $minPixels ?? $this->minPixels; + $this->maxPixels = $maxPixels ?? $this->maxPixels; + $this->allowSquare = $allowSquare ?? $this->allowSquare; + $this->allowLandscape = $allowLandscape ?? $this->allowLandscape; + $this->allowPortrait = $allowPortrait ?? $this->allowPortrait; + $this->detectCorrupted = $detectCorrupted ?? $this->detectCorrupted; + $this->sizeNotDetectedMessage = $sizeNotDetectedMessage ?? $this->sizeNotDetectedMessage; + $this->maxWidthMessage = $maxWidthMessage ?? $this->maxWidthMessage; + $this->minWidthMessage = $minWidthMessage ?? $this->minWidthMessage; + $this->maxHeightMessage = $maxHeightMessage ?? $this->maxHeightMessage; + $this->minHeightMessage = $minHeightMessage ?? $this->minHeightMessage; + $this->minPixelsMessage = $minPixelsMessage ?? $this->minPixelsMessage; + $this->maxPixelsMessage = $maxPixelsMessage ?? $this->maxPixelsMessage; + $this->maxRatioMessage = $maxRatioMessage ?? $this->maxRatioMessage; + $this->minRatioMessage = $minRatioMessage ?? $this->minRatioMessage; + $this->allowSquareMessage = $allowSquareMessage ?? $this->allowSquareMessage; + $this->allowLandscapeMessage = $allowLandscapeMessage ?? $this->allowLandscapeMessage; + $this->allowPortraitMessage = $allowPortraitMessage ?? $this->allowPortraitMessage; + $this->corruptedMessage = $corruptedMessage ?? $this->corruptedMessage; + } +} diff --git a/vendor/symfony/validator/Constraints/ImageValidator.php b/vendor/symfony/validator/Constraints/ImageValidator.php new file mode 100644 index 0000000..f199f1d --- /dev/null +++ b/vendor/symfony/validator/Constraints/ImageValidator.php @@ -0,0 +1,237 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\LogicException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * Validates whether a value is a valid image file and is valid + * against minWidth, maxWidth, minHeight and maxHeight constraints. + * + * @author Benjamin Dulau + * @author Bernhard Schussek + */ +class ImageValidator extends FileValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Image) { + throw new UnexpectedTypeException($constraint, Image::class); + } + + $violations = \count($this->context->getViolations()); + + parent::validate($value, $constraint); + + $failed = \count($this->context->getViolations()) !== $violations; + + if ($failed || null === $value || '' === $value) { + return; + } + + if (null === $constraint->minWidth && null === $constraint->maxWidth + && null === $constraint->minHeight && null === $constraint->maxHeight + && null === $constraint->minPixels && null === $constraint->maxPixels + && null === $constraint->minRatio && null === $constraint->maxRatio + && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait + && !$constraint->detectCorrupted) { + return; + } + + $size = @getimagesize($value); + + if (empty($size) || (0 === $size[0]) || (0 === $size[1])) { + $this->context->buildViolation($constraint->sizeNotDetectedMessage) + ->setCode(Image::SIZE_NOT_DETECTED_ERROR) + ->addViolation(); + + return; + } + + $width = $size[0]; + $height = $size[1]; + + if ($constraint->minWidth) { + if (!ctype_digit((string) $constraint->minWidth)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum width.', $constraint->minWidth)); + } + + if ($width < $constraint->minWidth) { + $this->context->buildViolation($constraint->minWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ min_width }}', $constraint->minWidth) + ->setCode(Image::TOO_NARROW_ERROR) + ->addViolation(); + + return; + } + } + + if ($constraint->maxWidth) { + if (!ctype_digit((string) $constraint->maxWidth)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum width.', $constraint->maxWidth)); + } + + if ($width > $constraint->maxWidth) { + $this->context->buildViolation($constraint->maxWidthMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ max_width }}', $constraint->maxWidth) + ->setCode(Image::TOO_WIDE_ERROR) + ->addViolation(); + + return; + } + } + + if ($constraint->minHeight) { + if (!ctype_digit((string) $constraint->minHeight)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum height.', $constraint->minHeight)); + } + + if ($height < $constraint->minHeight) { + $this->context->buildViolation($constraint->minHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ min_height }}', $constraint->minHeight) + ->setCode(Image::TOO_LOW_ERROR) + ->addViolation(); + + return; + } + } + + if ($constraint->maxHeight) { + if (!ctype_digit((string) $constraint->maxHeight)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight)); + } + + if ($height > $constraint->maxHeight) { + $this->context->buildViolation($constraint->maxHeightMessage) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ max_height }}', $constraint->maxHeight) + ->setCode(Image::TOO_HIGH_ERROR) + ->addViolation(); + } + } + + $pixels = $width * $height; + + if (null !== $constraint->minPixels) { + if (!ctype_digit((string) $constraint->minPixels)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels)); + } + + if ($pixels < $constraint->minPixels) { + $this->context->buildViolation($constraint->minPixelsMessage) + ->setParameter('{{ pixels }}', $pixels) + ->setParameter('{{ min_pixels }}', $constraint->minPixels) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ width }}', $width) + ->setCode(Image::TOO_FEW_PIXEL_ERROR) + ->addViolation(); + } + } + + if (null !== $constraint->maxPixels) { + if (!ctype_digit((string) $constraint->maxPixels)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels)); + } + + if ($pixels > $constraint->maxPixels) { + $this->context->buildViolation($constraint->maxPixelsMessage) + ->setParameter('{{ pixels }}', $pixels) + ->setParameter('{{ max_pixels }}', $constraint->maxPixels) + ->setParameter('{{ height }}', $height) + ->setParameter('{{ width }}', $width) + ->setCode(Image::TOO_MANY_PIXEL_ERROR) + ->addViolation(); + } + } + + $ratio = round($width / $height, 2); + + if (null !== $constraint->minRatio) { + if (!is_numeric((string) $constraint->minRatio)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid minimum ratio.', $constraint->minRatio)); + } + + if ($ratio < round($constraint->minRatio, 2)) { + $this->context->buildViolation($constraint->minRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ min_ratio }}', round($constraint->minRatio, 2)) + ->setCode(Image::RATIO_TOO_SMALL_ERROR) + ->addViolation(); + } + } + + if (null !== $constraint->maxRatio) { + if (!is_numeric((string) $constraint->maxRatio)) { + throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum ratio.', $constraint->maxRatio)); + } + + if ($ratio > round($constraint->maxRatio, 2)) { + $this->context->buildViolation($constraint->maxRatioMessage) + ->setParameter('{{ ratio }}', $ratio) + ->setParameter('{{ max_ratio }}', round($constraint->maxRatio, 2)) + ->setCode(Image::RATIO_TOO_BIG_ERROR) + ->addViolation(); + } + } + + if (!$constraint->allowSquare && $width == $height) { + $this->context->buildViolation($constraint->allowSquareMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::SQUARE_NOT_ALLOWED_ERROR) + ->addViolation(); + } + + if (!$constraint->allowLandscape && $width > $height) { + $this->context->buildViolation($constraint->allowLandscapeMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::LANDSCAPE_NOT_ALLOWED_ERROR) + ->addViolation(); + } + + if (!$constraint->allowPortrait && $width < $height) { + $this->context->buildViolation($constraint->allowPortraitMessage) + ->setParameter('{{ width }}', $width) + ->setParameter('{{ height }}', $height) + ->setCode(Image::PORTRAIT_NOT_ALLOWED_ERROR) + ->addViolation(); + } + + if ($constraint->detectCorrupted) { + if (!\function_exists('imagecreatefromstring')) { + throw new LogicException('Corrupted images detection requires installed and enabled GD extension.'); + } + + $resource = @imagecreatefromstring(file_get_contents($value)); + + if (false === $resource) { + $this->context->buildViolation($constraint->corruptedMessage) + ->setCode(Image::CORRUPTED_IMAGE_ERROR) + ->addViolation(); + + return; + } + + imagedestroy($resource); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Ip.php b/vendor/symfony/validator/Constraints/Ip.php new file mode 100644 index 0000000..0e41240 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Ip.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * Validates that a value is a valid IP address. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * @author Joseph Bielawski + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Ip extends Constraint +{ + public const V4 = '4'; + public const V6 = '6'; + public const ALL = 'all'; + + // adds FILTER_FLAG_NO_PRIV_RANGE flag (skip private ranges) + public const V4_NO_PRIV = '4_no_priv'; + public const V6_NO_PRIV = '6_no_priv'; + public const ALL_NO_PRIV = 'all_no_priv'; + + // adds FILTER_FLAG_NO_RES_RANGE flag (skip reserved ranges) + public const V4_NO_RES = '4_no_res'; + public const V6_NO_RES = '6_no_res'; + public const ALL_NO_RES = 'all_no_res'; + + // adds FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags (skip both) + public const V4_ONLY_PUBLIC = '4_public'; + public const V6_ONLY_PUBLIC = '6_public'; + public const ALL_ONLY_PUBLIC = 'all_public'; + + public const INVALID_IP_ERROR = 'b1b427ae-9f6f-41b0-aa9b-84511fbb3c5b'; + + protected static $versions = [ + self::V4, + self::V6, + self::ALL, + + self::V4_NO_PRIV, + self::V6_NO_PRIV, + self::ALL_NO_PRIV, + + self::V4_NO_RES, + self::V6_NO_RES, + self::ALL_NO_RES, + + self::V4_ONLY_PUBLIC, + self::V6_ONLY_PUBLIC, + self::ALL_ONLY_PUBLIC, + ]; + + protected static $errorNames = [ + self::INVALID_IP_ERROR => 'INVALID_IP_ERROR', + ]; + + public $version = self::V4; + + public $message = 'This is not a valid IP address.'; + + public $normalizer; + + /** + * {@inheritdoc} + */ + public function __construct( + array $options = null, + string $version = null, + string $message = null, + callable $normalizer = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->version = $version ?? $this->version; + $this->message = $message ?? $this->message; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (!\in_array($this->version, self::$versions)) { + throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s".', implode('", "', self::$versions))); + } + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/IpValidator.php b/vendor/symfony/validator/Constraints/IpValidator.php new file mode 100644 index 0000000..e48d41e --- /dev/null +++ b/vendor/symfony/validator/Constraints/IpValidator.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid IP address. + * + * @author Bernhard Schussek + * @author Joseph Bielawski + */ +class IpValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Ip) { + throw new UnexpectedTypeException($constraint, Ip::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + switch ($constraint->version) { + case Ip::V4: + $flag = \FILTER_FLAG_IPV4; + break; + + case Ip::V6: + $flag = \FILTER_FLAG_IPV6; + break; + + case Ip::V4_NO_PRIV: + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V6_NO_PRIV: + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::ALL_NO_PRIV: + $flag = \FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V4_NO_RES: + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_NO_RES: + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_NO_RES: + $flag = \FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V4_ONLY_PUBLIC: + $flag = \FILTER_FLAG_IPV4 | \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_ONLY_PUBLIC: + $flag = \FILTER_FLAG_IPV6 | \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_ONLY_PUBLIC: + $flag = \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE; + break; + + default: + $flag = 0; + break; + } + + if (!filter_var($value, \FILTER_VALIDATE_IP, $flag)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Ip::INVALID_IP_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/IsFalse.php b/vendor/symfony/validator/Constraints/IsFalse.php new file mode 100644 index 0000000..460aafc --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsFalse.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class IsFalse extends Constraint +{ + public const NOT_FALSE_ERROR = 'd53a91b0-def3-426a-83d7-269da7ab4200'; + + protected static $errorNames = [ + self::NOT_FALSE_ERROR => 'NOT_FALSE_ERROR', + ]; + + public $message = 'This value should be false.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/IsFalseValidator.php b/vendor/symfony/validator/Constraints/IsFalseValidator.php new file mode 100644 index 0000000..79c4234 --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsFalseValidator.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class IsFalseValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof IsFalse) { + throw new UnexpectedTypeException($constraint, IsFalse::class); + } + + if (null === $value || false === $value || 0 === $value || '0' === $value) { + return; + } + + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(IsFalse::NOT_FALSE_ERROR) + ->addViolation(); + } +} diff --git a/vendor/symfony/validator/Constraints/IsNull.php b/vendor/symfony/validator/Constraints/IsNull.php new file mode 100644 index 0000000..2a8439f --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsNull.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class IsNull extends Constraint +{ + public const NOT_NULL_ERROR = '60d2f30b-8cfa-4372-b155-9656634de120'; + + protected static $errorNames = [ + self::NOT_NULL_ERROR => 'NOT_NULL_ERROR', + ]; + + public $message = 'This value should be null.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/IsNullValidator.php b/vendor/symfony/validator/Constraints/IsNullValidator.php new file mode 100644 index 0000000..b6e7817 --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsNullValidator.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class IsNullValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof IsNull) { + throw new UnexpectedTypeException($constraint, IsNull::class); + } + + if (null !== $value) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(IsNull::NOT_NULL_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/IsTrue.php b/vendor/symfony/validator/Constraints/IsTrue.php new file mode 100644 index 0000000..7b95475 --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsTrue.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class IsTrue extends Constraint +{ + public const NOT_TRUE_ERROR = '2beabf1c-54c0-4882-a928-05249b26e23b'; + + protected static $errorNames = [ + self::NOT_TRUE_ERROR => 'NOT_TRUE_ERROR', + ]; + + public $message = 'This value should be true.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/IsTrueValidator.php b/vendor/symfony/validator/Constraints/IsTrueValidator.php new file mode 100644 index 0000000..6088f6d --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsTrueValidator.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class IsTrueValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof IsTrue) { + throw new UnexpectedTypeException($constraint, IsTrue::class); + } + + if (null === $value) { + return; + } + + if (true !== $value && 1 !== $value && '1' !== $value) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(IsTrue::NOT_TRUE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Isbn.php b/vendor/symfony/validator/Constraints/Isbn.php new file mode 100644 index 0000000..b95dfeb --- /dev/null +++ b/vendor/symfony/validator/Constraints/Isbn.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author The Whole Life To Learn + * @author Manuel Reinhard + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Isbn extends Constraint +{ + public const ISBN_10 = 'isbn10'; + public const ISBN_13 = 'isbn13'; + + public const TOO_SHORT_ERROR = '949acbb0-8ef5-43ed-a0e9-032dfd08ae45'; + public const TOO_LONG_ERROR = '3171387d-f80a-47b3-bd6e-60598545316a'; + public const INVALID_CHARACTERS_ERROR = '23d21cea-da99-453d-98b1-a7d916fbb339'; + public const CHECKSUM_FAILED_ERROR = '2881c032-660f-46b6-8153-d352d9706640'; + public const TYPE_NOT_RECOGNIZED_ERROR = 'fa54a457-f042-441f-89c4-066ee5bdd3e1'; + + protected static $errorNames = [ + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR', + ]; + + public $isbn10Message = 'This value is not a valid ISBN-10.'; + public $isbn13Message = 'This value is not a valid ISBN-13.'; + public $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'; + public $type; + public $message; + + /** + * {@inheritdoc} + * + * @param string|array|null $type The ISBN standard to validate or a set of options + */ + public function __construct( + $type = null, + string $message = null, + string $isbn10Message = null, + string $isbn13Message = null, + string $bothIsbnMessage = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (\is_array($type)) { + $options = array_merge($type, $options); + } elseif (null !== $type) { + $options['value'] = $type; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->isbn10Message = $isbn10Message ?? $this->isbn10Message; + $this->isbn13Message = $isbn13Message ?? $this->isbn13Message; + $this->bothIsbnMessage = $bothIsbnMessage ?? $this->bothIsbnMessage; + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'type'; + } +} diff --git a/vendor/symfony/validator/Constraints/IsbnValidator.php b/vendor/symfony/validator/Constraints/IsbnValidator.php new file mode 100644 index 0000000..d015a1d --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsbnValidator.php @@ -0,0 +1,184 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether the value is a valid ISBN-10 or ISBN-13. + * + * @author The Whole Life To Learn + * @author Manuel Reinhard + * @author Bernhard Schussek + * + * @see https://en.wikipedia.org/wiki/Isbn + */ +class IsbnValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Isbn) { + throw new UnexpectedTypeException($constraint, Isbn::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + $canonical = str_replace('-', '', $value); + + // Explicitly validate against ISBN-10 + if (Isbn::ISBN_10 === $constraint->type) { + if (true !== ($code = $this->validateIsbn10($canonical))) { + $this->context->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + + return; + } + + // Explicitly validate against ISBN-13 + if (Isbn::ISBN_13 === $constraint->type) { + if (true !== ($code = $this->validateIsbn13($canonical))) { + $this->context->buildViolation($this->getMessage($constraint, $constraint->type)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + + return; + } + + // Try both ISBNs + + // First, try ISBN-10 + $code = $this->validateIsbn10($canonical); + + // The ISBN can only be an ISBN-13 if the value was too long for ISBN-10 + if (Isbn::TOO_LONG_ERROR === $code) { + // Try ISBN-13 now + $code = $this->validateIsbn13($canonical); + + // If too short, this means we have 11 or 12 digits + if (Isbn::TOO_SHORT_ERROR === $code) { + $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR; + } + } + + if (true !== $code) { + $this->context->buildViolation($this->getMessage($constraint)) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + } + + protected function validateIsbn10(string $isbn) + { + // Choose an algorithm so that ERROR_INVALID_CHARACTERS is preferred + // over ERROR_TOO_SHORT/ERROR_TOO_LONG + // Otherwise "0-45122-5244" passes, but "0-45122_5244" reports + // "too long" + + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 3. ERROR_CHECKSUM_FAILED + + $checkSum = 0; + + for ($i = 0; $i < 10; ++$i) { + // If we test the length before the loop, we get an ERROR_TOO_SHORT + // when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for + // "0-45122_5244" (typo) + if (!isset($isbn[$i])) { + return Isbn::TOO_SHORT_ERROR; + } + + if ('X' === $isbn[$i]) { + $digit = 10; + } elseif (ctype_digit($isbn[$i])) { + $digit = $isbn[$i]; + } else { + return Isbn::INVALID_CHARACTERS_ERROR; + } + + $checkSum += $digit * (10 - $i); + } + + if (isset($isbn[$i])) { + return Isbn::TOO_LONG_ERROR; + } + + return 0 === $checkSum % 11 ? true : Isbn::CHECKSUM_FAILED_ERROR; + } + + protected function validateIsbn13(string $isbn) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 3. ERROR_CHECKSUM_FAILED + + if (!ctype_digit($isbn)) { + return Isbn::INVALID_CHARACTERS_ERROR; + } + + $length = \strlen($isbn); + + if ($length < 13) { + return Isbn::TOO_SHORT_ERROR; + } + + if ($length > 13) { + return Isbn::TOO_LONG_ERROR; + } + + $checkSum = 0; + + for ($i = 0; $i < 13; $i += 2) { + $checkSum += $isbn[$i]; + } + + for ($i = 1; $i < 12; $i += 2) { + $checkSum += $isbn[$i] * 3; + } + + return 0 === $checkSum % 10 ? true : Isbn::CHECKSUM_FAILED_ERROR; + } + + protected function getMessage(Isbn $constraint, string $type = null) + { + if (null !== $constraint->message) { + return $constraint->message; + } elseif (Isbn::ISBN_10 === $type) { + return $constraint->isbn10Message; + } elseif (Isbn::ISBN_13 === $type) { + return $constraint->isbn13Message; + } + + return $constraint->bothIsbnMessage; + } +} diff --git a/vendor/symfony/validator/Constraints/Isin.php b/vendor/symfony/validator/Constraints/Isin.php new file mode 100644 index 0000000..08fa60d --- /dev/null +++ b/vendor/symfony/validator/Constraints/Isin.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Laurent Masforné + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Isin extends Constraint +{ + public const VALIDATION_LENGTH = 12; + public const VALIDATION_PATTERN = '/[A-Z]{2}[A-Z0-9]{9}[0-9]{1}/'; + + public const INVALID_LENGTH_ERROR = '88738dfc-9ed5-ba1e-aebe-402a2a9bf58e'; + public const INVALID_PATTERN_ERROR = '3d08ce0-ded9-a93d-9216-17ac21265b65e'; + public const INVALID_CHECKSUM_ERROR = '32089b-0ee1-93ba-399e-aa232e62f2d29d'; + + protected static $errorNames = [ + self::INVALID_LENGTH_ERROR => 'INVALID_LENGTH_ERROR', + self::INVALID_PATTERN_ERROR => 'INVALID_PATTERN_ERROR', + self::INVALID_CHECKSUM_ERROR => 'INVALID_CHECKSUM_ERROR', + ]; + + public $message = 'This value is not a valid International Securities Identification Number (ISIN).'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/IsinValidator.php b/vendor/symfony/validator/Constraints/IsinValidator.php new file mode 100644 index 0000000..d5e4d9d --- /dev/null +++ b/vendor/symfony/validator/Constraints/IsinValidator.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Laurent Masforné + * + * @see https://en.wikipedia.org/wiki/International_Securities_Identification_Number + */ +class IsinValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Isin) { + throw new UnexpectedTypeException($constraint, Isin::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = strtoupper($value); + + if (Isin::VALIDATION_LENGTH !== \strlen($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Isin::INVALID_LENGTH_ERROR) + ->addViolation(); + + return; + } + + if (!preg_match(Isin::VALIDATION_PATTERN, $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Isin::INVALID_PATTERN_ERROR) + ->addViolation(); + + return; + } + + if (!$this->isCorrectChecksum($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Isin::INVALID_CHECKSUM_ERROR) + ->addViolation(); + } + } + + private function isCorrectChecksum(string $input): bool + { + $characters = str_split($input); + foreach ($characters as $i => $char) { + $characters[$i] = \intval($char, 36); + } + $number = implode('', $characters); + + return 0 === $this->context->getValidator()->validate($number, new Luhn())->count(); + } +} diff --git a/vendor/symfony/validator/Constraints/Issn.php b/vendor/symfony/validator/Constraints/Issn.php new file mode 100644 index 0000000..b3b7b21 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Issn.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Antonio J. García Lagar + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Issn extends Constraint +{ + public const TOO_SHORT_ERROR = '6a20dd3d-f463-4460-8e7b-18a1b98abbfb'; + public const TOO_LONG_ERROR = '37cef893-5871-464e-8b12-7fb79324833c'; + public const MISSING_HYPHEN_ERROR = '2983286f-8134-4693-957a-1ec4ef887b15'; + public const INVALID_CHARACTERS_ERROR = 'a663d266-37c2-4ece-a914-ae891940c588'; + public const INVALID_CASE_ERROR = '7b6dd393-7523-4a6c-b84d-72b91bba5e1a'; + public const CHECKSUM_FAILED_ERROR = 'b0f92dbc-667c-48de-b526-ad9586d43e85'; + + protected static $errorNames = [ + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::MISSING_HYPHEN_ERROR => 'MISSING_HYPHEN_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + ]; + + public $message = 'This value is not a valid ISSN.'; + public $caseSensitive = false; + public $requireHyphen = false; + + public function __construct( + array $options = null, + string $message = null, + bool $caseSensitive = null, + bool $requireHyphen = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->caseSensitive = $caseSensitive ?? $this->caseSensitive; + $this->requireHyphen = $requireHyphen ?? $this->requireHyphen; + } +} diff --git a/vendor/symfony/validator/Constraints/IssnValidator.php b/vendor/symfony/validator/Constraints/IssnValidator.php new file mode 100644 index 0000000..aa83201 --- /dev/null +++ b/vendor/symfony/validator/Constraints/IssnValidator.php @@ -0,0 +1,131 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether the value is a valid ISSN. + * + * @author Antonio J. García Lagar + * @author Bernhard Schussek + * + * @see https://en.wikipedia.org/wiki/Issn + */ +class IssnValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Issn) { + throw new UnexpectedTypeException($constraint, Issn::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + $canonical = $value; + + // 1234-567X + // ^ + if (isset($canonical[4]) && '-' === $canonical[4]) { + // remove hyphen + $canonical = substr($canonical, 0, 4).substr($canonical, 5); + } elseif ($constraint->requireHyphen) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::MISSING_HYPHEN_ERROR) + ->addViolation(); + + return; + } + + $length = \strlen($canonical); + + if ($length < 8) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_SHORT_ERROR) + ->addViolation(); + + return; + } + + if ($length > 8) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::TOO_LONG_ERROR) + ->addViolation(); + + return; + } + + // 1234567X + // ^^^^^^^ digits only + if (!ctype_digit(substr($canonical, 0, 7))) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + // 1234567X + // ^ digit, x or X + if (!ctype_digit($canonical[7]) && 'x' !== $canonical[7] && 'X' !== $canonical[7]) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + // 1234567X + // ^ case-sensitive? + if ($constraint->caseSensitive && 'x' === $canonical[7]) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::INVALID_CASE_ERROR) + ->addViolation(); + + return; + } + + // Calculate a checksum. "X" equals 10. + $checkSum = 'X' === $canonical[7] || 'x' === $canonical[7] ? 10 : $canonical[7]; + + for ($i = 0; $i < 7; ++$i) { + // Multiply the first digit by 8, the second by 7, etc. + $checkSum += (8 - $i) * (int) $canonical[$i]; + } + + if (0 !== $checkSum % 11) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Issn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Json.php b/vendor/symfony/validator/Constraints/Json.php new file mode 100644 index 0000000..4388858 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Json.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Imad ZAIRIG + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Json extends Constraint +{ + public const INVALID_JSON_ERROR = '0789c8ad-2d2b-49a4-8356-e2ce63998504'; + + protected static $errorNames = [ + self::INVALID_JSON_ERROR => 'INVALID_JSON_ERROR', + ]; + + public $message = 'This value should be valid JSON.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/JsonValidator.php b/vendor/symfony/validator/Constraints/JsonValidator.php new file mode 100644 index 0000000..e553ae3 --- /dev/null +++ b/vendor/symfony/validator/Constraints/JsonValidator.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Imad ZAIRIG + */ +class JsonValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Json) { + throw new UnexpectedTypeException($constraint, Json::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $value = (string) $value; + + json_decode($value); + + if (\JSON_ERROR_NONE !== json_last_error()) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Json::INVALID_JSON_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Language.php b/vendor/symfony/validator/Constraints/Language.php new file mode 100644 index 0000000..a8204da --- /dev/null +++ b/vendor/symfony/validator/Constraints/Language.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Languages; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Language extends Constraint +{ + public const NO_SUCH_LANGUAGE_ERROR = 'ee65fec4-9a20-4202-9f39-ca558cd7bdf7'; + + protected static $errorNames = [ + self::NO_SUCH_LANGUAGE_ERROR => 'NO_SUCH_LANGUAGE_ERROR', + ]; + + public $message = 'This value is not a valid language.'; + public $alpha3 = false; + + public function __construct( + array $options = null, + string $message = null, + bool $alpha3 = null, + array $groups = null, + $payload = null + ) { + if (!class_exists(Languages::class)) { + throw new LogicException('The Intl component is required to use the Language constraint. Try running "composer require symfony/intl".'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->alpha3 = $alpha3 ?? $this->alpha3; + } +} diff --git a/vendor/symfony/validator/Constraints/LanguageValidator.php b/vendor/symfony/validator/Constraints/LanguageValidator.php new file mode 100644 index 0000000..911a713 --- /dev/null +++ b/vendor/symfony/validator/Constraints/LanguageValidator.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Languages; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid language code. + * + * @author Bernhard Schussek + */ +class LanguageValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Language) { + throw new UnexpectedTypeException($constraint, Language::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if ($constraint->alpha3 ? !Languages::alpha3CodeExists($value) : !Languages::exists($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Language::NO_SUCH_LANGUAGE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Length.php b/vendor/symfony/validator/Constraints/Length.php new file mode 100644 index 0000000..29a89a3 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Length.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Length extends Constraint +{ + public const TOO_SHORT_ERROR = '9ff3fdc4-b214-49db-8718-39c315e33d45'; + public const TOO_LONG_ERROR = 'd94b19cc-114f-4f44-9cc4-4138e80a87b9'; + public const NOT_EQUAL_LENGTH_ERROR = '4b6f5c76-22b4-409d-af16-fbe823ba9332'; + public const INVALID_CHARACTERS_ERROR = '35e6a710-aa2e-4719-b58e-24b35749b767'; + + protected static $errorNames = [ + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::NOT_EQUAL_LENGTH_ERROR => 'NOT_EQUAL_LENGTH_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + ]; + + public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; + public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; + public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; + public $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; + public $max; + public $min; + public $charset = 'UTF-8'; + public $normalizer; + public $allowEmptyString = false; + + /** + * {@inheritdoc} + * + * @param int|array|null $exactly The expected exact length or a set of options + */ + public function __construct( + $exactly = null, + int $min = null, + int $max = null, + string $charset = null, + callable $normalizer = null, + string $exactMessage = null, + string $minMessage = null, + string $maxMessage = null, + string $charsetMessage = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (\is_array($exactly)) { + $options = array_merge($exactly, $options); + $exactly = $options['value'] ?? null; + } + + $min = $min ?? $options['min'] ?? null; + $max = $max ?? $options['max'] ?? null; + + unset($options['value'], $options['min'], $options['max']); + + if (null !== $exactly && null === $min && null === $max) { + $min = $max = $exactly; + } + + parent::__construct($options, $groups, $payload); + + $this->min = $min; + $this->max = $max; + $this->charset = $charset ?? $this->charset; + $this->normalizer = $normalizer ?? $this->normalizer; + $this->exactMessage = $exactMessage ?? $this->exactMessage; + $this->minMessage = $minMessage ?? $this->minMessage; + $this->maxMessage = $maxMessage ?? $this->maxMessage; + $this->charsetMessage = $charsetMessage ?? $this->charsetMessage; + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint "%s".', __CLASS__), ['min', 'max']); + } + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + + if (isset($options['allowEmptyString'])) { + trigger_deprecation('symfony/validator', '5.2', sprintf('The "allowEmptyString" option of the "%s" constraint is deprecated.', self::class)); + } + } +} diff --git a/vendor/symfony/validator/Constraints/LengthValidator.php b/vendor/symfony/validator/Constraints/LengthValidator.php new file mode 100644 index 0000000..c4bbffe --- /dev/null +++ b/vendor/symfony/validator/Constraints/LengthValidator.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class LengthValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Length) { + throw new UnexpectedTypeException($constraint, Length::class); + } + + if (null === $value || ('' === $value && $constraint->allowEmptyString)) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $stringValue = (string) $value; + + if (null !== $constraint->normalizer) { + $stringValue = ($constraint->normalizer)($stringValue); + } + + try { + $invalidCharset = !@mb_check_encoding($stringValue, $constraint->charset); + } catch (\ValueError $e) { + if (!str_starts_with($e->getMessage(), 'mb_check_encoding(): Argument #2 ($encoding) must be a valid encoding')) { + throw $e; + } + + $invalidCharset = true; + } + + if ($invalidCharset) { + $this->context->buildViolation($constraint->charsetMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ charset }}', $constraint->charset) + ->setInvalidValue($value) + ->setCode(Length::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + $length = mb_strlen($stringValue, $constraint->charset); + + if (null !== $constraint->max && $length > $constraint->max) { + $exactlyOptionEnabled = $constraint->min == $constraint->max; + + $this->context->buildViolation($exactlyOptionEnabled ? $constraint->exactMessage : $constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->max) + ->setInvalidValue($value) + ->setPlural((int) $constraint->max) + ->setCode($exactlyOptionEnabled ? Length::NOT_EQUAL_LENGTH_ERROR : Length::TOO_LONG_ERROR) + ->addViolation(); + + return; + } + + if (null !== $constraint->min && $length < $constraint->min) { + $exactlyOptionEnabled = $constraint->min == $constraint->max; + + $this->context->buildViolation($exactlyOptionEnabled ? $constraint->exactMessage : $constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($stringValue)) + ->setParameter('{{ limit }}', $constraint->min) + ->setInvalidValue($value) + ->setPlural((int) $constraint->min) + ->setCode($exactlyOptionEnabled ? Length::NOT_EQUAL_LENGTH_ERROR : Length::TOO_SHORT_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/LessThan.php b/vendor/symfony/validator/Constraints/LessThan.php new file mode 100644 index 0000000..acd6c9e --- /dev/null +++ b/vendor/symfony/validator/Constraints/LessThan.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class LessThan extends AbstractComparison +{ + public const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2'; + + protected static $errorNames = [ + self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', + ]; + + public $message = 'This value should be less than {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/LessThanOrEqual.php b/vendor/symfony/validator/Constraints/LessThanOrEqual.php new file mode 100644 index 0000000..6f72845 --- /dev/null +++ b/vendor/symfony/validator/Constraints/LessThanOrEqual.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class LessThanOrEqual extends AbstractComparison +{ + public const TOO_HIGH_ERROR = '30fbb013-d015-4232-8b3b-8f3be97a7e14'; + + protected static $errorNames = [ + self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', + ]; + + public $message = 'This value should be less than or equal to {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php b/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php new file mode 100644 index 0000000..f7f4c8b --- /dev/null +++ b/vendor/symfony/validator/Constraints/LessThanOrEqualValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are less than or equal to the previous (<=). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class LessThanOrEqualValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return null === $value2 || $value1 <= $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return LessThanOrEqual::TOO_HIGH_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/LessThanValidator.php b/vendor/symfony/validator/Constraints/LessThanValidator.php new file mode 100644 index 0000000..64e1075 --- /dev/null +++ b/vendor/symfony/validator/Constraints/LessThanValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are less than the previous (<). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class LessThanValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return null === $value2 || $value1 < $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return LessThan::TOO_HIGH_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/Locale.php b/vendor/symfony/validator/Constraints/Locale.php new file mode 100644 index 0000000..43c46cc --- /dev/null +++ b/vendor/symfony/validator/Constraints/Locale.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Locales; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\LogicException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Locale extends Constraint +{ + public const NO_SUCH_LOCALE_ERROR = 'a0af4293-1f1a-4a1c-a328-979cba6182a2'; + + protected static $errorNames = [ + self::NO_SUCH_LOCALE_ERROR => 'NO_SUCH_LOCALE_ERROR', + ]; + + public $message = 'This value is not a valid locale.'; + public $canonicalize = true; + + public function __construct( + array $options = null, + string $message = null, + bool $canonicalize = null, + array $groups = null, + $payload = null + ) { + if (!class_exists(Locales::class)) { + throw new LogicException('The Intl component is required to use the Locale constraint. Try running "composer require symfony/intl".'); + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->canonicalize = $canonicalize ?? $this->canonicalize; + } +} diff --git a/vendor/symfony/validator/Constraints/LocaleValidator.php b/vendor/symfony/validator/Constraints/LocaleValidator.php new file mode 100644 index 0000000..860273d --- /dev/null +++ b/vendor/symfony/validator/Constraints/LocaleValidator.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Locales; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid locale code. + * + * @author Bernhard Schussek + */ +class LocaleValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Locale) { + throw new UnexpectedTypeException($constraint, Locale::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $inputValue = (string) $value; + $value = $inputValue; + if ($constraint->canonicalize) { + $value = \Locale::canonicalize($value); + } + + if (!Locales::exists($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($inputValue)) + ->setCode(Locale::NO_SUCH_LOCALE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Luhn.php b/vendor/symfony/validator/Constraints/Luhn.php new file mode 100644 index 0000000..b2d2c29 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Luhn.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * Metadata for the LuhnValidator. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Tim Nagel + * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Luhn extends Constraint +{ + public const INVALID_CHARACTERS_ERROR = 'dfad6d23-1b74-4374-929b-5cbb56fc0d9e'; + public const CHECKSUM_FAILED_ERROR = '4d760774-3f50-4cd5-a6d5-b10a3299d8d3'; + + protected static $errorNames = [ + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', + ]; + + public $message = 'Invalid card number.'; + + public function __construct( + array $options = null, + string $message = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/LuhnValidator.php b/vendor/symfony/validator/Constraints/LuhnValidator.php new file mode 100644 index 0000000..0f568fa --- /dev/null +++ b/vendor/symfony/validator/Constraints/LuhnValidator.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates a PAN using the LUHN Algorithm. + * + * For a list of example card numbers that are used to test this + * class, please see the LuhnValidatorTest class. + * + * @see http://en.wikipedia.org/wiki/Luhn_algorithm + * + * @author Tim Nagel + * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ + * @author Bernhard Schussek + */ +class LuhnValidator extends ConstraintValidator +{ + /** + * Validates a credit card number with the Luhn algorithm. + * + * @param mixed $value + * + * @throws UnexpectedTypeException when the given credit card number is no string + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Luhn) { + throw new UnexpectedTypeException($constraint, Luhn::class); + } + + if (null === $value || '' === $value) { + return; + } + + // Work with strings only, because long numbers are represented as floats + // internally and don't work with strlen() + if (!\is_string($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (!ctype_digit($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + $checkSum = 0; + $length = \strlen($value); + + // Starting with the last digit and walking left, add every second + // digit to the check sum + // e.g. 7 9 9 2 7 3 9 8 7 1 3 + // ^ ^ ^ ^ ^ ^ + // = 7 + 9 + 7 + 9 + 7 + 3 + for ($i = $length - 1; $i >= 0; $i -= 2) { + $checkSum += $value[$i]; + } + + // Starting with the second last digit and walking left, double every + // second digit and add it to the check sum + // For doubles greater than 9, sum the individual digits + // e.g. 7 9 9 2 7 3 9 8 7 1 3 + // ^ ^ ^ ^ ^ + // = 1+8 + 4 + 6 + 1+6 + 2 + for ($i = $length - 2; $i >= 0; $i -= 2) { + $checkSum += array_sum(str_split((int) $value[$i] * 2)); + } + + if (0 === $checkSum || 0 !== $checkSum % 10) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Luhn::CHECKSUM_FAILED_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Negative.php b/vendor/symfony/validator/Constraints/Negative.php new file mode 100644 index 0000000..c13ebcb --- /dev/null +++ b/vendor/symfony/validator/Constraints/Negative.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Jan Schädlich + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Negative extends LessThan +{ + use ZeroComparisonConstraintTrait; + + public $message = 'This value should be negative.'; +} diff --git a/vendor/symfony/validator/Constraints/NegativeOrZero.php b/vendor/symfony/validator/Constraints/NegativeOrZero.php new file mode 100644 index 0000000..5be735c --- /dev/null +++ b/vendor/symfony/validator/Constraints/NegativeOrZero.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Jan Schädlich + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NegativeOrZero extends LessThanOrEqual +{ + use ZeroComparisonConstraintTrait; + + public $message = 'This value should be either negative or zero.'; +} diff --git a/vendor/symfony/validator/Constraints/NotBlank.php b/vendor/symfony/validator/Constraints/NotBlank.php new file mode 100644 index 0000000..6f98d5a --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotBlank.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + * @author Kévin Dunglas + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NotBlank extends Constraint +{ + public const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3'; + + protected static $errorNames = [ + self::IS_BLANK_ERROR => 'IS_BLANK_ERROR', + ]; + + public $message = 'This value should not be blank.'; + public $allowNull = false; + public $normalizer; + + public function __construct(array $options = null, string $message = null, bool $allowNull = null, callable $normalizer = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + $this->allowNull = $allowNull ?? $this->allowNull; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/NotBlankValidator.php b/vendor/symfony/validator/Constraints/NotBlankValidator.php new file mode 100644 index 0000000..86af061 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotBlankValidator.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + * @author Kévin Dunglas + */ +class NotBlankValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof NotBlank) { + throw new UnexpectedTypeException($constraint, NotBlank::class); + } + + if ($constraint->allowNull && null === $value) { + return; + } + + if (\is_string($value) && null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + if (false === $value || (empty($value) && '0' != $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(NotBlank::IS_BLANK_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/NotCompromisedPassword.php b/vendor/symfony/validator/Constraints/NotCompromisedPassword.php new file mode 100644 index 0000000..213bde2 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotCompromisedPassword.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * Checks if a password has been leaked in a data breach. + * + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Kévin Dunglas + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NotCompromisedPassword extends Constraint +{ + public const COMPROMISED_PASSWORD_ERROR = 'd9bcdbfe-a9d6-4bfa-a8ff-da5fd93e0f6d'; + + protected static $errorNames = [self::COMPROMISED_PASSWORD_ERROR => 'COMPROMISED_PASSWORD_ERROR']; + + public $message = 'This password has been leaked in a data breach, it must not be used. Please use another password.'; + public $threshold = 1; + public $skipOnError = false; + + public function __construct( + array $options = null, + string $message = null, + int $threshold = null, + bool $skipOnError = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->threshold = $threshold ?? $this->threshold; + $this->skipOnError = $skipOnError ?? $this->skipOnError; + } +} diff --git a/vendor/symfony/validator/Constraints/NotCompromisedPasswordValidator.php b/vendor/symfony/validator/Constraints/NotCompromisedPasswordValidator.php new file mode 100644 index 0000000..adcdb7a --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotCompromisedPasswordValidator.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\HttpClient\HttpClient; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; +use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; + +/** + * Checks if a password has been leaked in a data breach using haveibeenpwned.com's API. + * Use a k-anonymity model to protect the password being searched for. + * + * @see https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange + * + * @author Kévin Dunglas + */ +class NotCompromisedPasswordValidator extends ConstraintValidator +{ + private const DEFAULT_API_ENDPOINT = 'https://api.pwnedpasswords.com/range/%s'; + + private $httpClient; + private $charset; + private $enabled; + private $endpoint; + + public function __construct(HttpClientInterface $httpClient = null, string $charset = 'UTF-8', bool $enabled = true, string $endpoint = null) + { + if (null === $httpClient && !class_exists(HttpClient::class)) { + throw new \LogicException(sprintf('The "%s" class requires the "HttpClient" component. Try running "composer require symfony/http-client".', self::class)); + } + + $this->httpClient = $httpClient ?? HttpClient::create(); + $this->charset = $charset; + $this->enabled = $enabled; + $this->endpoint = $endpoint ?? self::DEFAULT_API_ENDPOINT; + } + + /** + * {@inheritdoc} + * + * @throws ExceptionInterface + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof NotCompromisedPassword) { + throw new UnexpectedTypeException($constraint, NotCompromisedPassword::class); + } + + if (!$this->enabled) { + return; + } + + if (null !== $value && !is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + if ('' === $value) { + return; + } + + if ('UTF-8' !== $this->charset) { + $value = mb_convert_encoding($value, 'UTF-8', $this->charset); + } + + $hash = strtoupper(sha1($value)); + $hashPrefix = substr($hash, 0, 5); + $url = sprintf($this->endpoint, $hashPrefix); + + try { + $result = $this->httpClient->request('GET', $url)->getContent(); + } catch (ExceptionInterface $e) { + if ($constraint->skipOnError) { + return; + } + + throw $e; + } + + foreach (explode("\r\n", $result) as $line) { + [$hashSuffix, $count] = explode(':', $line); + + if ($hashPrefix.$hashSuffix === $hash && $constraint->threshold <= (int) $count) { + $this->context->buildViolation($constraint->message) + ->setCode(NotCompromisedPassword::COMPROMISED_PASSWORD_ERROR) + ->addViolation(); + + return; + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/NotEqualTo.php b/vendor/symfony/validator/Constraints/NotEqualTo.php new file mode 100644 index 0000000..4b2accd --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotEqualTo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NotEqualTo extends AbstractComparison +{ + public const IS_EQUAL_ERROR = 'aa2e33da-25c8-4d76-8c6c-812f02ea89dd'; + + protected static $errorNames = [ + self::IS_EQUAL_ERROR => 'IS_EQUAL_ERROR', + ]; + + public $message = 'This value should not be equal to {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/NotEqualToValidator.php b/vendor/symfony/validator/Constraints/NotEqualToValidator.php new file mode 100644 index 0000000..b80c5ea --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotEqualToValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values are all unequal (!=). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class NotEqualToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 != $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return NotEqualTo::IS_EQUAL_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/NotIdenticalTo.php b/vendor/symfony/validator/Constraints/NotIdenticalTo.php new file mode 100644 index 0000000..82ee014 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotIdenticalTo.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NotIdenticalTo extends AbstractComparison +{ + public const IS_IDENTICAL_ERROR = '4aaac518-0dda-4129-a6d9-e216b9b454a0'; + + protected static $errorNames = [ + self::IS_IDENTICAL_ERROR => 'IS_IDENTICAL_ERROR', + ]; + + public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; +} diff --git a/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php b/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php new file mode 100644 index 0000000..3ea8b5a --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotIdenticalToValidator.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Validates values aren't identical (!==). + * + * @author Daniel Holmes + * @author Bernhard Schussek + */ +class NotIdenticalToValidator extends AbstractComparisonValidator +{ + /** + * {@inheritdoc} + */ + protected function compareValues($value1, $value2) + { + return $value1 !== $value2; + } + + /** + * {@inheritdoc} + */ + protected function getErrorCode() + { + return NotIdenticalTo::IS_IDENTICAL_ERROR; + } +} diff --git a/vendor/symfony/validator/Constraints/NotNull.php b/vendor/symfony/validator/Constraints/NotNull.php new file mode 100644 index 0000000..85783c7 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotNull.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class NotNull extends Constraint +{ + public const IS_NULL_ERROR = 'ad32d13f-c3d4-423b-909a-857b961eb720'; + + protected static $errorNames = [ + self::IS_NULL_ERROR => 'IS_NULL_ERROR', + ]; + + public $message = 'This value should not be null.'; + + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + parent::__construct($options ?? [], $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/NotNullValidator.php b/vendor/symfony/validator/Constraints/NotNullValidator.php new file mode 100644 index 0000000..d02fcc4 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NotNullValidator.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class NotNullValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof NotNull) { + throw new UnexpectedTypeException($constraint, NotNull::class); + } + + if (null === $value) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(NotNull::IS_NULL_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/NumberConstraintTrait.php b/vendor/symfony/validator/Constraints/NumberConstraintTrait.php new file mode 100644 index 0000000..3229871 --- /dev/null +++ b/vendor/symfony/validator/Constraints/NumberConstraintTrait.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +trigger_deprecation('symfony/validator', '5.2', '%s is deprecated.', NumberConstraintTrait::class); + +/** + * @author Jan Schädlich + * + * @deprecated since Symfony 5.2 + */ +trait NumberConstraintTrait +{ + private function configureNumberConstraintOptions($options): array + { + if (null === $options) { + $options = []; + } elseif (!\is_array($options)) { + $options = [$this->getDefaultOption() => $options]; + } + + if (isset($options['propertyPath'])) { + throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class)); + } + + if (isset($options['value'])) { + throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', static::class)); + } + + $options['value'] = 0; + + return $options; + } +} diff --git a/vendor/symfony/validator/Constraints/Optional.php b/vendor/symfony/validator/Constraints/Optional.php new file mode 100644 index 0000000..dab8b43 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Optional.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"ANNOTATION"}) + * + * @author Bernhard Schussek + */ +class Optional extends Existence +{ +} diff --git a/vendor/symfony/validator/Constraints/Positive.php b/vendor/symfony/validator/Constraints/Positive.php new file mode 100644 index 0000000..951e944 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Positive.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Jan Schädlich + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Positive extends GreaterThan +{ + use ZeroComparisonConstraintTrait; + + public $message = 'This value should be positive.'; +} diff --git a/vendor/symfony/validator/Constraints/PositiveOrZero.php b/vendor/symfony/validator/Constraints/PositiveOrZero.php new file mode 100644 index 0000000..a7669c6 --- /dev/null +++ b/vendor/symfony/validator/Constraints/PositiveOrZero.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Jan Schädlich + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class PositiveOrZero extends GreaterThanOrEqual +{ + use ZeroComparisonConstraintTrait; + + public $message = 'This value should be either positive or zero.'; +} diff --git a/vendor/symfony/validator/Constraints/Range.php b/vendor/symfony/validator/Constraints/Range.php new file mode 100644 index 0000000..906057e --- /dev/null +++ b/vendor/symfony/validator/Constraints/Range.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyPathInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\LogicException; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Range extends Constraint +{ + public const INVALID_CHARACTERS_ERROR = 'ad9a9798-7a99-4df7-8ce9-46e416a1e60b'; + public const NOT_IN_RANGE_ERROR = '04b91c99-a946-4221-afc5-e65ebac401eb'; + public const TOO_HIGH_ERROR = '2d28afcb-e32e-45fb-a815-01c431a86a69'; + public const TOO_LOW_ERROR = '76454e69-502c-46c5-9643-f447d837c4d5'; + + protected static $errorNames = [ + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::NOT_IN_RANGE_ERROR => 'NOT_IN_RANGE_ERROR', + self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', + self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', + ]; + + public $notInRangeMessage = 'This value should be between {{ min }} and {{ max }}.'; + public $minMessage = 'This value should be {{ limit }} or more.'; + public $maxMessage = 'This value should be {{ limit }} or less.'; + public $invalidMessage = 'This value should be a valid number.'; + public $invalidDateTimeMessage = 'This value should be a valid datetime.'; + public $min; + public $minPropertyPath; + public $max; + public $maxPropertyPath; + + /** + * @internal + */ + public $deprecatedMinMessageSet = false; + + /** + * @internal + */ + public $deprecatedMaxMessageSet = false; + + /** + * {@inheritdoc} + * + * @param string|PropertyPathInterface|null $minPropertyPath + * @param string|PropertyPathInterface|null $maxPropertyPath + */ + public function __construct( + array $options = null, + string $notInRangeMessage = null, + string $minMessage = null, + string $maxMessage = null, + string $invalidMessage = null, + string $invalidDateTimeMessage = null, + $min = null, + $minPropertyPath = null, + $max = null, + $maxPropertyPath = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->notInRangeMessage = $notInRangeMessage ?? $this->notInRangeMessage; + $this->minMessage = $minMessage ?? $this->minMessage; + $this->maxMessage = $maxMessage ?? $this->maxMessage; + $this->invalidMessage = $invalidMessage ?? $this->invalidMessage; + $this->invalidDateTimeMessage = $invalidDateTimeMessage ?? $this->invalidDateTimeMessage; + $this->min = $min ?? $this->min; + $this->minPropertyPath = $minPropertyPath ?? $this->minPropertyPath; + $this->max = $max ?? $this->max; + $this->maxPropertyPath = $maxPropertyPath ?? $this->maxPropertyPath; + + if (null === $this->min && null === $this->minPropertyPath && null === $this->max && null === $this->maxPropertyPath) { + throw new MissingOptionsException(sprintf('Either option "min", "minPropertyPath", "max" or "maxPropertyPath" must be given for constraint "%s".', __CLASS__), ['min', 'minPropertyPath', 'max', 'maxPropertyPath']); + } + + if (null !== $this->min && null !== $this->minPropertyPath) { + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "min" or "minPropertyPath" options to be set, not both.', static::class)); + } + + if (null !== $this->max && null !== $this->maxPropertyPath) { + throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "max" or "maxPropertyPath" options to be set, not both.', static::class)); + } + + if ((null !== $this->minPropertyPath || null !== $this->maxPropertyPath) && !class_exists(PropertyAccess::class)) { + throw new LogicException(sprintf('The "%s" constraint requires the Symfony PropertyAccess component to use the "minPropertyPath" or "maxPropertyPath" option.', static::class)); + } + + if (null !== $this->min && null !== $this->max) { + $this->deprecatedMinMessageSet = isset($options['minMessage']) || null !== $minMessage; + $this->deprecatedMaxMessageSet = isset($options['maxMessage']) || null !== $maxMessage; + + // BC layer, should throw a ConstraintDefinitionException in 6.0 + if ($this->deprecatedMinMessageSet || $this->deprecatedMaxMessageSet) { + trigger_deprecation('symfony/validator', '4.4', '"minMessage" and "maxMessage" are deprecated when the "min" and "max" options are both set. Use "notInRangeMessage" instead.'); + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/RangeValidator.php b/vendor/symfony/validator/Constraints/RangeValidator.php new file mode 100644 index 0000000..e24cd87 --- /dev/null +++ b/vendor/symfony/validator/Constraints/RangeValidator.php @@ -0,0 +1,211 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; +use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\PropertyAccess\PropertyAccessorInterface; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class RangeValidator extends ConstraintValidator +{ + private $propertyAccessor; + + public function __construct(PropertyAccessorInterface $propertyAccessor = null) + { + $this->propertyAccessor = $propertyAccessor; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Range) { + throw new UnexpectedTypeException($constraint, Range::class); + } + + if (null === $value) { + return; + } + + $min = $this->getLimit($constraint->minPropertyPath, $constraint->min, $constraint); + $max = $this->getLimit($constraint->maxPropertyPath, $constraint->max, $constraint); + + if (!is_numeric($value) && !$value instanceof \DateTimeInterface) { + if ($this->isParsableDatetimeString($min) && $this->isParsableDatetimeString($max)) { + $this->context->buildViolation($constraint->invalidDateTimeMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setCode(Range::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } else { + $this->context->buildViolation($constraint->invalidMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setCode(Range::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + return; + } + + // Convert strings to DateTimes if comparing another DateTime + // This allows to compare with any date/time value supported by + // the DateTime constructor: + // https://php.net/datetime.formats + if ($value instanceof \DateTimeInterface) { + $dateTimeClass = null; + + if (\is_string($min)) { + $dateTimeClass = $value instanceof \DateTimeImmutable ? \DateTimeImmutable::class : \DateTime::class; + + try { + $min = new $dateTimeClass($min); + } catch (\Exception $e) { + throw new ConstraintDefinitionException(sprintf('The min value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $min, $dateTimeClass, get_debug_type($constraint))); + } + } + + if (\is_string($max)) { + $dateTimeClass = $dateTimeClass ?: ($value instanceof \DateTimeImmutable ? \DateTimeImmutable::class : \DateTime::class); + + try { + $max = new $dateTimeClass($max); + } catch (\Exception $e) { + throw new ConstraintDefinitionException(sprintf('The max value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $max, $dateTimeClass, get_debug_type($constraint))); + } + } + } + + $hasLowerLimit = null !== $min; + $hasUpperLimit = null !== $max; + + if ($hasLowerLimit && $hasUpperLimit && ($value < $min || $value > $max)) { + $message = $constraint->notInRangeMessage; + $code = Range::NOT_IN_RANGE_ERROR; + + if ($value < $min && $constraint->deprecatedMinMessageSet) { + $message = $constraint->minMessage; + $code = Range::TOO_LOW_ERROR; + } + + if ($value > $max && $constraint->deprecatedMaxMessageSet) { + $message = $constraint->maxMessage; + $code = Range::TOO_HIGH_ERROR; + } + + $violationBuilder = $this->context->buildViolation($message) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ min }}', $this->formatValue($min, self::PRETTY_DATE)) + ->setParameter('{{ max }}', $this->formatValue($max, self::PRETTY_DATE)) + ->setCode($code); + + if (null !== $constraint->maxPropertyPath) { + $violationBuilder->setParameter('{{ max_limit_path }}', $constraint->maxPropertyPath); + } + + if (null !== $constraint->minPropertyPath) { + $violationBuilder->setParameter('{{ min_limit_path }}', $constraint->minPropertyPath); + } + + $violationBuilder->addViolation(); + + return; + } + + if ($hasUpperLimit && $value > $max) { + $violationBuilder = $this->context->buildViolation($constraint->maxMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE)) + ->setCode(Range::TOO_HIGH_ERROR); + + if (null !== $constraint->maxPropertyPath) { + $violationBuilder->setParameter('{{ max_limit_path }}', $constraint->maxPropertyPath); + } + + if (null !== $constraint->minPropertyPath) { + $violationBuilder->setParameter('{{ min_limit_path }}', $constraint->minPropertyPath); + } + + $violationBuilder->addViolation(); + + return; + } + + if ($hasLowerLimit && $value < $min) { + $violationBuilder = $this->context->buildViolation($constraint->minMessage) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) + ->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE)) + ->setCode(Range::TOO_LOW_ERROR); + + if (null !== $constraint->maxPropertyPath) { + $violationBuilder->setParameter('{{ max_limit_path }}', $constraint->maxPropertyPath); + } + + if (null !== $constraint->minPropertyPath) { + $violationBuilder->setParameter('{{ min_limit_path }}', $constraint->minPropertyPath); + } + + $violationBuilder->addViolation(); + } + } + + private function getLimit(?string $propertyPath, $default, Constraint $constraint) + { + if (null === $propertyPath) { + return $default; + } + + if (null === $object = $this->context->getObject()) { + return $default; + } + + try { + return $this->getPropertyAccessor()->getValue($object, $propertyPath); + } catch (NoSuchPropertyException $e) { + throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $propertyPath, get_debug_type($constraint)).$e->getMessage(), 0, $e); + } + } + + private function getPropertyAccessor(): PropertyAccessorInterface + { + if (null === $this->propertyAccessor) { + $this->propertyAccessor = PropertyAccess::createPropertyAccessor(); + } + + return $this->propertyAccessor; + } + + private function isParsableDatetimeString($boundary): bool + { + if (null === $boundary) { + return true; + } + + if (!\is_string($boundary)) { + return false; + } + + try { + new \DateTime($boundary); + } catch (\Exception $e) { + return false; + } + + return true; + } +} diff --git a/vendor/symfony/validator/Constraints/Regex.php b/vendor/symfony/validator/Constraints/Regex.php new file mode 100644 index 0000000..63bbd8d --- /dev/null +++ b/vendor/symfony/validator/Constraints/Regex.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Regex extends Constraint +{ + public const REGEX_FAILED_ERROR = 'de1e3db3-5ed4-4941-aae4-59f3667cc3a3'; + + protected static $errorNames = [ + self::REGEX_FAILED_ERROR => 'REGEX_FAILED_ERROR', + ]; + + public $message = 'This value is not valid.'; + public $pattern; + public $htmlPattern; + public $match = true; + public $normalizer; + + /** + * {@inheritdoc} + * + * @param string|array $pattern The pattern to evaluate or an array of options + */ + public function __construct( + $pattern, + string $message = null, + string $htmlPattern = null, + bool $match = null, + callable $normalizer = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (\is_array($pattern)) { + $options = array_merge($pattern, $options); + } elseif (null !== $pattern) { + $options['value'] = $pattern; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->htmlPattern = $htmlPattern ?? $this->htmlPattern; + $this->match = $match ?? $this->match; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'pattern'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return ['pattern']; + } + + /** + * Converts the htmlPattern to a suitable format for HTML5 pattern. + * Example: /^[a-z]+$/ would be converted to [a-z]+ + * However, if options are specified, it cannot be converted. + * + * @see http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute + * + * @return string|null + */ + public function getHtmlPattern() + { + // If htmlPattern is specified, use it + if (null !== $this->htmlPattern) { + return empty($this->htmlPattern) + ? null + : $this->htmlPattern; + } + + // Quit if delimiters not at very beginning/end (e.g. when options are passed) + if ($this->pattern[0] !== $this->pattern[\strlen($this->pattern) - 1]) { + return null; + } + + $delimiter = $this->pattern[0]; + + // Unescape the delimiter + $pattern = str_replace('\\'.$delimiter, $delimiter, substr($this->pattern, 1, -1)); + + // If the pattern is inverted, we can wrap it in + // ((?!pattern).)* + if (!$this->match) { + return '((?!'.$pattern.').)*'; + } + + // If the pattern contains an or statement, wrap the pattern in + // .*(pattern).* and quit. Otherwise we'd need to parse the pattern + if (str_contains($pattern, '|')) { + return '.*('.$pattern.').*'; + } + + // Trim leading ^, otherwise prepend .* + $pattern = '^' === $pattern[0] ? substr($pattern, 1) : '.*'.$pattern; + + // Trim trailing $, otherwise append .* + $pattern = '$' === $pattern[\strlen($pattern) - 1] ? substr($pattern, 0, -1) : $pattern.'.*'; + + return $pattern; + } +} diff --git a/vendor/symfony/validator/Constraints/RegexValidator.php b/vendor/symfony/validator/Constraints/RegexValidator.php new file mode 100644 index 0000000..7fadf76 --- /dev/null +++ b/vendor/symfony/validator/Constraints/RegexValidator.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value match or not given regexp pattern. + * + * @author Bernhard Schussek + * @author Joseph Bielawski + */ +class RegexValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Regex) { + throw new UnexpectedTypeException($constraint, Regex::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + if ($constraint->match xor preg_match($constraint->pattern, $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Regex::REGEX_FAILED_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Required.php b/vendor/symfony/validator/Constraints/Required.php new file mode 100644 index 0000000..bd77a90 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Required.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * @Annotation + * @Target({"ANNOTATION"}) + * + * @author Bernhard Schussek + */ +class Required extends Existence +{ +} diff --git a/vendor/symfony/validator/Constraints/Sequentially.php b/vendor/symfony/validator/Constraints/Sequentially.php new file mode 100644 index 0000000..36a801a --- /dev/null +++ b/vendor/symfony/validator/Constraints/Sequentially.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +/** + * Use this constraint to sequentially validate nested constraints. + * Validation for the nested constraints collection will stop at first violation. + * + * @Annotation + * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Maxime Steinhausser + */ +#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Sequentially extends Composite +{ + public $constraints = []; + + public function __construct($constraints = null, array $groups = null, $payload = null) + { + parent::__construct($constraints ?? [], $groups, $payload); + } + + public function getDefaultOption() + { + return 'constraints'; + } + + public function getRequiredOptions() + { + return ['constraints']; + } + + protected function getCompositeOption() + { + return 'constraints'; + } + + public function getTargets() + { + return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT]; + } +} diff --git a/vendor/symfony/validator/Constraints/SequentiallyValidator.php b/vendor/symfony/validator/Constraints/SequentiallyValidator.php new file mode 100644 index 0000000..434d2ab --- /dev/null +++ b/vendor/symfony/validator/Constraints/SequentiallyValidator.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Maxime Steinhausser + */ +class SequentiallyValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Sequentially) { + throw new UnexpectedTypeException($constraint, Sequentially::class); + } + + $context = $this->context; + + $validator = $context->getValidator()->inContext($context); + + $originalCount = $validator->getViolations()->count(); + + foreach ($constraint->constraints as $c) { + if ($originalCount !== $validator->validate($value, $c)->getViolations()->count()) { + break; + } + } + } +} diff --git a/vendor/symfony/validator/Constraints/Time.php b/vendor/symfony/validator/Constraints/Time.php new file mode 100644 index 0000000..366d623 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Time.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Time extends Constraint +{ + public const INVALID_FORMAT_ERROR = '9d27b2bb-f755-4fbf-b725-39b1edbdebdf'; + public const INVALID_TIME_ERROR = '8532f9e1-84b2-4d67-8989-0818bc38533b'; + + protected static $errorNames = [ + self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', + self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', + ]; + + public $message = 'This value is not a valid time.'; + + public function __construct( + array $options = null, + string $message = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/TimeValidator.php b/vendor/symfony/validator/Constraints/TimeValidator.php new file mode 100644 index 0000000..5a71e44 --- /dev/null +++ b/vendor/symfony/validator/Constraints/TimeValidator.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class TimeValidator extends ConstraintValidator +{ + public const PATTERN = '/^(\d{2}):(\d{2}):(\d{2})$/'; + + /** + * Checks whether a time is valid. + * + * @internal + */ + public static function checkTime(int $hour, int $minute, float $second): bool + { + return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60; + } + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Time) { + throw new UnexpectedTypeException($constraint, Time::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (!preg_match(static::PATTERN, $value, $matches)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_FORMAT_ERROR) + ->addViolation(); + + return; + } + + if (!self::checkTime($matches[1], $matches[2], $matches[3])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_TIME_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Timezone.php b/vendor/symfony/validator/Constraints/Timezone.php new file mode 100644 index 0000000..409fbc1 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Timezone.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Javier Spagnoletti + * @author Hugo Hamon + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Timezone extends Constraint +{ + public const TIMEZONE_IDENTIFIER_ERROR = '5ce113e6-5e64-4ea2-90fe-d2233956db13'; + public const TIMEZONE_IDENTIFIER_IN_ZONE_ERROR = 'b57767b1-36c0-40ac-a3d7-629420c775b8'; + public const TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR = 'c4a22222-dc92-4fc0-abb0-d95b268c7d0b'; + public const TIMEZONE_IDENTIFIER_INTL_ERROR = '45863c26-88dc-41ba-bf53-c73bd1f7e90d'; + + public $zone = \DateTimeZone::ALL; + public $countryCode; + public $intlCompatible = false; + public $message = 'This value is not a valid timezone.'; + + protected static $errorNames = [ + self::TIMEZONE_IDENTIFIER_ERROR => 'TIMEZONE_IDENTIFIER_ERROR', + self::TIMEZONE_IDENTIFIER_IN_ZONE_ERROR => 'TIMEZONE_IDENTIFIER_IN_ZONE_ERROR', + self::TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR => 'TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR', + self::TIMEZONE_IDENTIFIER_INTL_ERROR => 'TIMEZONE_IDENTIFIER_INTL_ERROR', + ]; + + /** + * {@inheritdoc} + * + * @param int|array|null $zone A combination of {@see \DateTimeZone} class constants or a set of options + */ + public function __construct( + $zone = null, + string $message = null, + string $countryCode = null, + bool $intlCompatible = null, + array $groups = null, + $payload = null, + array $options = [] + ) { + if (\is_array($zone)) { + $options = array_merge($zone, $options); + } elseif (null !== $zone) { + $options['value'] = $zone; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->countryCode = $countryCode ?? $this->countryCode; + $this->intlCompatible = $intlCompatible ?? $this->intlCompatible; + + if (null === $this->countryCode) { + if (0 >= $this->zone || \DateTimeZone::ALL_WITH_BC < $this->zone) { + throw new ConstraintDefinitionException('The option "zone" must be a valid range of "\DateTimeZone" constants.'); + } + } elseif (\DateTimeZone::PER_COUNTRY !== (\DateTimeZone::PER_COUNTRY & $this->zone)) { + throw new ConstraintDefinitionException('The option "countryCode" can only be used when the "zone" option is configured with "\DateTimeZone::PER_COUNTRY".'); + } + if ($this->intlCompatible && !class_exists(\IntlTimeZone::class)) { + throw new ConstraintDefinitionException('The option "intlCompatible" can only be used when the PHP intl extension is available.'); + } + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'zone'; + } +} diff --git a/vendor/symfony/validator/Constraints/TimezoneValidator.php b/vendor/symfony/validator/Constraints/TimezoneValidator.php new file mode 100644 index 0000000..ab6b4ee --- /dev/null +++ b/vendor/symfony/validator/Constraints/TimezoneValidator.php @@ -0,0 +1,124 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Intl\Exception\MissingResourceException; +use Symfony\Component\Intl\Timezones; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether a value is a valid timezone identifier. + * + * @author Javier Spagnoletti + * @author Hugo Hamon + */ +class TimezoneValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Timezone) { + throw new UnexpectedTypeException($constraint, Timezone::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if ($constraint->intlCompatible && 'Etc/Unknown' === \IntlTimeZone::createTimeZone($value)->getID()) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Timezone::TIMEZONE_IDENTIFIER_INTL_ERROR) + ->addViolation(); + + return; + } + + if ( + \in_array($value, self::getPhpTimezones($constraint->zone, $constraint->countryCode), true) || + \in_array($value, self::getIntlTimezones($constraint->zone, $constraint->countryCode), true) + ) { + return; + } + + if ($constraint->countryCode) { + $code = Timezone::TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR; + } elseif (\DateTimeZone::ALL !== $constraint->zone) { + $code = Timezone::TIMEZONE_IDENTIFIER_IN_ZONE_ERROR; + } else { + $code = Timezone::TIMEZONE_IDENTIFIER_ERROR; + } + + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode($code) + ->addViolation(); + } + + private static function getPhpTimezones(int $zone, string $countryCode = null): array + { + if (null !== $countryCode) { + try { + return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: []; + } catch (\ValueError $e) { + return []; + } + } + + return \DateTimeZone::listIdentifiers($zone); + } + + private static function getIntlTimezones(int $zone, string $countryCode = null): array + { + if (!class_exists(Timezones::class)) { + return []; + } + + if (null !== $countryCode) { + try { + return Timezones::forCountryCode($countryCode); + } catch (MissingResourceException $e) { + return []; + } + } + + $timezones = Timezones::getIds(); + + if (\DateTimeZone::ALL === (\DateTimeZone::ALL & $zone)) { + return $timezones; + } + + $filtered = []; + foreach ((new \ReflectionClass(\DateTimeZone::class))->getConstants() as $const => $flag) { + if ($flag !== ($flag & $zone)) { + continue; + } + + $filtered[] = array_filter($timezones, static function ($id) use ($const) { + return 0 === stripos($id, $const.'/'); + }); + } + + return $filtered ? array_merge(...$filtered) : []; + } +} diff --git a/vendor/symfony/validator/Constraints/Traverse.php b/vendor/symfony/validator/Constraints/Traverse.php new file mode 100644 index 0000000..fe6527d --- /dev/null +++ b/vendor/symfony/validator/Constraints/Traverse.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @Annotation + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_CLASS)] +class Traverse extends Constraint +{ + public $traverse = true; + + /** + * @param bool|array|null $traverse + */ + public function __construct($traverse = null) + { + if (\is_array($traverse) && \array_key_exists('groups', $traverse)) { + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint "%s".', __CLASS__)); + } + + parent::__construct($traverse); + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'traverse'; + } + + /** + * {@inheritdoc} + */ + public function getTargets() + { + return self::CLASS_CONSTRAINT; + } +} diff --git a/vendor/symfony/validator/Constraints/Type.php b/vendor/symfony/validator/Constraints/Type.php new file mode 100644 index 0000000..220c219 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Type.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Type extends Constraint +{ + public const INVALID_TYPE_ERROR = 'ba785a8c-82cb-4283-967c-3cf342181b40'; + + protected static $errorNames = [ + self::INVALID_TYPE_ERROR => 'INVALID_TYPE_ERROR', + ]; + + public $message = 'This value should be of type {{ type }}.'; + public $type; + + /** + * {@inheritdoc} + * + * @param string|array $type One ore multiple types to validate against or a set of options + */ + public function __construct($type, string $message = null, array $groups = null, $payload = null, array $options = []) + { + if (\is_array($type) && \is_string(key($type))) { + $options = array_merge($type, $options); + } elseif (null !== $type) { + $options['value'] = $type; + } + + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } + + /** + * {@inheritdoc} + */ + public function getDefaultOption() + { + return 'type'; + } + + /** + * {@inheritdoc} + */ + public function getRequiredOptions() + { + return ['type']; + } +} diff --git a/vendor/symfony/validator/Constraints/TypeValidator.php b/vendor/symfony/validator/Constraints/TypeValidator.php new file mode 100644 index 0000000..0a938c6 --- /dev/null +++ b/vendor/symfony/validator/Constraints/TypeValidator.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class TypeValidator extends ConstraintValidator +{ + private const VALIDATION_FUNCTIONS = [ + 'bool' => 'is_bool', + 'boolean' => 'is_bool', + 'int' => 'is_int', + 'integer' => 'is_int', + 'long' => 'is_int', + 'float' => 'is_float', + 'double' => 'is_float', + 'real' => 'is_float', + 'numeric' => 'is_numeric', + 'string' => 'is_string', + 'scalar' => 'is_scalar', + 'array' => 'is_array', + 'iterable' => 'is_iterable', + 'countable' => 'is_countable', + 'callable' => 'is_callable', + 'object' => 'is_object', + 'resource' => 'is_resource', + 'null' => 'is_null', + 'alnum' => 'ctype_alnum', + 'alpha' => 'ctype_alpha', + 'cntrl' => 'ctype_cntrl', + 'digit' => 'ctype_digit', + 'graph' => 'ctype_graph', + 'lower' => 'ctype_lower', + 'print' => 'ctype_print', + 'punct' => 'ctype_punct', + 'space' => 'ctype_space', + 'upper' => 'ctype_upper', + 'xdigit' => 'ctype_xdigit', + ]; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Type) { + throw new UnexpectedTypeException($constraint, Type::class); + } + + if (null === $value) { + return; + } + + $types = (array) $constraint->type; + + foreach ($types as $type) { + $type = strtolower($type); + if (isset(self::VALIDATION_FUNCTIONS[$type]) && self::VALIDATION_FUNCTIONS[$type]($value)) { + return; + } + + if ($value instanceof $type) { + return; + } + } + + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ type }}', implode('|', $types)) + ->setCode(Type::INVALID_TYPE_ERROR) + ->addViolation(); + } +} diff --git a/vendor/symfony/validator/Constraints/Ulid.php b/vendor/symfony/validator/Constraints/Ulid.php new file mode 100644 index 0000000..d1644b8 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Ulid.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * + * @author Laurent Clouet + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Ulid extends Constraint +{ + public const TOO_SHORT_ERROR = '7b44804e-37d5-4df4-9bdd-b738d4a45bb4'; + public const TOO_LONG_ERROR = '9608249f-6da1-4d53-889e-9864b58c4d37'; + public const INVALID_CHARACTERS_ERROR = 'e4155739-5135-4258-9c81-ae7b44b5311e'; + public const TOO_LARGE_ERROR = 'df8cfb9a-ce6d-4a69-ae5a-eea7ab6f278b'; + + protected static $errorNames = [ + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', + ]; + + public $message = 'This is not a valid ULID.'; + + public function __construct( + array $options = null, + string $message = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + } +} diff --git a/vendor/symfony/validator/Constraints/UlidValidator.php b/vendor/symfony/validator/Constraints/UlidValidator.php new file mode 100644 index 0000000..45f85b8 --- /dev/null +++ b/vendor/symfony/validator/Constraints/UlidValidator.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether the value is a valid ULID (Universally Unique Lexicographically Sortable Identifier). + * Cf https://github.com/ulid/spec for ULID specifications. + * + * @author Laurent Clouet + */ +class UlidValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Ulid) { + throw new UnexpectedTypeException($constraint, Ulid::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (26 !== \strlen($value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(26 > \strlen($value) ? Ulid::TOO_SHORT_ERROR : Ulid::TOO_LONG_ERROR) + ->addViolation(); + } + + if (\strlen($value) !== strspn($value, '0123456789ABCDEFGHJKMNPQRSTVWXYZabcdefghjkmnpqrstvwxyz')) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Ulid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + } + + // Largest valid ULID is '7ZZZZZZZZZZZZZZZZZZZZZZZZZ' + // Cf https://github.com/ulid/spec#overflow-errors-when-parsing-base32-strings + if ($value[0] > '7') { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Ulid::TOO_LARGE_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Unique.php b/vendor/symfony/validator/Constraints/Unique.php new file mode 100644 index 0000000..6280e97 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Unique.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Yevgeniy Zholkevskiy + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Unique extends Constraint +{ + public const IS_NOT_UNIQUE = '7911c98d-b845-4da0-94b7-a8dac36bc55a'; + + protected static $errorNames = [ + self::IS_NOT_UNIQUE => 'IS_NOT_UNIQUE', + ]; + + public $message = 'This collection should contain only unique elements.'; + public $normalizer; + + public function __construct( + array $options = null, + string $message = null, + callable $normalizer = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/UniqueValidator.php b/vendor/symfony/validator/Constraints/UniqueValidator.php new file mode 100644 index 0000000..2758a3f --- /dev/null +++ b/vendor/symfony/validator/Constraints/UniqueValidator.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Yevgeniy Zholkevskiy + */ +class UniqueValidator extends ConstraintValidator +{ + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Unique) { + throw new UnexpectedTypeException($constraint, Unique::class); + } + + if (null === $value) { + return; + } + + if (!\is_array($value) && !$value instanceof \IteratorAggregate) { + throw new UnexpectedValueException($value, 'array|IteratorAggregate'); + } + + $collectionElements = []; + $normalizer = $this->getNormalizer($constraint); + foreach ($value as $element) { + $element = $normalizer($element); + + if (\in_array($element, $collectionElements, true)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Unique::IS_NOT_UNIQUE) + ->addViolation(); + + return; + } + $collectionElements[] = $element; + } + } + + private function getNormalizer(Unique $unique): callable + { + if (null === $unique->normalizer) { + return static function ($value) { + return $value; + }; + } + + return $unique->normalizer; + } +} diff --git a/vendor/symfony/validator/Constraints/Url.php b/vendor/symfony/validator/Constraints/Url.php new file mode 100644 index 0000000..23cd77c --- /dev/null +++ b/vendor/symfony/validator/Constraints/Url.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Url extends Constraint +{ + public const INVALID_URL_ERROR = '57c2f299-1154-4870-89bb-ef3b1f5ad229'; + + protected static $errorNames = [ + self::INVALID_URL_ERROR => 'INVALID_URL_ERROR', + ]; + + public $message = 'This value is not a valid URL.'; + public $protocols = ['http', 'https']; + public $relativeProtocol = false; + public $normalizer; + + public function __construct( + array $options = null, + string $message = null, + array $protocols = null, + bool $relativeProtocol = null, + callable $normalizer = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->protocols = $protocols ?? $this->protocols; + $this->relativeProtocol = $relativeProtocol ?? $this->relativeProtocol; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/UrlValidator.php b/vendor/symfony/validator/Constraints/UrlValidator.php new file mode 100644 index 0000000..a72eac6 --- /dev/null +++ b/vendor/symfony/validator/Constraints/UrlValidator.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * @author Bernhard Schussek + */ +class UrlValidator extends ConstraintValidator +{ + public const PATTERN = '~^ + (%s):// # protocol + (((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+:)?((?:[\_\.\pL\pN-]|%%[0-9A-Fa-f]{2})+)@)? # basic auth + ( + (?: + (?:xn--[a-z0-9-]++\.)*+xn--[a-z0-9-]++ # a domain name using punycode + | + (?:[\pL\pN\pS\pM\-\_]++\.)+[\pL\pN\pM]++ # a multi-level domain name + | + [a-z0-9\-\_]++ # a single-level domain name + )\.? + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address + | # or + \[ + (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) + \] # an IPv6 address + ) + (:[0-9]+)? # a port (optional) + (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path + (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) + (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) + $~ixu'; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Url) { + throw new UnexpectedTypeException($constraint, Url::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + if ('' === $value) { + return; + } + + if (null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + $pattern = $constraint->relativeProtocol ? str_replace('(%s):', '(?:(%s):)?', static::PATTERN) : static::PATTERN; + $pattern = sprintf($pattern, implode('|', $constraint->protocols)); + + if (!preg_match($pattern, $value)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Url::INVALID_URL_ERROR) + ->addViolation(); + + return; + } + } +} diff --git a/vendor/symfony/validator/Constraints/Uuid.php b/vendor/symfony/validator/Constraints/Uuid.php new file mode 100644 index 0000000..84f83f8 --- /dev/null +++ b/vendor/symfony/validator/Constraints/Uuid.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\InvalidArgumentException; + +/** + * @Annotation + * + * @author Colin O'Dell + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Uuid extends Constraint +{ + public const TOO_SHORT_ERROR = 'aa314679-dac9-4f54-bf97-b2049df8f2a3'; + public const TOO_LONG_ERROR = '494897dd-36f8-4d31-8923-71a8d5f3000d'; + public const INVALID_CHARACTERS_ERROR = '51120b12-a2bc-41bf-aa53-cd73daf330d0'; + public const INVALID_HYPHEN_PLACEMENT_ERROR = '98469c83-0309-4f5d-bf95-a496dcaa869c'; + public const INVALID_VERSION_ERROR = '21ba13b4-b185-4882-ac6f-d147355987eb'; + public const INVALID_VARIANT_ERROR = '164ef693-2b9d-46de-ad7f-836201f0c2db'; + + protected static $errorNames = [ + self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR', + self::TOO_LONG_ERROR => 'TOO_LONG_ERROR', + self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR', + self::INVALID_HYPHEN_PLACEMENT_ERROR => 'INVALID_HYPHEN_PLACEMENT_ERROR', + self::INVALID_VERSION_ERROR => 'INVALID_VERSION_ERROR', + self::INVALID_VARIANT_ERROR => 'INVALID_VARIANT_ERROR', + ]; + + // Possible versions defined by RFC 4122 + public const V1_MAC = 1; + public const V2_DCE = 2; + public const V3_MD5 = 3; + public const V4_RANDOM = 4; + public const V5_SHA1 = 5; + public const V6_SORTABLE = 6; + + public const ALL_VERSIONS = [ + self::V1_MAC, + self::V2_DCE, + self::V3_MD5, + self::V4_RANDOM, + self::V5_SHA1, + self::V6_SORTABLE, + ]; + + /** + * Message to display when validation fails. + * + * @var string + */ + public $message = 'This is not a valid UUID.'; + + /** + * Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122. + * + * Set this to `false` to allow legacy formats with different dash positioning or wrapping characters + * + * @var bool + */ + public $strict = true; + + /** + * Array of allowed versions (see version constants above). + * + * All UUID versions are allowed by default + * + * @var int[] + */ + public $versions = self::ALL_VERSIONS; + + public $normalizer; + + /** + * {@inheritdoc} + * + * @param int[]|null $versions + */ + public function __construct( + array $options = null, + string $message = null, + array $versions = null, + bool $strict = null, + callable $normalizer = null, + array $groups = null, + $payload = null + ) { + parent::__construct($options, $groups, $payload); + + $this->message = $message ?? $this->message; + $this->versions = $versions ?? $this->versions; + $this->strict = $strict ?? $this->strict; + $this->normalizer = $normalizer ?? $this->normalizer; + + if (null !== $this->normalizer && !\is_callable($this->normalizer)) { + throw new InvalidArgumentException(sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer))); + } + } +} diff --git a/vendor/symfony/validator/Constraints/UuidValidator.php b/vendor/symfony/validator/Constraints/UuidValidator.php new file mode 100644 index 0000000..0662966 --- /dev/null +++ b/vendor/symfony/validator/Constraints/UuidValidator.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; + +/** + * Validates whether the value is a valid UUID (also known as GUID). + * + * Strict validation will allow a UUID as specified per RFC 4122. + * Loose validation will allow any type of UUID. + * + * @author Colin O'Dell + * @author Bernhard Schussek + * + * @see http://tools.ietf.org/html/rfc4122 + * @see https://en.wikipedia.org/wiki/Universally_unique_identifier + */ +class UuidValidator extends ConstraintValidator +{ + // The strict pattern matches UUIDs like this: + // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx + + // Roughly speaking: + // x = any hexadecimal character + // M = any allowed version {1..6} + // N = any allowed variant {8, 9, a, b} + + public const STRICT_LENGTH = 36; + public const STRICT_FIRST_HYPHEN_POSITION = 8; + public const STRICT_LAST_HYPHEN_POSITION = 23; + public const STRICT_VERSION_POSITION = 14; + public const STRICT_VARIANT_POSITION = 19; + + // The loose pattern validates similar yet non-compliant UUIDs. + // Hyphens are completely optional. If present, they should only appear + // between every fourth character: + // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + // The value can also be wrapped with characters like []{}: + // {xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx} + + // Neither the version nor the variant is validated by this pattern. + + public const LOOSE_MAX_LENGTH = 39; + public const LOOSE_FIRST_HYPHEN_POSITION = 4; + + /** + * {@inheritdoc} + */ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Uuid) { + throw new UnexpectedTypeException($constraint, Uuid::class); + } + + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedValueException($value, 'string'); + } + + $value = (string) $value; + + if (null !== $constraint->normalizer) { + $value = ($constraint->normalizer)($value); + } + + if ($constraint->strict) { + $this->validateStrict($value, $constraint); + + return; + } + + $this->validateLoose($value, $constraint); + } + + private function validateLoose(string $value, Uuid $constraint) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_INVALID_HYPHEN_PLACEMENT + // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG + + // Trim any wrapping characters like [] or {} used by some legacy systems + $trimmed = trim($value, '[]{}'); + + // Position of the next expected hyphen + $h = self::LOOSE_FIRST_HYPHEN_POSITION; + + // Expected length + $l = self::LOOSE_MAX_LENGTH; + + for ($i = 0; $i < $l; ++$i) { + // Check length + if (!isset($trimmed[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + + return; + } + + // Hyphens must occur every fifth position + // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx + // ^ ^ ^ ^ ^ ^ ^ + if ('-' === $trimmed[$i]) { + if ($i !== $h) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + + return; + } + + $h += 5; + + continue; + } + + // Missing hyphens are ignored + if ($i === $h) { + $h += 4; + --$l; + } + + // Check characters + if (!ctype_xdigit($trimmed[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + } + + // Check length again + if (isset($trimmed[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } + } + + private function validateStrict(string $value, Uuid $constraint) + { + // Error priority: + // 1. ERROR_INVALID_CHARACTERS + // 2. ERROR_INVALID_HYPHEN_PLACEMENT + // 3. ERROR_TOO_SHORT/ERROR_TOO_LONG + // 4. ERROR_INVALID_VERSION + // 5. ERROR_INVALID_VARIANT + + // Position of the next expected hyphen + $h = self::STRICT_FIRST_HYPHEN_POSITION; + + for ($i = 0; $i < self::STRICT_LENGTH; ++$i) { + // Check length + if (!isset($value[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_SHORT_ERROR) + ->addViolation(); + + return; + } + + // Check hyphen placement + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + // ^ ^ ^ ^ + if ('-' === $value[$i]) { + if ($i !== $h) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + + return; + } + + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + // ^ + if ($h < self::STRICT_LAST_HYPHEN_POSITION) { + $h += 5; + } + + continue; + } + + // Check characters + if (!ctype_xdigit($value[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_CHARACTERS_ERROR) + ->addViolation(); + + return; + } + + // Missing hyphen + if ($i === $h) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); + + return; + } + } + + // Check length again + if (isset($value[$i])) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::TOO_LONG_ERROR) + ->addViolation(); + } + + // Check version + if (!\in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VERSION_ERROR) + ->addViolation(); + } + + // Check variant - first two bits must equal "10" + // 0b10xx + // & 0b1100 (12) + // = 0b1000 (8) + if (8 !== (hexdec($value[self::STRICT_VARIANT_POSITION]) & 12)) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Uuid::INVALID_VARIANT_ERROR) + ->addViolation(); + } + } +} diff --git a/vendor/symfony/validator/Constraints/Valid.php b/vendor/symfony/validator/Constraints/Valid.php new file mode 100644 index 0000000..9ee69fd --- /dev/null +++ b/vendor/symfony/validator/Constraints/Valid.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; + +/** + * @Annotation + * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) + * + * @author Bernhard Schussek + */ +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Valid extends Constraint +{ + public $traverse = true; + + public function __get(string $option) + { + if ('groups' === $option) { + // when this is reached, no groups have been configured + return null; + } + + return parent::__get($option); + } + + /** + * {@inheritdoc} + */ + public function addImplicitGroupName(string $group) + { + if (null !== $this->groups) { + parent::addImplicitGroupName($group); + } + } +} diff --git a/vendor/symfony/validator/Constraints/ValidValidator.php b/vendor/symfony/validator/Constraints/ValidValidator.php new file mode 100644 index 0000000..85eabb8 --- /dev/null +++ b/vendor/symfony/validator/Constraints/ValidValidator.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Christian Flothmann + */ +class ValidValidator extends ConstraintValidator +{ + public function validate($value, Constraint $constraint) + { + if (!$constraint instanceof Valid) { + throw new UnexpectedTypeException($constraint, Valid::class); + } + + if (null === $value) { + return; + } + + $this->context + ->getValidator() + ->inContext($this->context) + ->validate($value, null, $this->context->getGroup()); + } +} diff --git a/vendor/symfony/validator/Constraints/ZeroComparisonConstraintTrait.php b/vendor/symfony/validator/Constraints/ZeroComparisonConstraintTrait.php new file mode 100644 index 0000000..b65fcf2 --- /dev/null +++ b/vendor/symfony/validator/Constraints/ZeroComparisonConstraintTrait.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * @internal + * + * @author Jan Schädlich + * @author Alexander M. Turek + */ +trait ZeroComparisonConstraintTrait +{ + public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + { + if (null === $options) { + $options = []; + } + + if (isset($options['propertyPath'])) { + throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class)); + } + + if (isset($options['value'])) { + throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', static::class)); + } + + parent::__construct(0, null, $message, $groups, $payload, $options); + } + + public function validatedBy(): string + { + return parent::class.'Validator'; + } +} diff --git a/vendor/symfony/validator/ContainerConstraintValidatorFactory.php b/vendor/symfony/validator/ContainerConstraintValidatorFactory.php new file mode 100644 index 0000000..0b5baed --- /dev/null +++ b/vendor/symfony/validator/ContainerConstraintValidatorFactory.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Psr\Container\ContainerInterface; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Uses a service container to create constraint validators. + * + * @author Kris Wallsmith + */ +class ContainerConstraintValidatorFactory implements ConstraintValidatorFactoryInterface +{ + private $container; + private $validators; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->validators = []; + } + + /** + * {@inheritdoc} + * + * @throws ValidatorException When the validator class does not exist + * @throws UnexpectedTypeException When the validator is not an instance of ConstraintValidatorInterface + */ + public function getInstance(Constraint $constraint) + { + $name = $constraint->validatedBy(); + + if (!isset($this->validators[$name])) { + if ($this->container->has($name)) { + $this->validators[$name] = $this->container->get($name); + } else { + if (!class_exists($name)) { + throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, get_debug_type($constraint))); + } + + $this->validators[$name] = new $name(); + } + } + + if (!$this->validators[$name] instanceof ConstraintValidatorInterface) { + throw new UnexpectedTypeException($this->validators[$name], ConstraintValidatorInterface::class); + } + + return $this->validators[$name]; + } +} diff --git a/vendor/symfony/validator/Context/ExecutionContext.php b/vendor/symfony/validator/Context/ExecutionContext.php new file mode 100644 index 0000000..c640da3 --- /dev/null +++ b/vendor/symfony/validator/Context/ExecutionContext.php @@ -0,0 +1,372 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\ConstraintViolationListInterface; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\MemberMetadata; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; +use Symfony\Component\Validator\Util\PropertyPath; +use Symfony\Component\Validator\Validator\LazyProperty; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilder; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * The context used and created by {@link ExecutionContextFactory}. + * + * @author Bernhard Schussek + * + * @see ExecutionContextInterface + * + * @internal since version 2.5. Code against ExecutionContextInterface instead. + */ +class ExecutionContext implements ExecutionContextInterface +{ + /** + * @var ValidatorInterface + */ + private $validator; + + /** + * The root value of the validated object graph. + * + * @var mixed + */ + private $root; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var string|null + */ + private $translationDomain; + + /** + * The violations generated in the current context. + * + * @var ConstraintViolationList + */ + private $violations; + + /** + * The currently validated value. + * + * @var mixed + */ + private $value; + + /** + * The currently validated object. + * + * @var object|null + */ + private $object; + + /** + * The property path leading to the current value. + * + * @var string + */ + private $propertyPath = ''; + + /** + * The current validation metadata. + * + * @var MetadataInterface|null + */ + private $metadata; + + /** + * The currently validated group. + * + * @var string|null + */ + private $group; + + /** + * The currently validated constraint. + * + * @var Constraint|null + */ + private $constraint; + + /** + * Stores which objects have been validated in which group. + * + * @var bool[][] + */ + private $validatedObjects = []; + + /** + * Stores which class constraint has been validated for which object. + * + * @var bool[] + */ + private $validatedConstraints = []; + + /** + * Stores which objects have been initialized. + * + * @var bool[] + */ + private $initializedObjects; + + /** + * @var \SplObjectStorage + */ + private $cachedObjectsRefs; + + /** + * @param mixed $root The root value of the validated object graph + * + * @internal Called by {@link ExecutionContextFactory}. Should not be used in user code. + */ + public function __construct(ValidatorInterface $validator, $root, TranslatorInterface $translator, string $translationDomain = null) + { + $this->validator = $validator; + $this->root = $root; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->violations = new ConstraintViolationList(); + $this->cachedObjectsRefs = new \SplObjectStorage(); + } + + /** + * {@inheritdoc} + */ + public function setNode($value, ?object $object, MetadataInterface $metadata = null, string $propertyPath) + { + $this->value = $value; + $this->object = $object; + $this->metadata = $metadata; + $this->propertyPath = $propertyPath; + } + + /** + * {@inheritdoc} + */ + public function setGroup(?string $group) + { + $this->group = $group; + } + + /** + * {@inheritdoc} + */ + public function setConstraint(Constraint $constraint) + { + $this->constraint = $constraint; + } + + /** + * {@inheritdoc} + */ + public function addViolation(string $message, array $parameters = []) + { + $this->violations->add(new ConstraintViolation( + $this->translator->trans($message, $parameters, $this->translationDomain), + $message, + $parameters, + $this->root, + $this->propertyPath, + $this->getValue(), + null, + null, + $this->constraint + )); + } + + /** + * {@inheritdoc} + */ + public function buildViolation(string $message, array $parameters = []): ConstraintViolationBuilderInterface + { + return new ConstraintViolationBuilder( + $this->violations, + $this->constraint, + $message, + $parameters, + $this->root, + $this->propertyPath, + $this->getValue(), + $this->translator, + $this->translationDomain + ); + } + + /** + * {@inheritdoc} + */ + public function getViolations(): ConstraintViolationListInterface + { + return $this->violations; + } + + /** + * {@inheritdoc} + */ + public function getValidator(): ValidatorInterface + { + return $this->validator; + } + + /** + * {@inheritdoc} + */ + public function getRoot() + { + return $this->root; + } + + /** + * {@inheritdoc} + */ + public function getValue() + { + if ($this->value instanceof LazyProperty) { + return $this->value->getPropertyValue(); + } + + return $this->value; + } + + /** + * {@inheritdoc} + */ + public function getObject() + { + return $this->object; + } + + /** + * {@inheritdoc} + */ + public function getMetadata(): ?MetadataInterface + { + return $this->metadata; + } + + /** + * {@inheritdoc} + */ + public function getGroup(): ?string + { + return $this->group; + } + + public function getConstraint(): ?Constraint + { + return $this->constraint; + } + + /** + * {@inheritdoc} + */ + public function getClassName(): ?string + { + return $this->metadata instanceof MemberMetadata || $this->metadata instanceof ClassMetadataInterface ? $this->metadata->getClassName() : null; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName(): ?string + { + return $this->metadata instanceof PropertyMetadataInterface ? $this->metadata->getPropertyName() : null; + } + + /** + * {@inheritdoc} + */ + public function getPropertyPath(string $subPath = ''): string + { + return PropertyPath::append($this->propertyPath, $subPath); + } + + /** + * {@inheritdoc} + */ + public function markGroupAsValidated(string $cacheKey, string $groupHash) + { + if (!isset($this->validatedObjects[$cacheKey])) { + $this->validatedObjects[$cacheKey] = []; + } + + $this->validatedObjects[$cacheKey][$groupHash] = true; + } + + /** + * {@inheritdoc} + */ + public function isGroupValidated(string $cacheKey, string $groupHash): bool + { + return isset($this->validatedObjects[$cacheKey][$groupHash]); + } + + /** + * {@inheritdoc} + */ + public function markConstraintAsValidated(string $cacheKey, string $constraintHash) + { + $this->validatedConstraints[$cacheKey.':'.$constraintHash] = true; + } + + /** + * {@inheritdoc} + */ + public function isConstraintValidated(string $cacheKey, string $constraintHash): bool + { + return isset($this->validatedConstraints[$cacheKey.':'.$constraintHash]); + } + + /** + * {@inheritdoc} + */ + public function markObjectAsInitialized(string $cacheKey) + { + $this->initializedObjects[$cacheKey] = true; + } + + /** + * {@inheritdoc} + */ + public function isObjectInitialized(string $cacheKey): bool + { + return isset($this->initializedObjects[$cacheKey]); + } + + /** + * @internal + */ + public function generateCacheKey(object $object): string + { + if (!isset($this->cachedObjectsRefs[$object])) { + $this->cachedObjectsRefs[$object] = spl_object_hash($object); + } + + return $this->cachedObjectsRefs[$object]; + } + + public function __clone() + { + $this->violations = clone $this->violations; + } +} diff --git a/vendor/symfony/validator/Context/ExecutionContextFactory.php b/vendor/symfony/validator/Context/ExecutionContextFactory.php new file mode 100644 index 0000000..623bd16 --- /dev/null +++ b/vendor/symfony/validator/Context/ExecutionContextFactory.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * Creates new {@link ExecutionContext} instances. + * + * @author Bernhard Schussek + * + * @internal version 2.5. Code against ExecutionContextFactoryInterface instead. + */ +class ExecutionContextFactory implements ExecutionContextFactoryInterface +{ + private $translator; + private $translationDomain; + + public function __construct(TranslatorInterface $translator, string $translationDomain = null) + { + $this->translator = $translator; + $this->translationDomain = $translationDomain; + } + + /** + * {@inheritdoc} + */ + public function createContext(ValidatorInterface $validator, $root) + { + return new ExecutionContext( + $validator, + $root, + $this->translator, + $this->translationDomain + ); + } +} diff --git a/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php b/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php new file mode 100644 index 0000000..a300086 --- /dev/null +++ b/vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Creates instances of {@link ExecutionContextInterface}. + * + * You can use a custom factory if you want to customize the execution context + * that is passed through the validation run. + * + * @author Bernhard Schussek + */ +interface ExecutionContextFactoryInterface +{ + /** + * Creates a new execution context. + * + * @param mixed $root The root value of the validated + * object graph + * + * @return ExecutionContextInterface + */ + public function createContext(ValidatorInterface $validator, $root); +} diff --git a/vendor/symfony/validator/Context/ExecutionContextInterface.php b/vendor/symfony/validator/Context/ExecutionContextInterface.php new file mode 100644 index 0000000..093aa71 --- /dev/null +++ b/vendor/symfony/validator/Context/ExecutionContextInterface.php @@ -0,0 +1,339 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Context; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolationListInterface; +use Symfony\Component\Validator\Mapping; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; + +/** + * The context of a validation run. + * + * The context collects all violations generated during the validation. By + * default, validators execute all validations in a new context: + * + * $violations = $validator->validate($object); + * + * When you make another call to the validator, while the validation is in + * progress, the violations will be isolated from each other: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * // The violations are not added to $this->context + * $violations = $validator->validate($value); + * } + * + * However, if you want to add the violations to the current context, use the + * {@link ValidatorInterface::inContext()} method: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * // The violations are added to $this->context + * $validator + * ->inContext($this->context) + * ->validate($value) + * ; + * } + * + * Additionally, the context provides information about the current state of + * the validator, such as the currently validated class, the name of the + * currently validated property and more. These values change over time, so you + * cannot store a context and expect that the methods still return the same + * results later on. + * + * @author Bernhard Schussek + */ +interface ExecutionContextInterface +{ + /** + * Adds a violation at the current node of the validation graph. + * + * @param string|\Stringable $message The error message as a string or a stringable object + * @param array $params The parameters substituted in the error message + */ + public function addViolation(string $message, array $params = []); + + /** + * Returns a builder for adding a violation with extended information. + * + * Call {@link ConstraintViolationBuilderInterface::addViolation()} to + * add the violation when you're done with the configuration: + * + * $context->buildViolation('Please enter a number between %min% and %max%.') + * ->setParameter('%min%', '3') + * ->setParameter('%max%', '10') + * ->setTranslationDomain('number_validation') + * ->addViolation(); + * + * @param string|\Stringable $message The error message as a string or a stringable object + * @param array $parameters The parameters substituted in the error message + * + * @return ConstraintViolationBuilderInterface + */ + public function buildViolation(string $message, array $parameters = []); + + /** + * Returns the validator. + * + * Useful if you want to validate additional constraints: + * + * public function validate($value, Constraint $constraint) + * { + * $validator = $this->context->getValidator(); + * + * $violations = $validator->validate($value, new Length(['min' => 3])); + * + * if (count($violations) > 0) { + * // ... + * } + * } + * + * @return ValidatorInterface + */ + public function getValidator(); + + /** + * Returns the currently validated object. + * + * If the validator is currently validating a class constraint, the + * object of that class is returned. If it is validating a property or + * getter constraint, the object that the property/getter belongs to is + * returned. + * + * In other cases, null is returned. + * + * @return object|null + */ + public function getObject(); + + /** + * Sets the currently validated value. + * + * @param mixed $value The validated value + * @param object|null $object The currently validated object + * @param string $propertyPath The property path to the current value + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setNode($value, ?object $object, MetadataInterface $metadata = null, string $propertyPath); + + /** + * Sets the currently validated group. + * + * @param string|null $group The validated group + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setGroup(?string $group); + + /** + * Sets the currently validated constraint. + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function setConstraint(Constraint $constraint); + + /** + * Marks an object as validated in a specific validation group. + * + * @param string $cacheKey The hash of the object + * @param string $groupHash The group's name or hash, if it is group + * sequence + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function markGroupAsValidated(string $cacheKey, string $groupHash); + + /** + * Returns whether an object was validated in a specific validation group. + * + * @param string $cacheKey The hash of the object + * @param string $groupHash The group's name or hash, if it is group + * sequence + * + * @return bool + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function isGroupValidated(string $cacheKey, string $groupHash); + + /** + * Marks a constraint as validated for an object. + * + * @param string $cacheKey The hash of the object + * @param string $constraintHash The hash of the constraint + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function markConstraintAsValidated(string $cacheKey, string $constraintHash); + + /** + * Returns whether a constraint was validated for an object. + * + * @param string $cacheKey The hash of the object + * @param string $constraintHash The hash of the constraint + * + * @return bool + * + * @internal Used by the validator engine. Should not be called by user + * code. + */ + public function isConstraintValidated(string $cacheKey, string $constraintHash); + + /** + * Marks that an object was initialized. + * + * @param string $cacheKey The hash of the object + * + * @internal Used by the validator engine. Should not be called by user + * code. + * + * @see ObjectInitializerInterface + */ + public function markObjectAsInitialized(string $cacheKey); + + /** + * Returns whether an object was initialized. + * + * @param string $cacheKey The hash of the object + * + * @return bool + * + * @internal Used by the validator engine. Should not be called by user + * code. + * + * @see ObjectInitializerInterface + */ + public function isObjectInitialized(string $cacheKey); + + /** + * Returns the violations generated by the validator so far. + * + * @return ConstraintViolationListInterface + */ + public function getViolations(); + + /** + * Returns the value at which validation was started in the object graph. + * + * The validator, when given an object, traverses the properties and + * related objects and their properties. The root of the validation is the + * object from which the traversal started. + * + * The current value is returned by {@link getValue}. + * + * @return mixed + */ + public function getRoot(); + + /** + * Returns the value that the validator is currently validating. + * + * If you want to retrieve the object that was originally passed to the + * validator, use {@link getRoot}. + * + * @return mixed + */ + public function getValue(); + + /** + * Returns the metadata for the currently validated value. + * + * With the core implementation, this method returns a + * {@link Mapping\ClassMetadataInterface} instance if the current value is an object, + * a {@link Mapping\PropertyMetadata} instance if the current value is + * the value of a property and a {@link Mapping\GetterMetadata} instance if + * the validated value is the result of a getter method. + * + * If the validated value is neither of these, for example if the validator + * has been called with a plain value and constraint, this method returns + * null. + * + * @return MetadataInterface|null + */ + public function getMetadata(); + + /** + * Returns the validation group that is currently being validated. + * + * @return string|null + */ + public function getGroup(); + + /** + * Returns the class name of the current node. + * + * If the metadata of the current node does not implement + * {@link Mapping\ClassMetadataInterface} or if no metadata is available for the + * current node, this method returns null. + * + * @return string|null + */ + public function getClassName(); + + /** + * Returns the property name of the current node. + * + * If the metadata of the current node does not implement + * {@link PropertyMetadataInterface} or if no metadata is available for the + * current node, this method returns null. + * + * @return string|null + */ + public function getPropertyName(); + + /** + * Returns the property path to the value that the validator is currently + * validating. + * + * For example, take the following object graph: + * + *
+     * (Person)---($address: Address)---($street: string)
+     * 
+ * + * When the Person instance is passed to the validator, the + * property path is initially empty. When the $address property + * of that person is validated, the property path is "address". When + * the $street property of the related Address instance + * is validated, the property path is "address.street". + * + * Properties of objects are prefixed with a dot in the property path. + * Indices of arrays or objects implementing the {@link \ArrayAccess} + * interface are enclosed in brackets. For example, if the property in + * the previous example is $addresses and contains an array + * of Address instance, the property path generated for the + * $street property of one of these addresses is for example + * "addresses[0].street". + * + * @param string $subPath Optional. The suffix appended to the current + * property path. + * + * @return string The current property path. The result may be an empty + * string if the validator is currently validating the + * root value of the validation graph. + */ + public function getPropertyPath(string $subPath = ''); +} diff --git a/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php b/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php new file mode 100644 index 0000000..2b36267 --- /dev/null +++ b/vendor/symfony/validator/DataCollector/ValidatorDataCollector.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\DataCollector; + +use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; +use Symfony\Component\Validator\Validator\TraceableValidator; +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Caster\ClassStub; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Maxime Steinhausser + * + * @final + */ +class ValidatorDataCollector extends DataCollector implements LateDataCollectorInterface +{ + private $validator; + + public function __construct(TraceableValidator $validator) + { + $this->validator = $validator; + $this->reset(); + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Throwable $exception = null) + { + // Everything is collected once, on kernel terminate. + } + + public function reset() + { + $this->data = [ + 'calls' => $this->cloneVar([]), + 'violations_count' => 0, + ]; + } + + /** + * {@inheritdoc} + */ + public function lateCollect() + { + $collected = $this->validator->getCollectedData(); + $this->data['calls'] = $this->cloneVar($collected); + $this->data['violations_count'] = array_reduce($collected, function ($previous, $item) { + return $previous + \count($item['violations']); + }, 0); + } + + public function getCalls(): Data + { + return $this->data['calls']; + } + + public function getViolationsCount(): int + { + return $this->data['violations_count']; + } + + /** + * {@inheritdoc} + */ + public function getName(): string + { + return 'validator'; + } + + protected function getCasters(): array + { + return parent::getCasters() + [ + \Exception::class => function (\Exception $e, array $a, Stub $s) { + foreach (["\0Exception\0previous", "\0Exception\0trace"] as $k) { + if (isset($a[$k])) { + unset($a[$k]); + ++$s->cut; + } + } + + return $a; + }, + FormInterface::class => function (FormInterface $f, array $a) { + return [ + Caster::PREFIX_VIRTUAL.'name' => $f->getName(), + Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(\get_class($f->getConfig()->getType()->getInnerType())), + Caster::PREFIX_VIRTUAL.'data' => $f->getData(), + ]; + }, + ]; + } +} diff --git a/vendor/symfony/validator/DependencyInjection/AddAutoMappingConfigurationPass.php b/vendor/symfony/validator/DependencyInjection/AddAutoMappingConfigurationPass.php new file mode 100644 index 0000000..dca06ee --- /dev/null +++ b/vendor/symfony/validator/DependencyInjection/AddAutoMappingConfigurationPass.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Injects the automapping configuration as last argument of loaders tagged with the "validator.auto_mapper" tag. + * + * @author Kévin Dunglas + */ +class AddAutoMappingConfigurationPass implements CompilerPassInterface +{ + private $validatorBuilderService; + private $tag; + + public function __construct(string $validatorBuilderService = 'validator.builder', string $tag = 'validator.auto_mapper') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/validator', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->validatorBuilderService = $validatorBuilderService; + $this->tag = $tag; + } + + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasParameter('validator.auto_mapping') || !$container->hasDefinition($this->validatorBuilderService)) { + return; + } + + $config = $container->getParameter('validator.auto_mapping'); + + $globalNamespaces = []; + $servicesToNamespaces = []; + foreach ($config as $namespace => $value) { + if ([] === $value['services']) { + $globalNamespaces[] = $namespace; + + continue; + } + + foreach ($value['services'] as $service) { + $servicesToNamespaces[$service][] = $namespace; + } + } + + $validatorBuilder = $container->getDefinition($this->validatorBuilderService); + foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) { + $regexp = $this->getRegexp(array_merge($globalNamespaces, $servicesToNamespaces[$id] ?? [])); + $validatorBuilder->addMethodCall('addLoader', [new Reference($id)]); + $container->getDefinition($id)->setArgument('$classValidatorRegexp', $regexp); + } + + $container->getParameterBag()->remove('validator.auto_mapping'); + } + + /** + * Builds a regexp to check if a class is auto-mapped. + */ + private function getRegexp(array $patterns): ?string + { + if (!$patterns) { + return null; + } + + $regexps = []; + foreach ($patterns as $pattern) { + // Escape namespace + $regex = preg_quote(ltrim($pattern, '\\')); + + // Wildcards * and ** + $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']); + + // If this class does not end by a slash, anchor the end + if (!str_ends_with($regex, '\\')) { + $regex .= '$'; + } + + $regexps[] = '^'.$regex; + } + + return sprintf('{%s}', implode('|', $regexps)); + } +} diff --git a/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php b/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php new file mode 100644 index 0000000..a3c6559 --- /dev/null +++ b/vendor/symfony/validator/DependencyInjection/AddConstraintValidatorsPass.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * @author Johannes M. Schmitt + * @author Robin Chalas + */ +class AddConstraintValidatorsPass implements CompilerPassInterface +{ + private $validatorFactoryServiceId; + private $constraintValidatorTag; + + public function __construct(string $validatorFactoryServiceId = 'validator.validator_factory', string $constraintValidatorTag = 'validator.constraint_validator') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/validator', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->validatorFactoryServiceId = $validatorFactoryServiceId; + $this->constraintValidatorTag = $constraintValidatorTag; + } + + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition($this->validatorFactoryServiceId)) { + return; + } + + $validators = []; + foreach ($container->findTaggedServiceIds($this->constraintValidatorTag, true) as $id => $attributes) { + $definition = $container->getDefinition($id); + + if (isset($attributes[0]['alias'])) { + $validators[$attributes[0]['alias']] = new Reference($id); + } + + $validators[$definition->getClass()] = new Reference($id); + } + + $container + ->getDefinition($this->validatorFactoryServiceId) + ->replaceArgument(0, ServiceLocatorTagPass::register($container, $validators)) + ; + } +} diff --git a/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php b/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php new file mode 100644 index 0000000..0ea8eef --- /dev/null +++ b/vendor/symfony/validator/DependencyInjection/AddValidatorInitializersPass.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * @author Fabien Potencier + * @author Robin Chalas + */ +class AddValidatorInitializersPass implements CompilerPassInterface +{ + private $builderService; + private $initializerTag; + + public function __construct(string $builderService = 'validator.builder', string $initializerTag = 'validator.initializer') + { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/validator', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + + $this->builderService = $builderService; + $this->initializerTag = $initializerTag; + } + + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition($this->builderService)) { + return; + } + + $initializers = []; + foreach ($container->findTaggedServiceIds($this->initializerTag, true) as $id => $attributes) { + $initializers[] = new Reference($id); + } + + $container->getDefinition($this->builderService)->addMethodCall('addObjectInitializers', [$initializers]); + } +} diff --git a/vendor/symfony/validator/Exception/BadMethodCallException.php b/vendor/symfony/validator/Exception/BadMethodCallException.php new file mode 100644 index 0000000..939161b --- /dev/null +++ b/vendor/symfony/validator/Exception/BadMethodCallException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base BadMethodCallException for the Validator component. + * + * @author Bernhard Schussek + */ +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/validator/Exception/ConstraintDefinitionException.php b/vendor/symfony/validator/Exception/ConstraintDefinitionException.php new file mode 100644 index 0000000..b24fdd6 --- /dev/null +++ b/vendor/symfony/validator/Exception/ConstraintDefinitionException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class ConstraintDefinitionException extends ValidatorException +{ +} diff --git a/vendor/symfony/validator/Exception/ExceptionInterface.php b/vendor/symfony/validator/Exception/ExceptionInterface.php new file mode 100644 index 0000000..390e8c0 --- /dev/null +++ b/vendor/symfony/validator/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base ExceptionInterface for the Validator component. + * + * @author Bernhard Schussek + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/validator/Exception/GroupDefinitionException.php b/vendor/symfony/validator/Exception/GroupDefinitionException.php new file mode 100644 index 0000000..ab7e91d --- /dev/null +++ b/vendor/symfony/validator/Exception/GroupDefinitionException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class GroupDefinitionException extends ValidatorException +{ +} diff --git a/vendor/symfony/validator/Exception/InvalidArgumentException.php b/vendor/symfony/validator/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..22da39b --- /dev/null +++ b/vendor/symfony/validator/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base InvalidArgumentException for the Validator component. + * + * @author Bernhard Schussek + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/validator/Exception/InvalidOptionsException.php b/vendor/symfony/validator/Exception/InvalidOptionsException.php new file mode 100644 index 0000000..79d064f --- /dev/null +++ b/vendor/symfony/validator/Exception/InvalidOptionsException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class InvalidOptionsException extends ValidatorException +{ + private $options; + + public function __construct(string $message, array $options) + { + parent::__construct($message); + + $this->options = $options; + } + + public function getOptions() + { + return $this->options; + } +} diff --git a/vendor/symfony/validator/Exception/LogicException.php b/vendor/symfony/validator/Exception/LogicException.php new file mode 100644 index 0000000..41d0975 --- /dev/null +++ b/vendor/symfony/validator/Exception/LogicException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class LogicException extends \LogicException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/validator/Exception/MappingException.php b/vendor/symfony/validator/Exception/MappingException.php new file mode 100644 index 0000000..4c8c057 --- /dev/null +++ b/vendor/symfony/validator/Exception/MappingException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class MappingException extends ValidatorException +{ +} diff --git a/vendor/symfony/validator/Exception/MissingOptionsException.php b/vendor/symfony/validator/Exception/MissingOptionsException.php new file mode 100644 index 0000000..61de567 --- /dev/null +++ b/vendor/symfony/validator/Exception/MissingOptionsException.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class MissingOptionsException extends ValidatorException +{ + private $options; + + public function __construct(string $message, array $options) + { + parent::__construct($message); + + $this->options = $options; + } + + public function getOptions() + { + return $this->options; + } +} diff --git a/vendor/symfony/validator/Exception/NoSuchMetadataException.php b/vendor/symfony/validator/Exception/NoSuchMetadataException.php new file mode 100644 index 0000000..4cac74c --- /dev/null +++ b/vendor/symfony/validator/Exception/NoSuchMetadataException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * @author Bernhard Schussek + */ +class NoSuchMetadataException extends ValidatorException +{ +} diff --git a/vendor/symfony/validator/Exception/OutOfBoundsException.php b/vendor/symfony/validator/Exception/OutOfBoundsException.php new file mode 100644 index 0000000..30906e8 --- /dev/null +++ b/vendor/symfony/validator/Exception/OutOfBoundsException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base OutOfBoundsException for the Validator component. + * + * @author Bernhard Schussek + */ +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/validator/Exception/RuntimeException.php b/vendor/symfony/validator/Exception/RuntimeException.php new file mode 100644 index 0000000..df4a50c --- /dev/null +++ b/vendor/symfony/validator/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * Base RuntimeException for the Validator component. + * + * @author Bernhard Schussek + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/validator/Exception/UnexpectedTypeException.php b/vendor/symfony/validator/Exception/UnexpectedTypeException.php new file mode 100644 index 0000000..86a7c03 --- /dev/null +++ b/vendor/symfony/validator/Exception/UnexpectedTypeException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class UnexpectedTypeException extends ValidatorException +{ + public function __construct($value, string $expectedType) + { + parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, get_debug_type($value))); + } +} diff --git a/vendor/symfony/validator/Exception/UnexpectedValueException.php b/vendor/symfony/validator/Exception/UnexpectedValueException.php new file mode 100644 index 0000000..7a7f7f7 --- /dev/null +++ b/vendor/symfony/validator/Exception/UnexpectedValueException.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * @author Christian Flothmann + */ +class UnexpectedValueException extends UnexpectedTypeException +{ + private $expectedType; + + public function __construct($value, string $expectedType) + { + parent::__construct($value, $expectedType); + + $this->expectedType = $expectedType; + } + + public function getExpectedType(): string + { + return $this->expectedType; + } +} diff --git a/vendor/symfony/validator/Exception/UnsupportedMetadataException.php b/vendor/symfony/validator/Exception/UnsupportedMetadataException.php new file mode 100644 index 0000000..aff569b --- /dev/null +++ b/vendor/symfony/validator/Exception/UnsupportedMetadataException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +/** + * @author Bernhard Schussek + */ +class UnsupportedMetadataException extends InvalidArgumentException +{ +} diff --git a/vendor/symfony/validator/Exception/ValidationFailedException.php b/vendor/symfony/validator/Exception/ValidationFailedException.php new file mode 100644 index 0000000..ca0314c --- /dev/null +++ b/vendor/symfony/validator/Exception/ValidationFailedException.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +use Symfony\Component\Validator\ConstraintViolationListInterface; + +/** + * @author Jan Vernieuwe + */ +class ValidationFailedException extends RuntimeException +{ + private $violations; + private $value; + + public function __construct($value, ConstraintViolationListInterface $violations) + { + $this->violations = $violations; + $this->value = $value; + parent::__construct($violations); + } + + public function getValue() + { + return $this->value; + } + + public function getViolations(): ConstraintViolationListInterface + { + return $this->violations; + } +} diff --git a/vendor/symfony/validator/Exception/ValidatorException.php b/vendor/symfony/validator/Exception/ValidatorException.php new file mode 100644 index 0000000..28bd470 --- /dev/null +++ b/vendor/symfony/validator/Exception/ValidatorException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Exception; + +class ValidatorException extends RuntimeException +{ +} diff --git a/vendor/symfony/validator/GroupSequenceProviderInterface.php b/vendor/symfony/validator/GroupSequenceProviderInterface.php new file mode 100644 index 0000000..0374a8b --- /dev/null +++ b/vendor/symfony/validator/GroupSequenceProviderInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Constraints\GroupSequence; + +/** + * Defines the interface for a group sequence provider. + */ +interface GroupSequenceProviderInterface +{ + /** + * Returns which validation groups should be used for a certain state + * of the object. + * + * @return string[]|string[][]|GroupSequence + */ + public function getGroupSequence(); +} diff --git a/vendor/symfony/validator/LICENSE b/vendor/symfony/validator/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/validator/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/validator/Mapping/AutoMappingStrategy.php b/vendor/symfony/validator/Mapping/AutoMappingStrategy.php new file mode 100644 index 0000000..4012ddc --- /dev/null +++ b/vendor/symfony/validator/Mapping/AutoMappingStrategy.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Specifies how the auto-mapping feature should behave. + * + * @author Maxime Steinhausser + */ +final class AutoMappingStrategy +{ + /** + * Nothing explicitly set, rely on auto-mapping configured regex. + */ + public const NONE = 0; + + /** + * Explicitly enabled. + */ + public const ENABLED = 1; + + /** + * Explicitly disabled. + */ + public const DISABLED = 2; + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/validator/Mapping/CascadingStrategy.php b/vendor/symfony/validator/Mapping/CascadingStrategy.php new file mode 100644 index 0000000..6bab8ac --- /dev/null +++ b/vendor/symfony/validator/Mapping/CascadingStrategy.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Specifies whether an object should be cascaded. + * + * Cascading is relevant for any node type but class nodes. If such a node + * contains an object of value, and if cascading is enabled, then the node + * traverser will try to find class metadata for that object and validate the + * object against that metadata. + * + * If no metadata is found for a cascaded object, and if that object implements + * {@link \Traversable}, the node traverser will iterate over the object and + * cascade each object or collection contained within, unless iteration is + * prohibited by the specified {@link TraversalStrategy}. + * + * Although the constants currently represent a boolean switch, they are + * implemented as bit mask in order to allow future extensions. + * + * @author Bernhard Schussek + * + * @see TraversalStrategy + */ +class CascadingStrategy +{ + /** + * Specifies that a node should not be cascaded. + */ + public const NONE = 1; + + /** + * Specifies that a node should be cascaded. + */ + public const CASCADE = 2; + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/validator/Mapping/ClassMetadata.php b/vendor/symfony/validator/Mapping/ClassMetadata.php new file mode 100644 index 0000000..31f5484 --- /dev/null +++ b/vendor/symfony/validator/Mapping/ClassMetadata.php @@ -0,0 +1,513 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Cascade; +use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\GroupDefinitionException; + +/** + * Default implementation of {@link ClassMetadataInterface}. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * @author Fabien Potencier + */ +class ClassMetadata extends GenericMetadata implements ClassMetadataInterface +{ + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getClassName()} instead. + */ + public $name; + + /** + * @var string + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getDefaultGroup()} instead. + */ + public $defaultGroup; + + /** + * @var MemberMetadata[][] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $members = []; + + /** + * @var PropertyMetadata[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $properties = []; + + /** + * @var GetterMetadata[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyMetadata()} instead. + */ + public $getters = []; + + /** + * @var array + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getGroupSequence()} instead. + */ + public $groupSequence = []; + + /** + * @var bool + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link isGroupSequenceProvider()} instead. + */ + public $groupSequenceProvider = false; + + /** + * The strategy for traversing traversable objects. + * + * By default, only instances of {@link \Traversable} are traversed. + * + * @var int + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getTraversalStrategy()} instead. + */ + public $traversalStrategy = TraversalStrategy::IMPLICIT; + + /** + * @var \ReflectionClass + */ + private $reflClass; + + public function __construct(string $class) + { + $this->name = $class; + // class name without namespace + if (false !== $nsSep = strrpos($class, '\\')) { + $this->defaultGroup = substr($class, $nsSep + 1); + } else { + $this->defaultGroup = $class; + } + } + + /** + * {@inheritdoc} + */ + public function __sleep() + { + $parentProperties = parent::__sleep(); + + // Don't store the cascading strategy. Classes never cascade. + unset($parentProperties[array_search('cascadingStrategy', $parentProperties)]); + + return array_merge($parentProperties, [ + 'getters', + 'groupSequence', + 'groupSequenceProvider', + 'members', + 'name', + 'properties', + 'defaultGroup', + ]); + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + return $this->name; + } + + /** + * Returns the name of the default group for this class. + * + * For each class, the group "Default" is an alias for the group + * "", where is the non-namespaced name of the + * class. All constraints implicitly or explicitly assigned to group + * "Default" belong to both of these groups, unless the class defines + * a group sequence. + * + * If a class defines a group sequence, validating the class in "Default" + * will validate the group sequence. The constraints assigned to "Default" + * can still be validated by validating the class in "". + * + * @return string + */ + public function getDefaultGroup() + { + return $this->defaultGroup; + } + + /** + * {@inheritdoc} + * + * If the constraint {@link Cascade} is added, the cascading strategy will be + * changed to {@link CascadingStrategy::CASCADE}. + * + * If the constraint {@link Traverse} is added, the traversal strategy will be + * changed. Depending on the $traverse property of that constraint, + * the traversal strategy will be set to one of the following: + * + * - {@link TraversalStrategy::IMPLICIT} by default + * - {@link TraversalStrategy::NONE} if $traverse is disabled + * - {@link TraversalStrategy::TRAVERSE} if $traverse is enabled + */ + public function addConstraint(Constraint $constraint) + { + $this->checkConstraint($constraint); + + if ($constraint instanceof Traverse) { + if ($constraint->traverse) { + // If traverse is true, traversal should be explicitly enabled + $this->traversalStrategy = TraversalStrategy::TRAVERSE; + } else { + // If traverse is false, traversal should be explicitly disabled + $this->traversalStrategy = TraversalStrategy::NONE; + } + + // The constraint is not added + return $this; + } + + if ($constraint instanceof Cascade) { + if (\PHP_VERSION_ID < 70400) { + throw new ConstraintDefinitionException(sprintf('The constraint "%s" requires PHP 7.4.', Cascade::class)); + } + + $this->cascadingStrategy = CascadingStrategy::CASCADE; + + foreach ($this->getReflectionClass()->getProperties() as $property) { + if ($property->hasType() && (('array' === $type = $property->getType()->getName()) || class_exists(($type)))) { + $this->addPropertyConstraint($property->getName(), new Valid()); + } + } + + // The constraint is not added + return $this; + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + parent::addConstraint($constraint); + + return $this; + } + + /** + * Adds a constraint to the given property. + * + * @return $this + */ + public function addPropertyConstraint(string $property, Constraint $constraint) + { + if (!isset($this->properties[$property])) { + $this->properties[$property] = new PropertyMetadata($this->getClassName(), $property); + + $this->addPropertyMetadata($this->properties[$property]); + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + $this->properties[$property]->addConstraint($constraint); + + return $this; + } + + /** + * @param Constraint[] $constraints + * + * @return $this + */ + public function addPropertyConstraints(string $property, array $constraints) + { + foreach ($constraints as $constraint) { + $this->addPropertyConstraint($property, $constraint); + } + + return $this; + } + + /** + * Adds a constraint to the getter of the given property. + * + * The name of the getter is assumed to be the name of the property with an + * uppercased first letter and the prefix "get", "is" or "has". + * + * @return $this + */ + public function addGetterConstraint(string $property, Constraint $constraint) + { + if (!isset($this->getters[$property])) { + $this->getters[$property] = new GetterMetadata($this->getClassName(), $property); + + $this->addPropertyMetadata($this->getters[$property]); + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + $this->getters[$property]->addConstraint($constraint); + + return $this; + } + + /** + * Adds a constraint to the getter of the given property. + * + * @return $this + */ + public function addGetterMethodConstraint(string $property, string $method, Constraint $constraint) + { + if (!isset($this->getters[$property])) { + $this->getters[$property] = new GetterMetadata($this->getClassName(), $property, $method); + + $this->addPropertyMetadata($this->getters[$property]); + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + + $this->getters[$property]->addConstraint($constraint); + + return $this; + } + + /** + * @param Constraint[] $constraints + * + * @return $this + */ + public function addGetterConstraints(string $property, array $constraints) + { + foreach ($constraints as $constraint) { + $this->addGetterConstraint($property, $constraint); + } + + return $this; + } + + /** + * @param Constraint[] $constraints + * + * @return $this + */ + public function addGetterMethodConstraints(string $property, string $method, array $constraints) + { + foreach ($constraints as $constraint) { + $this->addGetterMethodConstraint($property, $method, $constraint); + } + + return $this; + } + + /** + * Merges the constraints of the given metadata into this object. + */ + public function mergeConstraints(self $source) + { + if ($source->isGroupSequenceProvider()) { + $this->setGroupSequenceProvider(true); + } + + foreach ($source->getConstraints() as $constraint) { + $this->addConstraint(clone $constraint); + } + + foreach ($source->getConstrainedProperties() as $property) { + foreach ($source->getPropertyMetadata($property) as $member) { + $member = clone $member; + + foreach ($member->getConstraints() as $constraint) { + if (\in_array($constraint::DEFAULT_GROUP, $constraint->groups, true)) { + $member->constraintsByGroup[$this->getDefaultGroup()][] = $constraint; + } + + $constraint->addImplicitGroupName($this->getDefaultGroup()); + } + + $this->addPropertyMetadata($member); + + if ($member instanceof MemberMetadata && !$member->isPrivate($this->name)) { + $property = $member->getPropertyName(); + + if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) { + $this->properties[$property] = $member; + } elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) { + $this->getters[$property] = $member; + } + } + } + } + } + + /** + * {@inheritdoc} + */ + public function hasPropertyMetadata(string $property) + { + return \array_key_exists($property, $this->members); + } + + /** + * {@inheritdoc} + */ + public function getPropertyMetadata(string $property) + { + return $this->members[$property] ?? []; + } + + /** + * {@inheritdoc} + */ + public function getConstrainedProperties() + { + return array_keys($this->members); + } + + /** + * Sets the default group sequence for this class. + * + * @param string[]|GroupSequence $groupSequence An array of group names + * + * @return $this + * + * @throws GroupDefinitionException + */ + public function setGroupSequence($groupSequence) + { + if ($this->isGroupSequenceProvider()) { + throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider.'); + } + + if (\is_array($groupSequence)) { + $groupSequence = new GroupSequence($groupSequence); + } + + if (\in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) { + throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences.', Constraint::DEFAULT_GROUP)); + } + + if (!\in_array($this->getDefaultGroup(), $groupSequence->groups, true)) { + throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence.', $this->getDefaultGroup())); + } + + $this->groupSequence = $groupSequence; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasGroupSequence() + { + return $this->groupSequence && \count($this->groupSequence->groups) > 0; + } + + /** + * {@inheritdoc} + */ + public function getGroupSequence() + { + return $this->groupSequence; + } + + /** + * Returns a ReflectionClass instance for this class. + * + * @return \ReflectionClass + */ + public function getReflectionClass() + { + if (!$this->reflClass) { + $this->reflClass = new \ReflectionClass($this->getClassName()); + } + + return $this->reflClass; + } + + /** + * Sets whether a group sequence provider should be used. + * + * @throws GroupDefinitionException + */ + public function setGroupSequenceProvider(bool $active) + { + if ($this->hasGroupSequence()) { + throw new GroupDefinitionException('Defining a group sequence provider is not allowed with a static group sequence.'); + } + + if (!$this->getReflectionClass()->implementsInterface('Symfony\Component\Validator\GroupSequenceProviderInterface')) { + throw new GroupDefinitionException(sprintf('Class "%s" must implement GroupSequenceProviderInterface.', $this->name)); + } + + $this->groupSequenceProvider = $active; + } + + /** + * {@inheritdoc} + */ + public function isGroupSequenceProvider() + { + return $this->groupSequenceProvider; + } + + /** + * {@inheritdoc} + */ + public function getCascadingStrategy() + { + return $this->cascadingStrategy; + } + + private function addPropertyMetadata(PropertyMetadataInterface $metadata) + { + $property = $metadata->getPropertyName(); + + $this->members[$property][] = $metadata; + } + + private function checkConstraint(Constraint $constraint) + { + if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets(), true)) { + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', get_debug_type($constraint))); + } + + if ($constraint instanceof Composite) { + foreach ($constraint->getNestedConstraints() as $nestedConstraint) { + $this->checkConstraint($nestedConstraint); + } + } + } +} diff --git a/vendor/symfony/validator/Mapping/ClassMetadataInterface.php b/vendor/symfony/validator/Mapping/ClassMetadataInterface.php new file mode 100644 index 0000000..99764c5 --- /dev/null +++ b/vendor/symfony/validator/Mapping/ClassMetadataInterface.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\GroupSequenceProviderInterface; + +/** + * Stores all metadata needed for validating objects of specific class. + * + * Most importantly, the metadata stores the constraints against which an object + * and its properties should be validated. + * + * Additionally, the metadata stores whether the "Default" group is overridden + * by a group sequence for that class and whether instances of that class + * should be traversed or not. + * + * @author Bernhard Schussek + * + * @see MetadataInterface + * @see GroupSequence + * @see GroupSequenceProviderInterface + * @see TraversalStrategy + */ +interface ClassMetadataInterface extends MetadataInterface +{ + /** + * Returns the names of all constrained properties. + * + * @return string[] + */ + public function getConstrainedProperties(); + + /** + * Returns whether the "Default" group is overridden by a group sequence. + * + * If it is, you can access the group sequence with {@link getGroupSequence()}. + * + * @return bool + */ + public function hasGroupSequence(); + + /** + * Returns the group sequence that overrides the "Default" group for this + * class. + * + * @return GroupSequence|null + */ + public function getGroupSequence(); + + /** + * Returns whether the "Default" group is overridden by a dynamic group + * sequence obtained by the validated objects. + * + * If this method returns true, the class must implement + * {@link GroupSequenceProviderInterface}. + * This interface will be used to obtain the group sequence when an object + * of this class is validated. + * + * @return bool + */ + public function isGroupSequenceProvider(); + + /** + * Check if there's any metadata attached to the given named property. + * + * @param string $property The property name + * + * @return bool + */ + public function hasPropertyMetadata(string $property); + + /** + * Returns all metadata instances for the given named property. + * + * If your implementation does not support properties, throw an exception + * in this method (for example a BadMethodCallException). + * + * @param string $property The property name + * + * @return PropertyMetadataInterface[] + */ + public function getPropertyMetadata(string $property); + + /** + * Returns the name of the backing PHP class. + * + * @return string + */ + public function getClassName(); +} diff --git a/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php b/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php new file mode 100644 index 0000000..ec21d54 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Factory/BlackHoleMetadataFactory.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +use Symfony\Component\Validator\Exception\LogicException; + +/** + * Metadata factory that does not store metadata. + * + * This implementation is useful if you want to validate values against + * constraints only and you don't need to add constraints to classes and + * properties. + * + * @author Fabien Potencier + */ +class BlackHoleMetadataFactory implements MetadataFactoryInterface +{ + /** + * {@inheritdoc} + */ + public function getMetadataFor($value) + { + throw new LogicException('This class does not support metadata.'); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + return false; + } +} diff --git a/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php new file mode 100644 index 0000000..42ed050 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; + +/** + * Creates new {@link ClassMetadataInterface} instances. + * + * Whenever {@link getMetadataFor()} is called for the first time with a given + * class name or object of that class, a new metadata instance is created and + * returned. On subsequent requests for the same class, the same metadata + * instance will be returned. + * + * You can optionally pass a {@link LoaderInterface} instance to the constructor. + * Whenever a new metadata instance is created, it is passed to the loader, + * which can configure the metadata based on configuration loaded from the + * filesystem or a database. If you want to use multiple loaders, wrap them in a + * {@link LoaderChain}. + * + * You can also optionally pass a {@link CacheInterface} instance to the + * constructor. This cache will be used for persisting the generated metadata + * between multiple PHP requests. + * + * @author Bernhard Schussek + */ +class LazyLoadingMetadataFactory implements MetadataFactoryInterface +{ + protected $loader; + protected $cache; + + /** + * The loaded metadata, indexed by class name. + * + * @var ClassMetadata[] + */ + protected $loadedClasses = []; + + public function __construct(LoaderInterface $loader = null, CacheItemPoolInterface $cache = null) + { + $this->loader = $loader; + $this->cache = $cache; + } + + /** + * {@inheritdoc} + * + * If the method was called with the same class name (or an object of that + * class) before, the same metadata instance is returned. + * + * If the factory was configured with a cache, this method will first look + * for an existing metadata instance in the cache. If an existing instance + * is found, it will be returned without further ado. + * + * Otherwise, a new metadata instance is created. If the factory was + * configured with a loader, the metadata is passed to the + * {@link LoaderInterface::loadClassMetadata()} method for further + * configuration. At last, the new object is returned. + */ + public function getMetadataFor($value) + { + if (!\is_object($value) && !\is_string($value)) { + throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', get_debug_type($value))); + } + + $class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\'); + + if (isset($this->loadedClasses[$class])) { + return $this->loadedClasses[$class]; + } + + if (!class_exists($class) && !interface_exists($class, false)) { + throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class)); + } + + $cacheItem = null === $this->cache ? null : $this->cache->getItem($this->escapeClassName($class)); + if ($cacheItem && $cacheItem->isHit()) { + $metadata = $cacheItem->get(); + + // Include constraints from the parent class + $this->mergeConstraints($metadata); + + return $this->loadedClasses[$class] = $metadata; + } + + $metadata = new ClassMetadata($class); + + if (null !== $this->loader) { + $this->loader->loadClassMetadata($metadata); + } + + if (null !== $cacheItem) { + $this->cache->save($cacheItem->set($metadata)); + } + + // Include constraints from the parent class + $this->mergeConstraints($metadata); + + return $this->loadedClasses[$class] = $metadata; + } + + private function mergeConstraints(ClassMetadata $metadata) + { + if ($metadata->getReflectionClass()->isInterface()) { + return; + } + + // Include constraints from the parent class + if ($parent = $metadata->getReflectionClass()->getParentClass()) { + $metadata->mergeConstraints($this->getMetadataFor($parent->name)); + } + + // Include constraints from all directly implemented interfaces + foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) { + if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) { + continue; + } + + if ($parent && \in_array($interface->getName(), $parent->getInterfaceNames(), true)) { + continue; + } + + $metadata->mergeConstraints($this->getMetadataFor($interface->name)); + } + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + if (!\is_object($value) && !\is_string($value)) { + return false; + } + + $class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\'); + + return class_exists($class) || interface_exists($class, false); + } + + /** + * Replaces backslashes by dots in a class name. + */ + private function escapeClassName(string $class): string + { + if (str_contains($class, '@')) { + // anonymous class: replace all PSR6-reserved characters + return str_replace(["\0", '\\', '/', '@', ':', '{', '}', '(', ')'], '.', $class); + } + + return str_replace('\\', '.', $class); + } +} diff --git a/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php b/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php new file mode 100644 index 0000000..d3517c5 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Factory; + +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Mapping\MetadataInterface; + +/** + * Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. + * + * @author Bernhard Schussek + */ +interface MetadataFactoryInterface +{ + /** + * Returns the metadata for the given value. + * + * @param mixed $value Some value + * + * @return MetadataInterface + * + * @throws NoSuchMetadataException If no metadata exists for the given value + */ + public function getMetadataFor($value); + + /** + * Returns whether the class is able to return metadata for the given value. + * + * @param mixed $value Some value + * + * @return bool + */ + public function hasMetadataFor($value); +} diff --git a/vendor/symfony/validator/Mapping/GenericMetadata.php b/vendor/symfony/validator/Mapping/GenericMetadata.php new file mode 100644 index 0000000..06971e8 --- /dev/null +++ b/vendor/symfony/validator/Mapping/GenericMetadata.php @@ -0,0 +1,240 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Cascade; +use Symfony\Component\Validator\Constraints\DisableAutoMapping; +use Symfony\Component\Validator\Constraints\EnableAutoMapping; +use Symfony\Component\Validator\Constraints\Traverse; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * A generic container of {@link Constraint} objects. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + */ +class GenericMetadata implements MetadataInterface +{ + /** + * @var Constraint[] + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getConstraints()} and {@link findConstraints()} instead. + */ + public $constraints = []; + + /** + * @var array + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link findConstraints()} instead. + */ + public $constraintsByGroup = []; + + /** + * The strategy for cascading objects. + * + * By default, objects are not cascaded. + * + * @var int + * + * @see CascadingStrategy + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getCascadingStrategy()} instead. + */ + public $cascadingStrategy = CascadingStrategy::NONE; + + /** + * The strategy for traversing traversable objects. + * + * By default, traversable objects are not traversed. + * + * @var int + * + * @see TraversalStrategy + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getTraversalStrategy()} instead. + */ + public $traversalStrategy = TraversalStrategy::NONE; + + /** + * Is auto-mapping enabled? + * + * @var int + * + * @see AutoMappingStrategy + * + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getAutoMappingStrategy()} instead. + */ + public $autoMappingStrategy = AutoMappingStrategy::NONE; + + /** + * Returns the names of the properties that should be serialized. + * + * @return string[] + */ + public function __sleep() + { + return [ + 'constraints', + 'constraintsByGroup', + 'cascadingStrategy', + 'traversalStrategy', + 'autoMappingStrategy', + ]; + } + + /** + * Clones this object. + */ + public function __clone() + { + $constraints = $this->constraints; + + $this->constraints = []; + $this->constraintsByGroup = []; + + foreach ($constraints as $constraint) { + $this->addConstraint(clone $constraint); + } + } + + /** + * Adds a constraint. + * + * If the constraint {@link Valid} is added, the cascading strategy will be + * changed to {@link CascadingStrategy::CASCADE}. Depending on the + * $traverse property of that constraint, the traversal strategy + * will be set to one of the following: + * + * - {@link TraversalStrategy::IMPLICIT} if $traverse is enabled + * - {@link TraversalStrategy::NONE} if $traverse is disabled + * + * @return $this + * + * @throws ConstraintDefinitionException When trying to add the {@link Cascade} + * or {@link Traverse} constraint + */ + public function addConstraint(Constraint $constraint) + { + if ($constraint instanceof Traverse || $constraint instanceof Cascade) { + throw new ConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', get_debug_type($constraint))); + } + + if ($constraint instanceof Valid && null === $constraint->groups) { + $this->cascadingStrategy = CascadingStrategy::CASCADE; + + if ($constraint->traverse) { + $this->traversalStrategy = TraversalStrategy::IMPLICIT; + } else { + $this->traversalStrategy = TraversalStrategy::NONE; + } + + return $this; + } + + if ($constraint instanceof DisableAutoMapping || $constraint instanceof EnableAutoMapping) { + $this->autoMappingStrategy = $constraint instanceof EnableAutoMapping ? AutoMappingStrategy::ENABLED : AutoMappingStrategy::DISABLED; + + // The constraint is not added + return $this; + } + + $this->constraints[] = $constraint; + + foreach ($constraint->groups as $group) { + $this->constraintsByGroup[$group][] = $constraint; + } + + return $this; + } + + /** + * Adds an list of constraints. + * + * @param Constraint[] $constraints The constraints to add + * + * @return $this + */ + public function addConstraints(array $constraints) + { + foreach ($constraints as $constraint) { + $this->addConstraint($constraint); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getConstraints() + { + return $this->constraints; + } + + /** + * Returns whether this element has any constraints. + * + * @return bool + */ + public function hasConstraints() + { + return \count($this->constraints) > 0; + } + + /** + * {@inheritdoc} + * + * Aware of the global group (* group). + */ + public function findConstraints(string $group) + { + return $this->constraintsByGroup[$group] ?? []; + } + + /** + * {@inheritdoc} + */ + public function getCascadingStrategy() + { + return $this->cascadingStrategy; + } + + /** + * {@inheritdoc} + */ + public function getTraversalStrategy() + { + return $this->traversalStrategy; + } + + /** + * @see AutoMappingStrategy + */ + public function getAutoMappingStrategy(): int + { + return $this->autoMappingStrategy; + } +} diff --git a/vendor/symfony/validator/Mapping/GetterMetadata.php b/vendor/symfony/validator/Mapping/GetterMetadata.php new file mode 100644 index 0000000..0be3329 --- /dev/null +++ b/vendor/symfony/validator/Mapping/GetterMetadata.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Stores all metadata needed for validating a class property via its getter + * method. + * + * A property getter is any method that is equal to the property's name, + * prefixed with "get", "is" or "has". That method will be used to access the + * property's value. + * + * The getter will be invoked by reflection, so the access of private and + * protected getters is supported. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +class GetterMetadata extends MemberMetadata +{ + /** + * @param string $class The class the getter is defined on + * @param string $property The property which the getter returns + * @param string|null $method The method that is called to retrieve the value being validated (null for auto-detection) + * + * @throws ValidatorException + */ + public function __construct(string $class, string $property, string $method = null) + { + if (null === $method) { + $getMethod = 'get'.ucfirst($property); + $isMethod = 'is'.ucfirst($property); + $hasMethod = 'has'.ucfirst($property); + + if (method_exists($class, $getMethod)) { + $method = $getMethod; + } elseif (method_exists($class, $isMethod)) { + $method = $isMethod; + } elseif (method_exists($class, $hasMethod)) { + $method = $hasMethod; + } else { + throw new ValidatorException(sprintf('Neither of these methods exist in class "%s": "%s", "%s", "%s".', $class, $getMethod, $isMethod, $hasMethod)); + } + } elseif (!method_exists($class, $method)) { + throw new ValidatorException(sprintf('The "%s()" method does not exist in class "%s".', $method, $class)); + } + + parent::__construct($class, $method, $property); + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($object) + { + return $this->newReflectionMember($object)->invoke($object); + } + + /** + * {@inheritdoc} + */ + protected function newReflectionMember($objectOrClassName) + { + return new \ReflectionMethod($objectOrClassName, $this->getName()); + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php b/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php new file mode 100644 index 0000000..9f6667f --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/AbstractLoader.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MappingException; + +/** + * Base loader for validation metadata. + * + * This loader supports the loading of constraints from Symfony's default + * namespace (see {@link DEFAULT_NAMESPACE}) using the short class names of + * those constraints. Constraints can also be loaded using their fully + * qualified class names. At last, namespace aliases can be defined to load + * constraints with the syntax "alias:ShortName". + * + * @author Bernhard Schussek + */ +abstract class AbstractLoader implements LoaderInterface +{ + /** + * The namespace to load constraints from by default. + */ + public const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; + + protected $namespaces = []; + + /** + * Adds a namespace alias. + * + * The namespace alias can be used to reference constraints from specific + * namespaces in {@link newConstraint()}: + * + * $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); + * + * $constraint = $this->newConstraint('mynamespace:NotNull'); + */ + protected function addNamespaceAlias(string $alias, string $namespace) + { + $this->namespaces[$alias] = $namespace; + } + + /** + * Creates a new constraint instance for the given constraint name. + * + * @param string $name The constraint name. Either a constraint relative + * to the default constraint namespace, or a fully + * qualified class name. Alternatively, the constraint + * may be preceded by a namespace alias and a colon. + * The namespace alias must have been defined using + * {@link addNamespaceAlias()}. + * @param mixed $options The constraint options + * + * @return Constraint + * + * @throws MappingException If the namespace prefix is undefined + */ + protected function newConstraint(string $name, $options = null) + { + if (str_contains($name, '\\') && class_exists($name)) { + $className = $name; + } elseif (str_contains($name, ':')) { + [$prefix, $className] = explode(':', $name, 2); + + if (!isset($this->namespaces[$prefix])) { + throw new MappingException(sprintf('Undefined namespace prefix "%s".', $prefix)); + } + + $className = $this->namespaces[$prefix].$className; + } else { + $className = self::DEFAULT_NAMESPACE.$name; + } + + return new $className($options); + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php b/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php new file mode 100644 index 0000000..6968927 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/AnnotationLoader.php @@ -0,0 +1,123 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Doctrine\Common\Annotations\Reader; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\GroupSequenceProvider; +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata using a Doctrine annotation {@link Reader} or using PHP 8 attributes. + * + * @author Bernhard Schussek + * @author Alexander M. Turek + */ +class AnnotationLoader implements LoaderInterface +{ + protected $reader; + + public function __construct(Reader $reader = null) + { + $this->reader = $reader; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + $reflClass = $metadata->getReflectionClass(); + $className = $reflClass->name; + $success = false; + + foreach ($this->getAnnotations($reflClass) as $constraint) { + if ($constraint instanceof GroupSequence) { + $metadata->setGroupSequence($constraint->groups); + } elseif ($constraint instanceof GroupSequenceProvider) { + $metadata->setGroupSequenceProvider(true); + } elseif ($constraint instanceof Constraint) { + $metadata->addConstraint($constraint); + } + + $success = true; + } + + foreach ($reflClass->getProperties() as $property) { + if ($property->getDeclaringClass()->name === $className) { + foreach ($this->getAnnotations($property) as $constraint) { + if ($constraint instanceof Constraint) { + $metadata->addPropertyConstraint($property->name, $constraint); + } + + $success = true; + } + } + } + + foreach ($reflClass->getMethods() as $method) { + if ($method->getDeclaringClass()->name === $className) { + foreach ($this->getAnnotations($method) as $constraint) { + if ($constraint instanceof Callback) { + $constraint->callback = $method->getName(); + + $metadata->addConstraint($constraint); + } elseif ($constraint instanceof Constraint) { + if (preg_match('/^(get|is|has)(.+)$/i', $method->name, $matches)) { + $metadata->addGetterMethodConstraint(lcfirst($matches[2]), $matches[0], $constraint); + } else { + throw new MappingException(sprintf('The constraint on "%s::%s()" cannot be added. Constraints can only be added on methods beginning with "get", "is" or "has".', $className, $method->name)); + } + } + + $success = true; + } + } + } + + return $success; + } + + /** + * @param \ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflection + */ + private function getAnnotations(object $reflection): iterable + { + if (\PHP_VERSION_ID >= 80000) { + foreach ($reflection->getAttributes(GroupSequence::class) as $attribute) { + yield $attribute->newInstance(); + } + foreach ($reflection->getAttributes(GroupSequenceProvider::class) as $attribute) { + yield $attribute->newInstance(); + } + foreach ($reflection->getAttributes(Constraint::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { + yield $attribute->newInstance(); + } + } + if (!$this->reader) { + return; + } + + if ($reflection instanceof \ReflectionClass) { + yield from $this->reader->getClassAnnotations($reflection); + } + if ($reflection instanceof \ReflectionMethod) { + yield from $this->reader->getMethodAnnotations($reflection); + } + if ($reflection instanceof \ReflectionProperty) { + yield from $this->reader->getPropertyAnnotations($reflection); + } + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/AutoMappingTrait.php b/vendor/symfony/validator/Mapping/Loader/AutoMappingTrait.php new file mode 100644 index 0000000..f76442f --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/AutoMappingTrait.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\AutoMappingStrategy; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Utility methods to create auto mapping loaders. + * + * @author Kévin Dunglas + */ +trait AutoMappingTrait +{ + private function isAutoMappingEnabledForClass(ClassMetadata $metadata, string $classValidatorRegexp = null): bool + { + // Check if AutoMapping constraint is set first + if (AutoMappingStrategy::NONE !== $strategy = $metadata->getAutoMappingStrategy()) { + return AutoMappingStrategy::ENABLED === $strategy; + } + + // Fallback on the config + return null !== $classValidatorRegexp && preg_match($classValidatorRegexp, $metadata->getClassName()); + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/FileLoader.php b/vendor/symfony/validator/Mapping/Loader/FileLoader.php new file mode 100644 index 0000000..0fc0172 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/FileLoader.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; + +/** + * Base loader for loading validation metadata from a file. + * + * @author Bernhard Schussek + * + * @see YamlFileLoader + * @see XmlFileLoader + */ +abstract class FileLoader extends AbstractLoader +{ + protected $file; + + /** + * Creates a new loader. + * + * @param string $file The mapping file to load + * + * @throws MappingException If the file does not exist or is not readable + */ + public function __construct(string $file) + { + if (!is_file($file)) { + throw new MappingException(sprintf('The mapping file "%s" does not exist.', $file)); + } + + if (!is_readable($file)) { + throw new MappingException(sprintf('The mapping file "%s" is not readable.', $file)); + } + + if (!stream_is_local($this->file)) { + throw new MappingException(sprintf('The mapping file "%s" is not a local file.', $file)); + } + + $this->file = $file; + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/FilesLoader.php b/vendor/symfony/validator/Mapping/Loader/FilesLoader.php new file mode 100644 index 0000000..f6574f4 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/FilesLoader.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Base loader for loading validation metadata from a list of files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see YamlFilesLoader + * @see XmlFilesLoader + */ +abstract class FilesLoader extends LoaderChain +{ + /** + * Creates a new loader. + * + * @param array $paths An array of file paths + */ + public function __construct(array $paths) + { + parent::__construct($this->getFileLoaders($paths)); + } + + /** + * Returns an array of file loaders for the given file paths. + * + * @return LoaderInterface[] + */ + protected function getFileLoaders(array $paths) + { + $loaders = []; + + foreach ($paths as $path) { + $loaders[] = $this->getFileLoaderInstance($path); + } + + return $loaders; + } + + /** + * Creates a loader for the given file path. + * + * @return LoaderInterface + */ + abstract protected function getFileLoaderInstance(string $path); +} diff --git a/vendor/symfony/validator/Mapping/Loader/LoaderChain.php b/vendor/symfony/validator/Mapping/Loader/LoaderChain.php new file mode 100644 index 0000000..b3d6184 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/LoaderChain.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata from multiple {@link LoaderInterface} instances. + * + * Pass the loaders when constructing the chain. Once + * {@link loadClassMetadata()} is called, that method will be called on all + * loaders in the chain. + * + * @author Bernhard Schussek + */ +class LoaderChain implements LoaderInterface +{ + protected $loaders; + + /** + * @param LoaderInterface[] $loaders The metadata loaders to use + * + * @throws MappingException If any of the loaders has an invalid type + */ + public function __construct(array $loaders) + { + foreach ($loaders as $loader) { + if (!$loader instanceof LoaderInterface) { + throw new MappingException(sprintf('Class "%s" is expected to implement LoaderInterface.', get_debug_type($loader))); + } + } + + $this->loaders = $loaders; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + $success = false; + + foreach ($this->loaders as $loader) { + $success = $loader->loadClassMetadata($metadata) || $success; + } + + return $success; + } + + /** + * @return LoaderInterface[] + */ + public function getLoaders() + { + return $this->loaders; + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php b/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php new file mode 100644 index 0000000..974214c --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/LoaderInterface.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata into {@link ClassMetadata} instances. + * + * @author Bernhard Schussek + */ +interface LoaderInterface +{ + /** + * Loads validation metadata into a {@link ClassMetadata} instance. + * + * @return bool + */ + public function loadClassMetadata(ClassMetadata $metadata); +} diff --git a/vendor/symfony/validator/Mapping/Loader/PropertyInfoLoader.php b/vendor/symfony/validator/Mapping/Loader/PropertyInfoLoader.php new file mode 100644 index 0000000..118c159 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/PropertyInfoLoader.php @@ -0,0 +1,179 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; +use Symfony\Component\PropertyInfo\Type as PropertyInfoType; +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Type; +use Symfony\Component\Validator\Mapping\AutoMappingStrategy; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Guesses and loads the appropriate constraints using PropertyInfo. + * + * @author Kévin Dunglas + */ +final class PropertyInfoLoader implements LoaderInterface +{ + use AutoMappingTrait; + + private $listExtractor; + private $typeExtractor; + private $accessExtractor; + private $classValidatorRegexp; + + public function __construct(PropertyListExtractorInterface $listExtractor, PropertyTypeExtractorInterface $typeExtractor, PropertyAccessExtractorInterface $accessExtractor, string $classValidatorRegexp = null) + { + $this->listExtractor = $listExtractor; + $this->typeExtractor = $typeExtractor; + $this->accessExtractor = $accessExtractor; + $this->classValidatorRegexp = $classValidatorRegexp; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata): bool + { + $className = $metadata->getClassName(); + if (!$properties = $this->listExtractor->getProperties($className)) { + return false; + } + + $loaded = false; + $enabledForClass = $this->isAutoMappingEnabledForClass($metadata, $this->classValidatorRegexp); + foreach ($properties as $property) { + if (false === $this->accessExtractor->isWritable($className, $property)) { + continue; + } + + if (!property_exists($className, $property)) { + continue; + } + + $types = $this->typeExtractor->getTypes($className, $property); + if (null === $types) { + continue; + } + + $enabledForProperty = $enabledForClass; + $hasTypeConstraint = false; + $hasNotNullConstraint = false; + $hasNotBlankConstraint = false; + $allConstraint = null; + foreach ($metadata->getPropertyMetadata($property) as $propertyMetadata) { + // Enabling or disabling auto-mapping explicitly always takes precedence + if (AutoMappingStrategy::DISABLED === $propertyMetadata->getAutoMappingStrategy()) { + continue 2; + } + + if (AutoMappingStrategy::ENABLED === $propertyMetadata->getAutoMappingStrategy()) { + $enabledForProperty = true; + } + + foreach ($propertyMetadata->getConstraints() as $constraint) { + if ($constraint instanceof Type) { + $hasTypeConstraint = true; + } elseif ($constraint instanceof NotNull) { + $hasNotNullConstraint = true; + } elseif ($constraint instanceof NotBlank) { + $hasNotBlankConstraint = true; + } elseif ($constraint instanceof All) { + $allConstraint = $constraint; + } + } + } + + if (!$enabledForProperty) { + continue; + } + + $loaded = true; + $builtinTypes = []; + $nullable = false; + $scalar = true; + foreach ($types as $type) { + $builtinTypes[] = $type->getBuiltinType(); + + if ($scalar && !\in_array($type->getBuiltinType(), [PropertyInfoType::BUILTIN_TYPE_INT, PropertyInfoType::BUILTIN_TYPE_FLOAT, PropertyInfoType::BUILTIN_TYPE_STRING, PropertyInfoType::BUILTIN_TYPE_BOOL], true)) { + $scalar = false; + } + + if (!$nullable && $type->isNullable()) { + $nullable = true; + } + } + if (!$hasTypeConstraint) { + if (1 === \count($builtinTypes)) { + if ($types[0]->isCollection() && \count($collectionValueType = $types[0]->getCollectionValueTypes()) > 0) { + [$collectionValueType] = $collectionValueType; + $this->handleAllConstraint($property, $allConstraint, $collectionValueType, $metadata); + } + + $metadata->addPropertyConstraint($property, $this->getTypeConstraint($builtinTypes[0], $types[0])); + } elseif ($scalar) { + $metadata->addPropertyConstraint($property, new Type(['type' => 'scalar'])); + } + } + + if (!$nullable && !$hasNotBlankConstraint && !$hasNotNullConstraint) { + $metadata->addPropertyConstraint($property, new NotNull()); + } + } + + return $loaded; + } + + private function getTypeConstraint(string $builtinType, PropertyInfoType $type): Type + { + if (PropertyInfoType::BUILTIN_TYPE_OBJECT === $builtinType && null !== $className = $type->getClassName()) { + return new Type(['type' => $className]); + } + + return new Type(['type' => $builtinType]); + } + + private function handleAllConstraint(string $property, ?All $allConstraint, PropertyInfoType $propertyInfoType, ClassMetadata $metadata) + { + $containsTypeConstraint = false; + $containsNotNullConstraint = false; + if (null !== $allConstraint) { + foreach ($allConstraint->constraints as $constraint) { + if ($constraint instanceof Type) { + $containsTypeConstraint = true; + } elseif ($constraint instanceof NotNull) { + $containsNotNullConstraint = true; + } + } + } + + $constraints = []; + if (!$containsNotNullConstraint && !$propertyInfoType->isNullable()) { + $constraints[] = new NotNull(); + } + + if (!$containsTypeConstraint) { + $constraints[] = $this->getTypeConstraint($propertyInfoType->getBuiltinType(), $propertyInfoType); + } + + if (null === $allConstraint) { + $metadata->addPropertyConstraint($property, new All(['constraints' => $constraints])); + } else { + $allConstraint->constraints = array_merge($allConstraint->constraints, $constraints); + } + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php b/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php new file mode 100644 index 0000000..256700e --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata by calling a static method on the loaded class. + * + * @author Bernhard Schussek + */ +class StaticMethodLoader implements LoaderInterface +{ + protected $methodName; + + /** + * Creates a new loader. + * + * @param string $methodName The name of the static method to call + */ + public function __construct(string $methodName = 'loadValidatorMetadata') + { + $this->methodName = $methodName; + } + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + /** @var \ReflectionClass $reflClass */ + $reflClass = $metadata->getReflectionClass(); + + if (!$reflClass->isInterface() && $reflClass->hasMethod($this->methodName)) { + $reflMethod = $reflClass->getMethod($this->methodName); + + if ($reflMethod->isAbstract()) { + return false; + } + + if (!$reflMethod->isStatic()) { + throw new MappingException(sprintf('The method "%s::%s()" should be static.', $reflClass->name, $this->methodName)); + } + + if ($reflMethod->getDeclaringClass()->name != $reflClass->name) { + return false; + } + + $reflMethod->invoke(null, $metadata); + + return true; + } + + return false; + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php new file mode 100644 index 0000000..66cfe8f --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php @@ -0,0 +1,231 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Config\Util\XmlUtils; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MappingException; +use Symfony\Component\Validator\Mapping\ClassMetadata; + +/** + * Loads validation metadata from an XML file. + * + * @author Bernhard Schussek + */ +class XmlFileLoader extends FileLoader +{ + /** + * The XML nodes of the mapping file. + * + * @var \SimpleXMLElement[]|null + */ + protected $classes; + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + if (null === $this->classes) { + $this->loadClassesFromXml(); + } + + if (isset($this->classes[$metadata->getClassName()])) { + $classDescription = $this->classes[$metadata->getClassName()]; + + $this->loadClassMetadataFromXml($metadata, $classDescription); + + return true; + } + + return false; + } + + /** + * Return the names of the classes mapped in this file. + * + * @return string[] + */ + public function getMappedClasses() + { + if (null === $this->classes) { + $this->loadClassesFromXml(); + } + + return array_keys($this->classes); + } + + /** + * Parses a collection of "constraint" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return Constraint[] + */ + protected function parseConstraints(\SimpleXMLElement $nodes) + { + $constraints = []; + + foreach ($nodes as $node) { + if (\count($node) > 0) { + if (\count($node->value) > 0) { + $options = $this->parseValues($node->value); + } elseif (\count($node->constraint) > 0) { + $options = $this->parseConstraints($node->constraint); + } elseif (\count($node->option) > 0) { + $options = $this->parseOptions($node->option); + } else { + $options = []; + } + } elseif ('' !== (string) $node) { + $options = XmlUtils::phpize(trim($node)); + } else { + $options = null; + } + + $constraints[] = $this->newConstraint((string) $node['name'], $options); + } + + return $constraints; + } + + /** + * Parses a collection of "value" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return array + */ + protected function parseValues(\SimpleXMLElement $nodes) + { + $values = []; + + foreach ($nodes as $node) { + if (\count($node) > 0) { + if (\count($node->value) > 0) { + $value = $this->parseValues($node->value); + } elseif (\count($node->constraint) > 0) { + $value = $this->parseConstraints($node->constraint); + } else { + $value = []; + } + } else { + $value = trim($node); + } + + if (isset($node['key'])) { + $values[(string) $node['key']] = $value; + } else { + $values[] = $value; + } + } + + return $values; + } + + /** + * Parses a collection of "option" XML nodes. + * + * @param \SimpleXMLElement $nodes The XML nodes + * + * @return array + */ + protected function parseOptions(\SimpleXMLElement $nodes) + { + $options = []; + + foreach ($nodes as $node) { + if (\count($node) > 0) { + if (\count($node->value) > 0) { + $value = $this->parseValues($node->value); + } elseif (\count($node->constraint) > 0) { + $value = $this->parseConstraints($node->constraint); + } else { + $value = []; + } + } else { + $value = XmlUtils::phpize($node); + if (\is_string($value)) { + $value = trim($value); + } + } + + $options[(string) $node['name']] = $value; + } + + return $options; + } + + /** + * Loads the XML class descriptions from the given file. + * + * @return \SimpleXMLElement + * + * @throws MappingException If the file could not be loaded + */ + protected function parseFile(string $path) + { + try { + $dom = XmlUtils::loadFile($path, __DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd'); + } catch (\Exception $e) { + throw new MappingException($e->getMessage(), $e->getCode(), $e); + } + + return simplexml_import_dom($dom); + } + + private function loadClassesFromXml() + { + // This method may throw an exception. Do not modify the class' + // state before it completes + $xml = $this->parseFile($this->file); + + $this->classes = []; + + foreach ($xml->namespace as $namespace) { + $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); + } + + foreach ($xml->class as $class) { + $this->classes[(string) $class['name']] = $class; + } + } + + private function loadClassMetadataFromXml(ClassMetadata $metadata, \SimpleXMLElement $classDescription) + { + if (\count($classDescription->{'group-sequence-provider'}) > 0) { + $metadata->setGroupSequenceProvider(true); + } + + foreach ($classDescription->{'group-sequence'} as $groupSequence) { + if (\count($groupSequence->value) > 0) { + $metadata->setGroupSequence($this->parseValues($groupSequence[0]->value)); + } + } + + foreach ($this->parseConstraints($classDescription->constraint) as $constraint) { + $metadata->addConstraint($constraint); + } + + foreach ($classDescription->property as $property) { + foreach ($this->parseConstraints($property->constraint) as $constraint) { + $metadata->addPropertyConstraint((string) $property['name'], $constraint); + } + } + + foreach ($classDescription->getter as $getter) { + foreach ($this->parseConstraints($getter->constraint) as $constraint) { + $metadata->addGetterConstraint((string) $getter['property'], $constraint); + } + } + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php b/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php new file mode 100644 index 0000000..5a242b0 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/XmlFilesLoader.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Loads validation metadata from a list of XML files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see FilesLoader + */ +class XmlFilesLoader extends FilesLoader +{ + /** + * {@inheritdoc} + */ + public function getFileLoaderInstance(string $file) + { + return new XmlFileLoader($file); + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php b/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php new file mode 100644 index 0000000..8d44ad6 --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/YamlFileLoader.php @@ -0,0 +1,189 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Parser as YamlParser; +use Symfony\Component\Yaml\Yaml; + +/** + * Loads validation metadata from a YAML file. + * + * @author Bernhard Schussek + */ +class YamlFileLoader extends FileLoader +{ + /** + * An array of YAML class descriptions. + * + * @var array + */ + protected $classes = null; + + /** + * Caches the used YAML parser. + * + * @var YamlParser + */ + private $yamlParser; + + /** + * {@inheritdoc} + */ + public function loadClassMetadata(ClassMetadata $metadata) + { + if (null === $this->classes) { + $this->loadClassesFromYaml(); + } + + if (isset($this->classes[$metadata->getClassName()])) { + $classDescription = $this->classes[$metadata->getClassName()]; + + $this->loadClassMetadataFromYaml($metadata, $classDescription); + + return true; + } + + return false; + } + + /** + * Return the names of the classes mapped in this file. + * + * @return string[] + */ + public function getMappedClasses() + { + if (null === $this->classes) { + $this->loadClassesFromYaml(); + } + + return array_keys($this->classes); + } + + /** + * Parses a collection of YAML nodes. + * + * @param array $nodes The YAML nodes + * + * @return array + */ + protected function parseNodes(array $nodes) + { + $values = []; + + foreach ($nodes as $name => $childNodes) { + if (is_numeric($name) && \is_array($childNodes) && 1 === \count($childNodes)) { + $options = current($childNodes); + + if (\is_array($options)) { + $options = $this->parseNodes($options); + } + + $values[] = $this->newConstraint(key($childNodes), $options); + } else { + if (\is_array($childNodes)) { + $childNodes = $this->parseNodes($childNodes); + } + + $values[$name] = $childNodes; + } + } + + return $values; + } + + /** + * Loads the YAML class descriptions from the given file. + * + * @throws \InvalidArgumentException If the file could not be loaded or did + * not contain a YAML array + */ + private function parseFile(string $path): array + { + try { + $classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT); + } catch (ParseException $e) { + throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $path).$e->getMessage(), 0, $e); + } + + // empty file + if (null === $classes) { + return []; + } + + // not an array + if (!\is_array($classes)) { + throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $this->file)); + } + + return $classes; + } + + private function loadClassesFromYaml() + { + if (null === $this->yamlParser) { + $this->yamlParser = new YamlParser(); + } + + $this->classes = $this->parseFile($this->file); + + if (isset($this->classes['namespaces'])) { + foreach ($this->classes['namespaces'] as $alias => $namespace) { + $this->addNamespaceAlias($alias, $namespace); + } + + unset($this->classes['namespaces']); + } + } + + private function loadClassMetadataFromYaml(ClassMetadata $metadata, array $classDescription) + { + if (isset($classDescription['group_sequence_provider'])) { + $metadata->setGroupSequenceProvider( + (bool) $classDescription['group_sequence_provider'] + ); + } + + if (isset($classDescription['group_sequence'])) { + $metadata->setGroupSequence($classDescription['group_sequence']); + } + + if (isset($classDescription['constraints']) && \is_array($classDescription['constraints'])) { + foreach ($this->parseNodes($classDescription['constraints']) as $constraint) { + $metadata->addConstraint($constraint); + } + } + + if (isset($classDescription['properties']) && \is_array($classDescription['properties'])) { + foreach ($classDescription['properties'] as $property => $constraints) { + if (null !== $constraints) { + foreach ($this->parseNodes($constraints) as $constraint) { + $metadata->addPropertyConstraint($property, $constraint); + } + } + } + } + + if (isset($classDescription['getters']) && \is_array($classDescription['getters'])) { + foreach ($classDescription['getters'] as $getter => $constraints) { + if (null !== $constraints) { + foreach ($this->parseNodes($constraints) as $constraint) { + $metadata->addGetterConstraint($getter, $constraint); + } + } + } + } + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php b/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php new file mode 100644 index 0000000..f32c67c --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/YamlFilesLoader.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping\Loader; + +/** + * Loads validation metadata from a list of YAML files. + * + * @author Bulat Shakirzyanov + * @author Bernhard Schussek + * + * @see FilesLoader + */ +class YamlFilesLoader extends FilesLoader +{ + /** + * {@inheritdoc} + */ + public function getFileLoaderInstance(string $file) + { + return new YamlFileLoader($file); + } +} diff --git a/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd b/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd new file mode 100644 index 0000000..1ca840b --- /dev/null +++ b/vendor/symfony/validator/Mapping/Loader/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/validator/Mapping/MemberMetadata.php b/vendor/symfony/validator/Mapping/MemberMetadata.php new file mode 100644 index 0000000..33934c6 --- /dev/null +++ b/vendor/symfony/validator/Mapping/MemberMetadata.php @@ -0,0 +1,194 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; + +/** + * Stores all metadata needed for validating a class property. + * + * The method of accessing the property's value must be specified by subclasses + * by implementing the {@link newReflectionMember()} method. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +abstract class MemberMetadata extends GenericMetadata implements PropertyMetadataInterface +{ + /** + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getClassName()} instead. + */ + public $class; + + /** + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getName()} instead. + */ + public $name; + + /** + * @internal This property is public in order to reduce the size of the + * class' serialized representation. Do not access it. Use + * {@link getPropertyName()} instead. + */ + public $property; + + /** + * @var \ReflectionMethod[]|\ReflectionProperty[] + */ + private $reflMember = []; + + /** + * @param string $class The name of the class this member is defined on + * @param string $name The name of the member + * @param string $property The property the member belongs to + */ + public function __construct(string $class, string $name, string $property) + { + $this->class = $class; + $this->name = $name; + $this->property = $property; + } + + /** + * {@inheritdoc} + */ + public function addConstraint(Constraint $constraint) + { + $this->checkConstraint($constraint); + + parent::addConstraint($constraint); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function __sleep() + { + return array_merge(parent::__sleep(), [ + 'class', + 'name', + 'property', + ]); + } + + /** + * Returns the name of the member. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function getClassName() + { + return $this->class; + } + + /** + * {@inheritdoc} + */ + public function getPropertyName() + { + return $this->property; + } + + /** + * Returns whether this member is public. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isPublic($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isPublic(); + } + + /** + * Returns whether this member is protected. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isProtected($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isProtected(); + } + + /** + * Returns whether this member is private. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return bool + */ + public function isPrivate($objectOrClassName) + { + return $this->getReflectionMember($objectOrClassName)->isPrivate(); + } + + /** + * Returns the reflection instance for accessing the member's value. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return \ReflectionMethod|\ReflectionProperty + */ + public function getReflectionMember($objectOrClassName) + { + $className = \is_string($objectOrClassName) ? $objectOrClassName : \get_class($objectOrClassName); + if (!isset($this->reflMember[$className])) { + $this->reflMember[$className] = $this->newReflectionMember($objectOrClassName); + } + + return $this->reflMember[$className]; + } + + /** + * Creates a new reflection instance for accessing the member's value. + * + * @param object|string $objectOrClassName The object or the class name + * + * @return \ReflectionMethod|\ReflectionProperty + */ + abstract protected function newReflectionMember($objectOrClassName); + + private function checkConstraint(Constraint $constraint) + { + if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets(), true)) { + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on properties or getters.', get_debug_type($constraint))); + } + + if ($constraint instanceof Composite) { + foreach ($constraint->getNestedConstraints() as $nestedConstraint) { + $this->checkConstraint($nestedConstraint); + } + } + } +} diff --git a/vendor/symfony/validator/Mapping/MetadataInterface.php b/vendor/symfony/validator/Mapping/MetadataInterface.php new file mode 100644 index 0000000..efb32ce --- /dev/null +++ b/vendor/symfony/validator/Mapping/MetadataInterface.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Constraint; + +/** + * A container for validation metadata. + * + * Most importantly, the metadata stores the constraints against which an object + * and its properties should be validated. + * + * Additionally, the metadata stores whether objects should be validated + * against their class' metadata and whether traversable objects should be + * traversed or not. + * + * @author Bernhard Schussek + * + * @see CascadingStrategy + * @see TraversalStrategy + */ +interface MetadataInterface +{ + /** + * Returns the strategy for cascading objects. + * + * @return int + * + * @see CascadingStrategy + */ + public function getCascadingStrategy(); + + /** + * Returns the strategy for traversing traversable objects. + * + * @return int + * + * @see TraversalStrategy + */ + public function getTraversalStrategy(); + + /** + * Returns all constraints of this element. + * + * @return Constraint[] + */ + public function getConstraints(); + + /** + * Returns all constraints for a given validation group. + * + * @param string $group The validation group + * + * @return Constraint[] + */ + public function findConstraints(string $group); +} diff --git a/vendor/symfony/validator/Mapping/PropertyMetadata.php b/vendor/symfony/validator/Mapping/PropertyMetadata.php new file mode 100644 index 0000000..8c18e5d --- /dev/null +++ b/vendor/symfony/validator/Mapping/PropertyMetadata.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +use Symfony\Component\Validator\Exception\ValidatorException; + +/** + * Stores all metadata needed for validating a class property. + * + * The value of the property is obtained by directly accessing the property. + * The property will be accessed by reflection, so the access of private and + * protected properties is supported. + * + * This class supports serialization and cloning. + * + * @author Bernhard Schussek + * + * @see PropertyMetadataInterface + */ +class PropertyMetadata extends MemberMetadata +{ + /** + * @param string $class The class this property is defined on + * @param string $name The name of this property + * + * @throws ValidatorException + */ + public function __construct(string $class, string $name) + { + if (!property_exists($class, $name)) { + throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $name, $class)); + } + + parent::__construct($class, $name, $name); + } + + /** + * {@inheritdoc} + */ + public function getPropertyValue($object) + { + $reflProperty = $this->getReflectionMember($object); + + if (\PHP_VERSION_ID >= 70400 && $reflProperty->hasType() && !$reflProperty->isInitialized($object)) { + // There is no way to check if a property has been unset or if it is uninitialized. + // When trying to access an uninitialized property, __get method is triggered. + + // If __get method is not present, no fallback is possible + // Otherwise we need to catch an Error in case we are trying to access an uninitialized but set property. + if (!method_exists($object, '__get')) { + return null; + } + + try { + return $reflProperty->getValue($object); + } catch (\Error $e) { + return null; + } + } + + return $reflProperty->getValue($object); + } + + /** + * {@inheritdoc} + */ + protected function newReflectionMember($objectOrClassName) + { + $originalClass = \is_string($objectOrClassName) ? $objectOrClassName : \get_class($objectOrClassName); + + while (!property_exists($objectOrClassName, $this->getName())) { + $objectOrClassName = get_parent_class($objectOrClassName); + + if (false === $objectOrClassName) { + throw new ValidatorException(sprintf('Property "%s" does not exist in class "%s".', $this->getName(), $originalClass)); + } + } + + $member = new \ReflectionProperty($objectOrClassName, $this->getName()); + $member->setAccessible(true); + + return $member; + } +} diff --git a/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php b/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php new file mode 100644 index 0000000..f4bbbb9 --- /dev/null +++ b/vendor/symfony/validator/Mapping/PropertyMetadataInterface.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Stores all metadata needed for validating the value of a class property. + * + * Most importantly, the metadata stores the constraints against which the + * property's value should be validated. + * + * Additionally, the metadata stores whether objects stored in the property + * should be validated against their class' metadata and whether traversable + * objects should be traversed or not. + * + * @author Bernhard Schussek + * + * @see MetadataInterface + * @see CascadingStrategy + * @see TraversalStrategy + */ +interface PropertyMetadataInterface extends MetadataInterface +{ + /** + * Returns the name of the property. + * + * @return string + */ + public function getPropertyName(); + + /** + * Extracts the value of the property from the given container. + * + * @param mixed $containingValue The container to extract the property value from + * + * @return mixed + */ + public function getPropertyValue($containingValue); +} diff --git a/vendor/symfony/validator/Mapping/TraversalStrategy.php b/vendor/symfony/validator/Mapping/TraversalStrategy.php new file mode 100644 index 0000000..0df5a7e --- /dev/null +++ b/vendor/symfony/validator/Mapping/TraversalStrategy.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Mapping; + +/** + * Specifies whether and how a traversable object should be traversed. + * + * If the node traverser traverses a node whose value is an instance of + * {@link \Traversable}, and if that node is either a class node or if + * cascading is enabled, then the node's traversal strategy will be checked. + * Depending on the requested traversal strategy, the node traverser will + * iterate over the object and cascade each object or collection returned by + * the iterator. + * + * The traversal strategy is ignored for arrays. Arrays are always iterated. + * + * @author Bernhard Schussek + * + * @see CascadingStrategy + */ +class TraversalStrategy +{ + /** + * Specifies that a node's value should be iterated only if it is an + * instance of {@link \Traversable}. + */ + public const IMPLICIT = 1; + + /** + * Specifies that a node's value should never be iterated. + */ + public const NONE = 2; + + /** + * Specifies that a node's value should always be iterated. If the value is + * not an instance of {@link \Traversable}, an exception should be thrown. + */ + public const TRAVERSE = 4; + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/validator/ObjectInitializerInterface.php b/vendor/symfony/validator/ObjectInitializerInterface.php new file mode 100644 index 0000000..6f3ac5e --- /dev/null +++ b/vendor/symfony/validator/ObjectInitializerInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +/** + * Prepares an object for validation. + * + * Concrete implementations of this interface are used by {@link Validator\ContextualValidatorInterface} + * to initialize objects just before validating them. + * + * @author Fabien Potencier + * @author Bernhard Schussek + */ +interface ObjectInitializerInterface +{ + public function initialize(object $object); +} diff --git a/vendor/symfony/validator/README.md b/vendor/symfony/validator/README.md new file mode 100644 index 0000000..8f3fd0e --- /dev/null +++ b/vendor/symfony/validator/README.md @@ -0,0 +1,16 @@ +Validator Component +=================== + +The Validator component provides tools to validate values following the +[JSR-303 Bean Validation specification][1]. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/validator.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://jcp.org/en/jsr/detail?id=303 diff --git a/vendor/symfony/validator/Resources/translations/validators.af.xlf b/vendor/symfony/validator/Resources/translations/validators.af.xlf new file mode 100644 index 0000000..61b9eac --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.af.xlf @@ -0,0 +1,387 @@ + + + + + + This value should be false. + Hierdie waarde moet vals wees. + + + This value should be true. + Hierdie waarde moet waar wees. + + + This value should be of type {{ type }}. + Hierdie waarde moet van die soort {{type}} wees. + + + This value should be blank. + Hierdie waarde moet leeg wees. + + + The value you selected is not a valid choice. + Die waarde wat jy gekies het is nie 'n geldige keuse nie. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Jy moet ten minste {{ limit }} kies.|Jy moet ten minste {{ limit }} keuses kies. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Jy moet by die meeste {{ limit }} keuse kies.|Jy moet by die meeste {{ limit }} keuses kies. + + + One or more of the given values is invalid. + Een of meer van die gegewe waardes is ongeldig. + + + This field was not expected. + Die veld is nie verwag nie. + + + This field is missing. + Hierdie veld ontbreek. + + + This value is not a valid date. + Hierdie waarde is nie 'n geldige datum nie. + + + This value is not a valid datetime. + Hierdie waarde is nie 'n geldige datum en tyd nie. + + + This value is not a valid email address. + Hierdie waarde is nie 'n geldige e-pos adres nie. + + + The file could not be found. + Die lêer kon nie gevind word nie. + + + The file is not readable. + Die lêer kan nie gelees word nie. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Die lêer is te groot ({{ size }} {{ suffix }}). Toegelaat maksimum grootte is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Die MIME-tipe van die lêer is ongeldig ({{ type }}). Toegelaat MIME-tipes is {{ types }}. + + + This value should be {{ limit }} or less. + Hierdie waarde moet {{ limit }} of minder wees. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Hierdie waarde is te lank. Dit moet {{ limit }} karakter of minder wees.|Hierdie waarde is te lank. Dit moet {{ limit }} karakters of minder wees. + + + This value should be {{ limit }} or more. + Hierdie waarde moet {{ limit }} of meer wees. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Hierdie waarde is te kort. Dit moet {{ limit }} karakter of meer wees.|Hierdie waarde is te kort. Dit moet {{ limit }} karakters of meer wees. + + + This value should not be blank. + Hierdie waarde moet nie leeg wees nie. + + + This value should not be null. + Hierdie waarde moet nie nul wees nie. + + + This value should be null. + Hierdie waarde moet nul wees. + + + This value is not valid. + Hierdie waarde is nie geldig nie. + + + This value is not a valid time. + Hierdie waarde is nie 'n geldige tyd nie. + + + This value is not a valid URL. + Hierdie waarde is nie 'n geldige URL nie. + + + The two values should be equal. + Die twee waardes moet gelyk wees. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Die lêer is te groot. Toegelaat maksimum grootte is {{ limit }} {{ suffix }}. + + + The file is too large. + Die lêer is te groot. + + + The file could not be uploaded. + Die lêer kan nie opgelaai word nie. + + + This value should be a valid number. + Hierdie waarde moet 'n geldige nommer wees. + + + This file is not a valid image. + Hierdie lêer is nie 'n geldige beeld nie. + + + This is not a valid IP address. + Hierdie is nie 'n geldige IP-adres nie. + + + This value is not a valid language. + Hierdie waarde is nie 'n geldige taal nie. + + + This value is not a valid locale. + Hierdie waarde is nie 'n geldige land instelling nie. + + + This value is not a valid country. + Hierdie waarde is nie 'n geldige land nie. + + + This value is already used. + Hierdie waarde word reeds gebruik. + + + The size of the image could not be detected. + Die grootte van die beeld kon nie opgespoor word nie. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Die beeld breedte is te groot ({{ width }}px). Toegelaat maksimum breedte is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Die beeld breedte is te klein ({{ width }}px). Minimum breedte verwag is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die beeld hoogte is te groot ({{ height }}px). Toegelaat maksimum hoogte is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die beeld hoogte is te klein ({{ height }}px). Minimum hoogte verwag is {{ min_height }}px. + + + This value should be the user's current password. + Hierdie waarde moet die huidige wagwoord van die gebruiker wees. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Hierdie waarde moet presies {{ limit }} karakter wees.|Hierdie waarde moet presies {{ limit }} karakters wees. + + + The file was only partially uploaded. + Die lêer is slegs gedeeltelik opgelaai. + + + No file was uploaded. + Geen lêer is opgelaai nie. + + + No temporary folder was configured in php.ini. + Geen tydelike lêer is ingestel in php.ini nie. + + + Cannot write temporary file to disk. + Kan nie tydelike lêer skryf op skyf nie. + + + A PHP extension caused the upload to fail. + 'n PHP-uitbreiding veroorsaak die oplaai van die lêer om te misluk. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Hierdie versameling moet {{ limit }} element of meer bevat.|Hierdie versameling moet {{ limit }} elemente of meer bevat. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Hierdie versameling moet {{ limit }} element of minder bevat.|Hierdie versameling moet {{ limit }} elemente of meer bevat. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Hierdie versameling moet presies {{ limit }} element bevat.|Hierdie versameling moet presies {{ limit }} elemente bevat. + + + Invalid card number. + Ongeldige kredietkaart nommer. + + + Unsupported card type or invalid card number. + Nie-ondersteunde tipe kaart of ongeldige kredietkaart nommer. + + + This is not a valid International Bank Account Number (IBAN). + Hierdie is nie 'n geldige Internationale Bank Rekening Nommer (IBAN) nie. + + + This value is not a valid ISBN-10. + Hierdie waarde is nie 'n geldige ISBN-10 nie. + + + This value is not a valid ISBN-13. + Hierdie waarde is nie 'n geldige ISBN-13 nie. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Hierdie waarde is nie 'n geldige ISBN-10 of ISBN-13 nie. + + + This value is not a valid ISSN. + Hierdie waarde is nie 'n geldige ISSN nie. + + + This value is not a valid currency. + Hierdie waarde is nie 'n geldige geldeenheid nie. + + + This value should be equal to {{ compared_value }}. + Hierdie waarde moet gelyk aan {{ compared_value }} wees. + + + This value should be greater than {{ compared_value }}. + Hierdie waarde moet meer as {{ compared_value }} wees. + + + This value should be greater than or equal to {{ compared_value }}. + Hierdie waarde moet meer of gelyk aan {{ compared_value }} wees. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Hierdie waarde moet identies aan {{ compared_value_type }} {{ compared_value }} wees. + + + This value should be less than {{ compared_value }}. + Hierdie waarde moet minder as {{ compared_value }} wees. + + + This value should be less than or equal to {{ compared_value }}. + Hierdie waarde moet minder of gelyk aan {{ compared_value }} wees. + + + This value should not be equal to {{ compared_value }}. + Hierdie waarde moet nie dieselfde as {{ compared_value }} wees nie. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Hierdie waarde moet nie identies as {{ compared_value_type }} {{ compared_value }} wees nie. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Die beeld aspek is te groot ({{ ratio }}). Die maksimum toegelate aspek is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Die beeld aspek is te klein ({{ ratio }}). Die minimum toegelate aspek is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Die beeld is vierkantig ({{ width }}x{{ height }}px). Vierkantige beelde word nie toegelaat nie. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Die beeld is landskap georiënteerd ({{ width }}x{{ height }}px). Landskap georiënteerde beelde word nie toegelaat nie. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Die beeld dis portret georiënteerd ({{ width }}x{{ height }}px). Portret georiënteerde beelde word nie toegelaat nie. + + + An empty file is not allowed. + 'n Leë lêer word nie toegelaat nie. + + + The host could not be resolved. + Die gasheer kon nie opgelos word nie. + + + This value does not match the expected {{ charset }} charset. + Die waarde stem nie ooreen met die verwagte {{ charset }} karakterstel nie. + + + This is not a valid Business Identifier Code (BIC). + Hierdie is nie 'n geldige Besigheids Identifikasie Kode (BIC) nie. + + + Error + Fout + + + This is not a valid UUID. + Hierdie is nie 'n geldige UUID nie. + + + This value should be a multiple of {{ compared_value }}. + Hierdie waarde moet 'n veelvoud van {{ compared_value }} wees. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Hierdie Besigheids Identifikasie Kode (BIK) is nie geassosieer met IBAN {{ iban }} nie. + + + This value should be valid JSON. + Hierdie waarde moet geldige JSON wees. + + + This collection should contain only unique elements. + Hierdie versameling moet net unieke elemente bevat. + + + This value should be positive. + Hierdie waarde moet positief wees. + + + This value should be either positive or zero. + Hierdie waarde moet positief of nul wees. + + + This value should be negative. + Hierdie waarde moet negatief wees. + + + This value should be either negative or zero. + Hierdie waarde moet negatief of nul wees. + + + This value is not a valid timezone. + Hierdie waarde is nie 'n geldige tydsone nie. + + + This value should be between {{ min }} and {{ max }}. + Hierdie waarde moet tussen {{ min }} en {{ max }} wees. + + + This value is not a valid hostname. + Hierdie waarde is nie 'n geldige gasheernaam nie. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Die hoeveelheid elemente in hierdie versameling moet 'n meelvoud van {{ compared_value }} wees. + + + This value should satisfy at least one of the following constraints: + Hierdie waarde moet voldoen aan ten minste een van hierdie beperkings: + + + Each element of this collection should satisfy its own set of constraints. + Elke element van hierdie versameling moet voldoen aan hulle eie beperkings. + + + This value is not a valid International Securities Identification Number (ISIN). + Hierdie waarde is nie 'n geldige Internasionale veiligheidsidentifikasienommer (ISIN) nie. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.ar.xlf b/vendor/symfony/validator/Resources/translations/validators.ar.xlf new file mode 100644 index 0000000..6aa0d59 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.ar.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + هذه القيمة يجب أن تكون خاطئة. + + + This value should be true. + هذه القيمة يجب أن تكون حقيقية. + + + This value should be of type {{ type }}. + هذه القيمة يجب ان تكون من نوع {{ type }}. + + + This value should be blank. + هذه القيمة يجب ان تكون فارغة. + + + The value you selected is not a valid choice. + القيمة المختارة ليست خيارا صحيحا. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيارات على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل.|يجب ان تختار {{ limit }} اختيار على الاقل. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيارات على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر.|يجب ان تختار {{ limit }} اختيار على الاكثر. + + + One or more of the given values is invalid. + واحد أو أكثر من القيم المعطاه خاطئ. + + + This field was not expected. + لم يكن من المتوقع هذا المجال. + + + This field is missing. + هذا المجال مفقود. + + + This value is not a valid date. + هذه القيمة ليست تاريخا صالحا. + + + This value is not a valid datetime. + هذه القيمة ليست تاريخا و وقتا صالحا. + + + This value is not a valid email address. + هذه القيمة ليست عنوان بريد إلكتروني صحيح. + + + The file could not be found. + لا يمكن العثور على الملف. + + + The file is not readable. + الملف غير قابل للقراءة. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + الملف كبير جدا ({{ size }} {{ suffix }}).اقصى مساحه مسموح بها ({{ limit }} {{ suffix }}). + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + نوع الملف غير صحيح ({{ type }}). الانواع المسموح بها هى {{ types }}. + + + This value should be {{ limit }} or less. + هذه القيمة يجب ان تكون {{ limit }} او اقل. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرف او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرف او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حروف او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرف او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرف او اقل.|هذه القيمة طويلة جدا. يجب ان تكون {{ limit }} حرف او اقل. + + + This value should be {{ limit }} or more. + هذه القيمة يجب ان تكون {{ limit }} او اكثر. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرف او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرف او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حروف او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرف او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرف او اكثر.|هذه القيمة قصيرة جدا. يجب ان تكون {{ limit }} حرف او اكثر. + + + This value should not be blank. + هذه القيمة يجب الا تكون فارغة. + + + This value should not be null. + هذه القيمة يجب الا تكون فارغة. + + + This value should be null. + هذه القيمة يجب ان تكون فارغة. + + + This value is not valid. + هذه القيمة غير صحيحة. + + + This value is not a valid time. + هذه القيمة ليست وقت صحيح. + + + This value is not a valid URL. + هذه القيمة ليست رابط الكترونى صحيح. + + + The two values should be equal. + القيمتان يجب ان تكونا متساويتان. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + الملف كبير جدا. اقصى مساحه مسموح بها {{ limit }} {{ suffix }}. + + + The file is too large. + الملف كبير جدا. + + + The file could not be uploaded. + لم استطع استقبال الملف. + + + This value should be a valid number. + هذه القيمة يجب ان تكون رقم. + + + This file is not a valid image. + هذا الملف ليس صورة صحيحة. + + + This is not a valid IP address. + هذه القيمة ليست عنوان رقمى صحيح. + + + This value is not a valid language. + هذه القيمة ليست لغة صحيحة. + + + This value is not a valid locale. + هذه القيمة ليست موقع صحيح. + + + This value is not a valid country. + هذه القيمة ليست بلدا صالحا. + + + This value is already used. + هذه القيمة مستخدمة بالفعل. + + + The size of the image could not be detected. + لم استطع معرفة حجم الصورة. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + عرض الصورة كبير جدا ({{ width }}px). اقصى عرض مسموح به هو{{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + عرض الصورة صغير جدا ({{ width }}px). اقل عرض مسموح به هو{{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + طول الصورة كبير جدا ({{ height }}px). اقصى طول مسموح به هو{{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + طول الصورة صغير جدا ({{ height }}px). اقل طول مسموح به هو{{ min_height }}px. + + + This value should be the user's current password. + هذه القيمة يجب ان تكون كلمة سر المستخدم الحالية. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + هذه القيمة يجب ان تحتوى على {{ limit }} حرف فقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حرف فقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حروف فقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حرف فقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حرف فقط.|هذه القيمة يجب ان تحتوى على {{ limit }} حرف فقط. + + + The file was only partially uploaded. + تم استقبال جزء من الملف فقط. + + + No file was uploaded. + لم يتم ارسال اى ملف. + + + No temporary folder was configured in php.ini. + لم يتم تهيئة حافظة مؤقتة فى ملف php.ini. + + + Cannot write temporary file to disk. + لم استطع كتابة الملف المؤقت. + + + A PHP extension caused the upload to fail. + احد اضافات PHP تسببت فى فشل استقبال الملف. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اكثر. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر او اقل. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر فقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر فقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عناصر فقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر فقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر فقط.|هذه المجموعة يجب ان تحتوى على {{ limit }} عنصر فقط. + + + Invalid card number. + رقم البطاقه غير صحيح. + + + Unsupported card type or invalid card number. + نوع البطاقه غير مدعوم او الرقم غير صحيح. + + + This is not a valid International Bank Account Number (IBAN). + الرقم IBAN (رقم الحساب المصرفي الدولي) الذي تم إدخاله غير صالح. + + + This value is not a valid ISBN-10. + هذه القيمة ليست ISBN-10 صالحة. + + + This value is not a valid ISBN-13. + هذه القيمة ليست ISBN-13 صالحة. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + هذه القيمة ليست ISBN-10 صالحة ولا ISBN-13 صالحة. + + + This value is not a valid ISSN. + هذه القيمة ليست ISSN صالحة. + + + This value is not a valid currency. + العُملة غير صحيحة. + + + This value should be equal to {{ compared_value }}. + القيمة يجب ان تساوي {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + القيمة يجب ان تكون اعلي من {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + القيمة يجب ان تكون مساوية او اعلي من {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + القيمة يجب ان تطابق {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + القيمة يجب ان تكون اقل من {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + القيمة يجب ان تساوي او تقل عن {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + القيمة يجب ان لا تساوي {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + القيمة يجب ان لا تطابق {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + نسبة العرض على الارتفاع للصورة كبيرة جدا ({{ ratio }}). الحد الأقصى للنسبة المسموح به هو {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + نسبة العرض على الارتفاع للصورة صغيرة جدا ({{ ratio }}). الحد الأدنى للنسبة المسموح به هو {{ max_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + الصورة مربعة ({{ width }}x{{ height }}px). الصور المربعة غير مسموح بها. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + الصورة في وضع أفقي ({{ width }}x{{ height }}px). الصور في وضع أفقي غير مسموح بها. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + الصورة في وضع عمودي ({{ width }}x{{ height }}px). الصور في وضع عمودي غير مسموح بها. + + + An empty file is not allowed. + ملف فارغ غير مسموح به. + + + The host could not be resolved. + يتعذر الإتصال بالنطاق. + + + This value does not match the expected {{ charset }} charset. + هذه القيمة غير متطابقة مع صيغة التحويل {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + هذه القيمة ليست رمز معرّف نشاط تجاري صالح (BIC). + + + Error + خطأ + + + This is not a valid UUID. + هذا ليس UUID صالح. + + + This value should be a multiple of {{ compared_value }}. + هذه القيمة يجب أن تكون مضاعف ل {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + رمز المعرّف نشاط تجاري (BIC) هذا لا يرتبط مع IBAN {{ iban }}. + + + This value should be valid JSON. + هذه القيمة يجب أن تكون صالحة ل JSON. + + + This collection should contain only unique elements. + يجب أن تحتوي هذه المجموعة علي عناصر فريدة فقط. + + + This value should be positive. + يجب أن تكون هذه القيمة موجبة. + + + This value should be either positive or zero. + يجب أن تكون هذه القيمة إما موجبة او صفر. + + + This value should be negative. + يجب أن تكون هذه القيمة سالبة. + + + This value should be either negative or zero. + يجب أن تكون هذه القيمة إما سالبة او صفر. + + + This value is not a valid timezone. + هذه القيمة ليست منطقة زمنية صحيحة. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + تم تسريب كلمة المرور هذه في خرق للبيانات، ويجب عدم استخدامها. يرجي استخدام كلمة مرور أخري. + + + This value should be between {{ min }} and {{ max }}. + يجب أن تكون هذه القيمة بين {{ min }} و {{ max }}. + + + This value is not a valid hostname. + هذه القيمة ليست اسم مضيف صالح. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + يجب أن يكون عدد العناصر في هذه المجموعة مضاعف {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + يجب أن تستوفي هذه القيمة واحدة من القيود التالية: + + + Each element of this collection should satisfy its own set of constraints. + يجب أن يفي كل عنصر من عناصر هذه المجموعة بمجموعة القيود الخاصة به. + + + This value is not a valid International Securities Identification Number (ISIN). + صالح (ISIN) هذه القيمة ليست رقم تعريف الأوراق المالية الدولي. + + + This value should be a valid expression. + يجب أن تكون هذه القيمة تعبيرًا صالحًا. + + + This value is not a valid CSS color. + هذه القيمة ليست لون CSS صالحًا. + + + This value is not a valid CIDR notation. + هذه القيمة ليست تدوين CIDR صالحًا. + + + The value of the netmask should be between {{ min }} and {{ max }}. + يجب أن تكون قيمة netmask بين {{ min }} و {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.az.xlf b/vendor/symfony/validator/Resources/translations/validators.az.xlf new file mode 100644 index 0000000..5948087 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.az.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Bu dəyər false olmalıdır. + + + This value should be true. + Bu dəyər true olmalıdır. + + + This value should be of type {{ type }}. + Bu dəyərin tipi {{ type }} olmalıdır. + + + This value should be blank. + Bu dəyər boş olmalıdır. + + + The value you selected is not a valid choice. + Seçdiyiniz dəyər düzgün bir seçim değil. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ən az {{ limit }} seçim qeyd edilməlidir. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ən çox {{ limit }} seçim qeyd edilməlidir. + + + One or more of the given values is invalid. + Təqdim edilən dəyərlərdən bir və ya bir neçəsi yanlışdır. + + + This field was not expected. + Bu sahə gözlənilmirdi. + + + This field is missing. + Bu sahə əksikdir. + + + This value is not a valid date. + Bu dəyər düzgün bir tarix deyil. + + + This value is not a valid datetime. + Bu dəyər düzgün bir tarixsaat deyil. + + + This value is not a valid email address. + Bu dəyər düzgün bir e-poçt adresi deyil. + + + The file could not be found. + Fayl tapılmadı. + + + The file is not readable. + Fayl oxunabilən deyil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl çox böyükdür ({{ size }} {{ suffix }}). İcazə verilən maksimum fayl ölçüsü {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faylın mime tipi yanlışdr ({{ type }}). İcazə verilən mime tipləri {{ types }}. + + + This value should be {{ limit }} or less. + Bu dəyər {{ limit }} və ya altında olmalıdır. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Bu dəyər çox uzundur. {{ limit }} və ya daha az simvol olmalıdır. + + + This value should be {{ limit }} or more. + Bu dəyər {{ limit }} veya daha fazla olmalıdır. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Bu dəyər çox qısadır. {{ limit }} və ya daha çox simvol olmalıdır. + + + This value should not be blank. + Bu dəyər boş olmamalıdır. + + + This value should not be null. + Bu dəyər boş olmamalıdır. + + + This value should be null. + Bu dəyər boş olmamalıdır. + + + This value is not valid. + Bu dəyər doğru deyil. + + + This value is not a valid time. + Bu dəyər doğru bir saat deyil. + + + This value is not a valid URL. + Bu dəyər doğru bir URL değil. + + + The two values should be equal. + İki dəyər eyni olmalıdır. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl çox böyükdür. İcazə verilən ən böyük fayl ölçüsü {{ limit }} {{ suffix }}. + + + The file is too large. + Fayl çox böyükdür. + + + The file could not be uploaded. + Fayl yüklənəbilmir. + + + This value should be a valid number. + Bu dəyər rəqəm olmalıdır. + + + This file is not a valid image. + Bu fayl düzgün bir şəkil deyil. + + + This is not a valid IP address. + Bu düzgün bir IP adresi deyil. + + + This value is not a valid language. + Bu dəyər düzgün bir dil deyil. + + + This value is not a valid locale. + Bu dəyər düzgün bir dil deyil. + + + This value is not a valid country. + Bu dəyər düzgün bir ölkə deyil. + + + This value is already used. + Bu dəyər hal-hazırda istifadədədir. + + + The size of the image could not be detected. + Şəklin ölçüsü hesablana bilmir. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Şəklin genişliyi çox böyükdür ({{ width }}px). İcazə verilən ən böyük genişlik {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Şəklin genişliyi çox kiçikdir ({{ width }}px). Ən az {{ min_width }}px olmalıdır. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Şəklin yüksəkliyi çox böyükdür ({{ height }}px). İcazə verilən ən böyük yüksəklik {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Şəklin yüksəkliyi çox kiçikdir ({{ height }}px). Ən az {{ min_height }}px olmalıdır. + + + This value should be the user's current password. + Bu dəyər istifadəçinin hazırkı parolu olmalıdır. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Bu dəyər tam olaraq {{ limit }} simvol olmaldır. + + + The file was only partially uploaded. + Fayl qismən yükləndi. + + + No file was uploaded. + Fayl yüklənmədi. + + + No temporary folder was configured in php.ini. + php.ini'də müvəqqəti qovluq quraşdırılmayıb. + + + Cannot write temporary file to disk. + Müvəqqəti fayl diskə yazıla bilmir. + + + A PHP extension caused the upload to fail. + Bir PHP əlavəsi faylın yüklənməsinə mane oldu. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bu kolleksiyada {{ limit }} və ya daha çox element olmalıdır. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bu kolleksiyada {{ limit }} və ya daha az element olmalıdır. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bu kolleksiyada tam olaraq {{ limit }} element olmalıdır. + + + Invalid card number. + Yanlış kart nömrəsi. + + + Unsupported card type or invalid card number. + Dəstəklənməyən kart tipi və ya yanlış kart nömrəsi. + + + This is not a valid International Bank Account Number (IBAN). + Bu dəyər doğru bir Beynəlxalq Bank Hesap Nömrəsi (IBAN) deyil. + + + This value is not a valid ISBN-10. + Bu dəyər doğru bir ISBN-10 deyil. + + + This value is not a valid ISBN-13. + Bu dəyər doğru bir ISBN-13 deyil. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Bu dəyər doğru bir ISBN-10 və ya ISBN-13 deyil. + + + This value is not a valid ISSN. + Bu dəyər doğru bir ISSN deyil. + + + This value is not a valid currency. + Bu dəyər doğru bir valyuta deyil. + + + This value should be equal to {{ compared_value }}. + Bu dəyər {{ compared_value }} ilə bərabər olmalıdır. + + + This value should be greater than {{ compared_value }}. + Bu dəyər {{ compared_value }} dəyərindən büyük olmalıdır. + + + This value should be greater than or equal to {{ compared_value }}. + Bu dəyər {{ compared_value }} ilə bərabər və ya daha böyük olmaldır. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Bu dəyər {{ compared_value_type }} {{ compared_value }} ilə eyni olmalıdır. + + + This value should be less than {{ compared_value }}. + Bu dəyər {{ compared_value }} dəyərindən kiçik olmalıdır. + + + This value should be less than or equal to {{ compared_value }}. + Bu dəyər {{ compared_value }} dəyərindən kiçik və ya bərabər olmalıdır. + + + This value should not be equal to {{ compared_value }}. + Bu değer {{ compared_value }} ile eşit olmamalıdır. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Bu dəyər {{ compared_value_type }} {{ compared_value }} ilə eyni olmamalıdır. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Şəkil nisbəti çox büyükdür ({{ ratio }}). İcazə verilən maksimum nisbət: {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Şəkil nisbəti çox balacadır ({{ ratio }}). İcazə verilən minimum nisbət: {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Şəkil kvadratdır ({{ width }}x{{ height }}px). Kvadrat şəkillərə icazə verilmir. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Şəkil albom rejimindədir ({{ width }}x{{ height }}px). Albom rejimli şəkillərə icazə verilmir. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Şəkil portret rejimindədir ({{ width }}x{{ height }}px). Portret rejimli şəkillərə icazə verilmir. + + + An empty file is not allowed. + Boş fayla icazə verilmir. + + + The host could not be resolved. + Ünvan tapılmadı. + + + This value does not match the expected {{ charset }} charset. + Bu dəyər gözlənilən {{ charset }} simvol cədvəli ilə uyğun gəlmir. + + + This is not a valid Business Identifier Code (BIC). + Bu dəyər doğru bir Biznes Təyinedici Kodu (BIC) deyil. + + + Error + Xəta + + + This is not a valid UUID. + Bu dəyər doğru bir UUID deyil. + + + This value should be a multiple of {{ compared_value }}. + Bu dəyər {{ compare_value }} dəyərinin bölənlərindən biri olmalıdır. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Bu Biznes Təyinedici Kodu (BIC) {{ iban }} IBAN kodu ilə əlaqəli deyil. + + + This value should be valid JSON. + Bu dəyər doğru bir JSON olmalıdır. + + + This collection should contain only unique elements. + Bu kolleksiyada sadəcə unikal elementlər olmalıdır. + + + This value should be positive. + Bu dəyər müsbət olmalıdır. + + + This value should be either positive or zero. + Bu dəyər müsbət və ya sıfır olmalıdır. + + + This value should be negative. + Bu dəyər mənfi olmaldır. + + + This value should be either negative or zero. + Bu dəyər mənfi və ya sıfır olmaldır. + + + This value is not a valid timezone. + Bu dəyər doğru bir zaman zolağı deyil. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Bu parol data oğurluğunda tapıldığı üçün işlədilməməlidir. Zəhmət olmasa, başqa parol seçin. + + + This value should be between {{ min }} and {{ max }}. + Bu dəyər {{ min }} və {{ max }} arasında olmaldır. + + + This value is not a valid hostname. + Bu dəyər doğru bir host adı deyil. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Bu kolleksiyadakı elementlerin sayı {{ compared_value }} tam bölünəni olmalıdır. + + + This value should satisfy at least one of the following constraints: + Bu dəyər aşağıdakı məcburiyyətlərdən birini qarşılamalıdır: + + + Each element of this collection should satisfy its own set of constraints. + Bu kolleksiyadakı hər element öz məcburiyyətlərini qarşılamalıdır. + + + This value is not a valid International Securities Identification Number (ISIN). + Bu dəyər doğru bir Qiymətli Kağızın Beynəlxalq İdentifikasiya Kodu (ISIN) deyil. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.be.xlf b/vendor/symfony/validator/Resources/translations/validators.be.xlf new file mode 100644 index 0000000..6489556 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.be.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Значэнне павінна быць Не. + + + This value should be true. + Значэнне павінна быць Так. + + + This value should be of type {{ type }}. + Тып значэння павінен быць {{ type }}. + + + This value should be blank. + Значэнне павінна быць пустым. + + + The value you selected is not a valid choice. + Абранае вамі значэнне не сапраўднае. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Вы павінны выбраць хаця б {{ limit }} варыянт.|Вы павінны выбраць хаця б {{ limit }} варыянтаў. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Вы павінны выбраць не больш за {{ limit }} варыянт.|Вы павінны выбраць не больш за {{ limit }} варыянтаў. + + + One or more of the given values is invalid. + Адзін або некалькі пазначаных значэнняў з'яўляецца несапраўдным. + + + This field was not expected. + Гэта поле не чакаецца. + + + This field is missing. + Гэта поле адсутнічае. + + + This value is not a valid date. + Гэта значэнне не з'яўляецца карэктнай датай. + + + This value is not a valid datetime. + Гэта значэнне не з'яўляецца карэктнай датай i часом. + + + This value is not a valid email address. + Гэта значэнне не з'яўляецца карэктным адрасам электроннай пошты. + + + The file could not be found. + Файл не знойдзен. + + + The file is not readable. + Файл не чытаецца. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадта вялікі ({{ size }} {{ suffix }}). Максімальна дазволены памер {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-тып файлу некарэкты ({{ type }}). Дазволеныя MIME-тыпы файлу {{ types }}. + + + This value should be {{ limit }} or less. + Значэнне павінна быць {{ limit }} або менш. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Значэнне занадта доўгае. Яно павінна мець {{ limit }} сімвал або менш.|Значэнне занадта доўгае. Яно павінна мець {{ limit }} сімвалаў або менш. + + + This value should be {{ limit }} or more. + Значэнне павінна быць {{ limit }} або больш. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Значэнне занадта кароткае. Яно павінна мець прынамсі {{ limit }} сімвал.|Значэнне занадта кароткае. Яно павінна мець прынамсі {{ limit }} сімвалаў. + + + This value should not be blank. + Значэнне не павінна быць пустым. + + + This value should not be null. + Значэнне не павінна быць null. + + + This value should be null. + Значэнне павінна быць null. + + + This value is not valid. + Значэнне з'яўляецца не сапраўдным. + + + This value is not a valid time. + Значэнне не з'яўляецца сапраўдным часам. + + + This value is not a valid URL. + Значэнне не з'яўляецца сапраўдным URL-адрасам. + + + The two values should be equal. + Абодва значэнні павінны быць аднолькавымі. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадта вялікі. Максімальна дазволены памер {{ limit }} {{ suffix }}. + + + The file is too large. + Файл занадта вялікі. + + + The file could not be uploaded. + Немагчыма запампаваць файл. + + + This value should be a valid number. + Значэнне павінна быць лікам. + + + This file is not a valid image. + Гэты файл не з'яўляецца сапраўднай выявай. + + + This is not a valid IP address. + Значэнне не з'яўляецца сапраўдным IP-адрасам. + + + This value is not a valid language. + Значэнне не з'яўляецца сапраўдным мовай. + + + This value is not a valid locale. + Значэнне не з'яўляецца сапраўднай лакаллю. + + + This value is not a valid country. + Значэнне не з'яўляецца сапраўднай краінай. + + + This value is already used. + Гэта значэнне ўжо выкарыстоўваецца. + + + The size of the image could not be detected. + Немагчыма вызначыць памер выявы. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Гэта выява занадта вялікая ({{ width }}px). Дазваляецца максімальная шырыня {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Гэта выява занадта маленькая ({{ width }}px). Дазваляецца мінімальная шырыня {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Гэты выява занадта вялікая ({{ width }}px). Дазваляецца максімальная вышыня {{ max_width }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Гэта выява занадта маленькая ({{ width }}px). Дазваляецца мінімальная вышыня {{ min_width }}px. + + + This value should be the user's current password. + Значэнне павінна быць цяперашнім паролем карыстальніка. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Значэнне павінна мець {{ limit }} сімвал.|Значэнне павінна мець {{ limit }} сімвалаў. + + + The file was only partially uploaded. + Файл быў запампаваны толькі часткова. + + + No file was uploaded. + Файл не быў запампаваны. + + + No temporary folder was configured in php.ini. + У php.ini не была налажана часовая папка, або часовая папка не існуе. + + + Cannot write temporary file to disk. + Немагчыма запісаць часовы файл на дыск. + + + A PHP extension caused the upload to fail. + Пашырэнне PHP выклікала памылку загрузкі. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Калекцыя павінна змяшчаць прынамсі {{ limit }} элемент.|Калекцыя павінна змяшчаць прынамсі {{ limit }} элементаў. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Калекцыя павінна змяшчаць {{ limit }} або менш элемент.|Калекцыя павінна змяшчаць {{ limit }} або менш элементаў. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Калекцыя павінна змяшчаць роўна {{ limit }} элемент.|Калекцыя павінна змяшчаць роўна {{ limit }} элементаў. + + + Invalid card number. + Несапраўдны нумар карты. + + + Unsupported card type or invalid card number. + Тып карты не падтрымліваецца або несапраўдны нумар карты. + + + This is not a valid International Bank Account Number (IBAN). + Несапраўдны міжнародны нумар банкаўскага рахунку (IBAN). + + + This value is not a valid ISBN-10. + Гэта значэнне не з'яўляецца сапраўдным ISBN-10. + + + This value is not a valid ISBN-13. + Гэта значэнне не з'яўляецца сапраўдным ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Гэта значэнне не з'яўляецца сапраўдным ISBN-10 або ISBN-13. + + + This value is not a valid ISSN. + Гэта значэнне не з'яўляецца сапраўдным ISSN. + + + This value is not a valid currency. + Гэта значэнне не з'яўляецца сапраўднай валютай. + + + This value should be equal to {{ compared_value }}. + Значэнне павінна раўняцца {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Значэнне павінна быць больш чым {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Значэнне павінна быць больш чым або раўняцца {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Значэнне павінна быць ідэнтычным {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Значэнне павінна быць менш чым {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Значэнне павінна быць менш чым або раўняцца {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Значэнне не павінна раўняцца {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Значэнне не павінна быць ідэнтычным {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Суадносіны бакоў выявы з'яўляецца занадта вялікім ({{ ratio }}). Дазваляецца максімальныя суадносіны {{max_ratio}} . + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Суадносіны бакоў выявы з'яўляецца занадта маленькімі ({{ ratio }}). Дазваляецца мінімальныя суадносіны {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Выява квадратная ({{width}}x{{height}}px). Квадратныя выявы не дазволены. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Выява ў альбомнай арыентацыі ({{ width }}x{{ height }}px). Выявы ў альбомнай арыентацыі не дазволены. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Выява ў партрэтнай арыентацыі ({{ width }}x{{ height }}px). Выявы ў партрэтнай арыентацыі не дазволены. + + + An empty file is not allowed. + Пусты файл не дазволены. + + + The host could not be resolved. + Не магчыма знайсці імя хоста. + + + This value does not match the expected {{ charset }} charset. + Гэта значэнне не супадае з чаканай {{ charset }} кадыроўкай. + + + This is not a valid Business Identifier Code (BIC). + Несапраўдны банкаўскі ідэнтыфікацыйны код (BIC). + + + Error + Памылка + + + This is not a valid UUID. + Гэта несапраўдны UUID. + + + This value should be a multiple of {{ compared_value }}. + Значэнне павінна быць кратным {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Банкаўскі ідэнтыфікацыйны код (BIC) не звязан з IBAN {{ iban }}. + + + This value should be valid JSON. + Гэта значэнне павінна быць у фармаце JSON. + + + This collection should contain only unique elements. + Калекцыя павінна змяшчаць толькі ўнікальныя элементы. + + + This value should be positive. + Значэнне павінна быць дадатным. + + + This value should be either positive or zero. + Значэнне павінна быць дадатным ці нуль. + + + This value should be negative. + Значэнне павінна быць адмоўным. + + + This value should be either negative or zero. + Значэнне павінна быць адмоўным ці нуль. + + + This value is not a valid timezone. + Значэнне не з'яўляецца сапраўдным гадзінным поясам. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Гэты пароль быў выкрадзены ў выніку ўзлому дадзеных, таму яго нельга выкарыстоўваць. Калі ласка, выкарыстоўвайце іншы пароль. + + + This value should be between {{ min }} and {{ max }}. + Значэнне павінна быць паміж {{min}} і {{max}}. + + + This value is not a valid hostname. + Значэнне не з'яўляецца карэктным імем хаста. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Колькасць элементаў у гэтай калекцыі павінна быць кратным {{compared_value}}. + + + This value should satisfy at least one of the following constraints: + Значэнне павінна задавальняць як мінімум аднаму з наступных абмежаванняў: + + + Each element of this collection should satisfy its own set of constraints. + Кожны элемент гэтай калекцыі павінен задавальняць свайму ўласнаму набору абмежаванняў. + + + This value is not a valid International Securities Identification Number (ISIN). + Значэнне не з'яўляецца карэктным міжнародным ідэнтыфікацыйным нумарам каштоўных папер (ISIN). + + + This value should be a valid expression. + Значэнне не з'яўляецца сапраўдным выразам. + + + This value is not a valid CSS color. + Значэнне не з'яўляецца дапушчальным колерам CSS. + + + This value is not a valid CIDR notation. + Значэнне не з'яўляецца сапраўднай натацыяй CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Значэнне сеткавай маскі павінна быць ад {{min}} да {{max}}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.bg.xlf b/vendor/symfony/validator/Resources/translations/validators.bg.xlf new file mode 100644 index 0000000..455ff81 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.bg.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Стойността трябва да бъде лъжа (false). + + + This value should be true. + Стойността трябва да бъде истина (true). + + + This value should be of type {{ type }}. + Стойността трябва да бъде от тип {{ type }}. + + + This value should be blank. + Стойността трябва да бъде празна. + + + The value you selected is not a valid choice. + Избраната стойност е невалидна. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Трябва да изберете поне {{ limit }} опция.|Трябва да изберете поне {{ limit }} опции. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Трябва да изберете най-много {{ limit }} опция.|Трябва да изберете най-много {{ limit }} опции. + + + One or more of the given values is invalid. + Една или повече от зададените стойности е невалидна. + + + This field was not expected. + Полето не се е очаквало. + + + This field is missing. + Полето липсва. + + + This value is not a valid date. + Стойността не е валидна дата. + + + This value is not a valid datetime. + Стойността не е валидна дата и час. + + + This value is not a valid email address. + Стойността не е валиден имейл адрес. + + + The file could not be found. + Файлът не беше открит. + + + The file is not readable. + Файлът не може да бъде прочетен. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файлът е твърде голям ({{ size }} {{ suffix }}). Максималният размер е {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime типа на файла е невалиден ({{ type }}). Разрешени mime типове са {{ types }}. + + + This value should be {{ limit }} or less. + Стойността трябва да бъде {{ limit }} или по-малко. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Стойността е твърде дълга. Трябва да съдържа най-много {{ limit }} символ.|Стойността е твърде дълга. Трябва да съдържа най-много {{ limit }} символа. + + + This value should be {{ limit }} or more. + Стойността трябва да бъде {{ limit }} или повече. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Стойността е твърде кратка. Трябва да съдържа поне {{ limit }} символ.|Стойността е твърде кратка. Трябва да съдържа поне {{ limit }} символа. + + + This value should not be blank. + Стойността не трябва да бъде празна. + + + This value should not be null. + Стойността не трябва да бъде null. + + + This value should be null. + Стойността трябва да бъде null. + + + This value is not valid. + Стойността не е валидна. + + + This value is not a valid time. + Стойността не е валидно време. + + + This value is not a valid URL. + Стойността не е валиден URL. + + + The two values should be equal. + Двете стойности трябва да бъдат равни. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файлът е твърде голям. Разрешеният максимален размер е {{ limit }} {{ suffix }}. + + + The file is too large. + Файлът е твърде голям. + + + The file could not be uploaded. + Файлът не може да бъде качен. + + + This value should be a valid number. + Стойността трябва да бъде валиден номер. + + + This file is not a valid image. + Файлът не е валидно изображение. + + + This is not a valid IP address. + Това не е валиден IP адрес. + + + This value is not a valid language. + Стойността не е валиден език. + + + This value is not a valid locale. + Стойността не е валидна локализация. + + + This value is not a valid country. + Стойността не е валидна държава. + + + This value is already used. + Стойността вече е в употреба. + + + The size of the image could not be detected. + Размера на изображението не може да бъде определен. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Изображението е твърде широко ({{ width }}px). Широчината трябва да бъде максимум {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Изображението е с твърде малка широчина ({{ width }}px). Широчината трябва да бъде минимум {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Изображението е с твърде голяма височина ({{ height }}px). Височината трябва да бъде максимум {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Изображението е с твърде малка височина ({{ height }}px). Височина трябва да бъде минимум {{ min_height }}px. + + + This value should be the user's current password. + Стойността трябва да бъде текущата потребителска парола. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Стойността трябва да бъде точно {{ limit }} символ.|Стойността трябва да бъде точно {{ limit }} символа. + + + The file was only partially uploaded. + Файлът е качен частично. + + + No file was uploaded. + Файлът не беше качен. + + + No temporary folder was configured in php.ini. + Не е посочена директория за временни файлове в php.ini. + + + Cannot write temporary file to disk. + Не може да запише временен файл на диска. + + + A PHP extension caused the upload to fail. + PHP разширение предизвика прекъсване на качването. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Колекцията трябва да съдържа поне {{ limit }} елемент.|Колекцията трябва да съдържа поне {{ limit }} елемента. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Колекцията трябва да съдържа най-много {{ limit }} елемент.|Колекцията трябва да съдържа най-много {{ limit }} елемента. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Колекцията трябва да съдържа точно {{ limit }} елемент.|Колекцията трябва да съдържа точно {{ limit }} елемента. + + + Invalid card number. + Невалиден номер на карта. + + + Unsupported card type or invalid card number. + Неподдържан тип карта или невалиден номер на карта. + + + This is not a valid International Bank Account Number (IBAN). + Това не е валиден Международен номер на банкова сметка (IBAN). + + + This value is not a valid ISBN-10. + Стойността не е валиден ISBN-10. + + + This value is not a valid ISBN-13. + Стойността не е валиден ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Стойността не е нито валиден ISBN-10, нито валиден ISBN-13. + + + This value is not a valid ISSN. + Стойността не е валиден ISSN. + + + This value is not a valid currency. + Стойността не е валидна валута. + + + This value should be equal to {{ compared_value }}. + Стойността трябва да бъде равна на {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Стойността трябва да бъде по-голяма от {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Стойността трябва да бъде по-голяма или равна на {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Стойността трябва да бъде идентична с {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Стойността трябва да бъде по-малка {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Стойността трябва да бъде по-малка или равна на {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Стойността не трябва да бъде равна на {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Стойността не трябва да бъде идентична с {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Изображението е с твърде голяма пропорция ({{ ratio }}). Максималната пропорция трябва да е {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Изображението е с твърде малка пропорция ({{ ratio }}). Минималната пропорция трябва да е {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Изображението е квадрат ({{ width }}x{{ height }}px). Такива изображения не са разрешени. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Изображението е с пейзажна ориентация ({{ width }}x{{ height }}px). Изображения с такава ориентация не са разрешени. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Изображението е с портретна ориентация ({{ width }}x{{ height }}px). Изображения с такава ориентация не са разрешени. + + + An empty file is not allowed. + Празни файлове не са разрешени. + + + The host could not be resolved. + Хостът е недостъпен. + + + This value does not match the expected {{ charset }} charset. + Стойността не съвпада с очакваната {{ charset }} кодировка. + + + This is not a valid Business Identifier Code (BIC). + Това не е валиден Бизнес идентификационен код (BIC). + + + Error + Грешка + + + This is not a valid UUID. + Това не е валиден UUID. + + + This value should be a multiple of {{ compared_value }}. + Стойността трябва да бъде кратно число на {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Бизнес идентификационния код (BIC) не е свързан с IBAN {{ iban }}. + + + This value should be valid JSON. + Стойността трябва да е валиден JSON. + + + This collection should contain only unique elements. + Колекцията трябва да съдържа само уникални елементи. + + + This value should be positive. + Стойността трябва да бъде положително число. + + + This value should be either positive or zero. + Стойността трябва бъде положително число или нула. + + + This value should be negative. + Стойността трябва да бъде отрицателно число. + + + This value should be either negative or zero. + Стойността трябва да бъде отрицателно число или нула. + + + This value is not a valid timezone. + Стойността не е валидна часова зона. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Тази парола е компрометирана, не трябва да бъде използвана. Моля използвайте друга парола. + + + This value should be between {{ min }} and {{ max }}. + Стойността трябва да бъде между {{ min }} и {{ max }}. + + + This value is not a valid hostname. + Стойността не е валиден hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Броят на елементите в тази колекция трябва да бъде кратен на {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Стойността трябва да отговаря на поне едно от следните ограничения: + + + Each element of this collection should satisfy its own set of constraints. + Всеки елемент от тази колекция трябва да отговаря на собствения си набор от ограничения. + + + This value is not a valid International Securities Identification Number (ISIN). + Стойността не е валиден Международен идентификационен номер на ценни книжа (ISIN). + + + This value should be a valid expression. + Стойността трябва да бъде валиден израз. + + + This value is not a valid CSS color. + Стойността не е валиден CSS цвят. + + + This value is not a valid CIDR notation. + Стойността не е валидна CIDR нотация. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Стойността на мрежовата маска трябва да бъде между {{ min }} и {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.bs.xlf b/vendor/symfony/validator/Resources/translations/validators.bs.xlf new file mode 100644 index 0000000..43102cc --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.bs.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Ova vrijednost bi trebalo da bude "netačno" (false). + + + This value should be true. + Ova vrijednost bi trebalo da bude "tačno" (true). + + + This value should be of type {{ type }}. + Ova vrijednost bi trebalo da bude tipa {{ type }}. + + + This value should be blank. + Ova vrijednost bi trebalo da bude prazna. + + + The value you selected is not a valid choice. + Odabrana vrijednost nije validan izbor. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Morate odabrati barem {{ limit }} mogućnost.|Morate odabrati barem {{ limit }} mogućnosti.|Morate odabrati barem {{ limit }} mogućnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.|Morate odabrati najviše {{ limit }} mogućnosti. + + + One or more of the given values is invalid. + Jedna ili više datih vrijednosti nisu validne. + + + This field was not expected. + Ovo polje nije očekivano. + + + This field is missing. + Ovo polje nedostaje. + + + This value is not a valid date. + Ova vrijednost nije ispravan datum. + + + This value is not a valid datetime. + Ova vrijednost nije ispravnog datum-vrijeme (datetime) formata. + + + This value is not a valid email address. + Ova vrijednost nije ispravna e-mail adresa. + + + The file could not be found. + Ova datoteka ne može biti pronađena. + + + The file is not readable. + Ova datoteka nije čitljiva. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Ova datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke nije ispravan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}. + + + This value should be {{ limit }} or less. + Ova vrijednost bi trebalo da bude {{ limit }} ili manje. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.|Ova vrijednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje. + + + This value should be {{ limit }} or more. + Ova vrijednost bi trebalo da bude {{ limit }} ili više. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.|Ova vrijednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više. + + + This value should not be blank. + Ova vrijednost ne bi trebalo da bude prazna. + + + This value should not be null. + Ova vrijednost ne bi trebalo da bude null. + + + This value should be null. + Ova vrijednost bi trebalo da bude null. + + + This value is not valid. + Ova vrijednost nije ispravna. + + + This value is not a valid time. + Ova vrijednost nije ispravno vrijeme. + + + This value is not a valid URL. + Ova vrijednost nije ispravan URL. + + + The two values should be equal. + Obje vrijednosti bi trebalo da budu jednake. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ova datoteka je prevelika. Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The file is too large. + Ova datoteka je prevelika. + + + The file could not be uploaded. + Ova datoteka ne može biti prenijeta (uploaded). + + + This value should be a valid number. + Ova vrijednost bi trebalo da bude ispravan broj. + + + This file is not a valid image. + Ova datoteka nije validna slika. + + + This is not a valid IP address. + Ovo nije ispravna IP adresa. + + + This value is not a valid language. + Ova vrijednost nije validan jezik. + + + This value is not a valid locale. + Ova vrijednost nije validna regionalna oznaka. + + + This value is not a valid country. + Ova vrijednost nije validna država. + + + This value is already used. + Ova vrijednost je već upotrebljena. + + + The size of the image could not be detected. + Nije moguće otkriti veličinu ove slike. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina slike je prevelika ({{ width }}px). Najveća dozvoljena širina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina slike je premala ({{ width }}px). Najmanja dozvoljena širina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Dužina slike je prevelika ({{ height }}px). Najveća dozvoljena dužina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Dužina slike je premala ({{ height }}px). Najmanja dozvoljena dužina je {{ min_height }}px. + + + This value should be the user's current password. + Ova vrijednost bi trebalo da bude trenutna korisnička lozinka. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ova vrijednost bi trebalo da ima tačno {{ limit }} karakter.|Ova vrijednost bi trebalo da ima tačno {{ limit }} karaktera. + + + The file was only partially uploaded. + Datoteka je samo djelimično prenijeta (uploaded). + + + No file was uploaded. + Nijedna datoteka nije prenijeta (uploaded). + + + No temporary folder was configured in php.ini. + Privremeni direktorijum nije konfigurisan u datoteci php.ini. + + + Cannot write temporary file to disk. + Privremenu datoteku nije moguće upisati na disk. + + + A PHP extension caused the upload to fail. + Prenos datoteke nije uspio zbog PHP ekstenzije. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elementa.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata. + + + Invalid card number. + Broj kartice je neispravan. + + + Unsupported card type or invalid card number. + Tip kartice nije podržan ili je broj kartice neispravan. + + + This is not a valid International Bank Account Number (IBAN). + Ova vrijednost nije ispravan međunarodni broj bankovnog računa (IBAN). + + + This value is not a valid ISBN-10. + Ova vrijednost nije ispravan ISBN-10. + + + This value is not a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-10 niti ISBN-13. + + + This value is not a valid ISSN. + Ova vrijednost nije ispravan ISSN. + + + This value is not a valid currency. + Ova vrijednost nije ispravna valuta. + + + This value should be equal to {{ compared_value }}. + Ova vrijednost bi trebalo da bude jednaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ova vrijednost bi trebalo da bude veća od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ova vrijednost bi trebalo da bude jednaka ili veća od {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost bi trebalo da bude identična {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ova vrijednost bi trebalo da bude manja od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ova vrijednost bi trebalo da bude jednaka ili manja od {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ova vrijednost bi trebalo da bude različita od {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost bi trebalo da bude identična sa {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmjera ove slike je prevelika ({{ ratio }}). Maksimalna dozvoljena razmjera je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmjera ove slike je premala ({{ ratio }}). Minimalna očekivana razmjera je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Ova slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Ova slika je orijentisana horizontalno (landscape) ({{ width }}x{{ height }}px). Horizontalno orijentisane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Ova slika je orijentisana vertikalno (portrait) ({{ width }}x{{ height }}px). Vertikalno orijentisane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Nije moguće odrediti poslužitelja (host). + + + This value does not match the expected {{ charset }} charset. + Ova vrijednost ne odgovara očekivanom {{ charset }} setu karaktera (charset). + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan poslovni identifikacioni kod (BIC). + + + Error + Greška + + + This is not a valid UUID. + Ovo nije validan UUID. + + + This value should be a multiple of {{ compared_value }}. + Ova vrijednost bi trebalo da bude djeljiva sa {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ovaj poslovni identifikacioni kod (BIC) nije povezan sa IBAN-om {{ iban }}. + + + This value should be valid JSON. + Ova vrijednost bi trebalo da bude validan JSON. + + + This collection should contain only unique elements. + Ova kolekcija bi trebala da sadrži samo jedinstvene elemente. + + + This value should be positive. + Ova vrijednost bi trebalo da bude pozitivna. + + + This value should be either positive or zero. + Ova vrijednost bi trebalo da bude pozitivna ili jednaka nuli. + + + This value should be negative. + Ova vrijednost bi trebalo da bude negativna. + + + This value should be either negative or zero. + Ova vrijednost bi trebalo da bude negativna ili jednaka nuli. + + + This value is not a valid timezone. + Ova vrijednost nije validna vremenska zona. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ova lozinka je procurila u nekom od slučajeva kompromitovanja podataka, nemojte je koristiti. Koristite drugu lozinku. + + + This value should be between {{ min }} and {{ max }}. + Ova vrijednosti bi trebala biti između {{ min }} i {{ max }}. + + + This value is not a valid hostname. + Ova vrijednost nije ispravno ime poslužitelja (hostname). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Broj elemenata u ovoj kolekciji bi trebalo da bude djeljiv sa {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ova vrijednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja: + + + Each element of this collection should satisfy its own set of constraints. + Svaki element ove kolekcije bi trebalo da zadovolji sopstveni skup ograničenja. + + + This value is not a valid International Securities Identification Number (ISIN). + Ova vrijednost nije ispravna međunarodna identifikaciona oznaka hartija od vrijednosti (ISIN). + + + This value should be a valid expression. + Ova vrijednost bi trebala biti važeći izraz. + + + This value is not a valid CSS color. + Ova vrijednost nije važeća CSS boja. + + + This value is not a valid CIDR notation. + Ova vrijednost nije važeća CIDR notacija. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Vrijednost NetMask bi trebala biti između {{min}} i {{max}}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.ca.xlf b/vendor/symfony/validator/Resources/translations/validators.ca.xlf new file mode 100644 index 0000000..04f3e9a --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.ca.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Aquest valor hauria de ser fals. + + + This value should be true. + Aquest valor hauria de ser cert. + + + This value should be of type {{ type }}. + Aquest valor hauria de ser del tipus {{ type }}. + + + This value should be blank. + Aquest valor hauria d'estar buit. + + + The value you selected is not a valid choice. + El valor seleccionat no és una opció vàlida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ha de seleccionar almenys {{ limit }} opció.|Ha de seleccionar almenys {{ limit }} opcions. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ha de seleccionar com a màxim {{ limit }} opció.|Ha de seleccionar com a màxim {{ limit }} opcions. + + + One or more of the given values is invalid. + Un o més dels valors facilitats són incorrectes. + + + This field was not expected. + Aquest camp no s'esperava. + + + This field is missing. + Aquest camp està desaparegut. + + + This value is not a valid date. + Aquest valor no és una data vàlida. + + + This value is not a valid datetime. + Aquest valor no és una data i hora vàlida. + + + This value is not a valid email address. + Aquest valor no és una adreça d'email vàlida. + + + The file could not be found. + No s'ha pogut trobar l'arxiu. + + + The file is not readable. + No es pot llegir l'arxiu. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + L'arxiu és massa gran ({{ size }} {{ suffix }}). La grandària màxima permesa és {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + El tipus mime de l'arxiu no és vàlid ({{ type }}). Els tipus mime vàlids són {{ types }}. + + + This value should be {{ limit }} or less. + Aquest valor hauria de ser {{ limit }} o menys. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Aquest valor és massa llarg. Hauria de tenir {{ limit }} caràcter o menys.|Aquest valor és massa llarg. Hauria de tenir {{ limit }} caràcters o menys. + + + This value should be {{ limit }} or more. + Aquest valor hauria de ser {{ limit }} o més. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Aquest valor és massa curt. Hauria de tenir {{ limit }} caràcters o més. + + + This value should not be blank. + Aquest valor no hauria d'estar buit. + + + This value should not be null. + Aquest valor no hauria de ser null. + + + This value should be null. + Aquest valor hauria de ser null. + + + This value is not valid. + Aquest valor no és vàlid. + + + This value is not a valid time. + Aquest valor no és una hora vàlida. + + + This value is not a valid URL. + Aquest valor no és una URL vàlida. + + + The two values should be equal. + Els dos valors haurien de ser iguals. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + L'arxiu és massa gran. El tamany màxim permés és {{ limit }} {{ suffix }}. + + + The file is too large. + L'arxiu és massa gran. + + + The file could not be uploaded. + No es pot pujar l'arxiu. + + + This value should be a valid number. + Aquest valor hauria de ser un nombre vàlid. + + + This file is not a valid image. + L'arxiu no és una imatge vàlida. + + + This is not a valid IP address. + Això no és una adreça IP vàlida. + + + This value is not a valid language. + Aquest valor no és un idioma vàlid. + + + This value is not a valid locale. + Aquest valor no és una localització vàlida. + + + This value is not a valid country. + Aquest valor no és un país vàlid. + + + This value is already used. + Aquest valor ja s'ha utilitzat. + + + The size of the image could not be detected. + No s'ha pogut determinar la grandària de la imatge. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + L'amplària de la imatge és massa gran ({{ width }}px). L'amplària màxima permesa són {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + L'amplària de la imatge és massa petita ({{ width }}px). L'amplària mínima requerida són {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altura de la imatge és massa gran ({{ height }}px). L'altura màxima permesa són {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altura de la imatge és massa petita ({{ height }}px). L'altura mínima requerida són {{ min_height }}px. + + + This value should be the user's current password. + Aquest valor hauria de ser la contrasenya actual de l'usuari. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Aquest valor hauria de tenir exactament {{ limit }} caràcter.|Aquest valor hauria de tenir exactament {{ limit }} caràcters. + + + The file was only partially uploaded. + L'arxiu va ser només pujat parcialment. + + + No file was uploaded. + Cap arxiu va ser pujat. + + + No temporary folder was configured in php.ini. + Cap carpeta temporal va ser configurada en php.ini. + + + Cannot write temporary file to disk. + No es va poder escriure l'arxiu temporal en el disc. + + + A PHP extension caused the upload to fail. + Una extensió de PHP va fer que la pujada fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Aquesta col·lecció ha de contenir {{ limit }} element o més.|Aquesta col·lecció ha de contenir {{ limit }} elements o més. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Aquesta col·lecció ha de contenir {{ limit }} element o menys.|Aquesta col·lecció ha de contenir {{ limit }} elements o menys. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Aquesta col·lecció ha de contenir exactament {{ limit }} element.|Aquesta col·lecció ha de contenir exactament {{ limit }} elements. + + + Invalid card number. + Número de targeta invàlid. + + + Unsupported card type or invalid card number. + Tipus de targeta no suportada o número de targeta invàlid. + + + This is not a valid International Bank Account Number (IBAN). + Això no és un nombre de compte bancari internacional (IBAN) vàlid. + + + This value is not a valid ISBN-10. + Aquest valor no és un ISBN-10 vàlid. + + + This value is not a valid ISBN-13. + Aquest valor no és un ISBN-13 vàlid. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Aquest valor no és ni un ISBN-10 vàlid ni un ISBN-13 vàlid. + + + This value is not a valid ISSN. + Aquest valor no és un ISSN vàlid. + + + This value is not a valid currency. + Aquest valor no és una divisa vàlida. + + + This value should be equal to {{ compared_value }}. + Aquest valor hauria de ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Aquest valor hauria de ser més gran a {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Aquest valor hauria de ser major o igual a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Aquest valor hauria de ser idèntic a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Aquest valor hauria de ser menor a {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Aquest valor hauria de ser menor o igual a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Aquest valor no hauria de ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Aquest valor no hauria de idèntic a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La proporció de l'imatge és massa gran ({{ ratio }}). La màxima proporció permesa és {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La proporció de l'imatge és massa petita ({{ ratio }}). La mínima proporció permesa és {{ max_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'imatge és quadrada({{ width }}x{{ height }}px). Les imatges quadrades no estan permeses. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'imatge està orientada horitzontalment ({{ width }}x{{ height }}px). Les imatges orientades horitzontalment no estan permeses. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'imatge està orientada verticalment ({{ width }}x{{ height }}px). Les imatges orientades verticalment no estan permeses. + + + An empty file is not allowed. + No està permès un fixter buit. + + + The host could not be resolved. + No s'ha pogut resoldre l'amfitrió. + + + This value does not match the expected {{ charset }} charset. + Aquest valor no coincideix amb l'esperat {{ charset }} joc de caràcters. + + + This is not a valid Business Identifier Code (BIC). + Aquest no és un codi d'identificació bancari (BIC) vàlid. + + + Error + Error + + + This is not a valid UUID. + Aquest valor no és un UUID vàlid. + + + This value should be a multiple of {{ compared_value }}. + Aquest valor ha de ser múltiple de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Aquest Codi d'identificació bancari (BIC) no està associat amb l'IBAN {{ iban }}. + + + This value should be valid JSON. + Aquest valor hauria de ser un JSON vàlid. + + + This collection should contain only unique elements. + Aquesta col·lecció només hauria de contenir elements únics. + + + This value should be positive. + Aquest valor hauria de ser positiu. + + + This value should be either positive or zero. + Aquest valor ha de ser positiu o zero. + + + This value should be negative. + Aquest valor ha de ser negatiu. + + + This value should be either negative or zero. + Aquest valor ha de ser negatiu o zero. + + + This value is not a valid timezone. + Aquest valor no és una zona horària vàlida. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Aquesta contrasenya s'ha filtrat en cas de violació de dades, no s'ha d'utilitzar. Utilitzeu una altra contrasenya. + + + This value should be between {{ min }} and {{ max }}. + Aquest valor ha d'estar entre {{ min }} i {{ max }}. + + + This value is not a valid hostname. + Aquest valor no és un nom d'amfitrió vàlid. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + El nombre d'elements d'aquesta col·lecció ha de ser múltiple de {{compared_value}}. + + + This value should satisfy at least one of the following constraints: + Aquest valor ha de satisfer almenys una de les restriccions següents: + + + Each element of this collection should satisfy its own set of constraints. + Cada element d'aquesta col·lecció hauria de satisfer el seu propi conjunt de restriccions. + + + This value is not a valid International Securities Identification Number (ISIN). + Aquest valor no és un número d'identificació de valors internacionals (ISIN) vàlid. + + + This value should be a valid expression. + Aquest valor hauria de ser una expressió vàlida. + + + This value is not a valid CSS color. + Aquest valor no és un color CSS vàlid. + + + This value is not a valid CIDR notation. + Aquest valor no és una notació CIDR vàlida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + El valor de la màscara de xarxa hauria d'estar entre {{ min }} i {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.cs.xlf b/vendor/symfony/validator/Resources/translations/validators.cs.xlf new file mode 100644 index 0000000..7541019 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.cs.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Tato hodnota musí být nepravdivá (false). + + + This value should be true. + Tato hodnota musí být pravdivá (true). + + + This value should be of type {{ type }}. + Tato hodnota musí být typu {{ type }}. + + + This value should be blank. + Tato hodnota musí být prázdná. + + + The value you selected is not a valid choice. + Vybraná hodnota není platnou možností. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Musí být vybrána nejméně {{ limit }} možnost.|Musí být vybrány nejméně {{ limit }} možnosti.|Musí být vybráno nejméně {{ limit }} možností. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Musí být vybrána maximálně {{ limit }} možnost.|Musí být vybrány maximálně {{ limit }} možnosti.|Musí být vybráno maximálně {{ limit }} možností. + + + One or more of the given values is invalid. + Některé z uvedených hodnot jsou neplatné. + + + This field was not expected. + Toto pole nebylo očekáváno. + + + This field is missing. + Toto pole chybí. + + + This value is not a valid date. + Tato hodnota není platné datum. + + + This value is not a valid datetime. + Tato hodnota není platné datum s časovým údajem. + + + This value is not a valid email address. + Tato hodnota není platná e-mailová adresa. + + + The file could not be found. + Soubor nebyl nalezen. + + + The file is not readable. + Soubor je nečitelný. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Soubor je příliš velký ({{ size }} {{ suffix }}). Maximální povolená velikost souboru je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Neplatný mime typ souboru ({{ type }}). Povolené mime typy souborů jsou {{ types }}. + + + This value should be {{ limit }} or less. + Tato hodnota musí být {{ limit }} nebo méně. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Tato hodnota je příliš dlouhá. Musí obsahovat maximálně {{ limit }} znak.|Tato hodnota je příliš dlouhá. Musí obsahovat maximálně {{ limit }} znaky.|Tato hodnota je příliš dlouhá. Musí obsahovat maximálně {{ limit }} znaků. + + + This value should be {{ limit }} or more. + Tato hodnota musí být {{ limit }} nebo více. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Tato hodnota je příliš krátká. Musí obsahovat minimálně {{ limit }} znak.|Tato hodnota je příliš krátká. Musí obsahovat minimálně {{ limit }} znaky.|Tato hodnota je příliš krátká. Musí obsahovat minimálně {{ limit }} znaků. + + + This value should not be blank. + Tato hodnota nesmí být prázdná. + + + This value should not be null. + Tato hodnota nesmí být null. + + + This value should be null. + Tato hodnota musí být null. + + + This value is not valid. + Tato hodnota není platná. + + + This value is not a valid time. + Tato hodnota není platný časový údaj. + + + This value is not a valid URL. + Tato hodnota není platná URL adresa. + + + The two values should be equal. + Tyto dvě hodnoty musí být stejné. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Soubor je příliš velký. Maximální povolená velikost souboru je {{ limit }} {{ suffix }}. + + + The file is too large. + Soubor je příliš velký. + + + The file could not be uploaded. + Soubor se nepodařilo nahrát. + + + This value should be a valid number. + Tato hodnota musí být číslo. + + + This file is not a valid image. + Tento soubor není obrázek. + + + This is not a valid IP address. + Toto není platná IP adresa. + + + This value is not a valid language. + Tento jazyk neexistuje. + + + This value is not a valid locale. + Tato lokalizace neexistuje. + + + This value is not a valid country. + Tato země neexistuje. + + + This value is already used. + Tato hodnota je již používána. + + + The size of the image could not be detected. + Nepodařily se zjistit rozměry obrázku. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Obrázek je příliš široký ({{ width }}px). Maximální povolená šířka obrázku je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Obrázek je příliš úzký ({{ width }}px). Minimální šířka musí být {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Obrázek je příliš vysoký ({{ height }}px). Maximální povolená výška obrázku je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Obrázek je příliš nízký ({{ height }}px). Minimální výška obrázku musí být {{ min_height }}px. + + + This value should be the user's current password. + Tato hodnota musí být aktuální heslo uživatele. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Tato hodnota musí mít přesně {{ limit }} znak.|Tato hodnota musí mít přesně {{ limit }} znaky.|Tato hodnota musí mít přesně {{ limit }} znaků. + + + The file was only partially uploaded. + Byla nahrána jen část souboru. + + + No file was uploaded. + Žádný soubor nebyl nahrán. + + + No temporary folder was configured in php.ini. + V php.ini není nastavena cesta k adresáři pro dočasné soubory. + + + Cannot write temporary file to disk. + Dočasný soubor se nepodařilo zapsat na disk. + + + A PHP extension caused the upload to fail. + Rozšíření PHP zabránilo nahrání souboru. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Tato kolekce musí obsahovat minimálně {{ limit }} prvek.|Tato kolekce musí obsahovat minimálně {{ limit }} prvky.|Tato kolekce musí obsahovat minimálně {{ limit }} prvků. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Tato kolekce musí obsahovat maximálně {{ limit }} prvek.|Tato kolekce musí obsahovat maximálně {{ limit }} prvky.|Tato kolekce musí obsahovat maximálně {{ limit }} prvků. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Tato kolekce musí obsahovat přesně {{ limit }} prvek.|Tato kolekce musí obsahovat přesně {{ limit }} prvky.|Tato kolekce musí obsahovat přesně {{ limit }} prvků. + + + Invalid card number. + Neplatné číslo karty. + + + Unsupported card type or invalid card number. + Nepodporovaný typ karty nebo neplatné číslo karty. + + + This is not a valid International Bank Account Number (IBAN). + Toto je neplatný IBAN. + + + This value is not a valid ISBN-10. + Tato hodnota není platné ISBN-10. + + + This value is not a valid ISBN-13. + Tato hodnota není platné ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Tato hodnota není platné ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Tato hodnota není platné ISSN. + + + This value is not a valid currency. + Tato měna neexistuje. + + + This value should be equal to {{ compared_value }}. + Tato hodnota musí být rovna {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Tato hodnota musí být větší než {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Tato hodnota musí být větší nebo rovna {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Tato hodnota musí být typu {{ compared_value_type }} a zároveň musí být rovna {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Tato hodnota musí být menší než {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Tato hodnota musí být menší nebo rovna {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Tato hodnota nesmí být rovna {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Tato hodnota nesmí být typu {{ compared_value_type }} a zároveň nesmí být rovna {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Poměr stran obrázku je příliš velký ({{ ratio }}). Maximální povolený poměr stran obrázku je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Poměr stran obrázku je příliš malý ({{ ratio }}). Minimální povolený poměr stran obrázku je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Strany obrázku jsou čtvercové ({{ width }}x{{ height }}px). Čtvercové obrázky nejsou povolené. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obrázek je orientovaný na šířku ({{ width }}x{{ height }}px). Obrázky orientované na šířku nejsou povolené. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obrázek je orientovaný na výšku ({{ width }}x{{ height }}px). Obrázky orientované na výšku nejsou povolené. + + + An empty file is not allowed. + Soubor nesmí být prázdný. + + + The host could not be resolved. + Hostitele nebylo možné rozpoznat. + + + This value does not match the expected {{ charset }} charset. + Tato hodnota neodpovídá očekávané znakové sadě {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Tato hodnota není platný identifikační kód podniku (BIC). + + + Error + Chyba + + + This is not a valid UUID. + Tato hodnota není platné UUID. + + + This value should be a multiple of {{ compared_value }}. + Tato hodnota musí být násobek hodnoty {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Bankovní identifikační kód (BIC) neodpovídá mezinárodnímu číslu účtu (IBAN) {{ iban }}. + + + This value should be valid JSON. + Tato hodnota musí být validní JSON. + + + This collection should contain only unique elements. + Tato kolekce musí obsahovat pouze unikátní prvky. + + + This value should be positive. + Tato hodnota musí být kladná. + + + This value should be either positive or zero. + Tato hodnota musí být buď kladná nebo nula. + + + This value should be negative. + Tato hodnota musí být záporná. + + + This value should be either negative or zero. + Tato hodnota musí být buď záporná nebo nula. + + + This value is not a valid timezone. + Tato časová zóna neexistuje. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Zadané heslo bylo součástí úniku dat, takže ho není možné použít. Použijte prosím jiné heslo. + + + This value should be between {{ min }} and {{ max }}. + Hodnota musí být mezi {{ min }} a {{ max }}. + + + This value is not a valid hostname. + Tato hodnota není platný hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Počet prvků v této kolekci musí být násobek {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Tato hodnota musí splňovat alespoň jedno z následujících omezení: + + + Each element of this collection should satisfy its own set of constraints. + Každý prvek v této kolekci musí splňovat svá vlastní omezení. + + + This value is not a valid International Securities Identification Number (ISIN). + Tato hodnota není platné mezinárodní identifikační číslo cenného papíru (ISIN). + + + This value should be a valid expression. + Tato hodnota musí být platný výraz. + + + This value is not a valid CSS color. + Tato hodnota není platná barva CSS. + + + This value is not a valid CIDR notation. + Tato hodnota není platná notace CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Hodnota masky sítě musí být mezi {{ min }} a {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.cy.xlf b/vendor/symfony/validator/Resources/translations/validators.cy.xlf new file mode 100644 index 0000000..752b6c2 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.cy.xlf @@ -0,0 +1,335 @@ + + + + + + This value should be false. + Dylid bod y gwerth hwn yn ffug. + + + This value should be true. + Dylid bod y gwerth hwn yn wir. + + + This value should be of type {{ type }}. + Dylid bod y gwerth hwn bod o fath {{ type }}. + + + This value should be blank. + Dylid bod y gwerth hwn yn wag. + + + The value you selected is not a valid choice. + Nid yw'r gwerth â ddewiswyd yn ddilys. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Rhaid dewis o leiaf {{ limit }} opsiwn. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Rhaid dewis dim mwy na {{ limit }} opsiwn. + + + One or more of the given values is invalid. + Mae un neu fwy o'r gwerthoedd a roddwyd yn annilys. + + + This field was not expected. + Nid oedd disgwyl y maes hwn. + + + This field is missing. + Mae'r maes hwn ar goll. + + + This value is not a valid date. + Nid yw'r gwerth yn ddyddiad dilys. + + + This value is not a valid datetime. + Nid yw'r gwerth yn datetime dilys. + + + This value is not a valid email address. + Nid yw'r gwerth yn gyfeiriad ebost dilys. + + + The file could not be found. + Ni ddarganfyddwyd y ffeil. + + + The file is not readable. + Ni ellir darllen y ffeil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Mae'r ffeil yn rhy fawr ({{ size }} {{ suffix }}). Yr uchafswm â ganiateir yw {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Nid yw math mime y ffeil yn ddilys ({{ type }}). Dyma'r mathau â ganiateir {{ types }}. + + + This value should be {{ limit }} or less. + Dylai'r gwerth hwn fod yn {{ limit }} neu lai. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Mae'r gwerth hwn rhy hir. Dylai gynnwys {{ limit }} nodyn cyfrifiadurol neu lai. + + + This value should be {{ limit }} or more. + Dylai'r gwerth hwn fod yn {{ limit }} neu fwy. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Mae'r gwerth hwn yn rhy fyr. Dylai gynnwys {{ limit }} nodyn cyfrifiadurol neu fwy. + + + This value should not be blank. + Ni ddylai'r gwerth hwn fod yn wag. + + + This value should not be null. + Ni ddylai'r gwerth hwn fod yn null. + + + This value should be null. + Dylai'r gwerth fod yn null. + + + This value is not valid. + Nid yw'r gwerth hwn yn ddilys. + + + This value is not a valid time. + Nid yw'r gwerth hwn yn amser dilys. + + + This value is not a valid URL. + Nid yw'r gwerth hwn yn URL dilys. + + + The two values should be equal. + Rhaid i'r ddau werth fod yn gyfystyr a'u gilydd. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Mae'r ffeil yn rhy fawr. Yr uchafswm â ganiateir yw {{ limit }} {{ suffix }}. + + + The file is too large. + Mae'r ffeil yn rhy fawr. + + + The file could not be uploaded. + Methwyd ag uwchlwytho'r ffeil. + + + This value should be a valid number. + Dylai'r gwerth hwn fod yn rif dilys. + + + This file is not a valid image. + Nid yw'r ffeil hon yn ddelwedd dilys. + + + This is not a valid IP address. + Nid yw hwn yn gyfeiriad IP dilys. + + + This value is not a valid language. + Nid yw'r gwerth hwn yn iaith ddilys. + + + This value is not a valid locale. + Nid yw'r gwerth hwn yn locale dilys. + + + This value is not a valid country. + Nid yw'r gwerth hwn yn wlad dilys. + + + This value is already used. + Mae'r gwerth hwn eisoes yn cael ei ddefnyddio. + + + The size of the image could not be detected. + Methwyd â darganfod maint y ddelwedd. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Mae lled y ddelwedd yn rhy fawr ({{ width }}px). Y lled mwyaf â ganiateir yw {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Mae lled y ddelwedd yn rhy fach ({{ width }}px). Y lled lleiaf â ganiateir yw {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Mae uchder y ddelwedd yn rhy fawr ({{ width }}px). Yr uchder mwyaf â ganiateir yw {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Mae uchder y ddelwedd yn rhy fach ({{ width }}px). Yr uchder lleiaf â ganiateir yw {{ min_height }}px. + + + This value should be the user's current password. + Dylaid bod y gwerth hwn yn gyfrinair presenol y defnyddiwr. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dylai'r gwerth hwn fod yn union {{ limit }} nodyn cyfrifiadurol o hyd. + + + The file was only partially uploaded. + Dim ond rhan o'r ffeil ag uwchlwythwyd. + + + No file was uploaded. + Ni uwchlwythwyd unrhyw ffeil. + + + No temporary folder was configured in php.ini. + Nid oes ffolder dros-dro wedi'i gosod yn php.ini. + + + Cannot write temporary file to disk. + Methwyd ag ysgrifennu'r ffeil dros-dro ar ddisg. + + + A PHP extension caused the upload to fail. + Methwyd ag uwchlwytho oherwydd ategyn PHP. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Dylai'r casgliad hwn gynnwys {{ limit }} elfen neu fwy. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Dylai'r casgliad hwn gynnwys {{ limit }} elfen neu lai. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Dylai'r casgliad hwn gynnwys union {{ limit }} elfen. + + + Invalid card number. + Nid oedd rhif y cerdyn yn ddilys. + + + Unsupported card type or invalid card number. + Unai ni dderbynir y math yna o gerdyn, neu nid yw rhif y cerdyn yn ddilys. + + + This is not a valid International Bank Account Number (IBAN). + Nid yw hwn yn Rhif Cyfrif Banc Rhyngwladol (IBAN) dilys. + + + This value is not a valid ISBN-10. + Nid yw'r gwerth hwn yn ISBN-10 dilys. + + + This value is not a valid ISBN-13. + Nid yw'r gwerth hwn yn ISBN-13 dilys. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Nid yw'r gwerth hwn yn Rhif ISBN-10 dilys nac yn ISBN-13 dilys. + + + This value is not a valid ISSN. + Nid yw'r gwerth hwn yn ISSN dilys. + + + This value is not a valid currency. + Nid yw'r gwerth hwn yn arian dilys. + + + This value should be equal to {{ compared_value }}. + Dylai'r gwerth hwn fod yn gyfartal â {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Dylai'r gwerth hwn fod yn fwy na {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Dylai'r gwerth hwn fod yn fwy na neu'n hafal i {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Dylai'r gwerth hwn fod yn union yr un fath â {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Dylai'r gwerth hwn fod yn llai na {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Dylai'r gwerth hwn fod yn llai na neu'n hafal i {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ni ddylai'r gwerth hwn fod yn hafal i {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ni ddylai'r gwerth hwn fod yn union yr un fath â {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Mae'r gymhareb delwedd yn rhy fawr ({{ ratio }}). Y gymhareb uchaf a ganiateir yw {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Mae'r gymhareb delwedd yn rhy fach ({{ ratio }}). Y gymhareb isaf a ddisgwylir yw {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Mae'r ddelwedd yn sgwâr ({{ width }}x{{ height }}px). Ni chaniateir delweddau sgwâr. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Mae'r ddelwedd mewn fformat tirlun ({{ width }}x{{ height }}px). Ni chaniateir delweddau mewn fformat tirlun. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Mae'r ddelwedd mewn fformat portread ({{ width }}x{{ height }}px). Ni chaniateir delweddau mewn fformat portread. + + + An empty file is not allowed. + Ni chaniateir ffeil wag. + + + The host could not be resolved. + Ni fu modd datrys y gwesteiwr. + + + This value does not match the expected {{ charset }} charset. + Nid yw'r gwerth hwn yn cyfateb â'r {{ charset }} set nodau ddisgwyliedig. + + + This is not a valid Business Identifier Code (BIC). + Nid yw hwn yn God Adnabod Busnes (BIC) dilys. + + + Error + Gwall + + + This is not a valid UUID. + Nid yw hyn yn UUID dilys. + + + This value should be a multiple of {{ compared_value }}. + Dylai'r gwerth hwn fod yn luosrif o {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Nid yw'r Cod Adnabod Busnes (BIC) hwn yn gysylltiedig ag IBAN {{ iban }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.da.xlf b/vendor/symfony/validator/Resources/translations/validators.da.xlf new file mode 100644 index 0000000..b76624e --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.da.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Værdien skal være falsk. + + + This value should be true. + Værdien skal være sand. + + + This value should be of type {{ type }}. + Værdien skal være af typen {{ type }}. + + + This value should be blank. + Værdien skal være blank. + + + The value you selected is not a valid choice. + Den valgte værdi er ikke gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du skal vælge mindst én mulighed.|Du skal vælge mindst {{ limit }} muligheder. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan højst vælge én mulighed.|Du kan højst vælge {{ limit }} muligheder. + + + One or more of the given values is invalid. + En eller flere af de angivne værdier er ugyldige. + + + This field was not expected. + Feltet blev ikke forventet. + + + This field is missing. + Dette felt mangler. + + + This value is not a valid date. + Værdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Værdien er ikke et gyldigt tidspunkt. + + + This value is not a valid email address. + Værdien er ikke en gyldig e-mailadresse. + + + The file could not be found. + Filen kunne ikke findes. + + + The file is not readable. + Filen kan ikke læses. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Maksimale tilladte størrelse er {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Filens MIME-type er ugyldig ({{ type }}). Tilladte MIME-typer er {{ types }}. + + + This value should be {{ limit }} or less. + Værdien skal være {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Værdien er for lang. Den må højst indeholde {{ limit }} tegn. + + + This value should be {{ limit }} or more. + Værdien skal være {{ limit }} eller mere. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Værdien er for kort. Den skal indeholde mindst {{ limit }} tegn. + + + This value should not be blank. + Værdien må ikke være blank. + + + This value should not be null. + Værdien må ikke være tom (null). + + + This value should be null. + Værdien skal være tom (null). + + + This value is not valid. + Værdien er ikke gyldig. + + + This value is not a valid time. + Værdien er ikke et gyldigt klokkeslæt. + + + This value is not a valid URL. + Værdien er ikke en gyldig URL. + + + The two values should be equal. + De to værdier skal være ens. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke uploades. + + + This value should be a valid number. + Værdien skal være et gyldigt tal. + + + This file is not a valid image. + Filen er ikke gyldigt billede. + + + This is not a valid IP address. + Dette er ikke en gyldig IP-adresse. + + + This value is not a valid language. + Værdien er ikke et gyldigt sprog. + + + This value is not a valid locale. + Værdien er ikke en gyldig lokalitet. + + + This value is not a valid country. + Værdien er ikke et gyldigt land. + + + This value is already used. + Værdien er allerede i brug. + + + The size of the image could not be detected. + Størrelsen på billedet kunne ikke detekteres. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Billedet er for bredt ({{ width }}px). Største tilladte bredde er {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Billedet er for smalt ({{ width }}px). Mindste forventede bredde er {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Billedet er for højt ({{ height }}px). Største tilladte højde er {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billedet er for lavt ({{ height }}px). Mindste forventede højde er {{ min_height }}px. + + + This value should be the user's current password. + Værdien skal være brugerens nuværende adgangskode. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Værdien skal være på præcis {{ limit }} tegn. + + + The file was only partially uploaded. + Filen blev kun delvist uploadet. + + + No file was uploaded. + Ingen fil blev uploadet. + + + No temporary folder was configured in php.ini. + Ingen midlertidig mappe er konfigureret i php.ini. + + + Cannot write temporary file to disk. + Kan ikke skrive midlertidig fil til disk. + + + A PHP extension caused the upload to fail. + En PHP-udvidelse forårsagede fejl i upload. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samling skal indeholde mindst ét element.|Denne samling skal indeholde mindst {{ limit }} elementer. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samling skal indeholde højst ét element.|Denne samling skal indeholde højst {{ limit }} elementer. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samling skal indeholde præcis ét element.|Denne samling skal indeholde præcis {{ limit }} elementer. + + + Invalid card number. + Ugyldigt kortnummer. + + + Unsupported card type or invalid card number. + Ikke-understøttet korttype eller ugyldigt kortnummer. + + + This is not a valid International Bank Account Number (IBAN). + Det er ikke et gyldigt International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + Værdien er ikke en gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Værdien er ikke en gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Værdien er hverken en gyldig ISBN-10 eller en gyldig ISBN-13. + + + This value is not a valid ISSN. + Værdien er ikke en gyldig ISSN. + + + This value is not a valid currency. + Denne værdi er ikke en gyldig valuta. + + + This value should be equal to {{ compared_value }}. + Denne værdi skal være lig med {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Denne værdi skal være større end {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Denne værdi skal være større end eller lig med {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Denne værdi skal være identisk med {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Denne værdi skal være mindre end {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Denne værdi skal være mindre end eller lig med {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Denne værdi bør ikke være lig med {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Denne værdi bør ikke være identisk med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Billedforholdet er for stort ({{ratio}}). Tilladt maksimumsforhold er {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Billedforholdet er for lille ({{ ratio }}). Minimumsforventet forventet er {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Billedet er firkantet ({{ width }} x {{ height }} px). Firkantede billeder er ikke tilladt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Billedet er landskabsorienteret ({{width}} x {{height}} px). Landskabsorienterede billeder er ikke tilladt + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Billedet er portrætorienteret ({{ width }}x{{ height }}px). Portrætorienterede billeder er ikke tilladt. + + + An empty file is not allowed. + En tom fil er ikke tilladt. + + + The host could not be resolved. + Værten kunne ikke løses. + + + This value does not match the expected {{ charset }} charset. + Denne værdi stemmer ikke overens med den forventede {{ charset }} charset. + + + This is not a valid Business Identifier Code (BIC). + Dette er ikke en gyldig Business Identifier Code (BIC).a + + + Error + Fejl + + + This is not a valid UUID. + Dette er ikke en gyldig UUID. + + + This value should be a multiple of {{ compared_value }}. + Denne værdi skal være et multiplikation af {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Denne Business Identifier Code (BIC) er ikke forbundet med IBAN {{ iban }}. + + + This value should be valid JSON. + Denne værdi skal være gyldig JSON. + + + This collection should contain only unique elements. + Denne samling bør kun indeholde unikke elementer. + + + This value should be positive. + Denne værdi skal være positiv. + + + This value should be either positive or zero. + Denne værdi skal være enten positiv eller nul. + + + This value should be negative. + Denne værdi skal være negativ. + + + This value should be either negative or zero. + Denne værdi skal være enten negativ eller nul. + + + This value is not a valid timezone. + Denne værdi er ikke en gyldig tidszone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Denne adgangskode er blevet lækket i et databrud, det må ikke bruges. Brug venligst en anden adgangskode. + + + This value should be between {{ min }} and {{ max }}. + Værdien skal være mellem {{ min }} og {{ max }}. + + + This value is not a valid hostname. + Værdien er ikke et gyldigt værtsnavn. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Antallet af elementer i denne samling skal være en multiplikation af {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Værdien skal overholde mindst én af følgende krav: + + + Each element of this collection should satisfy its own set of constraints. + Hvert element i denne samling skal overholde dens egne krav. + + + This value is not a valid International Securities Identification Number (ISIN). + Værdien er ikke et gyldig International Securities Identification Number (ISIN). + + + This value should be a valid expression. + Værdien skal være et gyldigt udtryk. + + + This value is not a valid CSS color. + Værdien skal være en gyldig CSS farve. + + + This value is not a valid CIDR notation. + Værdien er ikke en gyldig CIDR notation. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Værdien af netmasken skal være mellem {{ min }} og {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.de.xlf b/vendor/symfony/validator/Resources/translations/validators.de.xlf new file mode 100644 index 0000000..00be24f --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.de.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Dieser Wert sollte false sein. + + + This value should be true. + Dieser Wert sollte true sein. + + + This value should be of type {{ type }}. + Dieser Wert sollte vom Typ {{ type }} sein. + + + This value should be blank. + Dieser Wert sollte leer sein. + + + The value you selected is not a valid choice. + Sie haben einen ungültigen Wert ausgewählt. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Sie müssen mindestens {{ limit }} Möglichkeit wählen.|Sie müssen mindestens {{ limit }} Möglichkeiten wählen. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Sie dürfen höchstens {{ limit }} Möglichkeit wählen.|Sie dürfen höchstens {{ limit }} Möglichkeiten wählen. + + + One or more of the given values is invalid. + Einer oder mehrere der angegebenen Werte sind ungültig. + + + This field was not expected. + Dieses Feld wurde nicht erwartet. + + + This field is missing. + Dieses Feld fehlt. + + + This value is not a valid date. + Dieser Wert entspricht keiner gültigen Datumsangabe. + + + This value is not a valid datetime. + Dieser Wert entspricht keiner gültigen Datums- und Zeitangabe. + + + This value is not a valid email address. + Dieser Wert ist keine gültige E-Mail-Adresse. + + + The file could not be found. + Die Datei wurde nicht gefunden. + + + The file is not readable. + Die Datei ist nicht lesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Die Datei ist zu groß ({{ size }} {{ suffix }}). Die maximal zulässige Größe beträgt {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Der Dateityp ist ungültig ({{ type }}). Erlaubte Dateitypen sind {{ types }}. + + + This value should be {{ limit }} or less. + Dieser Wert sollte kleiner oder gleich {{ limit }} sein. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Diese Zeichenkette ist zu lang. Sie sollte höchstens {{ limit }} Zeichen haben.|Diese Zeichenkette ist zu lang. Sie sollte höchstens {{ limit }} Zeichen haben. + + + This value should be {{ limit }} or more. + Dieser Wert sollte größer oder gleich {{ limit }} sein. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Diese Zeichenkette ist zu kurz. Sie sollte mindestens {{ limit }} Zeichen haben.|Diese Zeichenkette ist zu kurz. Sie sollte mindestens {{ limit }} Zeichen haben. + + + This value should not be blank. + Dieser Wert sollte nicht leer sein. + + + This value should not be null. + Dieser Wert sollte nicht null sein. + + + This value should be null. + Dieser Wert sollte null sein. + + + This value is not valid. + Dieser Wert ist nicht gültig. + + + This value is not a valid time. + Dieser Wert entspricht keiner gültigen Zeitangabe. + + + This value is not a valid URL. + Dieser Wert ist keine gültige URL. + + + The two values should be equal. + Die beiden Werte sollten identisch sein. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Die Datei ist zu groß. Die maximal zulässige Größe beträgt {{ limit }} {{ suffix }}. + + + The file is too large. + Die Datei ist zu groß. + + + The file could not be uploaded. + Die Datei konnte nicht hochgeladen werden. + + + This value should be a valid number. + Dieser Wert sollte eine gültige Zahl sein. + + + This file is not a valid image. + Diese Datei ist kein gültiges Bild. + + + This is not a valid IP address. + Dies ist keine gültige IP-Adresse. + + + This value is not a valid language. + Dieser Wert entspricht keiner gültigen Sprache. + + + This value is not a valid locale. + Dieser Wert entspricht keinem gültigen Gebietsschema. + + + This value is not a valid country. + Dieser Wert entspricht keinem gültigen Land. + + + This value is already used. + Dieser Wert wird bereits verwendet. + + + The size of the image could not be detected. + Die Größe des Bildes konnte nicht ermittelt werden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Die Bildbreite ist zu groß ({{ width }}px). Die maximal zulässige Breite beträgt {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Die Bildbreite ist zu gering ({{ width }}px). Die erwartete Mindestbreite beträgt {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Die Bildhöhe ist zu groß ({{ height }}px). Die maximal zulässige Höhe beträgt {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Die Bildhöhe ist zu gering ({{ height }}px). Die erwartete Mindesthöhe beträgt {{ min_height }}px. + + + This value should be the user's current password. + Dieser Wert sollte dem aktuellen Benutzerpasswort entsprechen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dieser Wert sollte genau {{ limit }} Zeichen lang sein.|Dieser Wert sollte genau {{ limit }} Zeichen lang sein. + + + The file was only partially uploaded. + Die Datei wurde nur teilweise hochgeladen. + + + No file was uploaded. + Es wurde keine Datei hochgeladen. + + + No temporary folder was configured in php.ini. + Es wurde kein temporärer Ordner in der php.ini konfiguriert oder der temporäre Ordner existiert nicht. + + + Cannot write temporary file to disk. + Kann die temporäre Datei nicht speichern. + + + A PHP extension caused the upload to fail. + Eine PHP-Erweiterung verhinderte den Upload. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Diese Sammlung sollte {{ limit }} oder mehr Elemente beinhalten.|Diese Sammlung sollte {{ limit }} oder mehr Elemente beinhalten. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Diese Sammlung sollte {{ limit }} oder weniger Elemente beinhalten.|Diese Sammlung sollte {{ limit }} oder weniger Elemente beinhalten. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Diese Sammlung sollte genau {{ limit }} Element beinhalten.|Diese Sammlung sollte genau {{ limit }} Elemente beinhalten. + + + Invalid card number. + Ungültige Kartennummer. + + + Unsupported card type or invalid card number. + Nicht unterstützer Kartentyp oder ungültige Kartennummer. + + + This is not a valid International Bank Account Number (IBAN). + Dieser Wert ist keine gültige internationale Bankkontonummer (IBAN). + + + This value is not a valid ISBN-10. + Dieser Wert entspricht keiner gültigen ISBN-10. + + + This value is not a valid ISBN-13. + Dieser Wert entspricht keiner gültigen ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Dieser Wert ist weder eine gültige ISBN-10 noch eine gültige ISBN-13. + + + This value is not a valid ISSN. + Dieser Wert ist keine gültige ISSN. + + + This value is not a valid currency. + Dieser Wert ist keine gültige Währung. + + + This value should be equal to {{ compared_value }}. + Dieser Wert sollte gleich {{ compared_value }} sein. + + + This value should be greater than {{ compared_value }}. + Dieser Wert sollte größer als {{ compared_value }} sein. + + + This value should be greater than or equal to {{ compared_value }}. + Dieser Wert sollte größer oder gleich {{ compared_value }} sein. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Dieser Wert sollte identisch sein mit {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Dieser Wert sollte kleiner als {{ compared_value }} sein. + + + This value should be less than or equal to {{ compared_value }}. + Dieser Wert sollte kleiner oder gleich {{ compared_value }} sein. + + + This value should not be equal to {{ compared_value }}. + Dieser Wert sollte nicht {{ compared_value }} sein. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Dieser Wert sollte nicht identisch sein mit {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Das Seitenverhältnis des Bildes ist zu groß ({{ ratio }}). Der erlaubte Maximalwert ist {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Das Seitenverhältnis des Bildes ist zu klein ({{ ratio }}). Der erwartete Minimalwert ist {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Das Bild ist quadratisch ({{ width }}x{{ height }}px). Quadratische Bilder sind nicht erlaubt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Das Bild ist im Querformat ({{ width }}x{{ height }}px). Bilder im Querformat sind nicht erlaubt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Das Bild ist im Hochformat ({{ width }}x{{ height }}px). Bilder im Hochformat sind nicht erlaubt. + + + An empty file is not allowed. + Eine leere Datei ist nicht erlaubt. + + + The host could not be resolved. + Der Hostname konnte nicht aufgelöst werden. + + + This value does not match the expected {{ charset }} charset. + Dieser Wert entspricht nicht dem erwarteten Zeichensatz {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dieser Wert ist kein gültiger BIC. + + + Error + Fehler + + + This is not a valid UUID. + Dies ist keine gültige UUID. + + + This value should be a multiple of {{ compared_value }}. + Dieser Wert sollte ein Vielfaches von {{ compared_value }} sein. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Diese internationale Bankleitzahl (BIC) ist nicht mit der IBAN {{ iban }} assoziiert. + + + This value should be valid JSON. + Dieser Wert sollte gültiges JSON sein. + + + This collection should contain only unique elements. + Diese Sammlung darf keine doppelten Elemente enthalten. + + + This value should be positive. + Diese Zahl sollte positiv sein. + + + This value should be either positive or zero. + Diese Zahl sollte entweder positiv oder 0 sein. + + + This value should be negative. + Diese Zahl sollte negativ sein. + + + This value should be either negative or zero. + Diese Zahl sollte entweder negativ oder 0 sein. + + + This value is not a valid timezone. + Dieser Wert ist keine gültige Zeitzone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dieses Passwort ist Teil eines Datenlecks, es darf nicht verwendet werden. + + + This value should be between {{ min }} and {{ max }}. + Dieser Wert sollte zwischen {{ min }} und {{ max }} sein. + + + This value is not a valid hostname. + Dieser Wert ist kein gültiger Hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Die Anzahl an Elementen in dieser Sammlung sollte ein Vielfaches von {{ compared_value }} sein. + + + This value should satisfy at least one of the following constraints: + Dieser Wert sollte eine der folgenden Bedingungen erfüllen: + + + Each element of this collection should satisfy its own set of constraints. + Jedes Element dieser Sammlung sollte seine eigene Menge an Bedingungen erfüllen. + + + This value is not a valid International Securities Identification Number (ISIN). + Dieser Wert ist keine gültige Internationale Wertpapierkennnummer (ISIN). + + + This value should be a valid expression. + Dieser Wert sollte eine gültige Expression sein. + + + This value is not a valid CSS color. + Dieser Wert ist keine gültige CSS-Farbe. + + + This value is not a valid CIDR notation. + Dieser Wert entspricht nicht der CIDR-Notation. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Der Wert der Subnetzmaske sollte zwischen {{ min }} und {{ max }} liegen. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.el.xlf b/vendor/symfony/validator/Resources/translations/validators.el.xlf new file mode 100644 index 0000000..768986d --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.el.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Αυτή η τιμή πρέπει να είναι ψευδής. + + + This value should be true. + Αυτή η τιμή πρέπει να είναι αληθής. + + + This value should be of type {{ type }}. + Αυτή η τιμή πρέπει να είναι τύπου {{ type }}. + + + This value should be blank. + Αυτή η τιμή πρέπει να είναι κενή. + + + The value you selected is not a valid choice. + Η τιμή που επιλέχθηκε δεν αντιστοιχεί σε έγκυρη επιλογή. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Πρέπει να επιλέξτε τουλάχιστον {{ limit }} επιλογή.|Πρέπει να επιλέξτε τουλάχιστον {{ limit }} επιλογές. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Πρέπει να επιλέξτε το πολύ {{ limit }} επιλογή.|Πρέπει να επιλέξτε το πολύ {{ limit }} επιλογές. + + + One or more of the given values is invalid. + Μια ή περισσότερες τιμές δεν είναι έγκυρες. + + + This field was not expected. + Αυτό το πεδίο δεν ήταν αναμενόμενο. + + + This field is missing. + Λείπει αυτό το πεδίο. + + + This value is not a valid date. + Η τιμή δεν αντιστοιχεί σε έγκυρη ημερομηνία. + + + This value is not a valid datetime. + Η τιμή δεν αντιστοιχεί σε έγκυρη ημερομηνία και ώρα. + + + This value is not a valid email address. + Η τιμή δεν αντιστοιχεί σε έγκυρο email. + + + The file could not be found. + Το αρχείο δε μπορεί να βρεθεί. + + + The file is not readable. + Το αρχείο δεν είναι αναγνώσιμο. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Το αρχείο είναι πολύ μεγάλο ({{ size }} {{ suffix }}). Το μέγιστο επιτρεπτό μέγεθος είναι {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Ο τύπος mime του αρχείου δεν είναι έγκυρος ({{ type }}). Οι έγκυροι τύποι mime είναι {{ types }}. + + + This value should be {{ limit }} or less. + Αυτή η τιμή θα έπρεπε να είναι {{ limit }} ή λιγότερο. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Αυτή η τιμή είναι πολύ μεγάλη. Θα έπρεπε να έχει {{ limit }} χαρακτήρα ή λιγότερο.|Αυτή η τιμή είναι πολύ μεγάλη. Θα έπρεπε να έχει {{ limit }} χαρακτήρες ή λιγότερο. + + + This value should be {{ limit }} or more. + Αυτή η τιμή θα έπρεπε να είναι {{ limit }} ή περισσότερο. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Αυτή η τιμή είναι πολύ μικρή. Θα έπρεπε να έχει {{ limit }} χαρακτήρα ή περισσότερο.|Αυτή η τιμή είναι πολύ μικρή. Θα έπρεπε να έχει {{ limit }} χαρακτήρες ή περισσότερο. + + + This value should not be blank. + Αυτή η τιμή δεν πρέπει να είναι κενή. + + + This value should not be null. + Αυτή η τιμή δεν πρέπει να είναι μηδενική. + + + This value should be null. + Αυτή η τιμή πρέπει να είναι μηδενική. + + + This value is not valid. + Αυτή η τιμή δεν είναι έγκυρη. + + + This value is not a valid time. + Αυτή η τιμή δεν αντιστοιχεί σε έγκυρη ώρα. + + + This value is not a valid URL. + Αυτή η τιμή δεν αντιστοιχεί σε έγκυρο URL. + + + The two values should be equal. + Οι δύο τιμές θα πρέπει να είναι ίδιες. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Το αρχείο είναι πολύ μεγάλο. Το μέγιστο επιτρεπτό μέγεθος είναι {{ limit }} {{ suffix }}. + + + The file is too large. + Το αρχείο είναι πολύ μεγάλο. + + + The file could not be uploaded. + Το αρχείο δε μπορεί να ανέβει. + + + This value should be a valid number. + Αυτή η τιμή θα πρέπει να είναι ένας έγκυρος αριθμός. + + + This file is not a valid image. + Το αρχείο δεν αποτελεί έγκυρη εικόνα. + + + This is not a valid IP address. + Αυτό δεν είναι μια έγκυρη διεύθυνση IP. + + + This value is not a valid language. + Αυτή η τιμή δεν αντιστοιχεί σε μια έγκυρη γλώσσα. + + + This value is not a valid locale. + Αυτή η τιμή δεν αντιστοιχεί σε έγκυρο κωδικό τοποθεσίας. + + + This value is not a valid country. + Αυτή η τιμή δεν αντιστοιχεί σε μια έγκυρη χώρα. + + + This value is already used. + Αυτή η τιμή χρησιμοποιείται ήδη. + + + The size of the image could not be detected. + Το μέγεθος της εικόνας δεν ήταν δυνατό να ανιχνευθεί. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Το πλάτος της εικόνας είναι πολύ μεγάλο ({{ width }}px). Το μέγιστο επιτρεπτό πλάτος είναι {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Το πλάτος της εικόνας είναι πολύ μικρό ({{ width }}px). Το ελάχιστο επιτρεπτό πλάτος είναι {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Το ύψος της εικόνας είναι πολύ μεγάλο ({{ height }}px). Το μέγιστο επιτρεπτό ύψος είναι {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Το ύψος της εικόνας είναι πολύ μικρό ({{ height }}px). Το ελάχιστο επιτρεπτό ύψος είναι {{ min_height }}px. + + + This value should be the user's current password. + Αυτή η τιμή θα έπρεπε να είναι ο τρέχων κωδικός. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Αυτή η τιμή θα έπρεπε να έχει ακριβώς {{ limit }} χαρακτήρα.|Αυτή η τιμή θα έπρεπε να έχει ακριβώς {{ limit }} χαρακτήρες. + + + The file was only partially uploaded. + Το αρχείο δεν ανέβηκε ολόκληρο. + + + No file was uploaded. + Δεν ανέβηκε κανένα αρχείο. + + + No temporary folder was configured in php.ini. + Κανένας προσωρινός φάκελος δεν έχει ρυθμιστεί στο php.ini. + + + Cannot write temporary file to disk. + Αδυναμία εγγραφής προσωρινού αρχείου στο δίσκο. + + + A PHP extension caused the upload to fail. + Μια επέκταση PHP προκάλεσε αδυναμία ανεβάσματος. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Αυτή η συλλογή θα πρέπει να περιέχει {{ limit }} στοιχείο ή περισσότερα.|Αυτή η συλλογή θα πρέπει να περιέχει {{ limit }} στοιχεία ή περισσότερα. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Αυτή η συλλογή θα πρέπει να περιέχει {{ limit }} στοιχείo ή λιγότερα.|Αυτή η συλλογή θα πρέπει να περιέχει {{ limit }} στοιχεία ή λιγότερα. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Αυτή η συλλογή θα πρέπει να περιέχει ακριβώς {{ limit }} στοιχείo.|Αυτή η συλλογή θα πρέπει να περιέχει ακριβώς {{ limit }} στοιχεία. + + + Invalid card number. + Μη έγκυρος αριθμός κάρτας. + + + Unsupported card type or invalid card number. + Μη υποστηριζόμενος τύπος κάρτας ή μη έγκυρος αριθμός κάρτας. + + + This is not a valid International Bank Account Number (IBAN). + Αυτό δεν αντιστοιχεί σε έγκυρο διεθνή αριθμό τραπεζικού λογαριασμού (IBAN). + + + This value is not a valid ISBN-10. + Αυτό δεν είναι έγκυρος κωδικός ISBN-10. + + + This value is not a valid ISBN-13. + Αυτό δεν είναι έγκυρος κωδικός ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Αυτό δεν είναι ούτε έγκυρος κωδικός ISBN-10 ούτε έγκυρος κωδικός ISBN-13. + + + This value is not a valid ISSN. + Αυτό δεν είναι έγκυρος κωδικός ISSN. + + + This value is not a valid currency. + Αυτό δεν αντιστοιχεί σε έγκυρο νόμισμα. + + + This value should be equal to {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι ίση με {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι μεγαλύτερη από {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι μεγαλύτερη ή ίση με {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι πανομοιότυπη με {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι μικρότερη από {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Αυτή η τιμή θα πρέπει να είναι μικρότερη ή ίση με {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Αυτή η τιμή δεν θα πρέπει να είναι ίση με {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Αυτή η τιμή δεν πρέπει να είναι πανομοιότυπη με {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Η αναλογία πλάτους-ύψους της εικόνας είναι πολύ μεγάλη ({{ ratio }}). Μέγιστη επιτρεπτή αναλογία {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Η αναλογία πλάτους-ύψους της εικόνας είναι πολύ μικρή ({{ ratio }}). Ελάχιστη επιτρεπτή αναλογία {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Η εικόνα είναι τετράγωνη ({{ width }}x{{ height }}px). Δεν επιτρέπονται τετράγωνες εικόνες. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Η εικόνα έχει οριζόντιο προσανατολισμό ({{ width }}x{{ height }}px). Δεν επιτρέπονται εικόνες με οριζόντιο προσανατολισμό. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Η εικόνα έχει κάθετο προσανατολισμό ({{ width }}x{{ height }}px). Δεν επιτρέπονται εικόνες με κάθετο προσανατολισμό. + + + An empty file is not allowed. + Δεν επιτρέπεται κενό αρχείο. + + + The host could not be resolved. + Η διεύθυνση δεν μπόρεσε να επιλυθεί. + + + This value does not match the expected {{ charset }} charset. + Αυτή η τιμή δεν ταιριάζει στο αναμενόμενο {{ charset }} σύνολο χαρακτήρων. + + + This is not a valid Business Identifier Code (BIC). + Αυτός δεν είναι ένας έγκυρος κωδικός BIC. + + + Error + Σφάλμα + + + This is not a valid UUID. + Αυτό δεν είναι ένα έγκυρο UUID. + + + This value should be a multiple of {{ compared_value }}. + Αυτή η τιμή θα έπρεπε να είναι πολλαπλάσιο του {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Αυτός ο κωδικός BIC δεν σχετίζεται με το IBAN {{ iban }}. + + + This value should be valid JSON. + Αυτή η τιμή θα πρέπει να είναι έγκυρο JSON. + + + This collection should contain only unique elements. + Αυτή η συλλογή θα πρέπει να περιέχει μόνο μοναδικά στοιχεία. + + + This value should be positive. + Αυτή η τιμή θα πρέπει να είναι θετική. + + + This value should be either positive or zero. + Αυτή η τιμή θα πρέπει να είναι θετική ή μηδενική. + + + This value should be negative. + Αυτή η τιμή θα πρέπει να είναι αρνητική. + + + This value should be either negative or zero. + Αυτή η τιμή θα πρέπει να είναι αρνητική ή μηδενική. + + + This value is not a valid timezone. + Αυτή η τιμή θα δεν είναι έγκυρη ζώνη ώρας. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Αυτός ο κωδικός πρόσβασης έχει διαρρεύσει σε παραβίαση δεδομένων. Παρακαλούμε να χρησιμοποιήσετε έναν άλλο κωδικό. + + + This value should be between {{ min }} and {{ max }}. + Αυτή η τιμή θα πρέπει να είναι μεταξύ {{ min }} και {{ max }}. + + + This value is not a valid hostname. + Αυτή η τιμή δεν είναι έγκυρο όνομα υποδοχής. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Το νούμερο των στοιχείων σε αυτή τη συλλογή θα πρέπει να είναι πολλαπλάσιο του {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Αυτή η τιμή θα πρέπει να ικανοποιεί τουλάχιστον έναν από τους παρακάτω περιορισμούς: + + + Each element of this collection should satisfy its own set of constraints. + Κάθε στοιχείο σε αυτή τη συλλογή θα πρέπει να ικανοποιεί το δικό του σύνολο περιορισμών. + + + This value is not a valid International Securities Identification Number (ISIN). + Αυτή η τιμή δεν είναι έγκυρο International Securities Identification Number (ISIN). + + + This value should be a valid expression. + Αυτή η τιμή θα πρέπει να είναι μία έγκυρη έκφραση. + + + This value is not a valid CSS color. + Αυτή η τιμή δεν είναι έγκυρο χρώμα CSS. + + + This value is not a valid CIDR notation. + Αυτή η τιμή δεν είναι έγκυρη CIDR σημειογραφία. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Η τιμή του netmask πρέπει να είναι ανάμεσα σε {{ min }} και {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.en.xlf b/vendor/symfony/validator/Resources/translations/validators.en.xlf new file mode 100644 index 0000000..34c5421 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.en.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + This value should be false. + + + This value should be true. + This value should be true. + + + This value should be of type {{ type }}. + This value should be of type {{ type }}. + + + This value should be blank. + This value should be blank. + + + The value you selected is not a valid choice. + The value you selected is not a valid choice. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + + + One or more of the given values is invalid. + One or more of the given values is invalid. + + + This field was not expected. + This field was not expected. + + + This field is missing. + This field is missing. + + + This value is not a valid date. + This value is not a valid date. + + + This value is not a valid datetime. + This value is not a valid datetime. + + + This value is not a valid email address. + This value is not a valid email address. + + + The file could not be found. + The file could not be found. + + + The file is not readable. + The file is not readable. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + + + This value should be {{ limit }} or less. + This value should be {{ limit }} or less. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + + + This value should be {{ limit }} or more. + This value should be {{ limit }} or more. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + + + This value should not be blank. + This value should not be blank. + + + This value should not be null. + This value should not be null. + + + This value should be null. + This value should be null. + + + This value is not valid. + This value is not valid. + + + This value is not a valid time. + This value is not a valid time. + + + This value is not a valid URL. + This value is not a valid URL. + + + The two values should be equal. + The two values should be equal. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + + + The file is too large. + The file is too large. + + + The file could not be uploaded. + The file could not be uploaded. + + + This value should be a valid number. + This value should be a valid number. + + + This file is not a valid image. + This file is not a valid image. + + + This is not a valid IP address. + This is not a valid IP address. + + + This value is not a valid language. + This value is not a valid language. + + + This value is not a valid locale. + This value is not a valid locale. + + + This value is not a valid country. + This value is not a valid country. + + + This value is already used. + This value is already used. + + + The size of the image could not be detected. + The size of the image could not be detected. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + + + This value should be the user's current password. + This value should be the user's current password. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + + + The file was only partially uploaded. + The file was only partially uploaded. + + + No file was uploaded. + No file was uploaded. + + + No temporary folder was configured in php.ini. + No temporary folder was configured in php.ini, or the configured folder does not exist. + + + Cannot write temporary file to disk. + Cannot write temporary file to disk. + + + A PHP extension caused the upload to fail. + A PHP extension caused the upload to fail. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + + + Invalid card number. + Invalid card number. + + + Unsupported card type or invalid card number. + Unsupported card type or invalid card number. + + + This is not a valid International Bank Account Number (IBAN). + This is not a valid International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + This value is not a valid ISBN-10. + + + This value is not a valid ISBN-13. + This value is not a valid ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + This value is neither a valid ISBN-10 nor a valid ISBN-13. + + + This value is not a valid ISSN. + This value is not a valid ISSN. + + + This value is not a valid currency. + This value is not a valid currency. + + + This value should be equal to {{ compared_value }}. + This value should be equal to {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + This value should be greater than {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + This value should be greater than or equal to {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + This value should be less than {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + This value should be less than or equal to {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + This value should not be equal to {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + + + An empty file is not allowed. + An empty file is not allowed. + + + The host could not be resolved. + The host could not be resolved. + + + This value does not match the expected {{ charset }} charset. + This value does not match the expected {{ charset }} charset. + + + This is not a valid Business Identifier Code (BIC). + This is not a valid Business Identifier Code (BIC). + + + Error + Error + + + This is not a valid UUID. + This is not a valid UUID. + + + This value should be a multiple of {{ compared_value }}. + This value should be a multiple of {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + + + This value should be valid JSON. + This value should be valid JSON. + + + This collection should contain only unique elements. + This collection should contain only unique elements. + + + This value should be positive. + This value should be positive. + + + This value should be either positive or zero. + This value should be either positive or zero. + + + This value should be negative. + This value should be negative. + + + This value should be either negative or zero. + This value should be either negative or zero. + + + This value is not a valid timezone. + This value is not a valid timezone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + This password has been leaked in a data breach, it must not be used. Please use another password. + + + This value should be between {{ min }} and {{ max }}. + This value should be between {{ min }} and {{ max }}. + + + This value is not a valid hostname. + This value is not a valid hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + The number of elements in this collection should be a multiple of {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + This value should satisfy at least one of the following constraints: + + + Each element of this collection should satisfy its own set of constraints. + Each element of this collection should satisfy its own set of constraints. + + + This value is not a valid International Securities Identification Number (ISIN). + This value is not a valid International Securities Identification Number (ISIN). + + + This value should be a valid expression. + This value should be a valid expression. + + + This value is not a valid CSS color. + This value is not a valid CSS color. + + + This value is not a valid CIDR notation. + This value is not a valid CIDR notation. + + + The value of the netmask should be between {{ min }} and {{ max }}. + The value of the netmask should be between {{ min }} and {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.es.xlf b/vendor/symfony/validator/Resources/translations/validators.es.xlf new file mode 100644 index 0000000..897d0a4 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.es.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Este valor debería ser falso. + + + This value should be true. + Este valor debería ser verdadero. + + + This value should be of type {{ type }}. + Este valor debería ser de tipo {{ type }}. + + + This value should be blank. + Este valor debería estar vacío. + + + The value you selected is not a valid choice. + El valor seleccionado no es una opción válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Debe seleccionar al menos {{ limit }} opción.|Debe seleccionar al menos {{ limit }} opciones. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Debe seleccionar como máximo {{ limit }} opción.|Debe seleccionar como máximo {{ limit }} opciones. + + + One or more of the given values is invalid. + Uno o más de los valores indicados no son válidos. + + + This field was not expected. + Este campo no se esperaba. + + + This field is missing. + Este campo está desaparecido. + + + This value is not a valid date. + Este valor no es una fecha válida. + + + This value is not a valid datetime. + Este valor no es una fecha y hora válidas. + + + This value is not a valid email address. + Este valor no es una dirección de email válida. + + + The file could not be found. + No se pudo encontrar el archivo. + + + The file is not readable. + No se puede leer el archivo. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + El archivo es demasiado grande ({{ size }} {{ suffix }}). El tamaño máximo permitido es {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + El tipo mime del archivo no es válido ({{ type }}). Los tipos mime válidos son {{ types }}. + + + This value should be {{ limit }} or less. + Este valor debería ser {{ limit }} o menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor es demasiado largo. Debería tener {{ limit }} carácter o menos.|Este valor es demasiado largo. Debería tener {{ limit }} caracteres o menos. + + + This value should be {{ limit }} or more. + Este valor debería ser {{ limit }} o más. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor es demasiado corto. Debería tener {{ limit }} carácter o más.|Este valor es demasiado corto. Debería tener {{ limit }} caracteres o más. + + + This value should not be blank. + Este valor no debería estar vacío. + + + This value should not be null. + Este valor no debería ser nulo. + + + This value should be null. + Este valor debería ser nulo. + + + This value is not valid. + Este valor no es válido. + + + This value is not a valid time. + Este valor no es una hora válida. + + + This value is not a valid URL. + Este valor no es una URL válida. + + + The two values should be equal. + Los dos valores deberían ser iguales. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + El archivo es demasiado grande. El tamaño máximo permitido es {{ limit }} {{ suffix }}. + + + The file is too large. + El archivo es demasiado grande. + + + The file could not be uploaded. + No se pudo subir el archivo. + + + This value should be a valid number. + Este valor debería ser un número válido. + + + This file is not a valid image. + El archivo no es una imagen válida. + + + This is not a valid IP address. + Esto no es una dirección IP válida. + + + This value is not a valid language. + Este valor no es un idioma válido. + + + This value is not a valid locale. + Este valor no es una localización válida. + + + This value is not a valid country. + Este valor no es un país válido. + + + This value is already used. + Este valor ya se ha utilizado. + + + The size of the image could not be detected. + No se pudo determinar el tamaño de la imagen. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + El ancho de la imagen es demasiado grande ({{ width }}px). El ancho máximo permitido es de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + El ancho de la imagen es demasiado pequeño ({{ width }}px). El ancho mínimo requerido es {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La altura de la imagen es demasiado grande ({{ height }}px). La altura máxima permitida es de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La altura de la imagen es demasiado pequeña ({{ height }}px). La altura mínima requerida es de {{ min_height }}px. + + + This value should be the user's current password. + Este valor debería ser la contraseña actual del usuario. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor debería tener exactamente {{ limit }} carácter.|Este valor debería tener exactamente {{ limit }} caracteres. + + + The file was only partially uploaded. + El archivo fue sólo subido parcialmente. + + + No file was uploaded. + Ningún archivo fue subido. + + + No temporary folder was configured in php.ini. + Ninguna carpeta temporal fue configurada en php.ini o la carpeta configurada no existe. + + + Cannot write temporary file to disk. + No se pudo escribir el archivo temporal en el disco. + + + A PHP extension caused the upload to fail. + Una extensión de PHP hizo que la subida fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta colección debe contener {{ limit }} elemento o más.|Esta colección debe contener {{ limit }} elementos o más. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta colección debe contener {{ limit }} elemento o menos.|Esta colección debe contener {{ limit }} elementos o menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta colección debe contener exactamente {{ limit }} elemento.|Esta colección debe contener exactamente {{ limit }} elementos. + + + Invalid card number. + Número de tarjeta inválido. + + + Unsupported card type or invalid card number. + Tipo de tarjeta no soportado o número de tarjeta inválido. + + + This is not a valid International Bank Account Number (IBAN). + Esto no es un International Bank Account Number (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor no es un ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor no es un ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor no es ni un ISBN-10 válido ni un ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor no es un ISSN válido. + + + This value is not a valid currency. + Este valor no es una divisa válida. + + + This value should be equal to {{ compared_value }}. + Este valor debería ser igual que {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor debería ser mayor que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor debería ser mayor o igual que {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor debería ser idéntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor debería ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor debería ser menor o igual que {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor debería ser distinto de {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor no debería ser idéntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + La proporción de la imagen es demasiado grande ({{ ratio }}). La máxima proporción permitida es {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + La proporción de la imagen es demasiado pequeña ({{ ratio }}). La mínima proporción permitida es {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + La imagen es cuadrada ({{ width }}x{{ height }}px). Las imágenes cuadradas no están permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + La imagen está orientada horizontalmente ({{ width }}x{{ height }}px). Las imágenes orientadas horizontalmente no están permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + La imagen está orientada verticalmente ({{ width }}x{{ height }}px). Las imágenes orientadas verticalmente no están permitidas. + + + An empty file is not allowed. + No está permitido un archivo vacío. + + + The host could not be resolved. + No se puede resolver el host. + + + This value does not match the expected {{ charset }} charset. + La codificación de caracteres para este valor debería ser {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + No es un Código de Identificación Bancaria (BIC) válido. + + + Error + Error + + + This is not a valid UUID. + Este valor no es un UUID válido. + + + This value should be a multiple of {{ compared_value }}. + Este valor debería ser múltiplo de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Este Código de Identificación Bancaria (BIC) no está asociado con el IBAN {{ iban }}. + + + This value should be valid JSON. + Este valor debería ser un JSON válido. + + + This collection should contain only unique elements. + Esta colección debería tener exclusivamente elementos únicos. + + + This value should be positive. + Este valor debería ser positivo. + + + This value should be either positive or zero. + Este valor debería ser positivo o igual a cero. + + + This value should be negative. + Este valor debería ser negativo. + + + This value should be either negative or zero. + Este valor debería ser negativo o igual a cero. + + + This value is not a valid timezone. + Este valor no es una zona horaria válida. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña. + + + This value should be between {{ min }} and {{ max }}. + Este valor debería estar entre {{ min }} y {{ max }}. + + + This value is not a valid hostname. + Este valor no es un nombre de host válido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + El número de elementos en esta colección debería ser múltiplo de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Este valor debería satisfacer al menos una de las siguientes restricciones: + + + Each element of this collection should satisfy its own set of constraints. + Cada elemento de esta colección debería satisfacer su propio conjunto de restricciones. + + + This value is not a valid International Securities Identification Number (ISIN). + Este valor no es un número de identificación internacional de valores (ISIN) válido. + + + This value should be a valid expression. + Este valor debería ser una expresión válida. + + + This value is not a valid CSS color. + Este valor no es un color CSS válido. + + + This value is not a valid CIDR notation. + Este valor no es una notación CIDR válida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + El valor de la máscara de red debería estar entre {{ min }} y {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.et.xlf b/vendor/symfony/validator/Resources/translations/validators.et.xlf new file mode 100644 index 0000000..b323dcd --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.et.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Väärtus peaks olema väär. + + + This value should be true. + Väärtus peaks oleme tõene. + + + This value should be of type {{ type }}. + Väärtus peaks olema {{ type }}-tüüpi. + + + This value should be blank. + Väärtus peaks olema tühi. + + + The value you selected is not a valid choice. + Väärtus peaks olema üks etteantud valikutest. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Valima peaks vähemalt {{ limit }} valikut. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Valima peaks mitte rohkem kui {{ limit }} valikut. + + + One or more of the given values is invalid. + Üks või rohkem väärtustest on vigane. + + + This field was not expected. + See väli ei olnud oodatud. + + + This field is missing. + See väli on puudu. + + + This value is not a valid date. + Väärtus pole korrektne kuupäev. + + + This value is not a valid datetime. + Väärtus pole korrektne kuupäev ja kellaeg. + + + This value is not a valid email address. + Väärtus pole korrektne e-maili aadress. + + + The file could not be found. + Faili ei leita. + + + The file is not readable. + Fail ei ole loetav. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fail on liiga suur ({{ size }} {{ suffix }}). Suurim lubatud suurus on {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faili sisutüüp on vigane ({{ type }}). Lubatud sisutüübid on {{ types }}. + + + This value should be {{ limit }} or less. + Väärtus peaks olema {{ limit }} või vähem. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Väärtus on liiga pikk. Pikkus peaks olema {{ limit }} tähemärki või vähem. + + + This value should be {{ limit }} or more. + Väärtus peaks olema {{ limit }} või rohkem. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Väärtus on liiga lühike. Pikkus peaks olema {{ limit }} tähemärki või rohkem. + + + This value should not be blank. + Väärtus ei tohiks olla tühi. + + + This value should not be null. + Väärtus ei tohiks olla 'null'. + + + This value should be null. + Väärtus peaks olema 'null'. + + + This value is not valid. + Väärtus on vigane. + + + This value is not a valid time. + Väärtus pole korrektne aeg. + + + This value is not a valid URL. + Väärtus pole korrektne URL. + + + The two values should be equal. + Väärtused peaksid olema võrdsed. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fail on liiga suur. Maksimaalne lubatud suurus on {{ limit }} {{ suffix }}. + + + The file is too large. + Fail on liiga suur. + + + The file could not be uploaded. + Faili ei saa üles laadida. + + + This value should be a valid number. + Väärtus peaks olema korrektne number. + + + This file is not a valid image. + Fail ei ole korrektne pilt. + + + This is not a valid IP address. + IP aadress pole korrektne. + + + This value is not a valid language. + Väärtus pole korrektne keel. + + + This value is not a valid locale. + Väärtus pole korrektne asukohakeel. + + + This value is not a valid country. + Väärtus pole olemasolev riik. + + + This value is already used. + Väärtust on juba kasutatud. + + + The size of the image could not be detected. + Pildi suurust polnud võimalik tuvastada. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Pilt on liiga lai ({{ width }}px). Suurim lubatud laius on {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Pilt on liiga kitsas ({{ width }}px). Vähim lubatud laius on {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Pilt on liiga pikk ({{ height }}px). Lubatud suurim pikkus on {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Pilt pole piisavalt pikk ({{ height }}px). Lubatud vähim pikkus on {{ min_height }}px. + + + This value should be the user's current password. + Väärtus peaks olema kasutaja kehtiv salasõna. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Väärtus peaks olema täpselt {{ limit }} tähemärk pikk.|Väärtus peaks olema täpselt {{ limit }} tähemärki pikk. + + + The file was only partially uploaded. + Fail ei laetud täielikult üles. + + + No file was uploaded. + Ühtegi faili ei laetud üles. + + + No temporary folder was configured in php.ini. + Ühtegi ajutist kausta polnud php.ini-s seadistatud. + + + Cannot write temporary file to disk. + Ajutist faili ei saa kettale kirjutada. + + + A PHP extension caused the upload to fail. + PHP laiendi tõttu ebaõnnestus faili üleslaadimine. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Kogumikus peaks olema vähemalt {{ limit }} element.|Kogumikus peaks olema vähemalt {{ limit }} elementi. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Kogumikus peaks olema ülimalt {{ limit }} element.|Kogumikus peaks olema ülimalt {{ limit }} elementi. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Kogumikus peaks olema täpselt {{ limit }} element.|Kogumikus peaks olema täpselt {{ limit }}|elementi. + + + Invalid card number. + Vigane kaardi number. + + + Unsupported card type or invalid card number. + Kaardi tüüpi ei toetata või kaardi number on vigane. + + + This is not a valid International Bank Account Number (IBAN). + Väärtus pole korrektne IBAN-number. + + + This value is not a valid ISBN-10. + Väärtus pole korrektne ISBN-10. + + + This value is not a valid ISBN-13. + Väärtus pole korrektne ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Väärtus pole korrektne ISBN-10 ega ISBN-13. + + + This value is not a valid ISSN. + Väärtus pole korrektne ISSN. + + + This value is not a valid currency. + Väärtus pole korrektne valuuta. + + + This value should be equal to {{ compared_value }}. + Väärtus peaks olema võrdne {{ compared_value }}-ga. + + + This value should be greater than {{ compared_value }}. + Väärtus peaks olema suurem kui {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Väärtus peaks olema suurem kui või võrduma {{ compared_value }}-ga. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Väärtus peaks olema identne väärtusega {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Väärtus peaks olema väiksem kui {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Väärtus peaks olema väiksem kui või võrduma {{ compared_value }}-ga. + + + This value should not be equal to {{ compared_value }}. + Väärtus ei tohiks võrduda {{ compared_value }}-ga. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Väärtus ei tohiks olla identne väärtusega {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Kuvasuhe on liiga suur ({{ ratio }}). Lubatud maksimaalne suhe on {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Kuvasuhe on liiga väike ({{ ratio }}). Oodatav minimaalne suhe on {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Pilt on ruudukujuline ({{ width }}x{{ height }}px). Ruudukujulised pildid pole lubatud. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Pilt on horisontaalselt orienteeritud ({{ width }}x{{ height }}px). Maastikulised pildid pole lubatud. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Pilt on vertikaalselt orienteeritud ({{ width }}x{{ height }}px). Portreepildid pole lubatud. + + + An empty file is not allowed. + Tühi fail pole lubatud. + + + The host could not be resolved. + Sellist domeeni ei õnnestunud leida. + + + This value does not match the expected {{ charset }} charset. + See väärtus ei ühti eeldatava tähemärgiga {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + See ei ole kehtiv ettevõtte identifitseerimiskood (BIC). + + + Error + Viga + + + This is not a valid UUID. + See pole kehtiv UUID. + + + This value should be a multiple of {{ compared_value }}. + See väärtus peaks olema väärtuse {{ compared_value }} kordne. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + See ettevõtte identifitseerimiskood (BIC) ei ole seotud IBAN-iga {{ iban }}. + + + This value should be valid JSON. + See väärtus peaks olema kehtiv JSON. + + + This collection should contain only unique elements. + See kogu peaks sisaldama ainult unikaalseid elemente. + + + This value should be positive. + See väärtus peaks olema positiivne. + + + This value should be either positive or zero. + See väärtus peaks olema kas positiivne või null. + + + This value should be negative. + See väärtus peaks olema negatiivne. + + + This value should be either negative or zero. + See väärtus peaks olema kas negatiivne või null. + + + This value is not a valid timezone. + See väärtus pole kehtiv ajavöönd. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + See parool on lekkinud andmerikkumise korral, seda ei tohi kasutada. Palun kasutage muud parooli. + + + This value should be between {{ min }} and {{ max }}. + See väärtus peaks olema vahemikus {{ min }} kuni {{ max }}. + + + This value is not a valid hostname. + See väärtus pole korrektne domeeninimi. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Selles kogus olevate elementide arv peab olema arvu {{ compared_value }} kordne. + + + This value should satisfy at least one of the following constraints: + See väärtus peab vastama vähemalt ühele järgmistest tingimustest: + + + Each element of this collection should satisfy its own set of constraints. + Kõik väärtused selles kogus peavad vastama oma tingimustele. + + + This value is not a valid International Securities Identification Number (ISIN). + See väärtus pole korrektne ISIN-kood. + + + This value should be a valid expression. + See väärtus pole korrektne avaldis. + + + This value is not a valid CSS color. + See väärtus pole korrektne CSS-i värv. + + + This value is not a valid CIDR notation. + See väärtus pole korrektne CIDR võrguaadress. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Võrgumaski väärtus peaks olema vahemikus {{ min }} kuni {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.eu.xlf b/vendor/symfony/validator/Resources/translations/validators.eu.xlf new file mode 100644 index 0000000..ec58c60 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.eu.xlf @@ -0,0 +1,395 @@ + + + + + + This value should be false. + Balio hau faltsua izan beharko litzateke. + + + This value should be true. + Balio hau egia izan beharko litzateke. + + + This value should be of type {{ type }}. + Balio hau {{ type }} motakoa izan beharko litzateke. + + + This value should be blank. + Balio hau hutsik egon beharko litzateke. + + + The value you selected is not a valid choice. + Hautatu duzun balioa ez da aukera egoki bat. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Gutxienez aukera {{ limit }} hautatu behar duzu.|Gutxienez {{ limit }} aukera hautatu behar dituzu. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Gehienez aukera {{ limit }} hautatu behar duzu.|Gehienez {{ limit }} aukera hautatu behar dituzu. + + + One or more of the given values is invalid. + Emandako balioetatik gutxienez bat ez da egokia. + + + This field was not expected. + Eremu hau ez zen espero. + + + This field is missing. + Eremu hau falta da. + + + This value is not a valid date. + Balio hau ez da data egoki bat. + + + This value is not a valid datetime. + Balio hau ez da data-ordu egoki bat. + + + This value is not a valid email address. + Balio hau ez da posta elektroniko egoki bat. + + + The file could not be found. + Ezin izan da fitxategia aurkitu. + + + The file is not readable. + Fitxategia ez da irakurgarria. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fitxategia handiegia da ({{ size }} {{ suffix }}). Baimendutako tamaina handiena {{ limit }} {{ suffix }} da. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Fitxategiaren mime mota ez da egokia ({{ type }}). Hauek dira baimendutako mime motak: {{ types }}. + + + This value should be {{ limit }} or less. + Balio hau gehienez {{ limit }} izan beharko litzateke. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Balio hau luzeegia da. Gehienez karaktere {{ limit }} eduki beharko luke.|Balio hau luzeegia da. Gehienez {{ limit }} karaktere eduki beharko lituzke. + + + This value should be {{ limit }} or more. + Balio hau gutxienez {{ limit }} izan beharko litzateke. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Balio hau motzegia da. Karaktere {{ limit }} gutxienez eduki beharko luke.|Balio hau motzegia da. Gutxienez {{ limit }} karaktere eduki beharko lituzke. + + + This value should not be blank. + Balio hau ez litzateke hutsik egon behar. + + + This value should not be null. + Balio hau ez litzateke nulua izan behar. + + + This value should be null. + Balio hau nulua izan beharko litzateke. + + + This value is not valid. + Balio hau ez da egokia. + + + This value is not a valid time. + Balio hau ez da ordu egoki bat. + + + This value is not a valid URL. + Balio hau ez da baliabideen kokatzaile uniforme (URL) egoki bat. + + + The two values should be equal. + Bi balioak berdinak izan beharko lirateke. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fitxategia handiegia da. Baimendutako tamaina handiena {{ limit }} {{ suffix }} da. + + + The file is too large. + Fitxategia handiegia da. + + + The file could not be uploaded. + Ezin izan da fitxategia igo. + + + This value should be a valid number. + Balio hau zenbaki egoki bat izan beharko litzateke. + + + This file is not a valid image. + Fitxategi hau ez da irudi egoki bat. + + + This is not a valid IP address. + Honako hau ez da IP helbide egoki bat. + + + This value is not a valid language. + Balio hau ez da hizkuntza egoki bat. + + + This value is not a valid locale. + Balio hau ez da kokapen egoki bat. + + + This value is not a valid country. + Balio hau ez da herrialde egoki bat. + + + This value is already used. + Balio hau jadanik erabilia izan da. + + + The size of the image could not be detected. + Ezin izan da irudiaren tamaina detektatu. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Irudiaren zabalera handiegia da ({{ width }}px). Onartutako gehienezko zabalera {{ max_width }}px dira. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Irudiaren zabalera txikiegia da ({{ width }}px). Onartutako gutxieneko zabalera {{ min_width }}px dira. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Irudiaren altuera handiegia da ({{ height }}px). Onartutako gehienezko altuera {{ max_height }}px dira. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Irudiaren altuera txikiegia da ({{ height }}px). Onartutako gutxieneko altuera {{ min_height }}px dira. + + + This value should be the user's current password. + Balio hau uneko erabiltzailearen pasahitza izan beharko litzateke. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Balio honek zehazki karaktere {{ limit }} izan beharko luke.|Balio honek zehazki {{ limit }} karaktere izan beharko lituzke. + + + The file was only partially uploaded. + Fitxategiaren zati bat bakarrik igo da. + + + No file was uploaded. + Ez da fitxategirik igo. + + + No temporary folder was configured in php.ini. + Ez da aldi baterako karpetarik konfiguratu php.ini fitxategian. + + + Cannot write temporary file to disk. + Ezin izan da aldi baterako fitxategia diskoan idatzi. + + + A PHP extension caused the upload to fail. + PHP luzapen batek igoeraren hutsa eragin du. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bilduma honek gutxienez elementu {{ limit }} eduki beharko luke.|Bilduma honek gutxienez {{ limit }} elementu eduki beharko lituzke. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bilduma honek gehienez elementu {{ limit }} eduki beharko luke.|Bilduma honek gehienez {{ limit }} elementu eduki beharko lituzke. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bilduma honek zehazki elementu {{ limit }} eduki beharko luke.|Bilduma honek zehazki {{ limit }} elementu eduki beharko lituzke. + + + Invalid card number. + Txartel zenbaki baliogabea. + + + Unsupported card type or invalid card number. + Txartel mota onartezina edo txartel zenbaki baliogabea. + + + This is not a valid International Bank Account Number (IBAN). + Hau ez da baliozko banku internazionaleko kontu zenbaki (IBAN) bat. + + + This value is not a valid ISBN-10. + Balio hau ez da onartutako ISBN-10 bat. + + + This value is not a valid ISBN-13. + Balio hau ez da onartutako ISBN-13 bat. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Balio hau ez da onartutako ISBN-10 edo ISBN-13 bat. + + + This value is not a valid ISSN. + Balio hau ez da onartutako ISSN bat. + + + This value is not a valid currency. + Balio hau ez da baliozko moneta bat. + + + This value should be equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berbera izan beharko litzateke. + + + This value should be greater than {{ compared_value }}. + Balio hau {{ compared_value }} baino handiagoa izan beharko litzateke. + + + This value should be greater than or equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berdina edota handiagoa izan beharko litzateke. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Balio hau {{ compared_value_type }} {{ compared_value }}-(r)en berbera izan beharko litzateke. + + + This value should be less than {{ compared_value }}. + Balio hau {{ compared_value }} baino txikiagoa izan beharko litzateke. + + + This value should be less than or equal to {{ compared_value }}. + Balio hau {{ compared_value }}-(r)en berdina edota txikiagoa izan beharko litzateke. + + + This value should not be equal to {{ compared_value }}. + Balio hau ez litzateke {{ compared_value }}-(r)en berdina izan behar. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Balio hau ez litzateke {{ compared_value_type }} {{ compared_value }}-(r)en berbera izan behar. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Irudiaren proportzioa oso handia da ({{ ratio }}). Onartutako proportzio handienda {{ max_ratio }} da. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Irudiaren proportzioa oso txikia da ({{ ratio }}). Onartutako proportzio txikiena {{ min_ratio }} da. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Irudia karratua da ({{ width }}x{{ height }}px). Karratuak diren irudiak ez dira onartzen. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Irudia horizontalki bideratua dago ({{ width }}x{{ height }}px). Horizontalki bideratutako irudiak ez dira onartzen. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Irudia bertikalki bideratua dago ({{ width }}x{{ height }}px). Bertikalki bideratutako irudiak ez dira onartzen. + + + An empty file is not allowed. + Hutsik dagoen fitxategia ez da onartzen. + + + The host could not be resolved. + Host-a ezin da ebatzi. + + + This value does not match the expected {{ charset }} charset. + Balio honen karaktere kodea ez da esperotakoa {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Ez da balizko Banku Identifikazioko Kodea (BIC). + + + Error + Errore + + + This is not a valid UUID. + Balio hau ez da onartutako UUID bat. + + + This value should be a multiple of {{ compared_value }}. + Balio honek {{ compared_value }}-ren multiploa izan beharko luke. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Banku Identifikazioko Kode hau ez dago lotuta {{ IBAN }} IBAN-rekin. + + + This value should be valid JSON. + Balio honek baliozko JSON bat izan behar luke. + + + This collection should contain only unique elements. + Bilduma honek elementu bakarrak soilik izan beharko lituzke. + + + This value should be positive. + Balio honek positiboa izan beharko luke. + + + This value should be either positive or zero. + Balio honek positiboa edo zero izan behar luke. + + + This value should be negative. + Balio honek negatiboa izan behar luke. + + + This value should be either negative or zero. + Balio honek negatiboa edo zero izan behar luke. + + + This value is not a valid timezone. + Balio hori ez da baliozko ordu-eremua. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Pasahitz hori ezin da erabili, beste gune eta aplikazio batzuetako segurtasun-akatsei esker lortutako pasahitz publikoen zerrendan sartuta dagoelako. Mesedez, erabili beste pasahitz bat. + + + This value should be between {{ min }} and {{ max }}. + Balio honek {{ min }} eta {{ max }} artean egon behar luke. + + + This value is not a valid hostname. + Balio hori ez da ostalari-izen onargarria. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Bilduma honetako elementu-kopuruak {{ compared_value }}-ren multiploa izan behar luke. + + + This value should satisfy at least one of the following constraints: + Balio honek, gutxienez, murrizketa hauetako bat bete behar du: + + + Each element of this collection should satisfy its own set of constraints. + Bilduma honetako elementu bakoitzak bere murriztapen-multzoa bete behar du. + + + This value is not a valid International Securities Identification Number (ISIN). + Balio hori ez da baliozko baloreen nazioarteko identifikazio-zenbaki bat (ISIN). + + + This value should be a valid expression. + Balio hori baliozko adierazpena izan beharko litzateke. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.fa.xlf b/vendor/symfony/validator/Resources/translations/validators.fa.xlf new file mode 100644 index 0000000..b72bc6e --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.fa.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + این مقدار باید نادرست (False) باشد. + + + This value should be true. + این مقدار باید درست (True) باشد. + + + This value should be of type {{ type }}. + این مقدار باید از نوع {{ type }} باشد. + + + This value should be blank. + این مقدار باید خالی باشد. + + + The value you selected is not a valid choice. + مقدار انتخاب شده یک گزینه معتبر نمی‌باشد. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + شما باید حداقل {{ limit }} گزینه انتخاب نمایید.|شما باید حداقل {{ limit }} گزینه انتخاب نمایید. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + شما باید حداکثر {{ limit }} گزینه انتخاب نمایید.|شما باید حداکثر {{ limit }} گزینه انتخاب نمایید. + + + One or more of the given values is invalid. + یک یا چند مقدار داده شده نامعتبر است. + + + The fields {{ fields }} were not expected. + فیلدهای {{ fields }} مورد انتظار نبود. + + + The fields {{ fields }} are missing. + فیلدهای {{ fields }} مفقود شده اند. + + + This value is not a valid date. + این مقدار یک تاریخ معتبر نمی‌باشد. + + + This value is not a valid datetime. + این مقدار یک تاریخ و زمان معتبر نمی‌باشد. + + + This value is not a valid email address. + این یک آدرس رایانامه (ایمیل) معتبر نمی‌باشد. + + + The file could not be found. + فایل یافت نشد. + + + The file is not readable. + فایل قابل خواندن نیست. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). بیشینه (حداکثر) اندازه مجاز برابر با {{ limit }} {{ suffix }} می‌باشد. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + نوع mime این فایل نامعتبر است({{ type }}). انواع mime مجاز {{ types }} هستند. + + + This value should be {{ limit }} or less. + این مقدار باید کوچکتر و یا مساوی {{ limit }} باشد. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + این مقدار بسیار طولانی است. باید دارای {{limit}} کاراکتر یا کمتر باشد. | این مقدار بسیار طولانی است. باید دارای {{limit}} کاراکتر یا کمتر باشد. + + + This value should be {{ limit }} or more. + این مقدار باید بزرگتر و یا مساوی {{ limit }} باشد. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + این مقدار بیش از اندازه کوتاه است. باید {{ limit }} کاراکتر یا بیشتر داشته باشد.|این مقدار بیش از اندازه کوتاه است. باید {{ limit }} کاراکتر یا بیشتر داشته باشد. + + + This value should not be blank. + این مقدار نباید خالی باشد. + + + This value should not be null. + این مقدار نباید خالی باشد. + + + This value should be null. + این مقدار باید خالی باشد. + + + This value is not valid. + این مقدار معتبر نمی‌باشد. + + + This value is not a valid time. + این مقدار یک زمان معتبر نمی‌باشد. + + + This value is not a valid URL. + این مقدار شامل یک URL معتبر نمی‌باشد. + + + The two values should be equal. + دو مقدار باید با یکدیگر برابر باشند. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + فایل بیش از اندازه بزرگ است. بیشینه (حداکثر) اندازه مجاز {{ limit }} {{ suffix }} است. + + + The file is too large. + فایل بیش از اندازه بزرگ است. + + + The file could not be uploaded. + بارگذاری فایل با شکست مواجه گردید. + + + This value should be a valid number. + این مقدار باید یک عدد معتبر باشد. + + + This file is not a valid image. + این فایل یک تصویر معتبر نمی‌باشد. + + + This is not a valid IP address. + این آدرس IP معتبر نیست. + + + This value is not a valid language. + این مقدار یک زبان معتبر نمی‌باشد. + + + This value is not a valid locale. + این مقدار یک محل (locale) معتبر نمی‌باشد. + + + This value is not a valid country. + این مقدار یک کشور معتبر نمی‌باشد. + + + This value is already used. + این مقدار قبلاً استفاده شده است. + + + The size of the image could not be detected. + اندازه تصویر قابل شناسایی نمی‌باشد. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + عرض تصویر بسیار بزرگ است({{ width }}px). بیشینه (حداکثر) عرض مجاز {{ max_width }}px می‌باشد. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + عرض تصویر بسیار کوچک است({{ width }}px). کمینه (حداقل) عرض مورد انتظار {{ min_width }}px می‌باشد. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ارتفاع تصویر بسیار بزرگ است({{ height }}px). بیشینه (حداکثر) ارتفاع مجاز {{ max_height }}px می‌باشد. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ارتفاع تصویر بسیار کوچک است({{ height }}px). کمینه (حداقل) ارتفاع مورد انتظار {{ min_height }}px می‌باشد. + + + This value should be the user's current password. + این مقدار باید رمزعبور فعلی کاربر باشد. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + این مقدار باید دقیقا {{ limit }} کاراکتر داشته باشد.| این مقدار باید دقیقا {{ limit }} کاراکتر داشته باشد. + + + The file was only partially uploaded. + فایل به صورت جزئی بارگذاری گردیده است. + + + No file was uploaded. + هیچ فایلی بارگذاری نشد. + + + No temporary folder was configured in php.ini. + پوشه موقتی در php.ini پیکربندی نگردیده است. + + + Cannot write temporary file to disk. + فایل موقتی را نمی‌توان در دیسک نوشت. + + + A PHP extension caused the upload to fail. + یک افزونه PHP باعث شد بارگذاری ناموفق باشد. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + این مجموعه باید حاوی {{ limit }} عنصر یا بیشتر باشد.|این مجموعه باید حاوی {{ limit }} عنصر یا بیشتر باشد. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + این مجموعه باید حاوی {{ limit }} عنصر یا کمتر باشد.|این مجموعه باید حاوی {{ limit }} عنصر یا کمتر باشد. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + این مجموعه باید دقیقا حاوی {{ limit }} عنصر باشد.|این مجموعه باید دقیقا حاوی {{ limit }} عنصر باشد. + + + Invalid card number. + شماره کارت نامعتبر است. + + + Unsupported card type or invalid card number. + نوع کارت پشتیبانی نمی‌شود و یا شماره کارت نامعتبر می‌باشد. + + + This is not a valid International Bank Account Number (IBAN). + این یک شماره حساب بانک بین المللی معتبر نمی‌باشد(IBAN). + + + This value is not a valid ISBN-10. + این مقدار یک ISBN-10 معتبر نمی‌باشد. + + + This value is not a valid ISBN-13. + این مقدار یک ISBN-13 معتبر نمی‌باشد. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + این مقدار یک ISBN-10 معتبر و یا ISBN-13 معتبر نمی‌باشد. + + + This value is not a valid ISSN. + این مقدار یک ISSN معتبر نمی‌باشد. + + + This value is not a valid currency. + این مقدار یک واحد پول معتبر نمی‌باشد. + + + This value should be equal to {{ compared_value }}. + این مقدار باید برابر با {{ compared_value }} باشد. + + + This value should be greater than {{ compared_value }}. + این مقدار باید از {{ compared_value }} بیشتر باشد. + + + This value should be greater than or equal to {{ compared_value }}. + این مقدار باید بزرگتر و یا مساوی با {{ compared_value }} باشد. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + این مقدار باید برابر {{ compared_value_type }} {{ compared_value }} باشد. + + + This value should be less than {{ compared_value }}. + این مقدار باید کمتر از {{ compared_value }} باشد. + + + This value should be less than or equal to {{ compared_value }}. + این مقدار باید کمتر و یا مساوی با {{ compared_value }} باشد. + + + This value should not be equal to {{ compared_value }}. + این مقدار نباید با {{ compared_value }} برابر باشد. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + این مقدار نباید برابر {{ compared_value_type }} {{ compared_value }} باشد. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + ابعاد ({{ ratio }}) عکس بیش از حد بزرگ است. بیشینه (حداکثر) ابعاد مجاز {{ max_ratio }} می‌باشد. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + ابعاد ({{ ratio }}) عکس بیش از حد کوچک است. کمینه (حداقل) ابعاد مورد انتظار {{ min_ratio }} می‌باشد. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + این تصویر یک مربع ({{ width }}x{{ height }}px) می‌باشد. تصاویر مربع شکل مجاز نمی‌باشند. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + این تصویر افقی ({{ width }}x{{ height }}px) می‌باشد. تصاویر افقی مجاز نمی‌باشند. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + این تصویر عمودی ({{ width }}x{{ height }}px) می‌باشد. تصاویر عمودی مجاز نمی‌باشند. + + + An empty file is not allowed. + فایل خالی مجاز نمی‌باشد. + + + The host could not be resolved. + میزبان (Host) شناسایی نشد. + + + This value does not match the expected {{ charset }} charset. + این مقدار مطابق charset مورد انتظار {{ charset }} نمی باشد. + + + This is not a valid Business Identifier Code (BIC). + این مقدار یک کد شناسایی کسب‌و‌کار معتبر (BIC) نیست. + + + Error + خطا + + + This is not a valid UUID. + این مقدار یک UUID معتبر نمی‌باشد. + + + This value should be a multiple of {{ compared_value }}. + این مقدار باید چند برابر {{ compared_value }} باشد. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + این کد شناسایی کسب‌و‌کار (BIC) با شماره حساب بانکی بین‌المللی (IBAN) {{ iban }} مرتبط نیست. + + + This value should be valid JSON. + این مقدار باید یک JSON معتبر باشد. + + + This collection should contain only unique elements. + این مجموعه باید فقط حاوی عناصر یکتا باشد. + + + This value should be positive. + این مقدار باید مثبت باشد. + + + This value should be either positive or zero. + این مقدار باید مثبت یا صفر باشد. + + + This value should be negative. + این مقدار باید منفی باشد. + + + This value should be either negative or zero. + این مقدار باید منفی یا صفر باشد. + + + This value is not a valid timezone. + این مقدار یک منطقه‌زمانی (timezone) معتبر نیست. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + این رمزعبور در یک رخنه‌ی اطلاعاتی نشت کرده است. لطفاً از یک رمزعبور دیگر استفاده کنید. + + + This value should be between {{ min }} and {{ max }}. + این مقدار باید بین {{ min }} و {{ max }} باشد + + + This value is not a valid hostname. + این مقدار یک hostname معتبر نیست. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + تعداد عناصر این مجموعه باید ضریبی از {{ compared_value }} باشد. + + + This value should satisfy at least one of the following constraints: + این مقدار باید حداقل یکی از محدودیت‌های زیر را ارضا کند: + + + Each element of this collection should satisfy its own set of constraints. + هر یک از عناصر این مجموعه باید دسته محدودیت‌های خودش را ارضا کند. + + + This value is not a valid International Securities Identification Number (ISIN). + این مقدار یک شماره شناسایی بین‌المللی اوراق بهادار (ISIN) معتبر نیست. + + + This value should be a valid expression. + این مقدار باید یک عبارت معتبر باشد. + + + This value is not a valid CSS color. + این مقدار یک رنگ معتبر در CSS نیست. + + + This value is not a valid CIDR notation. + این مقدار یک نماد معتبر در CIDR نیست. + + + The value of the netmask should be between {{ min }} and {{ max }}. + مقدار ماسک شبکه (NetMask) باید بین {{ min }} و {{ max }} باشد. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.fi.xlf b/vendor/symfony/validator/Resources/translations/validators.fi.xlf new file mode 100644 index 0000000..9a6bfe4 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.fi.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Arvon tulee olla epätosi. + + + This value should be true. + Arvon tulee olla tosi. + + + This value should be of type {{ type }}. + Arvon tulee olla tyyppiä {{ type }}. + + + This value should be blank. + Arvon tulee olla tyhjä. + + + The value you selected is not a valid choice. + Arvon tulee olla yksi annetuista vaihtoehdoista. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Sinun tulee valita vähintään {{ limit }} vaihtoehtoa. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Sinun tulee valitan enintään {{ limit }} vaihtoehtoa. + + + One or more of the given values is invalid. + Yksi tai useampi annetuista arvoista on virheellinen. + + + This field was not expected. + Tässä kentässä ei odotettu. + + + This field is missing. + Tämä kenttä puuttuu. + + + This value is not a valid date. + Annettu arvo ei ole kelvollinen päivämäärä. + + + This value is not a valid datetime. + Annettu arvo ei ole kelvollinen päivämäärä ja kellonaika. + + + This value is not a valid email address. + Annettu arvo ei ole kelvollinen sähköpostiosoite. + + + The file could not be found. + Tiedostoa ei löydy. + + + The file is not readable. + Tiedostoa ei voida lukea. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Tiedostonkoko ({{ size }} {{ suffix }}) on liian iso. Suurin sallittu tiedostonkoko on {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Tiedostotyyppi ({{ type }}) on virheellinen. Sallittuja tiedostotyyppejä ovat {{ types }}. + + + This value should be {{ limit }} or less. + Arvon tulee olla {{ limit }} tai vähemmän. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Liian pitkä syöte. Syöte saa olla enintään {{ limit }} merkkiä. + + + This value should be {{ limit }} or more. + Arvon tulee olla {{ limit }} tai enemmän. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Liian lyhyt syöte. Syötteen tulee olla vähintään {{ limit }} merkkiä. + + + This value should not be blank. + Kenttä ei voi olla tyhjä. + + + This value should not be null. + Syöte ei voi olla null. + + + This value should be null. + Syötteen tulee olla null. + + + This value is not valid. + Virheellinen arvo. + + + This value is not a valid time. + Annettu arvo ei ole kelvollinen kellonaika. + + + This value is not a valid URL. + Annettu arvo ei ole kelvollinen URL-osoite. + + + The two values should be equal. + Kahden annetun arvon tulee olla samat. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Annettu tiedosto on liian iso. Suurin sallittu tiedostokoko on {{ limit }} {{ suffix }}. + + + The file is too large. + Tiedosto on liian iso. + + + The file could not be uploaded. + Tiedoston siirto epäonnistui. + + + This value should be a valid number. + Tämän arvon tulee olla numero. + + + This file is not a valid image. + Tämä tiedosto ei ole kelvollinen kuva. + + + This is not a valid IP address. + Tämä ei ole kelvollinen IP-osoite. + + + This value is not a valid language. + Tämä arvo ei ole kelvollinen kieli. + + + This value is not a valid locale. + Tämä arvo ei ole kelvollinen kieli- ja alueasetus (locale). + + + This value is not a valid country. + Tämä arvo ei ole kelvollinen maa. + + + This value is already used. + Tämä arvo on jo käytetty. + + + The size of the image could not be detected. + Kuvan kokoa ei voitu tunnistaa. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Kuva on liian leveä ({{ width }}px). Sallittu maksimileveys on {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Kuva on liian kapea ({{ width }}px). Leveyden tulisi olla vähintään {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Kuva on liian korkea ({{ width }}px). Sallittu maksimikorkeus on {{ max_width }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Kuva on liian matala ({{ height }}px). Korkeuden tulisi olla vähintään {{ min_height }}px. + + + This value should be the user's current password. + Tämän arvon tulisi olla käyttäjän tämänhetkinen salasana. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Tämän arvon tulisi olla tasan yhden merkin pituinen.|Tämän arvon tulisi olla tasan {{ limit }} merkkiä pitkä. + + + The file was only partially uploaded. + Tiedosto ladattiin vain osittain. + + + No file was uploaded. + Tiedostoa ei ladattu. + + + No temporary folder was configured in php.ini. + Väliaikaishakemistoa ei ole asetettu php.ini -tiedostoon. + + + Cannot write temporary file to disk. + Väliaikaistiedostoa ei voitu kirjoittaa levylle. + + + A PHP extension caused the upload to fail. + PHP-laajennoksen vuoksi tiedoston lataus epäonnistui. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Tässä ryhmässä tulisi olla yksi tai useampi elementti.|Tässä ryhmässä tulisi olla vähintään {{ limit }} elementtiä. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Tässä ryhmässä tulisi olla enintään yksi elementti.|Tässä ryhmässä tulisi olla enintään {{ limit }} elementtiä. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Tässä ryhmässä tulisi olla tasan yksi elementti.|Tässä ryhmässä tulisi olla enintään {{ limit }} elementtiä. + + + Invalid card number. + Virheellinen korttinumero. + + + Unsupported card type or invalid card number. + Tätä korttityyppiä ei tueta tai korttinumero on virheellinen. + + + This is not a valid International Bank Account Number (IBAN). + Arvo ei ole kelvollinen kansainvälinen pankkitilinumero (IBAN). + + + This value is not a valid ISBN-10. + Arvo ei ole kelvollinen ISBN-10. + + + This value is not a valid ISBN-13. + Arvo ei ole kelvollinen ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Arvo ei ole kelvollinen ISBN-10 tai kelvollinen ISBN-13. + + + This value is not a valid ISSN. + Arvo ei ole kelvollinen ISSN. + + + This value is not a valid currency. + Arvo ei ole kelvollinen valuutta. + + + This value should be equal to {{ compared_value }}. + Arvo ei ole sama kuin {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Arvon tulee olla suurempi kuin {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Arvon tulee olla suurempi tai yhtä suuri kuin {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Tämä arvo tulee olla sama kuin {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Arvon tulee olla pienempi kuin {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Arvon tulee olla pienempi tai yhtä suuri {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Arvon ei tule olla sama kuin {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Tämä arvo ei tule olla sama kuin {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Kuvasuhde on liian suuri ({{ ratio }}). Suurin sallittu suhde on {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Kuvasuhde on liian pieni ({{ ratio }}). Pienin sallittu arvo on {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Kuva on neliä ({{ width }}x{{ height }}px). Neliöt kuvat eivät ole sallittuja. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Kuva on vaakasuuntainen ({{ width }}x{{ height }}px). Vaakasuuntaiset kuvat eivät ole sallittuja. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Kuva on pystysuuntainen ({{ width }}x{{ height }}px). Pystysuuntaiset kuvat eivät ole sallittuja. + + + An empty file is not allowed. + Tyhjä tiedosto ei ole sallittu. + + + The host could not be resolved. + Palvelimeen ei saatu yhteyttä. + + + This value does not match the expected {{ charset }} charset. + Arvo ei vastaa odotettua merkistöä {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Arvo ei ole kelvollinen yritystunnus (BIC). + + + Error + Virhe + + + This is not a valid UUID. + Arvo ei ole kelvollinen UUID. + + + This value should be a multiple of {{ compared_value }}. + Tämän arvon tulisi olla kerrannainen {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Tämä yritystunnus (BIC) ei ole liitetty IBAN {{ iban }}. + + + This value should be valid JSON. + Arvon tulee olla kelvollinen JSON. + + + This collection should contain only unique elements. + Tämän ryhmän tulisi sisältää vain yksilöllisiä arvoja. + + + This value should be positive. + Arvon tulisi olla positiivinen. + + + This value should be either positive or zero. + Arvon tulisi olla joko positiivinen tai nolla. + + + This value should be negative. + Arvon tulisi olla negatiivinen. + + + This value should be either negative or zero. + Arvon tulisi olla joko negatiivinen tai nolla. + + + This value is not a valid timezone. + Arvo ei ole kelvollinen aikavyöhyke. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Tämä salasana on vuotanut tietomurrossa, sitä ei saa käyttää. Käytä toista salasanaa. + + + This value should be between {{ min }} and {{ max }}. + Arvon tulisi olla välillä {{ min }} - {{ max }}. + + + This value is not a valid hostname. + Arvo ei ole kelvollinen laitenimi (hostname). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Ryhmässä olevien elementtien määrän pitää olla monikerta luvulle {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Tämän arvon tulee läpäistä vähintään yksi seuraavista tarkistuksista: + + + Each element of this collection should satisfy its own set of constraints. + Ryhmän jokaisen elementin tulee läpäistä omat tarkistuksensa. + + + This value is not a valid International Securities Identification Number (ISIN). + Tämä arvo ei ole kelvollinen ISIN-koodi (International Securities Identification Number). + + + This value should be a valid expression. + Tämän arvon on oltava kelvollinen lauseke. + + + This value is not a valid CSS color. + Tämä arvo ei ole kelvollinen CSS-värimääritys. + + + This value is not a valid CIDR notation. + Tämä arvo ei ole kelvollinen CIDR-merkintä. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Verkkomaskille annetun arvon tulisi olla {{ min }} ja {{ max }} välillä. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.fr.xlf b/vendor/symfony/validator/Resources/translations/validators.fr.xlf new file mode 100644 index 0000000..9212777 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.fr.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Cette valeur doit être fausse. + + + This value should be true. + Cette valeur doit être vraie. + + + This value should be of type {{ type }}. + Cette valeur doit être de type {{ type }}. + + + This value should be blank. + Cette valeur doit être vide. + + + The value you selected is not a valid choice. + Cette valeur doit être l'un des choix proposés. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Vous devez sélectionner au moins {{ limit }} choix.|Vous devez sélectionner au moins {{ limit }} choix. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Vous devez sélectionner au maximum {{ limit }} choix.|Vous devez sélectionner au maximum {{ limit }} choix. + + + One or more of the given values is invalid. + Une ou plusieurs des valeurs soumises sont invalides. + + + This field was not expected. + Ce champ n'a pas été prévu. + + + This field is missing. + Ce champ est manquant. + + + This value is not a valid date. + Cette valeur n'est pas une date valide. + + + This value is not a valid datetime. + Cette valeur n'est pas une date valide. + + + This value is not a valid email address. + Cette valeur n'est pas une adresse email valide. + + + The file could not be found. + Le fichier n'a pas été trouvé. + + + The file is not readable. + Le fichier n'est pas lisible. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux ({{ size }} {{ suffix }}). Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Le type du fichier est invalide ({{ type }}). Les types autorisés sont {{ types }}. + + + This value should be {{ limit }} or less. + Cette valeur doit être inférieure ou égale à {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractère.|Cette chaîne est trop longue. Elle doit avoir au maximum {{ limit }} caractères. + + + This value should be {{ limit }} or more. + Cette valeur doit être supérieure ou égale à {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractère.|Cette chaîne est trop courte. Elle doit avoir au minimum {{ limit }} caractères. + + + This value should not be blank. + Cette valeur ne doit pas être vide. + + + This value should not be null. + Cette valeur ne doit pas être nulle. + + + This value should be null. + Cette valeur doit être nulle. + + + This value is not valid. + Cette valeur n'est pas valide. + + + This value is not a valid time. + Cette valeur n'est pas une heure valide. + + + This value is not a valid URL. + Cette valeur n'est pas une URL valide. + + + The two values should be equal. + Les deux valeurs doivent être identiques. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Le fichier est trop volumineux. Sa taille ne doit pas dépasser {{ limit }} {{ suffix }}. + + + The file is too large. + Le fichier est trop volumineux. + + + The file could not be uploaded. + Le téléchargement de ce fichier est impossible. + + + This value should be a valid number. + Cette valeur doit être un nombre. + + + This file is not a valid image. + Ce fichier n'est pas une image valide. + + + This is not a valid IP address. + Cette adresse IP n'est pas valide. + + + This value is not a valid language. + Cette langue n'est pas valide. + + + This value is not a valid locale. + Ce paramètre régional n'est pas valide. + + + This value is not a valid country. + Ce pays n'est pas valide. + + + This value is already used. + Cette valeur est déjà utilisée. + + + The size of the image could not be detected. + La taille de l'image n'a pas pu être détectée. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La largeur de l'image est trop grande ({{ width }}px). La largeur maximale autorisée est de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La largeur de l'image est trop petite ({{ width }}px). La largeur minimale attendue est de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + La hauteur de l'image est trop grande ({{ height }}px). La hauteur maximale autorisée est de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + La hauteur de l'image est trop petite ({{ height }}px). La hauteur minimale attendue est de {{ min_height }}px. + + + This value should be the user's current password. + Cette valeur doit être le mot de passe actuel de l'utilisateur. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Cette chaîne doit avoir exactement {{ limit }} caractère.|Cette chaîne doit avoir exactement {{ limit }} caractères. + + + The file was only partially uploaded. + Le fichier a été partiellement transféré. + + + No file was uploaded. + Aucun fichier n'a été transféré. + + + No temporary folder was configured in php.ini. + Aucun répertoire temporaire n'a été configuré dans le php.ini, ou le répertoire configuré n'existe pas. + + + Cannot write temporary file to disk. + Impossible d'écrire le fichier temporaire sur le disque. + + + A PHP extension caused the upload to fail. + Une extension PHP a empêché le transfert du fichier. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Cette collection doit contenir {{ limit }} élément ou plus.|Cette collection doit contenir {{ limit }} éléments ou plus. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Cette collection doit contenir {{ limit }} élément ou moins.|Cette collection doit contenir {{ limit }} éléments ou moins. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Cette collection doit contenir exactement {{ limit }} élément.|Cette collection doit contenir exactement {{ limit }} éléments. + + + Invalid card number. + Numéro de carte invalide. + + + Unsupported card type or invalid card number. + Type de carte non supporté ou numéro invalide. + + + This is not a valid International Bank Account Number (IBAN). + Le numéro IBAN (International Bank Account Number) saisi n'est pas valide. + + + This value is not a valid ISBN-10. + Cette valeur n'est pas un code ISBN-10 valide. + + + This value is not a valid ISBN-13. + Cette valeur n'est pas un code ISBN-13 valide. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Cette valeur n'est ni un code ISBN-10, ni un code ISBN-13 valide. + + + This value is not a valid ISSN. + Cette valeur n'est pas un code ISSN valide. + + + This value is not a valid currency. + Cette valeur n'est pas une devise valide. + + + This value should be equal to {{ compared_value }}. + Cette valeur doit être égale à {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Cette valeur doit être supérieure à {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Cette valeur doit être supérieure ou égale à {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur doit être identique à {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Cette valeur doit être inférieure à {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Cette valeur doit être inférieure ou égale à {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Cette valeur ne doit pas être égale à {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Cette valeur ne doit pas être identique à {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Le rapport largeur/hauteur de l'image est trop grand ({{ ratio }}). Le rapport maximal autorisé est {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Le rapport largeur/hauteur de l'image est trop petit ({{ ratio }}). Le rapport minimal attendu est {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'image est carrée ({{ width }}x{{ height }}px). Les images carrées ne sont pas autorisées. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'image est au format paysage ({{ width }}x{{ height }}px). Les images au format paysage ne sont pas autorisées. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'image est au format portrait ({{ width }}x{{ height }}px). Les images au format portrait ne sont pas autorisées. + + + An empty file is not allowed. + Un fichier vide n'est pas autorisé. + + + The host could not be resolved. + Le nom de domaine n'a pas pu être résolu. + + + This value does not match the expected {{ charset }} charset. + Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu. + + + This is not a valid Business Identifier Code (BIC). + Ce n'est pas un code universel d'identification des banques (BIC) valide. + + + Error + Erreur + + + This is not a valid UUID. + Ceci n'est pas un UUID valide. + + + This value should be a multiple of {{ compared_value }}. + Cette valeur doit être un multiple de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ce code d'identification d'entreprise (BIC) n'est pas associé à l'IBAN {{ iban }}. + + + This value should be valid JSON. + Cette valeur doit être un JSON valide. + + + This collection should contain only unique elements. + Cette collection ne doit pas comporter de doublons. + + + This value should be positive. + Cette valeur doit être strictement positive. + + + This value should be either positive or zero. + Cette valeur doit être supérieure ou égale à zéro. + + + This value should be negative. + Cette valeur doit être strictement négative. + + + This value should be either negative or zero. + Cette valeur doit être inférieure ou égale à zéro. + + + This value is not a valid timezone. + Cette valeur n'est pas un fuseau horaire valide. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ce mot de passe a été divulgué lors d'une fuite de données, il ne doit plus être utilisé. Veuillez utiliser un autre mot de passe. + + + This value should be between {{ min }} and {{ max }}. + Cette valeur doit être comprise entre {{ min }} et {{ max }}. + + + This value is not a valid hostname. + Cette valeur n'est pas un nom d'hôte valide. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Le nombre d'éléments de cette collection doit être un multiple de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Cette valeur doit satisfaire à au moins une des contraintes suivantes : + + + Each element of this collection should satisfy its own set of constraints. + Chaque élément de cette collection doit satisfaire à son propre jeu de contraintes. + + + This value is not a valid International Securities Identification Number (ISIN). + Cette valeur n'est pas un code international de sécurité valide (ISIN). + + + This value should be a valid expression. + Cette valeur doit être une expression valide. + + + This value is not a valid CSS color. + Cette valeur n'est pas une couleur CSS valide. + + + This value is not a valid CIDR notation. + Cette valeur n'est pas une notation CIDR valide. + + + The value of the netmask should be between {{ min }} and {{ max }}. + La valeur du masque de réseau doit être comprise entre {{ min }} et {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.gl.xlf b/vendor/symfony/validator/Resources/translations/validators.gl.xlf new file mode 100644 index 0000000..f8c5c04 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.gl.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Este valor debería ser falso. + + + This value should be true. + Este valor debería ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor debería ser de tipo {{ type }}. + + + This value should be blank. + Este valor debería estar baleiro. + + + The value you selected is not a valid choice. + O valor seleccionado non é unha opción válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Debe seleccionar polo menos {{ limit }} opción.|Debe seleccionar polo menos {{ limit }} opcions. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Debe seleccionar como máximo {{ limit }} opción.|Debe seleccionar como máximo {{ limit }} opcions. + + + One or more of the given values is invalid. + Un ou máis dos valores indicados non son válidos. + + + This field was not expected. + Este campo non era esperado. + + + This field is missing. + Este campo falta. + + + This value is not a valid date. + Este valor non é unha data válida. + + + This value is not a valid datetime. + Este valor non é unha data e hora válidas. + + + This value is not a valid email address. + Este valor non é unha dirección de correo electrónico válida. + + + The file could not be found. + Non se puido atopar o arquivo. + + + The file is not readable. + O arquivo non se pode ler. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é demasiado grande ({{ size }} {{ suffix }}). O tamaño máximo permitido é {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo non é válido ({{ type }}). Os tipos mime válidos son {{ types }}. + + + This value should be {{ limit }} or less. + Este valor debería ser {{ limit }} ou menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor é demasiado longo. Debería ter {{ limit }} carácter ou menos.|Este valor é demasiado longo. Debería ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor debería ser {{ limit }} ou máis. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor é demasiado curto. Debería ter {{ limit }} carácter ou máis.|Este valor é demasiado corto. Debería ter {{ limit }} caracteres ou máis. + + + This value should not be blank. + Este valor non debería estar baleiro. + + + This value should not be null. + Este valor non debería ser null. + + + This value should be null. + Este valor debería ser null. + + + This value is not valid. + Este valor non é válido. + + + This value is not a valid time. + Este valor non é unha hora válida. + + + This value is not a valid URL. + Este valor non é unha URL válida. + + + The two values should be equal. + Os dous valores deberían ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é demasiado grande. O tamaño máximo permitido é {{ limit }} {{ suffix }}. + + + The file is too large. + O arquivo é demasiado grande. + + + The file could not be uploaded. + No se puido cargar o arquivo. + + + This value should be a valid number. + Este valor debería ser un número válido. + + + This file is not a valid image. + O arquivo non é unha imaxe válida. + + + This is not a valid IP address. + Isto non é unha dirección IP válida. + + + This value is not a valid language. + Este valor non é un idioma válido. + + + This value is not a valid locale. + Este valor non é unha localización válida. + + + This value is not a valid country. + Este valor non é un país válido. + + + This value is already used. + Este valor xa está a ser empregado. + + + The size of the image could not be detected. + Non se puido determinar o tamaño da imaxe. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imaxe é demasiado grande ({{ width }}px). A largura máxima permitida son {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imaxe é demasiado pequena ({{ width }}px). A largura mínima requerida son {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imaxe é demasiado grande ({{ height }}px). A altura máxima permitida son {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imaxe é demasiado pequena ({{ height }}px). A altura mínima requerida son {{ min_height }}px. + + + This value should be the user's current password. + Este valor debería ser a contrasinal actual do usuario. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor debería ter exactamente {{ limit }} carácter.|Este valor debería ter exactamente {{ limit }} caracteres. + + + The file was only partially uploaded. + O arquivo foi só subido parcialmente. + + + No file was uploaded. + Non se subiu ningún arquivo. + + + No temporary folder was configured in php.ini. + Ningunha carpeta temporal foi configurada en php.ini, ou a carpeta non existe. + + + Cannot write temporary file to disk. + Non se puido escribir o arquivo temporal no disco. + + + A PHP extension caused the upload to fail. + Unha extensión de PHP provocou que a subida fallara. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta colección debe conter {{ limit }} elemento ou máis.|Esta colección debe conter {{ limit }} elementos ou máis. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta colección debe conter {{ limit }} elemento ou menos.|Esta colección debe conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta colección debe conter exactamente {{ limit }} elemento.|Esta colección debe conter exactamente {{ limit }} elementos. + + + Invalid card number. + Número de tarxeta non válido. + + + Unsupported card type or invalid card number. + Tipo de tarxeta non soportado ou número de tarxeta non válido. + + + This is not a valid International Bank Account Number (IBAN). + Este valor non é un International Bank Account Number (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor non é un ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor non é un ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor non é nin un ISBN-10 válido nin un ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor non é un ISSN válido. + + + This value is not a valid currency. + Este valor non é unha moeda válida. + + + This value should be equal to {{ compared_value }}. + Este valor debería ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor debería ser maior que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor debería ser maior ou igual que {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor debería ser identico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor debería ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor debería ser menor ou igual que {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor non debería ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor non debería ser identico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporción da imaxe é demasiado grande ({{ ratio }}). A proporción máxima permitida é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporción da é demasiado pequena ({{ ratio }}). A proporción mínima permitida é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imaxe é cadrada ({{ width }}x{{ height }}px). As imáxenes cadradas non están permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imaxe está orientada horizontalmente ({{ width }}x{{ height }}px). As imáxenes orientadas horizontalmente non están permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imaxe está orientada verticalmente ({{ width }}x{{ height }}px). As imáxenes orientadas verticalmente non están permitidas. + + + An empty file is not allowed. + Non está permitido un arquivo baleiro. + + + The host could not be resolved. + Non se puido resolver o host. + + + This value does not match the expected {{ charset }} charset. + A codificación de caracteres para este valor debería ser {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Non é un Código de Identificación Bancaria (BIC) válido. + + + Error + Erro + + + This is not a valid UUID. + Isto non é un UUID válido. + + + This value should be a multiple of {{ compared_value }}. + Este valor debería ser multiplo de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Este Código de identificación bancaria (BIC) non está asociado co IBAN {{ iban }}. + + + This value should be valid JSON. + Este valor debería ser un JSON válido. + + + This collection should contain only unique elements. + Esta colección só debería ter elementos únicos. + + + This value should be positive. + Este valor debería ser positivo. + + + This value should be either positive or zero. + Este valor debe ser positivo ou igual a cero. + + + This value should be negative. + Este valor debe ser negativo. + + + This value should be either negative or zero. + Este valor debe ser negativo ou igual a cero. + + + This value is not a valid timezone. + Este valor non é unha zona horaria válida. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Este contrasinal non se pode usar porque está incluído nunha lista de contrasinais públicos obtidos grazas a fallos de seguridade noutros sitios e aplicacións. Utiliza outro contrasinal. + + + This value should be between {{ min }} and {{ max }}. + Este valor debe estar comprendido entre {{ min }} e {{ max }}. + + + This value is not a valid hostname. + Este valor non é un nome de host válido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + O número de elementos desta colección debería ser múltiplo de {{compare_value}}. + + + This value should satisfy at least one of the following constraints: + Este valor debe cumprir polo menos unha das seguintes restricións: + + + Each element of this collection should satisfy its own set of constraints. + Cada elemento desta colección debe satisfacer o seu propio conxunto de restricións. + + + This value is not a valid International Securities Identification Number (ISIN). + Este valor non é un número de identificación de valores internacionais (ISIN) válido. + + + This value should be a valid expression. + Este valor debe ser unha expresión válida. + + + This value is not a valid CSS color. + Este valor non é unha cor CSS válida. + + + This value is not a valid CIDR notation. + Este valor non ten unha notación CIDR válida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + O valor da máscara de rede debería estar entre {{ min }} e {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.he.xlf b/vendor/symfony/validator/Resources/translations/validators.he.xlf new file mode 100644 index 0000000..af82426 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.he.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + הערך צריך להיות שקר. + + + This value should be true. + הערך צריך להיות אמת. + + + This value should be of type {{ type }}. + הערך צריך להיות מסוג {{ type }}. + + + This value should be blank. + הערך צריך להיות ריק. + + + The value you selected is not a valid choice. + הערך שבחרת אינו חוקי. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + אתה צריך לבחור לפחות {{ limit }} אפשרויות.|אתה צריך לבחור לפחות {{ limit }} אפשרויות. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + אתה צריך לבחור לכל היותר {{ limit }} אפשרויות.|אתה צריך לבחור לכל היותר {{ limit }} אפשרויות. + + + One or more of the given values is invalid. + אחד או יותר מהערכים אינו חוקי. + + + This field was not expected. + שדה זה לא היה צפוי + + + This field is missing. + שדה זה חסר. + + + This value is not a valid date. + הערך אינו תאריך חוקי. + + + This value is not a valid datetime. + הערך אינו תאריך ושעה חוקיים. + + + This value is not a valid email address. + כתובת המייל אינה תקינה. + + + The file could not be found. + הקובץ לא נמצא. + + + The file is not readable. + לא ניתן לקרוא את הקובץ. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + הקובץ גדול מדי ({{ size }} {{ suffix }}). הגודל המרבי המותר הוא {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + סוג MIME של הקובץ אינו חוקי ({{ type }}). מותרים סוגי MIME {{ types }}. + + + This value should be {{ limit }} or less. + הערך צריך להכיל {{ limit }} תווים לכל היותר. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + הערך ארוך מידי. הוא צריך להכיל {{ limit }} תווים לכל היותר.|הערך ארוך מידי. הוא צריך להכיל {{ limit }} תווים לכל היותר. + + + This value should be {{ limit }} or more. + הערך צריך להכיל {{ limit }} תווים לפחות. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + הערך קצר מידי. הוא צריך להכיל {{ limit }} תווים לפחות.|הערך קצר מידי. הערך צריך להכיל {{ limit }} תווים לפחות. + + + This value should not be blank. + הערך לא אמור להיות ריק. + + + This value should not be null. + הערך לא אמור להיות ריק. + + + This value should be null. + הערך צריך להיות ריק. + + + This value is not valid. + הערך אינו חוקי. + + + This value is not a valid time. + הערך אינו זמן תקין. + + + This value is not a valid URL. + זאת אינה כתובת אתר תקינה. + + + The two values should be equal. + שני הערכים צריכים להיות שווים. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + הקובץ גדול מדי. הגודל המרבי המותר הוא {{ limit }} {{ suffix }}. + + + The file is too large. + הקובץ גדול מדי. + + + The file could not be uploaded. + לא ניתן לעלות את הקובץ. + + + This value should be a valid number. + הערך צריך להיות מספר חוקי. + + + This file is not a valid image. + הקובץ הזה אינו תמונה תקינה. + + + This is not a valid IP address. + זו אינה כתובת IP חוקית. + + + This value is not a valid language. + הערך אינו שפה חוקית. + + + This value is not a valid locale. + הערך אינו אזור תקף. + + + This value is not a valid country. + הערך אינו ארץ חוקית. + + + This value is already used. + הערך כבר בשימוש. + + + The size of the image could not be detected. + לא ניתן לקבוע את גודל התמונה. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + רוחב התמונה גדול מדי ({{ width }}px). הרוחב המקסימלי הוא {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + רוחב התמונה קטן מדי ({{ width }}px). הרוחב המינימלי הוא {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + גובה התמונה גדול מדי ({{ height }}px). הגובה המקסימלי הוא {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + גובה התמונה קטן מדי ({{ height }}px). הגובה המינימלי הוא {{ min_height }}px. + + + This value should be the user's current password. + הערך צריך להיות סיסמת המשתמש הנוכחי. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + הערך צריך להיות בדיוק {{ limit }} תווים.|הערך צריך להיות בדיוק {{ limit }} תווים. + + + The file was only partially uploaded. + הקובץ הועלה באופן חלקי. + + + No file was uploaded. + הקובץ לא הועלה. + + + No temporary folder was configured in php.ini. + לא הוגדרה תיקייה זמנית ב php.ini. + + + Cannot write temporary file to disk. + לא ניתן לכתוב קובץ זמני לדיסק. + + + A PHP extension caused the upload to fail. + סיומת PHP גרם להעלאה להיכשל. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + האוסף אמור להכיל {{ limit }} אלמנטים או יותר.|האוסף אמור להכיל {{ limit }} אלמנטים או יותר. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + האוסף אמור להכיל {{ limit }} אלמנטים או פחות.|האוסף אמור להכיל {{ limit }} אלמנטים או פחות. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + האוסף צריך להכיל בדיוק {{ limit }} אלמנטים.|האוסף צריך להכיל בדיוק {{ limit }} אלמנטים. + + + Invalid card number. + מספר הכרטיס אינו חוקי. + + + Unsupported card type or invalid card number. + סוג הכרטיס אינו נתמך או לא חוקי. + + + This is not a valid International Bank Account Number (IBAN). + מספר חשבון בנק בינלאומי אינו חוקי (IBAN). + + + This value is not a valid ISBN-10. + הערך אינו ערך ISBN-10 חוקי. + + + This value is not a valid ISBN-13. + הערך אינו ערך ISBN-13 חוקי. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + הערך אינו ערך ISBN-10 חוקי או ערך ISBN-13 חוקי. + + + This value is not a valid ISSN. + הערך אינו ערך ISSN חוקי. + + + This value is not a valid currency. + הערך אינו ערך מטבע חוקי. + + + This value should be equal to {{ compared_value }}. + הערך חייב להיות שווה ל {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + הערך חייב להיות גדול מ {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + הערך חייב להיות גדול או שווה ל {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + הערך חייב להיות זהה ל {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + הערך חייב להיות קטן מ {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + הערך חייב להיות קטן או שווה ל {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + הערך חייב להיות לא שווה ל {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + הערך חייב להיות לא זהה ל {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + היחס של התמונה הוא גדול מדי ({{ ratio }}). היחס המקסימלי האפשרי הוא {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + היחס של התמונה הוא קטן מדי ({{ ratio }}). היחס המינימלי האפשרי הוא {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + התמונה מרובעת ({{ width }}x{{ height }}px). אסורות תמונות מרובעות. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + התמונה היא לרוחב ({{ width }}x{{ height }}px). אסורות תמונות לרוחב. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + התמונה היא לאורך ({{ width }}x{{ height }}px). אסורות תמונות לאורך. + + + An empty file is not allowed. + אסור קובץ ריק. + + + The host could not be resolved. + לא הייתה אפשרות לזהות את המארח. + + + This value does not match the expected {{ charset }} charset. + הערך אינו תואם למערך התווים {{ charset }} הצפוי. + + + This is not a valid Business Identifier Code (BIC). + קוד זיהוי עסקי אינו חוקי (BIC). + + + Error + שגיאה + + + This is not a valid UUID. + הערך אינו ערך UUID חוקי. + + + This value should be a multiple of {{ compared_value }}. + הערך חייב להיות כפולה של {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + הקוד זיהוי עסקי (BIC) אינו משוייך ל IBAN {{ iban }}. + + + This value should be valid JSON. + הערך אינו ערך JSON תקין. + + + This collection should contain only unique elements. + האוסף חייב להכיל רק אלמנטים ייחודיים. + + + This value should be positive. + הערך חייב להיות חיובי. + + + This value should be either positive or zero. + הערך חייב להיות חיובי או אפס. + + + This value should be negative. + הערך חייב להיות שלילי. + + + This value should be either negative or zero. + הערך חייב להיות שלילי או אפס. + + + This value is not a valid timezone. + הערך אינו אזור זמן תקין. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + סיסמא זו הודלפה בהדלפת מידע, אסור להשתמש בה. אנא השתמש בסיסמה אחרת. + + + This value should be between {{ min }} and {{ max }}. + הערך חייב להיות בין {{ min }} ו- {{ max }}. + + + This value is not a valid hostname. + ערך זה אינו שם מארח חוקי. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + מספר האלמנטים באוסף זה צריך להיות מכפיל של {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + ערך זה אמור לעמוד לפחות באחד התנאים הבאים: + + + Each element of this collection should satisfy its own set of constraints. + כל אלמנט באוסף זה אמור לעמוד בקבוצת התנאים שלו. + + + This value is not a valid International Securities Identification Number (ISIN). + ערך זה אינו מספר זיהוי ניירות ערך בינלאומי תקף (ISIN). + + + This value should be a valid expression. + ערך זה חייב להיות ביטוי חוקי. + + + This value is not a valid CSS color. + ערך זה אינו צבע CSS חוקי. + + + This value is not a valid CIDR notation. + ערך זה אינו סימון CIDR חוקי. + + + The value of the netmask should be between {{ min }} and {{ max }}. + הערך של מסכת הרשת חייב להיות בין {{ min }} ו {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.hr.xlf b/vendor/symfony/validator/Resources/translations/validators.hr.xlf new file mode 100644 index 0000000..34384b4 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.hr.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Ova vrijednost treba biti netočna (false). + + + This value should be true. + Ova vrijednost treba biti točna (true). + + + This value should be of type {{ type }}. + Ova vrijednost treba biti tipa {{ type }}. + + + This value should be blank. + Ova vrijednost treba biti prazna. + + + The value you selected is not a valid choice. + Ova vrijednost nije valjan izbor. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Izaberite barem {{ limit }} mogućnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Izaberite najviše {{ limit }} mogućnosti. + + + One or more of the given values is invalid. + Jedna ili više danih vrijednosti nije ispravna. + + + This field was not expected. + Ovo polje nije očekivano. + + + This field is missing. + Ovo polje nedostaje. + + + This value is not a valid date. + Ova vrijednost nije ispravan datum. + + + This value is not a valid datetime. + Ova vrijednost nije ispravnog datum-vrijeme formata. + + + This value is not a valid email address. + Ova vrijednost nije ispravna e-mail adresa. + + + The file could not be found. + Datoteka ne može biti pronađena. + + + The file is not readable. + Datoteka nije čitljiva. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke nije ispravan ({{ type }}). Dozvoljeni mime tipovi su {{ types }}. + + + This value should be {{ limit }} or less. + Ova vrijednost treba biti {{ limit }} ili manje. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ova vrijednost je predugačka. Treba imati {{ limit }} znakova ili manje. + + + This value should be {{ limit }} or more. + Ova vrijednost treba biti {{ limit }} ili više. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ova vrijednost je prekratka. Treba imati {{ limit }} znakova ili više. + + + This value should not be blank. + Ova vrijednost ne bi trebala biti prazna. + + + This value should not be null. + Ova vrijednost ne bi trebala biti null. + + + This value should be null. + Ova vrijednost treba biti null. + + + This value is not valid. + Ova vrijednost nije ispravna. + + + This value is not a valid time. + Ova vrijednost nije ispravno vrijeme. + + + This value is not a valid URL. + Ova vrijednost nije ispravan URL. + + + The two values should be equal. + Obje vrijednosti trebaju biti jednake. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ova datoteka je prevelika. Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The file is too large. + Ova datoteka je prevelika. + + + The file could not be uploaded. + Ova datoteka ne može biti prenesena. + + + This value should be a valid number. + Ova vrijednost treba biti ispravan broj. + + + This file is not a valid image. + Ova datoteka nije ispravna slika. + + + This is not a valid IP address. + Ovo nije ispravna IP adresa. + + + This value is not a valid language. + Ova vrijednost nije ispravan jezik. + + + This value is not a valid locale. + Ova vrijednost nije ispravana regionalna oznaka. + + + This value is not a valid country. + Ova vrijednost nije ispravna država. + + + This value is already used. + Ova vrijednost je već iskorištena. + + + The size of the image could not be detected. + Veličina slike se ne može odrediti. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina slike je prevelika ({{ width }}px). Najveća dozvoljena širina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina slike je premala ({{ width }}px). Najmanja dozvoljena širina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina slike je prevelika ({{ height }}px). Najveća dozvoljena visina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina slike je premala ({{ height }}px). Najmanja dozvoljena visina je {{ min_height }}px. + + + This value should be the user's current password. + Ova vrijednost treba biti trenutna korisnička lozinka. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ova vrijednost treba imati točno {{ limit }} znakova. + + + The file was only partially uploaded. + Datoteka je samo djelomično prenesena. + + + No file was uploaded. + Niti jedna datoteka nije prenesena. + + + No temporary folder was configured in php.ini. + U php.ini datoteci nije konfiguriran privremeni direktorij. + + + Cannot write temporary file to disk. + Ne mogu zapisati privremenu datoteku na disk. + + + A PHP extension caused the upload to fail. + Prijenos datoteke nije uspio zbog PHP ekstenzije. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ova kolekcija treba sadržavati {{ limit }} ili više elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili više elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili više elemenata. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata.|Ova kolekcija treba sadržavati {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ova kolekcija treba sadržavati točno {{ limit }} element.|Ova kolekcija treba sadržavati točno {{ limit }} elementa.|Ova kolekcija treba sadržavati točno {{ limit }} elemenata. + + + Invalid card number. + Neispravan broj kartice. + + + Unsupported card type or invalid card number. + Tip kartice nije podržan ili je broj kartice neispravan. + + + This is not a valid International Bank Account Number (IBAN). + Ova vrijednost nije ispravan međunarodni broj bankovnog računa (IBAN). + + + This value is not a valid ISBN-10. + Ova vrijednost nije ispravan ISBN-10. + + + This value is not a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ova vrijednost nije ispravan ISBN-10 niti ISBN-13. + + + This value is not a valid ISSN. + Ova vrijednost nije ispravan ISSN. + + + This value is not a valid currency. + Ova vrijednost nije ispravna valuta. + + + This value should be equal to {{ compared_value }}. + Ova vrijednost treba biti jednaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ova vrijednost treba biti veća od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ova vrijednost treba biti veća od ili jednaka {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost treba biti {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ova vrijednost treba biti manja od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ova vrijednost treba biti manja od ili jednaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ova vrijednost treba biti različita od {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrijednost treba biti različita od {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer slike je prevelik ({{ ratio }}). Dozvoljeni maksimalni omjer je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer slike je premali ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je orijentirana horizontalno ({{ width }}x{{ height }}px). Horizontalno orijentirane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je orijentirana vertikalno ({{ width }}x{{ height }}px). Vertikalno orijentirane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Poslužitelj ne može biti pronađen. + + + This value does not match the expected {{ charset }} charset. + Ova vrijednost ne odgovara očekivanom {{ charset }} znakovnom skupu. + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan poslovni identifikacijski broj (BIC). + + + Error + Greška + + + This is not a valid UUID. + Ovo nije validan UUID. + + + This value should be a multiple of {{ compared_value }}. + Ova vrijednost treba biti višekratnik od {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Poslovni identifikacijski broj (BIC) nije povezan sa IBAN brojem {{ iban }}. + + + This value should be valid JSON. + Ova vrijednost treba biti validan JSON. + + + This collection should contain only unique elements. + Ova kolekcija treba sadržavati samo unikatne elemente. + + + This value should be positive. + Ova vrijednost treba biti pozitivna. + + + This value should be either positive or zero. + Ova vrijednost treba biti pozitivna ili jednaka nuli. + + + This value should be negative. + Ova vrijednost treba biti negativna. + + + This value should be either negative or zero. + Ova vrijednost treba biti negativna ili jednaka nuli. + + + This value is not a valid timezone. + Ova vrijednost nije validna vremenska zona. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ova lozinka je procurila u nekom od sigurnosnih propusta, te je potrebno koristiti drugu lozinku. + + + This value should be between {{ min }} and {{ max }}. + Ova vrijednost treba biti između {{ min }} i {{ max }}. + + + This value is not a valid hostname. + Ova vrijednost nije ispravno ime poslužitelja (engl. hostname). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Broj elemenata u kolekciji treba biti djeljiv s {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ova vrijednost mora zadovoljiti jedan od sljedećih ograničenja: + + + Each element of this collection should satisfy its own set of constraints. + Svaki element ove kolekcije mora zadovoljiti vlastiti skup ograničenja. + + + This value is not a valid International Securities Identification Number (ISIN). + Ova vrijednost nije ispravan međunarodni identifikacijski broj vrijednosnih papira (ISIN). + + + This value should be a valid expression. + Ova vrijednost mora biti valjani izraz. + + + This value is not a valid CSS color. + Ova vrijednost nije važeća CSS boja. + + + This value is not a valid CIDR notation. + Ova vrijednost nije valjana CIDR notacija. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Vrijednost mrežne maske trebala bi biti između {{ min }} i {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.hu.xlf b/vendor/symfony/validator/Resources/translations/validators.hu.xlf new file mode 100644 index 0000000..30b0dbe --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.hu.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Ennek az értéknek hamisnak kell lennie. + + + This value should be true. + Ennek az értéknek igaznak kell lennie. + + + This value should be of type {{ type }}. + Ennek az értéknek {{ type }} típusúnak kell lennie. + + + This value should be blank. + Ennek az értéknek üresnek kell lennie. + + + The value you selected is not a valid choice. + A választott érték érvénytelen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Legalább {{ limit }} értéket kell kiválasztani.|Legalább {{ limit }} értéket kell kiválasztani. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Legfeljebb {{ limit }} értéket lehet kiválasztani.|Legfeljebb {{ limit }} értéket lehet kiválasztani. + + + One or more of the given values is invalid. + A megadott értékek közül legalább egy érvénytelen. + + + This field was not expected. + Nem várt mező. + + + This field is missing. + Ez a mező hiányzik. + + + This value is not a valid date. + Ez az érték nem egy érvényes dátum. + + + This value is not a valid datetime. + Ez az érték nem egy érvényes időpont. + + + This value is not a valid email address. + Ez az érték nem egy érvényes e-mail cím. + + + The file could not be found. + A fájl nem található. + + + The file is not readable. + A fájl nem olvasható. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + A fájl túl nagy ({{ size }} {{ suffix }}). A legnagyobb megengedett méret {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + A fájl MIME típusa érvénytelen ({{ type }}). Az engedélyezett MIME típusok: {{ types }}. + + + This value should be {{ limit }} or less. + Ez az érték legfeljebb {{ limit }} lehet. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ez az érték túl hosszú. Legfeljebb {{ limit }} karaktert tartalmazhat.|Ez az érték túl hosszú. Legfeljebb {{ limit }} karaktert tartalmazhat. + + + This value should be {{ limit }} or more. + Ez az érték legalább {{ limit }} kell, hogy legyen. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ez az érték túl rövid. Legalább {{ limit }} karaktert kell tartalmaznia.|Ez az érték túl rövid. Legalább {{ limit }} karaktert kell tartalmaznia. + + + This value should not be blank. + Ez az érték nem lehet üres. + + + This value should not be null. + Ez az érték nem lehet null. + + + This value should be null. + Ennek az értéknek nullnak kell lennie. + + + This value is not valid. + Ez az érték nem érvényes. + + + This value is not a valid time. + Ez az érték nem egy érvényes időpont. + + + This value is not a valid URL. + Ez az érték nem egy érvényes URL. + + + The two values should be equal. + A két értéknek azonosnak kell lennie. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + A fájl túl nagy. A megengedett maximális méret: {{ limit }} {{ suffix }}. + + + The file is too large. + A fájl túl nagy. + + + The file could not be uploaded. + A fájl nem tölthető fel. + + + This value should be a valid number. + Ennek az értéknek érvényes számnak kell lennie. + + + This file is not a valid image. + Ez a fájl nem egy érvényes kép. + + + This is not a valid IP address. + Ez az érték nem egy érvényes IP cím. + + + This value is not a valid language. + Ez az érték nem egy érvényes nyelv. + + + This value is not a valid locale. + Ez az érték nem egy érvényes területi beállítás. + + + This value is not a valid country. + Ez az érték nem egy érvényes ország. + + + This value is already used. + Ez az érték már használatban van. + + + The size of the image could not be detected. + A kép méretét nem lehet megállapítani. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A kép szélessége túl nagy ({{ width }}px). A megengedett legnagyobb szélesség {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A kép szélessége túl kicsi ({{ width }}px). Az elvárt legkisebb szélesség {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A kép magassága túl nagy ({{ height }}px). A megengedett legnagyobb magasság {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A kép magassága túl kicsi ({{ height }}px). Az elvárt legkisebb magasság {{ min_height }}px. + + + This value should be the user's current password. + Ez az érték a felhasználó jelenlegi jelszavával kell megegyezzen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ennek az értéknek pontosan {{ limit }} karaktert kell tartalmaznia.|Ennek az értéknek pontosan {{ limit }} karaktert kell tartalmaznia. + + + The file was only partially uploaded. + A fájl csak részben lett feltöltve. + + + No file was uploaded. + Nem lett fájl feltöltve. + + + No temporary folder was configured in php.ini. + Nincs ideiglenes könyvtár beállítva a php.ini-ben. + + + Cannot write temporary file to disk. + Az ideiglenes fájl nem írható a lemezre. + + + A PHP extension caused the upload to fail. + Egy PHP bővítmény miatt a feltöltés nem sikerült. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ennek a gyűjteménynek legalább {{ limit }} elemet kell tartalmaznia.|Ennek a gyűjteménynek legalább {{ limit }} elemet kell tartalmaznia. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ez a gyűjtemény legfeljebb {{ limit }} elemet tartalmazhat.|Ez a gyűjtemény legfeljebb {{ limit }} elemet tartalmazhat. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ennek a gyűjteménynek pontosan {{ limit }} elemet kell tartalmaznia.|Ennek a gyűjteménynek pontosan {{ limit }} elemet kell tartalmaznia. + + + Invalid card number. + Érvénytelen kártyaszám. + + + Unsupported card type or invalid card number. + Nem támogatott kártyatípus vagy érvénytelen kártyaszám. + + + This is not a valid International Bank Account Number (IBAN). + Érvénytelen nemzetközi bankszámlaszám (IBAN). + + + This value is not a valid ISBN-10. + Ez az érték nem egy érvényes ISBN-10. + + + This value is not a valid ISBN-13. + Ez az érték nem egy érvényes ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ez az érték nem egy érvényes ISBN-10 vagy ISBN-13. + + + This value is not a valid ISSN. + Ez az érték nem egy érvényes ISSN. + + + This value is not a valid currency. + Ez az érték nem egy érvényes pénznem. + + + This value should be equal to {{ compared_value }}. + Ez az érték legyen {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ez az érték nagyobb legyen, mint {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ez az érték nagyobb vagy egyenlő legyen, mint {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ez az érték ugyanolyan legyen, mint {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ez az érték kisebb legyen, mint {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ez az érték kisebb vagy egyenlő legyen, mint {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ez az érték ne legyen {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ez az érték ne legyen ugyanolyan, mint {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A képarány túl nagy ({{ ratio }}). A megengedett legnagyobb képarány {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A képarány túl kicsi ({{ ratio }}). A megengedett legkisebb képarány {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A kép négyzet alakú ({{ width }}x{{ height }}px). A négyzet alakú képek nem engedélyezettek. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A kép fekvő tájolású ({{ width }}x{{ height }}px). A fekvő tájolású képek nem engedélyezettek. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A kép álló tájolású ({{ width }}x{{ height }}px). Az álló tájolású képek nem engedélyezettek. + + + An empty file is not allowed. + Üres fájl nem megengedett. + + + The host could not be resolved. + Az állomásnevet nem lehet feloldani. + + + This value does not match the expected {{ charset }} charset. + Ez az érték nem az elvárt {{ charset }} karakterkódolást használja. + + + This is not a valid Business Identifier Code (BIC). + Érvénytelen nemzetközi bankazonosító kód (BIC/SWIFT). + + + Error + Hiba + + + This is not a valid UUID. + Érvénytelen egyedi azonosító (UUID). + + + This value should be a multiple of {{ compared_value }}. + Ennek az értéknek oszthatónak kell lennie a következővel: {{ compared_value }} + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ez a Bankazonosító kód (BIC) nem kapcsolódik az IBAN kódhoz ({{ iban }}). + + + This value should be valid JSON. + Ez az érték érvényes JSON kell, hogy legyen. + + + This value should be positive. + Ennek az értéknek pozitívnak kell lennie. + + + This value should be either positive or zero. + Ennek az értéknek pozitívnak vagy nullának kell lennie. + + + This value should be negative. + Ennek az értéknek negatívnak kell lennie. + + + This value should be either negative or zero. + Ennek az értéknek negatívnak vagy nullának kell lennie. + + + This collection should contain only unique elements. + Ez a gyűjtemény csak egyedi elemeket tartalmazhat. + + + This value is not a valid timezone. + Ez az érték nem egy érvényes időzóna. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ez a jelszó korábban egy adatvédelmi incidens során illetéktelenek kezébe került, így nem használható. Kérjük, használjon másik jelszót. + + + This value should be between {{ min }} and {{ max }}. + Ennek az értéknek {{ min }} és {{ max }} között kell lennie. + + + This value is not a valid hostname. + Ez az érték nem egy érvényes állomásnév (hosztnév). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + A gyűjteményben lévő elemek számának oszthatónak kell lennie a következővel: {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ennek az értéknek meg kell felelni legalább egynek a következő feltételek közül: + + + Each element of this collection should satisfy its own set of constraints. + A gyűjtemény minden elemének meg kell felelni a saját feltételeinek. + + + This value is not a valid International Securities Identification Number (ISIN). + Ez az érték nem egy érvényes nemzetközi értékpapír-azonosító szám (ISIN). + + + This value should be a valid expression. + Ennek az értéknek érvényes kifejezésnek kell lennie. + + + This value is not a valid CSS color. + Ez az érték nem egy érvényes CSS szín. + + + This value is not a valid CIDR notation. + Ez az érték nem egy érvényes CIDR jelölés. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Ennek a netmask értéknek {{ min }} és {{ max }} között kell lennie. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.hy.xlf b/vendor/symfony/validator/Resources/translations/validators.hy.xlf new file mode 100644 index 0000000..f53df12 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.hy.xlf @@ -0,0 +1,395 @@ + + + + + + This value should be false. + Արժեքը պետք է լինի կեղծ։ + + + This value should be true. + Արժեքը պետք է լինի իրական։ + + + This value should be of type {{ type }}. + Արժեքը պետք է լինի {{ type }} տեսակի։ + + + This value should be blank. + Արժեքը պետք է լինի դատարկ։ + + + The value you selected is not a valid choice. + Ձեր ընտրած արժեքը անվավեր ընտրություն է։ + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Դուք պետք է ընտրեք ամենաքիչը {{ limit }} տարբերակներ։ + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Դուք պետք է ընտրեք ոչ ավելի քան {{ limit }} տարբերակներ։ + + + One or more of the given values is invalid. + Մեկ կամ ավելի տրված արժեքները անվավեր են։ + + + This field was not expected. + Այս դաշտը չի սպասվում։ + + + This field is missing. + Այս դաշտը բացակայում է։ + + + This value is not a valid date. + Արժեքը սխալ ամսաթիվ է։ + + + This value is not a valid datetime. + Ամսաթվի և ժամանակի արժեքը անվավեր է։ + + + This value is not a valid email address. + Անվավեր էլ֊փոստի արժեք։ + + + The file could not be found. + Նիշքը չի գտնվել։ + + + The file is not readable. + Նիշքը անընթեռնելի է։ + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Նիշքը չափազանց մեծ է ({{ size }} {{ suffix }}): Մաքսիմալ թույլատրելի չափսը՝ {{ limit }} {{ suffix }}։ + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-տեսակը անվավեր է է({{ type }}): Նիշքերի թույլատրելի MIME-տեսակներն են: {{ types }}։ + + + This value should be {{ limit }} or less. + Արժեքը պետք է լինի {{ limit }} կամ փոքր։ + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Արժեքը չափազանց երկար է: Պետք է լինի {{ limit }} կամ ավել սիմվոլներ։ + + + This value should be {{ limit }} or more. + Արժեքը պետ է լինի {{ limit }} կամ շատ։ + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Արժեքը չափազանց կարճ է: Պետք է լինի {{ limit }} կամ ավելի սիմվոլներ։ + + + This value should not be blank. + Արժեքը չպետք է դատարկ լինի։ + + + This value should not be null. + Արժեքը չպետք է լինի null։ + + + This value should be null. + Արժեքը պետք է լինի null։ + + + This value is not valid. + Անվավեր արժեք։ + + + This value is not a valid time. + Ժամանակի արժեքը անվավեր է։ + + + This value is not a valid URL. + Արժեքը URL չէ։ + + + The two values should be equal. + Երկու արժեքները պետք է նույնը լինեն։ + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Նիշքը չափազանց մեծ է: Մաքսիմալ թույլատրելի չափսը {{ limit }} {{ suffix }} է։ + + + The file is too large. + Նիշքը չափազանց մեծ է։ + + + The file could not be uploaded. + Նիշքը չի կարող բեռնվել։ + + + This value should be a valid number. + Արժեքը պետք է լինի թիվ։ + + + This file is not a valid image. + Նիշքը նկարի վավեր ֆորմատ չէ։ + + + This is not a valid IP address. + Արժեքը վավեր IP հասցե չէ։ + + + This value is not a valid language. + Արժեքը վավեր լեզու չէ։ + + + This value is not a valid locale. + Արժեքը չի հանդիսանում վավեր տեղայնացում։ + + + This value is not a valid country. + Արժեքը պետք է լինի երկիր։ + + + This value is already used. + Այդ արժեքն արդեն օգտագործվում է։ + + + The size of the image could not be detected. + Նկարի չափսերը չստացվեց որոշել։ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Նկարի լայնությունը չափազանց մեծ է({{ width }}px). Մաքսիմալ չափն է {{ max_width }}px։ + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Նկարի լայնությունը չափազանց փոքր է ({{ width }}px). Մինիմալ չափն է {{ min_ width }}px։ + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Նկարի բարձրությունը չափազանց մեծ է ({{ height }}px). Մաքսիմալ չափն է {{ max_height }}px։ + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Նկարի բարձրությունը չափազանց փոքր է ({{ height }}px). Մինիմալ չափն է {{ min_height }}px։ + + + This value should be the user's current password. + Այս արժեքը պետք է լինի օգտագործողի ներկա ծածկագիրը։ + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Այս արժեքը պետք է ունենա ճիշտ {{ limit }} սիմվոլներ։ + + + The file was only partially uploaded. + Նիշքի մասնակի բեռնման սխալ։ + + + No file was uploaded. + Նիշքը չի բեռնվել։ + + + No temporary folder was configured in php.ini. + php.ini նիշքում ժամանակավոր պանակ նշված չէ։ + + + Cannot write temporary file to disk. + Ժամանակավոր նիշքը հնարավոր չէ գրել սկավառակի վրա։ + + + A PHP extension caused the upload to fail. + PHP ֆորմատը դարձել է բեռնման չհաջողման պատճառ։ + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Այս համախումբը պետք է պաուրակի {{ limit }} կամ ավելի տարրեր։|Այս հավելվածը պետք է պարունակի limit }} տարր կամ ավելին։|Այս համախումբը պետք է պարունակի {{ limit }} տարրերին կամ ավելի։ + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Այս համախումբը պետք է պաուրակի {{ limit }} տարրեր կամ քիչ։|Այս համախումբը պետք է պաուրակի {{ limit }} տարր կամ քիչ։|Այս համախումբը պետք է պաուրակի {{ limit }} տարրեր կամ քիչ։ + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Այս համախումբը պետք է պաուրակի ուղիղ {{ limit }} տարր։|Այս համախումբը պետք է պաուրակի ուղիղ {{ limit }} տարրեր։|Այս համախումբը պետք է պաուրակի {{ limit }} տարրեր։ + + + Invalid card number. + Քարտի սխալ համար: + + + Unsupported card type or invalid card number. + Չսպասարկվող կամ սխալ քարտի համար: + + + This is not a valid International Bank Account Number (IBAN). + Արժեքը վավեր միջազային բանկային հաշվի համար չէ (IBAN)։ + + + This value is not a valid ISBN-10. + Արժեքը ունի անվավեր ISBN-10 ձևաչափ։ + + + This value is not a valid ISBN-13. + Արժեքը ունի անվավեր ISBN-13 ձևաչափ։ + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Արժեքը չի համապատասխանում ISBN-10 և ISBN-13 ձևաչափերին։ + + + This value is not a valid ISSN. + Արժեքը չի համապաստասխանում ISSN ձևաչափին։ + + + This value is not a valid currency. + Արժեքը վավեր տարադրամ չէ։ + + + This value should be equal to {{ compared_value }}. + Արժեքը պետք է լինի {{ compared_value }}։ + + + This value should be greater than {{ compared_value }}. + Արժեքը պետք է մեծ լինի, քան {{ compared_value }}։ + + + This value should be greater than or equal to {{ compared_value }}. + Արժեքը պետք է լինի հավասար կամ մեծ քան {{ compared_value }}։ + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Արժեքը պետք է լինի ինչպես {{ compared_value_type }} {{ compared_value }}։ + + + This value should be less than {{ compared_value }}. + Արժեքը պետք է լինի փոքր քան {{ compared_value }}։ + + + This value should be less than or equal to {{ compared_value }}. + Արժեքը պետք է լինի փոքր կամ հավասար {{ compared_value }}։ + + + This value should not be equal to {{ compared_value }}. + Արժեքը պետք է լինի հավասար {{ compared_value }}։ + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Արժեքը պետք է լինի նունը {{ compared_value_type }} {{ compared_value }}: + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Պատկերի կողմերի հարաբերակցությունը խիստ մեծ է ({{ ratio }}). Մաքսիմալ հարաբերակցությունը՝ {{ max_ratio }}։ + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Պատկերի կողմերի հարաբերակցությունը խիստ փոքր է ({{ ratio }}). Մինիմալ հարաբերակցությունը՝ {{ min_ratio }}։ + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Պատկերը քառակուսի է({{ width }}x{{ height }}px)։ Քառակուսի նկարներ չեն թույլատրվում։ + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Պատկերը ալբոմային ուղղվածության է({{ width }}x{{ height }}px)․ դա չի թույլատրվում։ + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Պատկերը պորտրետային ուղղվածության է ({{ width }}x{{ height }}px)․ դա չի թույլատրվում։ + + + An empty file is not allowed. + Դատարկ նիշք չի թույլատրվում։ + + + The host could not be resolved. + Հոսթի անունը հնարավոր չի պարզել։ + + + This value does not match the expected {{ charset }} charset. + Արժեքը չի համընկնում {{ charset }} կոդավորման հետ։ + + + This is not a valid Business Identifier Code (BIC). + Սա վավեր Business Identifier Code (BIC) չէ։ + + + Error + Սխալ + + + This is not a valid UUID. + Սա վավեր UUID չէ։ + + + This value should be a multiple of {{ compared_value }}. + Այս արժեքը պետք է լինի բազմակի {{ compared_value }}։ + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Բիզնեսի նույնականացման կոդը (BIC) կապված չէ IBAN- ի հետ {{ iban }}։ + + + This value should be valid JSON. + Այս արժեքը պետք է լինի վավեր JSON։ + + + This collection should contain only unique elements. + Այս համախումբը պետք է պարունակի միայն եզակի տարրեր։ + + + This value should be positive. + Այս արժեքը պետք է լինի դրական։ + + + This value should be either positive or zero. + Այս արժեքը պետք է լինի դրական կամ զրոյական։ + + + This value should be negative. + Այս արժեքը պետք է լինի բացասական։ + + + This value should be either negative or zero. + Այս արժեքը պետք է լինի բացասական կամ զրոյական։ + + + This value is not a valid timezone. + Այս արժեքը վավեր ժամային գոտի չէ։ + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Գաղտնաբառը գտնվել է տվյալների արտահոսքում. այն չպետք է օգտագործվի: Խնդրում ենք օգտագործել մեկ այլ գաղտնաբառ։ + + + This value should be between {{ min }} and {{ max }}. + Այս արժեքը պետք է լինի {{ min }}-ի և {{ max }}-ի միջև։ + + + This value is not a valid hostname. + Այս հոստի անունը վավեր չէ։ + + + The number of elements in this collection should be a multiple of {{ compared_value }}․ + Այս համախմբի տարրերի քանակը պետք է հավասար լինի {{ compared_value }}-ի բազմապատիկներին։ + + + This value should satisfy at least one of the following constraints: + Այս արժեքը պետք է բավարարի հետևյալ սահմանափակումներից առնվազն մեկը։ + + + Each element of this collection should satisfy its own set of constraints. + Այս համախմբի յուրաքանչյուր տարր պետք է բավարարի իր սեփական սահմանափակումները։ + + + This value is not a valid International Securities Identification Number (ISIN). + Այս արժեքը արժեթղթերի նույնականացման միջազգային համարը վավեր չէ(ISIN)։ + + + This value should be a valid expression. + Այս արժեքը պետք է լինի վավեր արտահայտություն: + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.id.xlf b/vendor/symfony/validator/Resources/translations/validators.id.xlf new file mode 100644 index 0000000..1687f33 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.id.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Nilai ini harus bernilai salah. + + + This value should be true. + Nilai ini harus bernilai benar. + + + This value should be of type {{ type }}. + Nilai ini harus bertipe {{ type }}. + + + This value should be blank. + Nilai ini harus kosong. + + + The value you selected is not a valid choice. + Nilai yang dipilih tidak tepat. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Anda harus memilih paling tidak {{ limit }} pilihan. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Anda harus memilih paling banyak {{ limit }} pilihan. + + + One or more of the given values is invalid. + Satu atau lebih nilai yang diberikan tidak sah. + + + This field was not expected. + Ruas ini tidak diharapkan. + + + This field is missing. + Ruas ini hilang. + + + This value is not a valid date. + Nilai ini bukan merupakan tanggal yang sah. + + + This value is not a valid datetime. + Nilai ini bukan merupakan tanggal dan waktu yang sah. + + + This value is not a valid email address. + Nilai ini bukan alamat surel yang sah. + + + The file could not be found. + Berkas tidak dapat ditemukan. + + + The file is not readable. + Berkas tidak dapat dibaca. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Ukuran berkas terlalu besar ({{ size }} {{ suffix }}). Ukuran maksimum yang diizinkan adalah {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Jenis berkas ({{ type }}) tidak sah. Jenis berkas yang diizinkan adalah {{ types }}. + + + This value should be {{ limit }} or less. + Nilai ini harus {{ limit }} atau kurang. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Nilai ini terlalu panjang. Seharusnya {{ limit }} karakter atau kurang. + + + This value should be {{ limit }} or more. + Nilai ini harus {{ limit }} atau lebih. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Nilai ini terlalu pendek. Seharusnya {{ limit }} karakter atau lebih. + + + This value should not be blank. + Nilai ini tidak boleh kosong. + + + This value should not be null. + Nilai ini tidak boleh 'null'. + + + This value should be null. + Nilai ini harus 'null'. + + + This value is not valid. + Nilai ini tidak sah. + + + This value is not a valid time. + Nilai ini bukan merupakan waktu yang sah. + + + This value is not a valid URL. + Nilai ini bukan URL yang sah. + + + The two values should be equal. + Isi keduanya harus sama. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ukuran berkas terlalu besar. Ukuran maksimum yang diizinkan adalah {{ limit }} {{ suffix }}. + + + The file is too large. + Ukuran berkas terlalu besar. + + + The file could not be uploaded. + Berkas tidak dapat diunggah. + + + This value should be a valid number. + Nilai ini harus angka yang sah. + + + This file is not a valid image. + Berkas ini tidak termasuk citra. + + + This is not a valid IP address. + Ini bukan alamat IP yang sah. + + + This value is not a valid language. + Nilai ini bukan bahasa yang sah. + + + This value is not a valid locale. + Nilai ini bukan lokal yang sah. + + + This value is not a valid country. + Nilai ini bukan negara yang sah. + + + This value is already used. + Nilai ini sudah digunakan. + + + The size of the image could not be detected. + Ukuran dari citra tidak bisa dideteksi. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Lebar citra terlalu besar ({{ width }}px). Ukuran lebar maksimum adalah {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Lebar citra terlalu kecil ({{ width }}px). Ukuran lebar minimum yang diharapkan adalah {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Tinggi citra terlalu besar ({{ height }}px). Ukuran tinggi maksimum adalah {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Tinggi citra terlalu kecil ({{ height }}px). Ukuran tinggi minimum yang diharapkan adalah {{ min_height }}px. + + + This value should be the user's current password. + Nilai ini harus kata sandi pengguna saat ini. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Nilai ini harus memiliki tepat {{ limit }} karakter. + + + The file was only partially uploaded. + Berkas hanya terunggah sebagian. + + + No file was uploaded. + Tidak ada berkas terunggah. + + + No temporary folder was configured in php.ini. + Direktori sementara tidak dikonfiguasi pada php.ini. + + + Cannot write temporary file to disk. + Tidak dapat menuliskan berkas sementara ke dalam media penyimpanan. + + + A PHP extension caused the upload to fail. + Sebuah ekstensi PHP menyebabkan kegagalan unggah. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Kumpulan ini harus memiliki {{ limit }} elemen atau lebih. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Kumpulan ini harus memiliki kurang dari {{ limit }} elemen. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Kumpulan ini harus memiliki tepat {{ limit }} elemen. + + + Invalid card number. + Nomor kartu tidak sah. + + + Unsupported card type or invalid card number. + Jenis kartu tidak didukung atau nomor kartu tidak sah. + + + This is not a valid International Bank Account Number (IBAN). + Ini bukan Nomor Rekening Bank Internasional (IBAN) yang sah. + + + This value is not a valid ISBN-10. + Nilai ini bukan ISBN-10 yang sah. + + + This value is not a valid ISBN-13. + Nilai ini bukan ISBN-13 yang sah. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Nilai ini bukan ISBN-10 maupun ISBN-13 yang sah. + + + This value is not a valid ISSN. + Nilai ini bukan ISSN yang sah. + + + This value is not a valid currency. + Nilai ini bukan mata uang yang sah. + + + This value should be equal to {{ compared_value }}. + Nilai ini seharusnya sama dengan {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Nilai ini seharusnya lebih dari {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Nilai ini seharusnya lebih dari atau sama dengan {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Nilai ini seharusnya identik dengan {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Nilai ini seharusnya kurang dari {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Nilai ini seharusnya kurang dari atau sama dengan {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Nilai ini seharusnya tidak sama dengan {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Nilai ini seharusnya tidak identik dengan {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Rasio citra terlalu besar ({{ ratio }}). Rasio maksimum yang diizinkan adalah {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Rasio citra terlalu kecil ({{ ratio }}). Rasio minimum yang diharapkan adalah {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Citra persegi ({{ width }}x{{ height }}px). Citra persegi tidak diizinkan. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Citra berorientasi lanskap ({{ width }}x{{ height }}px). Citra berorientasi lanskap tidak diizinkan. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Citra berorientasi potret ({{ width }}x{{ height }}px). Citra berorientasi potret tidak diizinkan. + + + An empty file is not allowed. + Berkas kosong tidak diizinkan. + + + The host could not be resolved. + Host tidak dapat diselesaikan. + + + This value does not match the expected {{ charset }} charset. + Nilai ini tidak memenuhi set karakter {{ charset }} yang diharapkan. + + + This is not a valid Business Identifier Code (BIC). + Ini bukan Business Identifier Code (BIC) yang sah. + + + Error + Galat + + + This is not a valid UUID. + Ini bukan UUID yang sah. + + + This value should be a multiple of {{ compared_value }}. + Nilai ini harus kelipatan dari {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Business Identifier Code (BIC) ini tidak terkait dengan IBAN {{ iban }}. + + + This value should be valid JSON. + Nilai ini harus berisi JSON yang sah. + + + This collection should contain only unique elements. + Kumpulan ini harus mengandung elemen yang unik. + + + This value should be positive. + Nilai ini harus positif. + + + This value should be either positive or zero. + Nilai ini harus positif atau nol. + + + This value should be negative. + Nilai ini harus negatif. + + + This value should be either negative or zero. + Nilai ini harus negatif atau nol. + + + This value is not a valid timezone. + Nilai ini harus merupakan zona waktu yang sah. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Kata sandi ini telah bocor di data breach, harus tidak digunakan kembali. Silahkan gunakan kata sandi yang lain. + + + This value should be between {{ min }} and {{ max }}. + Nilai ini harus berada diantara {{ min }} dan {{ max }}. + + + This value is not a valid hostname. + Nilai ini bukan merupakan hostname yang sah. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Angka dari setiap elemen di dalam kumpulan ini harus kelipatan dari {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Nilai ini harus memenuhi setidaknya satu dari batasan berikut: + + + Each element of this collection should satisfy its own set of constraints. + Setiap elemen koleksi ini harus memenuhi batasannya sendiri. + + + This value is not a valid International Securities Identification Number (ISIN). + Nilai ini bukan merupakan International Securities Identification Number (ISIN) yang sah. + + + This value should be a valid expression. + Nilai ini harus berupa ekspresi yang sah. + + + This value is not a valid CSS color. + Nilai ini bukan merupakan warna CSS yang sah. + + + This value is not a valid CIDR notation. + Nilai ini bukan merupakan notasi CIDR yang sah. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Nilai dari netmask harus berada diantara {{ min }} dan {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.it.xlf b/vendor/symfony/validator/Resources/translations/validators.it.xlf new file mode 100644 index 0000000..c7cd437 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.it.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Questo valore dovrebbe essere falso. + + + This value should be true. + Questo valore dovrebbe essere vero. + + + This value should be of type {{ type }}. + Questo valore dovrebbe essere di tipo {{ type }}. + + + This value should be blank. + Questo valore dovrebbe essere vuoto. + + + The value you selected is not a valid choice. + Questo valore dovrebbe essere una delle opzioni disponibili. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Si dovrebbe selezionare almeno {{ limit }} opzione.|Si dovrebbero selezionare almeno {{ limit }} opzioni. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Si dovrebbe selezionare al massimo {{ limit }} opzione.|Si dovrebbero selezionare al massimo {{ limit }} opzioni. + + + One or more of the given values is invalid. + Uno o più valori inseriti non sono validi. + + + This field was not expected. + Questo campo non è stato previsto. + + + This field is missing. + Questo campo è mancante. + + + This value is not a valid date. + Questo valore non è una data valida. + + + This value is not a valid datetime. + Questo valore non è una data e ora valida. + + + This value is not a valid email address. + Questo valore non è un indirizzo email valido. + + + The file could not be found. + Non è stato possibile trovare il file. + + + The file is not readable. + Il file non è leggibile. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Il file è troppo grande ({{ size }} {{ suffix }}). La dimensione massima consentita è {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Il mime type del file non è valido ({{ type }}). I tipi permessi sono {{ types }}. + + + This value should be {{ limit }} or less. + Questo valore dovrebbe essere {{ limit }} o inferiore. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} carattere.|Questo valore è troppo lungo. Dovrebbe essere al massimo di {{ limit }} caratteri. + + + This value should be {{ limit }} or more. + Questo valore dovrebbe essere {{ limit }} o superiore. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} carattere.|Questo valore è troppo corto. Dovrebbe essere almeno di {{ limit }} caratteri. + + + This value should not be blank. + Questo valore non dovrebbe essere vuoto. + + + This value should not be null. + Questo valore non dovrebbe essere nullo. + + + This value should be null. + Questo valore dovrebbe essere nullo. + + + This value is not valid. + Questo valore non è valido. + + + This value is not a valid time. + Questo valore non è un'ora valida. + + + This value is not a valid URL. + Questo valore non è un URL valido. + + + The two values should be equal. + I due valori dovrebbero essere uguali. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Il file è troppo grande. La dimensione massima è {{ limit }} {{ suffix }}. + + + The file is too large. + Il file è troppo grande. + + + The file could not be uploaded. + Il file non può essere caricato. + + + This value should be a valid number. + Questo valore dovrebbe essere un numero. + + + This file is not a valid image. + Questo file non è una immagine valida. + + + This is not a valid IP address. + Questo valore non è un indirizzo IP valido. + + + This value is not a valid language. + Questo valore non è una lingua valida. + + + This value is not a valid locale. + Questo valore non è una impostazione regionale valida. + + + This value is not a valid country. + Questo valore non è una nazione valida. + + + This value is already used. + Questo valore è già stato utilizzato. + + + The size of the image could not be detected. + La dimensione dell'immagine non può essere determinata. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + La larghezza dell'immagine è troppo grande ({{ width }}px). La larghezza massima è di {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + La larghezza dell'immagine è troppo piccola ({{ width }}px). La larghezza minima è di {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + L'altezza dell'immagine è troppo grande ({{ height }}px). L'altezza massima è di {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + L'altezza dell'immagine è troppo piccola ({{ height }}px). L'altezza minima è di {{ min_height }}px. + + + This value should be the user's current password. + Questo valore dovrebbe essere la password attuale dell'utente. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Questo valore dovrebbe contenere esattamente {{ limit }} carattere.|Questo valore dovrebbe contenere esattamente {{ limit }} caratteri. + + + The file was only partially uploaded. + Il file è stato caricato solo parzialmente. + + + No file was uploaded. + Nessun file è stato caricato. + + + No temporary folder was configured in php.ini. + Nessuna cartella temporanea è stata configurata nel php.ini. + + + Cannot write temporary file to disk. + Impossibile scrivere il file temporaneo sul disco. + + + A PHP extension caused the upload to fail. + Un'estensione PHP ha causato il fallimento del caricamento. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Questa collezione dovrebbe contenere almeno {{ limit }} elemento.|Questa collezione dovrebbe contenere almeno {{ limit }} elementi. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Questa collezione dovrebbe contenere massimo {{ limit }} elemento.|Questa collezione dovrebbe contenere massimo {{ limit }} elementi. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Questa collezione dovrebbe contenere esattamente {{ limit }} elemento.|Questa collezione dovrebbe contenere esattamente {{ limit }} elementi. + + + Invalid card number. + Numero di carta non valido. + + + Unsupported card type or invalid card number. + Tipo di carta non supportato o numero non valido. + + + This is not a valid International Bank Account Number (IBAN). + Questo valore non è un IBAN (International Bank Account Number) valido. + + + This value is not a valid ISBN-10. + Questo valore non è un codice ISBN-10 valido. + + + This value is not a valid ISBN-13. + Questo valore non è un codice ISBN-13 valido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Questo valore non è un codice ISBN-10 o ISBN-13 valido. + + + This value is not a valid ISSN. + Questo valore non è un codice ISSN valido. + + + This value is not a valid currency. + Questo valore non è una valuta valida. + + + This value should be equal to {{ compared_value }}. + Questo valore dovrebbe essere uguale a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Questo valore dovrebbe essere maggiore di {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Questo valore dovrebbe essere maggiore o uguale a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Questo valore dovrebbe essere identico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Questo valore dovrebbe essere minore di {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Questo valore dovrebbe essere minore o uguale a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Questo valore dovrebbe essere diverso da {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Questo valore dovrebbe essere diverso da {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Il rapporto di aspetto dell'immagine è troppo grande ({{ ratio }}). Il rapporto massimo consentito è {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Il rapporto di aspetto dell'immagine è troppo piccolo ({{ ratio }}). Il rapporto minimo consentito è {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + L'immagine è quadrata ({{ width }}x{{ height }}px). Le immagini quadrate non sono consentite. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + L'immagine è orizzontale ({{ width }}x{{ height }}px). Le immagini orizzontali non sono consentite. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + L'immagine è verticale ({{ width }}x{{ height }}px). Le immagini verticali non sono consentite. + + + An empty file is not allowed. + Un file vuoto non è consentito. + + + The host could not be resolved. + L'host non può essere risolto. + + + This value does not match the expected {{ charset }} charset. + Questo valore non corrisponde al charset {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Questo valore non è un codice BIC valido. + + + Error + Errore + + + This is not a valid UUID. + Questo non è un UUID valido. + + + This value should be a multiple of {{ compared_value }}. + Questo valore dovrebbe essere un multiplo di {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Questo codice identificativo bancario (BIC) non è associato all'IBAN {{ iban }}. + + + This value should be valid JSON. + Questo valore dovrebbe essere un JSON valido. + + + This collection should contain only unique elements. + Questa collezione dovrebbe contenere solo elementi unici. + + + This value should be positive. + Questo valore dovrebbe essere positivo. + + + This value should be either positive or zero. + Questo valore dovrebbe essere positivo oppure zero. + + + This value should be negative. + Questo valore dovrebbe essere negativo. + + + This value should be either negative or zero. + Questo valore dovrebbe essere negativo oppure zero. + + + This value is not a valid timezone. + Questo valore non è un fuso orario valido. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Questa password è trapelata durante una compromissione di dati, non deve essere usata. Si prega di usare una password diversa. + + + This value should be between {{ min }} and {{ max }}. + Questo valore dovrebbe essere compreso tra {{ min }} e {{ max }}. + + + This value is not a valid hostname. + Questo valore non è un nome di host valido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Il numero di elementi in questa collezione dovrebbe essere un multiplo di {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Questo valore dovrebbe soddisfare almeno uno dei vincoli seguenti: + + + Each element of this collection should satisfy its own set of constraints. + Ciascun elemento di questa collezione dovrebbe soddisfare il suo insieme di vincoli. + + + This value is not a valid International Securities Identification Number (ISIN). + Questo valore non è un codice identificativo internazionale di valori mobiliari (ISIN) valido. + + + This value should be a valid expression. + Questo valore dovrebbe essere un'espressione valida. + + + This value is not a valid CSS color. + Questo valore non è un colore CSS valido. + + + This value is not a valid CIDR notation. + Questo valore non è una notazione CIDR valida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Il valore della netmask dovrebbe essere compreso tra {{ min }} e {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.ja.xlf b/vendor/symfony/validator/Resources/translations/validators.ja.xlf new file mode 100644 index 0000000..9feed48 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.ja.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + falseでなければなりません。 + + + This value should be true. + trueでなければなりません。 + + + This value should be of type {{ type }}. + 型は{{ type }}でなければなりません。 + + + This value should be blank. + 空でなければなりません。 + + + The value you selected is not a valid choice. + 有効な選択肢ではありません。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + {{ limit }}個以上選択してください。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + {{ limit }}個以内で選択してください。 + + + One or more of the given values is invalid. + 無効な選択肢が含まれています。 + + + This field was not expected. + このフィールドは予期されていませんでした。 + + + This field is missing. + このフィールドは、欠落しています。 + + + This value is not a valid date. + 有効な日付ではありません。 + + + This value is not a valid datetime. + 有効な日時ではありません。 + + + This value is not a valid email address. + 有効なメールアドレスではありません。 + + + The file could not be found. + ファイルが見つかりません。 + + + The file is not readable. + ファイルを読み込めません。 + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + ファイルのサイズが大きすぎます({{ size }} {{ suffix }})。有効な最大サイズは{{ limit }} {{ suffix }}です。 + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + ファイルのMIMEタイプが無効です({{ type }})。有効なMIMEタイプは{{ types }}です。 + + + This value should be {{ limit }} or less. + {{ limit }}以下でなければなりません。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 値が長すぎます。{{ limit }}文字以内でなければなりません。 + + + This value should be {{ limit }} or more. + {{ limit }}以上でなければなりません。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 値が短すぎます。{{ limit }}文字以上でなければなりません。 + + + This value should not be blank. + 空であってはなりません。 + + + This value should not be null. + nullであってはなりません。 + + + This value should be null. + nullでなければなりません。 + + + This value is not valid. + 有効な値ではありません。 + + + This value is not a valid time. + 有効な時刻ではありません。 + + + This value is not a valid URL. + 有効なURLではありません。 + + + The two values should be equal. + 2つの値が同じでなければなりません。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + ファイルのサイズが大きすぎます。有効な最大サイズは{{ limit }} {{ suffix }}です。 + + + The file is too large. + ファイルのサイズが大きすぎます。 + + + The file could not be uploaded. + ファイルをアップロードできませんでした。 + + + This value should be a valid number. + 有効な数字ではありません。 + + + This file is not a valid image. + ファイルが画像ではありません。 + + + This is not a valid IP address. + 有効なIPアドレスではありません。 + + + This value is not a valid language. + 有効な言語名ではありません。 + + + This value is not a valid locale. + 有効なロケールではありません。 + + + This value is not a valid country. + 有効な国名ではありません。 + + + This value is already used. + 既に使用されています。 + + + The size of the image could not be detected. + 画像のサイズが検出できません。 + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + 画像の幅が大きすぎます({{ width }}ピクセル)。{{ max_width }}ピクセルまでにしてください。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + 画像の幅が小さすぎます({{ width }}ピクセル)。{{ min_width }}ピクセル以上にしてください。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + 画像の高さが大きすぎます({{ height }}ピクセル)。{{ max_height }}ピクセルまでにしてください。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + 画像の高さが小さすぎます({{ height }}ピクセル)。{{ min_height }}ピクセル以上にしてください。 + + + This value should be the user's current password. + ユーザーの現在のパスワードでなければなりません。 + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ちょうど{{ limit }}文字でなければなりません。 + + + The file was only partially uploaded. + ファイルのアップロードは完全ではありません。 + + + No file was uploaded. + ファイルがアップロードされていません。 + + + No temporary folder was configured in php.ini. + php.iniで一時フォルダが設定されていません。 + + + Cannot write temporary file to disk. + 一時ファイルをディスクに書き込むことができません。 + + + A PHP extension caused the upload to fail. + PHP拡張によってアップロードに失敗しました。 + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + {{ limit }}個以上の要素を含んでなければいけません。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + 要素は{{ limit }}個までです。 + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + 要素はちょうど{{ limit }}個でなければなりません。 + + + Invalid card number. + 無効なカード番号です。 + + + Unsupported card type or invalid card number. + 未対応のカード種類又は無効なカード番号です。 + + + This is not a valid International Bank Account Number (IBAN). + 有効なIBANコードではありません。 + + + This value is not a valid ISBN-10. + 有効なISBN-10コードではありません。 + + + This value is not a valid ISBN-13. + 有効なISBN-13コードではありません。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 有効なISBN-10コード又はISBN-13コードではありません。 + + + This value is not a valid ISSN. + 有効なISSNコードではありません。 + + + This value is not a valid currency. + 有効な貨幣ではありません。 + + + This value should be equal to {{ compared_value }}. + {{ compared_value }}と等しくなければなりません。 + + + This value should be greater than {{ compared_value }}. + {{ compared_value }}より大きくなければなりません。 + + + This value should be greater than or equal to {{ compared_value }}. + {{ compared_value }}以上でなければなりません。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + {{ compared_value_type }}としての{{ compared_value }}と等しくなければなりません。 + + + This value should be less than {{ compared_value }}. + {{ compared_value }}未満でなければなりません。 + + + This value should be less than or equal to {{ compared_value }}. + {{ compared_value }}以下でなければなりません。 + + + This value should not be equal to {{ compared_value }}. + {{ compared_value }}と等しくてはいけません。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + {{ compared_value_type }}としての{{ compared_value }}と等しくてはいけません。 + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + 画像のアスペクト比が大きすぎます({{ ratio }})。{{ max_ratio }}までにしてください。 + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + 画像のアスペクト比が小さすぎます({{ ratio }})。{{ min_ratio }}以上にしてください。 + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + 画像が正方形になっています({{ width }}x{{ height }}ピクセル)。正方形の画像は許可されていません。 + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + 画像が横向きになっています({{ width }}x{{ height }}ピクセル)。横向きの画像は許可されていません。 + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + 画像が縦向きになっています({{ width }}x{{ height }}ピクセル)。縦向きの画像は許可されていません。 + + + An empty file is not allowed. + 空のファイルは許可されていません。 + + + The host could not be resolved. + ホストを解決できませんでした。 + + + This value does not match the expected {{ charset }} charset. + この値は予期される文字コード({{ charset }})と異なります。 + + + This is not a valid Business Identifier Code (BIC). + 有効なSWIFTコードではありません。 + + + Error + エラー + + + This is not a valid UUID. + 有効なUUIDではありません。 + + + This value should be a multiple of {{ compared_value }}. + {{ compared_value }}の倍数でなければなりません。 + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + このSWIFTコードはIBANコード({{ iban }})に関連付けられていません。 + + + This value should be valid JSON. + JSONでなければなりません。 + + + This collection should contain only unique elements. + 要素は重複してはなりません。 + + + This value should be positive. + 正の数でなければなりません。 + + + This value should be either positive or zero. + 正の数、または0でなければなりません。 + + + This value should be negative. + 負の数でなければなりません。 + + + This value should be either negative or zero. + 負の数、または0でなければなりません。 + + + This value is not a valid timezone. + 有効なタイムゾーンではありません。 + + + This password has been leaked in a data breach, it must not be used. Please use another password. + このパスワードは漏洩している為使用できません。 + + + This value should be between {{ min }} and {{ max }}. + {{ min }}以上{{ max }}以下でなければなりません。 + + + This value is not a valid hostname. + 有効なホスト名ではありません。 + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + 要素の数は{{ compared_value }}の倍数でなければなりません。 + + + This value should satisfy at least one of the following constraints: + 以下の制約のうち少なくとも1つを満たす必要があります: + + + Each element of this collection should satisfy its own set of constraints. + コレクションの各要素は、それぞれの制約を満たす必要があります。 + + + This value is not a valid International Securities Identification Number (ISIN). + この値は有効な国際証券識別番号(ISIN)ではありません。 + + + This value should be a valid expression. + 式でなければなりません。 + + + This value is not a valid CSS color. + この値は有効なCSSカラーではありません。 + + + This value is not a valid CIDR notation. + この値は有効なCIDR表記ではありません。 + + + The value of the netmask should be between {{ min }} and {{ max }}. + ネットマスクの値は、{{ min }}から{{ max }}の間にある必要があります。 + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.lb.xlf b/vendor/symfony/validator/Resources/translations/validators.lb.xlf new file mode 100644 index 0000000..f27bbd4 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.lb.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Dëse Wäert sollt falsch sinn. + + + This value should be true. + Dëse Wäert sollt wouer sinn. + + + This value should be of type {{ type }}. + Dëse Wäert sollt vum Typ {{ type }} sinn. + + + This value should be blank. + Dëse Wäert sollt eidel sinn. + + + The value you selected is not a valid choice. + Dëse Wäert sollt enger vun de Wielméiglechkeeten entspriechen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Et muss mindestens {{ limit }} Méiglechkeet ausgewielt ginn.|Et musse mindestens {{ limit }} Méiglechkeeten ausgewielt ginn. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Et dierf héchstens {{ limit }} Méiglechkeet ausgewielt ginn.|Et dierfen héchstens {{ limit }} Méiglechkeeten ausgewielt ginn. + + + One or more of the given values is invalid. + Een oder méi vun de Wäerter ass ongëlteg. + + + This field was not expected. + D'Feld gouf net erwaart. + + + This field is missing. + D'Feld feelt. + + + This value is not a valid date. + Dëse Wäert entsprécht kenger gëlteger Datumsangab. + + + This value is not a valid datetime. + Dëse Wäert entsprécht kenger gëlteger Datums- an Zäitangab. + + + This value is not a valid email address. + Dëse Wäert ass keng gëlteg Email-Adress. + + + The file could not be found. + De Fichier gouf net fonnt. + + + The file is not readable. + De Fichier ass net liesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + De Fichier ass ze grouss ({{ size }} {{ suffix }}). Déi zougeloosse Maximalgréisst bedréit {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Den Typ vum Fichier ass ongëlteg ({{ type }}). Erlaabten Type sinn {{ types }}. + + + This value should be {{ limit }} or less. + Dëse Wäert soll méi kleng oder gläich {{ limit }} sinn. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Dës Zeecheketten ass ze laang. Se sollt héchstens {{ limit }} Zeechen hunn. + + + This value should be {{ limit }} or more. + Dëse Wäert sollt méi grouss oder gläich {{ limit }} sinn. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Dës Zeecheketten ass ze kuerz. Se sollt mindestens {{ limit }} Zeechen hunn. + + + This value should not be blank. + Dëse Wäert sollt net eidel sinn. + + + This value should not be null. + Dëst sollt keen Null-Wäert sinn. + + + This value should be null. + Dëst sollt keen Null-Wäert sinn. + + + This value is not valid. + Dëse Wäert ass net gëlteg. + + + This value is not a valid time. + Dëse Wäert entsprécht kenger gëlteger Zäitangab. + + + This value is not a valid URL. + Dëse Wäert ass keng gëlteg URL. + + + The two values should be equal. + Béid Wäerter sollten identesch sinn. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + De fichier ass ze grouss. Déi maximal Gréisst dierf {{ limit }} {{ suffix }} net depasséieren. + + + The file is too large. + De Fichier ass ze grouss. + + + The file could not be uploaded. + De Fichier konnt net eropgeluede ginn. + + + This value should be a valid number. + Dëse Wäert sollt eng gëlteg Zuel sinn. + + + This file is not a valid image. + Dëse Fichier ass kee gëltegt Bild. + + + This is not a valid IP address. + Dëst ass keng gëlteg IP-Adress. + + + This value is not a valid language. + Dëse Wäert entsprécht kenger gëlteger Sprooch. + + + This value is not a valid locale. + Dëse Wäert entsprécht kengem gëltege Gebittsschema. + + + This value is not a valid country. + Dëse Wäert entsprécht kengem gëltege Land. + + + This value is already used. + Dëse Wäert gëtt scho benotzt. + + + The size of the image could not be detected. + D'Gréisst vum Bild konnt net detektéiert ginn. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + D'Breet vum Bild ass ze grouss ({{ width }}px). Déi erlaabte maximal Breet ass {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + D'Breet vum Bild ass ze kleng ({{ width }}px). Déi minimal Breet ass {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + D'Héicht vum Bild ass ze grouss ({{ height }}px). Déi erlaabte maximal Héicht ass {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + D'Héicht vum Bild ass ze kleng ({{ height }}px). Déi minimal Héicht ass {{ min_height }}px. + + + This value should be the user's current password. + Dëse Wäert sollt dem aktuelle Benotzerpasswuert entspriechen. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Dëse Wäert sollt exakt {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn. + + + The file was only partially uploaded. + De Fichier gouf just deelweis eropgelueden. + + + No file was uploaded. + Et gouf kee Fichier eropgelueden. + + + No temporary folder was configured in php.ini. + Et gouf keen temporären Dossier an der php.ini konfiguréiert oder den temporären Dossier existéiert net. + + + Cannot write temporary file to disk. + Den temporäre Fichier kann net gespäichert ginn. + + + A PHP extension caused the upload to fail. + Eng PHP-Erweiderung huet den Upload verhënnert. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Dës Sammlung sollt {{ limit }} oder méi Elementer hunn. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Dës Sammlung sollt {{ limit }} oder manner Elementer hunn. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Dës Sammlung sollt exakt {{ limit }} Element hunn.|Dës Sammlung sollt exakt {{ limit }} Elementer hunn. + + + Invalid card number. + Ongëlteg Kaartennummer. + + + Unsupported card type or invalid card number. + Net ënnerstëtzte Kaartentyp oder ongëlteg Kaartennummer. + + + This is not a valid International Bank Account Number (IBAN). + Dëst ass keng gëlteg IBAN-Kontonummer. + + + This value is not a valid ISBN-10. + Dëse Wäert ass keng gëlteg ISBN-10. + + + This value is not a valid ISBN-13. + Dëse Wäert ass keng gëlteg ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Dëse Wäert ass weder eng gëlteg ISBN-10 nach eng gëlteg ISBN-13. + + + This value is not a valid ISSN. + Dëse Wäert ass keng gëlteg ISSN. + + + This value is not a valid currency. + Dëse Wäert ass keng gëlteg Währung. + + + This value should be equal to {{ compared_value }}. + Dëse Wäert sollt {{ compared_value }} sinn. + + + This value should be greater than {{ compared_value }}. + Dëse Wäert sollt méi grouss wéi {{ compared_value }} sinn. + + + This value should be greater than or equal to {{ compared_value }}. + Dëse Wäert sollt méi grouss wéi oder gläich {{ compared_value }} sinn. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Dëse Wäert sollt identesch si mat {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Dëse Wäert sollt méi kleng wéi {{ compared_value }} sinn. + + + This value should be less than or equal to {{ compared_value }}. + Dëse Wäert sollt méi kleng wéi oder gläich {{ compared_value }} sinn. + + + This value should not be equal to {{ compared_value }}. + Dëse Wäert sollt net {{ compared_value }} sinn. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Dëse Wäert sollt net identesch si mat {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + D'Säiteverhältnis vum Bild ass ze grouss ({{ ratio }}). Den erlaabte Maximalwäert ass {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + D'Säiteverhältnis vum Bild ass ze kleng ({{ ratio }}). Den erwaarte Minimalwäert ass {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + D'Bild ass quadratesch ({{ width }}x{{ height }}px). Quadratesch Biller sinn net erlaabt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + D'Bild ass am Queeschformat ({{ width }}x{{ height }}px). Biller am Queeschformat sinn net erlaabt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + D'Bild ass am Héichformat ({{ width }}x{{ height }}px). Biller am Héichformat sinn net erlaabt. + + + An empty file is not allowed. + En eidele Fichier ass net erlaabt. + + + The host could not be resolved. + Den Host-Numm konnt net opgeléist ginn. + + + This value does not match the expected {{ charset }} charset. + Dëse Wäert entsprécht net dem erwaarten Zeechesaz {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dëst ass kee gëltege "Business Identifier Code" (BIC). + + + Error + Feeler + + + This is not a valid UUID. + Dëst ass keng gëlteg UUID. + + + This value should be a multiple of {{ compared_value }}. + Dëse Wäert sollt e puer vun {{ compared_value }} sinn. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Dëse "Business Identifier Code" (BIC) ass net mat IBAN verbonnen {{ iban }}. + + + This value should be valid JSON. + Dëse Wäert sollt gëlteg JSON. + + + This collection should contain only unique elements. + Dës Sammlung sollt just eenzegaarteg Elementer enthalen. + + + This value should be positive. + Dëse Wäert sollt positiv sinn. + + + This value should be either positive or zero. + Dëse Wäert sollt entweeder positiv oder null sinn. + + + This value should be negative. + Dëse Wäert sollt negativ sinn. + + + This value should be either negative or zero. + Dëse Wäert sollt entweeder negativ oder null sinn. + + + This value is not a valid timezone. + Dëse Wäert ass keng gëlteg Zäitzon. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dëst Passwuert war Deel vun engem Dateleck an dierf net benotzt ginn. Benotzt w.e.g. en anert Passwuert . + + + This value should be between {{ min }} and {{ max }}. + De Wäert sollt tëscht {{ min }} a(n) {{ max }} leien. + + + This value is not a valid hostname. + Dëse Wäert ass kee gëltegen Hostnumm. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + D'Unzuel un Elementer an dëser Sammlung sollt e multipel vu(n) {{ compared_value }} sinn. + + + This value should satisfy at least one of the following constraints: + Dëse Wäert sollt op d'mannst ee vun dësen Aschränkungen erfëllen: + + + Each element of this collection should satisfy its own set of constraints. + All Element aus dëser Sammlung sollt seng eegen Aschränkungen erfëllen. + + + This value is not a valid International Securities Identification Number (ISIN). + Dëse Wäert ass keng gëlteg International Wäertpabeiererkennnummer (ISIN). + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.lt.xlf b/vendor/symfony/validator/Resources/translations/validators.lt.xlf new file mode 100644 index 0000000..7a2c4c5 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.lt.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Reikšmė turi būti neigiama. + + + This value should be true. + Reikšmė turi būti teigiama. + + + This value should be of type {{ type }}. + Šios reikšmės tipas turi būti {{ type }}. + + + This value should be blank. + Ši reikšmė turi būti tuščia. + + + The value you selected is not a valid choice. + Neteisingas pasirinkimas. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Turite pasirinkti bent {{ limit }} variantą.|Turite pasirinkti bent {{ limit }} variantus.|Turite pasirinkti bent {{ limit }} variantų. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Turite pasirinkti ne daugiau kaip {{ limit }} variantą.|Turite pasirinkti ne daugiau kaip {{ limit }} variantus.|Turite pasirinkti ne daugiau kaip {{ limit }} variantų. + + + One or more of the given values is invalid. + Viena ar daugiau įvestų reikšmių yra netinkamos. + + + This field was not expected. + Nebuvo tikimasi Šis laukas. + + + This field is missing. + Šiame lauke yra dingęs. + + + This value is not a valid date. + Ši reikšmė nėra data. + + + This value is not a valid datetime. + Ši reikšmė nera data ir laikas. + + + This value is not a valid email address. + Ši reikšmė nėra tinkamas el. pašto adresas. + + + The file could not be found. + Byla nerasta. + + + The file is not readable. + Negalima nuskaityti bylos. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Byla yra per didelė ({{ size }} {{ suffix }}). Maksimalus dydis {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Netinkamas bylos tipas (mime type) ({{ type }}). Galimi bylų tipai {{ types }}. + + + This value should be {{ limit }} or less. + Reikšmė turi būti {{ limit }} arba mažiau. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Per didelis simbolių skaičius. Turi susidaryti iš {{ limit }} arba mažiau simbolių.|Per didelis simbolių skaičius. Turi susidaryti iš {{ limit }} arba mažiau simbolių.|Per didelis simbolių skaičius. Turi susidaryti iš {{ limit }} arba mažiau simbolių. + + + This value should be {{ limit }} or more. + Reikšmė turi būti {{ limit }} arba daugiau. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Per mažas simbolių skaičius. Turi susidaryti iš {{ limit }} arba daugiau simbolių.|Per mažas simbolių skaičius. Turi susidaryti iš {{ limit }} arba daugiau simbolių.|Per mažas simbolių skaičius. Turi susidaryti iš {{ limit }} arba daugiau simbolių. + + + This value should not be blank. + Ši reikšmė negali būti tuščia. + + + This value should not be null. + Ši reikšmė negali būti null. + + + This value should be null. + Ši reikšmė turi būti null. + + + This value is not valid. + Netinkama reikšmė. + + + This value is not a valid time. + Ši reikšmė nėra laikas. + + + This value is not a valid URL. + Ši reikšmė nėra tinkamas interneto adresas. + + + The two values should be equal. + Abi reikšmės turi būti identiškos. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Byla yra per didelė. Maksimalus dydis yra {{ limit }} {{ suffix }}. + + + The file is too large. + Byla per didelė. + + + The file could not be uploaded. + Byla negali būti įkelta. + + + This value should be a valid number. + Ši reikšmė turi būti skaičius. + + + This file is not a valid image. + Byla nėra paveikslėlis. + + + This is not a valid IP address. + Ši reikšmė nėra tinkamas IP adresas. + + + This value is not a valid language. + Ši reikšmė nėra tinkama kalba. + + + This value is not a valid locale. + Ši reikšmė nėra tinkama lokalė. + + + This value is not a valid country. + Ši reikšmė nėra tinkama šalis. + + + This value is already used. + Ši reikšmė jau yra naudojama. + + + The size of the image could not be detected. + Nepavyko nustatyti nuotraukos dydžio. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Nuotraukos plotis per didelis ({{ width }}px). Maksimalus leidžiamas plotis yra {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Nuotraukos plotis per mažas ({{ width }}px). Minimalus leidžiamas plotis yra {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Nuotraukos aukštis per didelis ({{ height }}px). Maksimalus leidžiamas aukštis yra {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Nuotraukos aukštis per mažas ({{ height }}px). Minimalus leidžiamas aukštis yra {{ min_height }}px. + + + This value should be the user's current password. + Ši reikšmė turi sutapti su dabartiniu naudotojo slaptažodžiu. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ši reikšmė turi turėti lygiai {{ limit }} simbolį.|Ši reikšmė turi turėti lygiai {{ limit }} simbolius.|Ši reikšmė turi turėti lygiai {{ limit }} simbolių. + + + The file was only partially uploaded. + Failas buvo tik dalinai įkeltas. + + + No file was uploaded. + Nebuvo įkelta jokių failų. + + + No temporary folder was configured in php.ini. + Nėra sukonfiguruoto jokio laikino katalogo php.ini faile. + + + Cannot write temporary file to disk. + Nepavyko išsaugoti laikino failo. + + + A PHP extension caused the upload to fail. + PHP plėtinys sutrukdė failo įkėlimą ir jis nepavyko. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Sąraše turi būti {{ limit }} arba daugiau įrašų.|Sąraše turi būti {{ limit }} arba daugiau įrašų.|Sąraše turi būti {{ limit }} arba daugiau įrašų. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Sąraše turi būti {{ limit }} arba mažiau įrašų.|Sąraše turi būti {{ limit }} arba mažiau įrašų.|Sąraše turi būti {{ limit }} arba mažiau įrašų. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Sąraše turi būti lygiai {{ limit }} įrašas.|Sąraše turi būti lygiai {{ limit }} įrašai.|Sąraše turi būti lygiai {{ limit }} įrašų. + + + Invalid card number. + Klaidingas kortelės numeris. + + + Unsupported card type or invalid card number. + Kortelės tipas nepalaikomas arba klaidingas kortelės numeris. + + + This is not a valid International Bank Account Number (IBAN). + Ši reišmė neatitinka tarptautinio banko sąskaitos numerio formato (IBAN). + + + This value is not a valid ISBN-10. + Ši reikšmė neatitinka ISBN-10 formato. + + + This value is not a valid ISBN-13. + Ši reikšmė neatitinka ISBN-13 formato. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ši reikšmė neatitinka nei ISBN-10, nei ISBN-13 formato. + + + This value is not a valid ISSN. + Ši reišmė neatitinka ISSN formato. + + + This value is not a valid currency. + Netinkamas valiutos formatas. + + + This value should be equal to {{ compared_value }}. + Ši reikšmė turi būti lygi {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ši reikšmė turi būti didesnė už {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ši reikšmė turi būti didesnė už arba lygi {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ši reikšmė turi būti identiška {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ši reikšmė turi būti mažesnė už {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ši reikšmė turi būti mažesnė už arba lygi {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ši reikšmė neturi būti lygi {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ši reikšmė neturi būti identiška {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Nuotraukos santykis yra per didelis ({{ ratio }}). Didžiausias leistinas santykis yra {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Nuotraukos santykis yra per mažas ({{ ratio }}). Mažiausias leistinas santykis yra {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Nuotrauka yra kvadratinė ({{ width }}x{{ height }}px). Kvadratinės nuotraukos nėra leistinos. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Nuotrauka orientuota į plotį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į plotį nėra leistinos. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Nuotrauka orientuota į aukštį ({{ width }}x{{ height }}px). Nuotraukos orientuotos į aukštį nėra leistinos. + + + An empty file is not allowed. + Failas negali būti tuščias. + + + The host could not be resolved. + Serveris nepasiekiamas. + + + This value does not match the expected {{ charset }} charset. + Ši reikšmė neatitinka {{ charset }} koduotės. + + + This is not a valid Business Identifier Code (BIC). + Bendrovės Identifikavimo Kodas (BIC) nėra tinkamas. + + + Error + Klaida + + + This is not a valid UUID. + Ši reikšmė nėra tinkamas UUID. + + + This value should be a multiple of {{ compared_value }}. + Ši reikšmė turi būti skaičiaus {{ compared_value }} kartotinis. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Šis bendrovės identifikavimo kodas (BIC) nesusijęs su IBAN {{ iban }}. + + + This value should be valid JSON. + Ši reikšmė turi būti tinkamo JSON formato. + + + This collection should contain only unique elements. + Sąraše turi būti tik unikalios reikšmės. + + + This value should be positive. + Reikšmė turi būti teigiama. + + + This value should be either positive or zero. + Reikšmė turi būti teigiama arba lygi nuliui. + + + This value should be negative. + Reikšmė turi būti neigiama. + + + This value should be either negative or zero. + Reikšmė turi būti neigiama arba lygi nuliui. + + + This value is not a valid timezone. + Reikšmė nėra tinkama laiko juosta. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Slaptažodis yra nutekėjęs duomenų saugumo pažeidime, jo naudoti negalima. Prašome naudoti kitą slaptažodį. + + + This value should be between {{ min }} and {{ max }}. + Ši reikšmė turi būti tarp {{ min }} ir {{ max }}. + + + This value is not a valid hostname. + Ši reikšmė nėra tinkamas svetainės adresas. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Šio sąrašo elementų skaičius turėtų būti skaičiaus {{ compared_value }} kartotinis. + + + This value should satisfy at least one of the following constraints: + Ši reikšmė turėtų atitikti bent vieną iš šių nurodymų: + + + Each element of this collection should satisfy its own set of constraints. + Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį. + + + This value is not a valid International Securities Identification Number (ISIN). + Ši reišmė neatitinka tarptautinio vertybinių popierių identifikavimo numerio formato (ISIN). + + + This value should be a valid expression. + Ši vertė turėtų būti teisinga išraiška. + + + This value is not a valid CSS color. + Ši reikšmė nėra tinkama CSS spalva. + + + This value is not a valid CIDR notation. + Ši vertė nėra tinkamas CIDR žymėjimas. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Tinklo kaukės reikšmė turi būti nuo {{ min }} iki {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.lv.xlf b/vendor/symfony/validator/Resources/translations/validators.lv.xlf new file mode 100644 index 0000000..fc71d5f --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.lv.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Šai vērtībai ir jābūt nepatiesai. + + + This value should be true. + Šai vērtībai ir jābūt patiesai. + + + This value should be of type {{ type }}. + Šīs vērtības tipam ir jābūt {{ type }}. + + + This value should be blank. + Šai vērtībai ir jābūt tukšai. + + + The value you selected is not a valid choice. + Vērtība, kuru jūs izvēlējāties nav derīga izvēle. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Jums nav jāveic izvēle.|Jums ir jāveic vismaz {{ limit }} izvēle.|Jums ir jāveic vismaz {{ limit }} izvēles. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Jums nav jāveic izvēle.|Jums ir jāveic ne vairāk kā {{ limit }} izvēle.|Jums ir jāveic ne vairāk kā {{ limit }} izvēles. + + + One or more of the given values is invalid. + Viena vai vairākas no dotajām vērtībām ir nederīgas. + + + This field was not expected. + Šis lauks netika gaidīts. + + + This field is missing. + Šis lauks ir pazudis. + + + This value is not a valid date. + Šī vērtība ir nederīgs datums. + + + This value is not a valid datetime. + Šī vērtība ir nederīgs datums un laiks + + + This value is not a valid email address. + Šī vērtība ir nederīga e-pasta adrese. + + + The file could not be found. + Fails nav atrasts. + + + The file is not readable. + Fails nav lasāms. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fails ir pārāk liels ({{ size }} {{ suffix }}). Atļautais maksimālais izmērs ir {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faila mime tips nav derīgs ({{ type }}). Atļautie mime tipi ir {{ types }}. + + + This value should be {{ limit }} or less. + Šai vērtībai ir jābūt ne vairāk kā {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Šīs vērtības garums ir 0 rakstzīmju.|Šī vērtība ir pārāk gara. Tai būtu jābūt ne vairāk kā {{ limit }} rakstzīmei.|Šī vērtība ir pārāk gara. Tai būtu jābūt ne vairāk kā {{ limit }} rakstzīmēm. + + + This value should be {{ limit }} or more. + Šai vērtībai ir jābūt ne mazāk kā {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Šīs vērtības garums ir 0 rakstzīmju.|Šī vērtība ir pārāk īsa. Tai būtu jābūt ne mazāk kā {{ limit }} rakstzīmei.|Šī vērtība ir pārāk īsa. Tai būtu jābūt ne mazāk kā {{ limit }} rakstzīmēm. + + + This value should not be blank. + Šai vērtībai nav jābūt tukšai. + + + This value should not be null. + Šai vērtībai nav jābūt null. + + + This value should be null. + Šai vērtībai ir jābūt null. + + + This value is not valid. + Šī vērtība ir nederīga. + + + This value is not a valid time. + Šī vērtība ir nederīgs laiks. + + + This value is not a valid URL. + Šī vērtība ir nederīgs URL. + + + The two values should be equal. + Abām vērtībām jābūt vienādam. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fails ir pārāk liels. Atļautais maksimālais izmērs ir {{ limit }} {{ suffix }}. + + + The file is too large. + Fails ir pārāk liels. + + + The file could not be uploaded. + Failu nevarēja augšupielādēt. + + + This value should be a valid number. + Šai vērtībai ir jābūt derīgam skaitlim. + + + This file is not a valid image. + Šis fails nav derīgs attēls. + + + This is not a valid IP address. + Šī nav derīga IP adrese. + + + This value is not a valid language. + Šī vērtība nav derīga valoda. + + + This value is not a valid locale. + Šī vērtība nav derīga lokalizācija. + + + This value is not a valid country. + Šī vērtība nav derīga valsts. + + + This value is already used. + Šī vērtība jau tiek izmantota. + + + The size of the image could not be detected. + Nevar noteikt attēla izmēru. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Attēla platums ir pārāk liels ({{ width }}px). Atļautais maksimālais platums ir {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Attēla platums ir pārāk mazs ({{ width }}px). Minimālais sagaidāmais platums ir {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Attēla augstums ir pārāk liels ({{ height }}px). Atļautais maksimālais augstums ir {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Attēla augstums ir pārāk mazs ({{ height }}px). Minimālais sagaidāmais augstums ir {{ min_height }}px. + + + This value should be the user's current password. + Šai vērtībai ir jābūt lietotāja pašreizējai parolei. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Šīs vērtības garums ir 0 rakstzīmju.|Šai vērtībai ir jābūt tieši {{ limit }} rakstzīmei.|Šai vērtībai ir jābūt tieši {{ limit }} rakstzīmēm. + + + The file was only partially uploaded. + Fails bija tikai daļēji augšupielādēts. + + + No file was uploaded. + Fails netika augšupielādēts. + + + No temporary folder was configured in php.ini. + Pagaidu mape php.ini failā nav nokonfigurēta. + + + Cannot write temporary file to disk. + Nevar ierakstīt pagaidu failu uz diska. + + + A PHP extension caused the upload to fail. + PHP paplašinājums izraisīja augšupielādes neizdošanos. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Šis krājums satur 0 elementu.|Šim krājumam jāsatur vismaz {{ limit }} elementu.|Šim krājumam jāsatur vismaz {{ limit }} elementus. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Šis krājums satur 0 elementu.|Šim krājumam jāsatur ne vairāk kā {{ limit }} elementu.|Šim krājumam jāsatur ne vairāk kā {{ limit }} elementus. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Šis krājums satur 0 elementu.|Šim krājumam jāsatur tieši {{ limit }} elementu.|Šim krājumam jāsatur tieši {{ limit }} elementus. + + + Invalid card number. + Nederīgs kartes numurs. + + + Unsupported card type or invalid card number. + Neatbalstīts kartes tips vai nederīgs kartes numurs. + + + This is not a valid International Bank Account Number (IBAN). + Šis nav derīgs starptautisks banku konta numurs (IBAN). + + + This value is not a valid ISBN-10. + Šī vērtība nav derīgs ISBN-10 numurs. + + + This value is not a valid ISBN-13. + Šī vērtība nav derīgs ISBN-13 numurs + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Šī vērtība neatbilst ne derīgam ISBN-10 numuram, ne derīgm ISBN-13 numuram. + + + This value is not a valid ISSN. + Šī vērtība nav derīgs ISSN numurs + + + This value is not a valid currency. + Šī vērtība nav derīga valūta + + + This value should be equal to {{ compared_value }}. + Šai vērtībai ir jābūt vienādai ar {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Šai vērtībai ir jābūt lielākai par {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Šai vērtībai ir jābūt lielākai vai vienādai ar {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Šai vērtībai ir jābūt identiskai ar {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Šai vērtībai ir jābūt mazākai par {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Šai vērtībai ir jābūt mazākai vai vienādai ar {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Šai vērtībai ir jābūt vienādai ar {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Šai vērtībai nav jābūt identiskai ar {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Attēla attiecība ir pārāk liela ({{ ratio }}). Atļautā maksimālā attiecība ir {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Attēla attiecība ir pārāk maza ({{ ratio }}). Minimālā sagaidāmā attiecība ir {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Šis attēls ir kvadrāts ({{ width }}x{{ height }}px). Kvadrātveida attēli nav atļauti. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Attēls ir orientēts kā ainava ({{ width }}x{{ height }}px). Attēli, kas ir orientēti kā ainavas nav atļauti. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Attēls ir orientēts kā portrets ({{ width }}x{{ height }}px). Attēli, kas ir orientēti kā portreti nav atļauti. + + + An empty file is not allowed. + Tukšs fails nav atļauts. + + + The host could not be resolved. + Resursdatora nosaukumu nevar atrisināt. + + + This value does not match the expected {{ charset }} charset. + Šī vērtība neatbilst sagaidāmajai rakstzīmju kopai {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Šī vērtība nav derīgs Biznesa Identifikācijas Kods (BIC). + + + Error + Kļūda + + + This is not a valid UUID. + Šis nav derīgs UUID. + + + This value should be a multiple of {{ compared_value }}. + Šai vērtībai jābūt vairākas reizes atkārtotai {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Šis Biznesa Identifikācijas Kods (BIC) neatbilst {{ iban }} konta numuram (IBAN). + + + This value should be valid JSON. + Šai vērtībai jābūt derīgam JSON. + + + This collection should contain only unique elements. + Šai kolekcijai jāsatur tikai unikāli elementi. + + + This value should be positive. + Šai vērtībai jābūt pozitīvai. + + + This value should be either positive or zero. + Šai vērtībai jābūt pozitīvai vai vienādai ar nulli. + + + This value should be negative. + Šai vērtībai jābūt negatīvai. + + + This value should be either negative or zero. + Šai vērtībai jābūt negatīvai vai vienādai ar nulli. + + + This value is not a valid timezone. + Šī vērtība nav derīga laika zona. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Šī parole tika publicēta datu noplūdē, viņu nedrīkst izmantot. Lūdzu, izvēlieties citu paroli. + + + This value should be between {{ min }} and {{ max }}. + Šai vērtībai jābūt starp {{ min }} un {{ max }}. + + + This value is not a valid hostname. + Šī vērtība nav derīgs tīmekļa servera nosaukums. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Elementu skaitam šajā kolekcijā jābūt {{ compared_value }} reizinājumam. + + + This value should satisfy at least one of the following constraints: + Šai vērtībai jāiekļaujas vismaz vienā no sekojošiem ierobežojumiem: + + + Each element of this collection should satisfy its own set of constraints. + Šīs kolekcijas katram elementam jāiekļaujas savā ierobežojumu kopā. + + + This value is not a valid International Securities Identification Number (ISIN). + Šī vērtība nav derīgs starptautiskais vērtspapīru identifikācijas numurs (ISIN). + + + This value should be a valid expression. + Šai vērtībai jābūt korektai izteiksmei. + + + This value is not a valid CSS color. + Šī vērtība nav korekta CSS krāsa. + + + This value is not a valid CIDR notation. + Šī vērtība nav korekts CIDR apzīmējums. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Tīkla maskas (netmask) vērtībai jābūt starp {{ min }} un {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.mn.xlf b/vendor/symfony/validator/Resources/translations/validators.mn.xlf new file mode 100644 index 0000000..b767dc8 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.mn.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Энэ утга буруу байх ёстой. + + + This value should be true. + Энэ утга үнэн байх ёстой. + + + This value should be of type {{ type }}. + Энэ утга {{ type }} -н төрөл байх ёстой. + + + This value should be blank. + Энэ утга хоосон байх ёстой. + + + The value you selected is not a valid choice. + Сонгосон утга буруу байна. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Хамгийн багадаа {{ limit }} утга сонгогдсон байх ёстой. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Хамгийн ихдээ {{ limit }} утга сонгогдох боломжтой. + + + One or more of the given values is invalid. + Өгөгдсөн нэг эсвэл нэгээс олон утга буруу байна. + + + This field was not expected. + Энэ талбар нь хүлээгдэж байсан юм. + + + This field is missing. + Энэ талбар нь алга болсон байна. + + + This value is not a valid date. + Энэ утга буруу date төрөл байна . + + + This value is not a valid datetime. + Энэ утга буруу цаг төрөл байна. + + + This value is not a valid email address. + И-майл хаяг буруу байна. + + + The file could not be found. + Файл олдсонгүй. + + + The file is not readable. + Файл уншигдахуйц биш байна. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл хэтэрхий том байна ({{ size }} {{ suffix }}). Зөвшөөрөгдөх дээд хэмжээ {{ limit }} {{ suffix }} байна. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Файлын MIME-төрөл нь буруу байна ({{ type }}). Зөвшөөрөгдөх MIME-төрлүүд {{ types }}. + + + This value should be {{ limit }} or less. + Энэ утга {{ limit }} юмуу эсвэл бага байна. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Энэ утга хэтэрхий урт байна. {{ limit }} тэмдэгтийн урттай юмуу эсвэл бага байна. + + + This value should be {{ limit }} or more. + Энэ утга {{ limit }} юмуу эсвэл их байна. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Энэ утга хэтэрхий богино байна. {{ limit }} тэмдэгт эсвэл их байна. + + + This value should not be blank. + Энэ утга хоосон байж болохгүй. + + + This value should not be null. + Энэ утга null байж болохгүй. + + + This value should be null. + Энэ утга null байна. + + + This value is not valid. + Энэ утга буруу байна. + + + This value is not a valid time. + Энэ утга буруу цаг төрөл байна. + + + This value is not a valid URL. + Энэ утга буруу URL байна . + + + The two values should be equal. + Хоёр утгууд ижил байх ёстой. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл хэтэрхий том байна. Зөвшөөрөгдөх дээд хэмжээ нь {{ limit }} {{ suffix }} байна. + + + The file is too large. + Файл хэтэрхий том байна. + + + The file could not be uploaded. + Файл upload хийгдсэнгүй. + + + This value should be a valid number. + Энэ утга зөвхөн тоо байна. + + + This file is not a valid image. + Файл зураг биш байна. + + + This is not a valid IP address. + IP хаяг зөв биш байна. + + + This value is not a valid language. + Энэ утга үнэн зөв хэл биш байна. + + + This value is not a valid locale. + Энэ утга үнэн зөв байршил биш байна. + + + This value is not a valid country. + Энэ утга үнэн бодит улс биш байна. + + + This value is already used. + Энэ утга аль хэдийнээ хэрэглэгдсэн байна. + + + The size of the image could not be detected. + Зургийн хэмжээ тогтоогдож чадсангүй. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Зургийн өргөн хэтэрхий том байна ({{ width }}px). Өргөн нь хамгийн ихдээ {{ max_width }}px байх боломжтой. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Зургийн өргөн хэтэрхий жижиг байна ({{ width }}px). Өргөн нь хамгийн багадаа {{ min_width }}px байх боломжтой. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Зургийн өндөр хэтэрхий том байна ({{ height }}px). Өндөр нь хамгийн ихдээ {{ max_height }}px байх боломжтой. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Зургийн өндөр хэтэрхий жижиг байна ({{ height }}px). Өндөр нь хамгийн багадаа {{ min_height }}px байх боломжтой. + + + This value should be the user's current password. + Энэ утга хэрэглэгчийн одоогийн нууц үг байх ёстой. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Энэ утга яг {{ limit }} тэмдэгт байх ёстой.|Энэ утга яг {{ limit }} тэмдэгт байх ёстой. + + + The file was only partially uploaded. + Файлын зөвхөн хагас нь upload хийгдсэн. + + + No file was uploaded. + Ямар ч файл upload хийгдсэнгүй. + + + No temporary folder was configured in php.ini. + php.ini дээр түр зуурын хавтсыг тохируулаагүй байна, эсвэл тохируулсан хавтас байхгүй байна. + + + Cannot write temporary file to disk. + Түр зуурын файлыг диск руу бичиж болохгүй байна. + + + A PHP extension caused the upload to fail. + PHP extension нь upload -г амжилтгүй болгоод байна. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Энэ коллекц {{ limit }} ба түүнээс дээш тооны элемент агуулах ёстой.|Энэ коллекц {{ limit }} ба түүнээс дээш тооны элемент агуулах ёстой. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Энэ коллекц {{ limit }} ба түүнээс доош тооны элемент агуулах ёстой.|Энэ коллекц {{ limit }} ба түүнээс доош тооны элемент агуулах ёстой. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Энэ коллекц яг {{ limit }} элемент агуулах ёстой.|Энэ коллекц яг {{ limit }} элемент агуулах ёстой. + + + Invalid card number. + Картын дугаар буруу байна. + + + Unsupported card type or invalid card number. + Дэмжигдээгүй картын төрөл эсвэл картын дугаар буруу байна. + + + This is not a valid International Bank Account Number (IBAN). + Энэ утга үнэн зөв Олон Улсын Банкны Дансны Дугаар (IBAN) биш байна. + + + This value is not a valid ISBN-10. + Энэ утга үнэн зөв ISBN-10 биш байна. + + + This value is not a valid ISBN-13. + Энэ утга үнэн зөв ISBN-13 биш байна. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Энэ утга үнэн зөв ISBN-10 юмуу ISBN-13 биш байна. + + + This value is not a valid ISSN. + Энэ утга үнэн зөв ISSN биш байна. + + + This value is not a valid currency. + Энэ утга үнэн бодит валют биш байна. + + + This value should be equal to {{ compared_value }}. + Энэ утга {{ compared_value }} -тaй тэнцүү байх ёстой. + + + This value should be greater than {{ compared_value }}. + Энэ утга {{ compared_value }} -с их байх ёстой. + + + This value should be greater than or equal to {{ compared_value }}. + Энэ утга {{ compared_value }} -тай тэнцүү юмуу эсвэл их байх ёстой. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Энэ утга {{ compared_value_type }} {{ compared_value }} -тай яг ижил байх ёстой. + + + This value should be less than {{ compared_value }}. + Энэ утга {{ compared_value }} -с бага байх ёстой. + + + This value should be less than or equal to {{ compared_value }}. + Энэ утга {{ compared_value }} -тай ижил юмуу эсвэл бага байх ёстой. + + + This value should not be equal to {{ compared_value }}. + Энэ утга {{ compared_value }} -тай тэнцүү байх ёсгүй. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Энэ утга {{ compared_value_type }} {{ compared_value }} -тай яг ижил байх ёсгүй. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Зургийн харьцаа хэтэрхий том байна ({{ ratio }}). Харьцаа нь хамгийн ихдээ {{ max_ratio }} байна. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Зургийн харьцаа хэтэрхий жижиг байна ({{ ratio }}). Харьцаа нь хамгийн багадаа {{ min_ratio }} байна. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Зураг дөрвөлжин хэлбэртэй байна ({{ width }}x{{ height }}px). Дөрвөлжин зургууд оруулах боломжгүй. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Зураг хэвтээ байрлалтай байна ({{ width }}x{{ height }}px). Хэвтээ байрлалтай зургууд оруулах боломжгүй. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Зургууд босоо байрлалтай байна ({{ width }}x{{ height }}px). Босоо байрлалтай зургууд оруулах боломжгүй. + + + An empty file is not allowed. + Хоосон файл оруулах боломжгүй. + + + The host could not be resolved. + Хост зөв тохирогдоогүй байна. + + + This value does not match the expected {{ charset }} charset. + Энэ утга тооцоолсон {{ charset }} тэмдэгттэй таарахгүй байна. + + + This is not a valid Business Identifier Code (BIC). + Энэ утга үнэн зөв Business Identifier Code (BIC) биш байна. + + + Error + Алдаа + + + This is not a valid UUID. + Энэ утга үнэн зөв UUID биш байна. + + + This value should be a multiple of {{ compared_value }}. + Энэ утга {{ compared_value }} -н үржвэр байх ёстой. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Энэ Business Identifier Code (BIC) код нь IBAN {{ iban }} -тай холбоогүй байна. + + + This value should be valid JSON. + Энэ утга JSON байх ёстой. + + + This collection should contain only unique elements. + Энэ коллекц зөвхөн давтагдахгүй элементүүд агуулах ёстой. + + + This value should be positive. + Энэ утга эерэг байх ёстой. + + + This value should be either positive or zero. + Энэ утга тэг эсвэл эерэг байх ёстой. + + + This value should be negative. + Энэ утга сөрөг байх ёстой. + + + This value should be either negative or zero. + Энэ утга сөрөг эсвэл тэг байх ёстой. + + + This value is not a valid timezone. + Энэ утга үнэн зөв цагийн бүс биш байна. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Энэ нууц үгийн мэдээлэл алдагдсан байх магадлалтай учраас дахин ашиглагдах ёсгүй. Өөр нууц үг ашиглана уу. + + + This value should be between {{ min }} and {{ max }}. + Энэ утга {{ min }} -с {{ max }} хооронд байх ёстой. + + + This value is not a valid hostname. + Энэ утга буруу hostname байна. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Энэхүү цуглуулган дахь элемэнтийн тоо, {{ compared_value }}-н үржвэр байх ёстой. + + + This value should satisfy at least one of the following constraints: + Энэ утга доорх болзолуудын ядаж нэгийг хангах ёстой: + + + Each element of this collection should satisfy its own set of constraints. + Энэхүү цуглуулган дахь элемэнтүүд өөр өөрсдийн болзолуудаа хангах ёстой. + + + This value is not a valid International Securities Identification Number (ISIN). + Энэ утга зөв International Securities Identification Number (ISIN) биш байна. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.my.xlf b/vendor/symfony/validator/Resources/translations/validators.my.xlf new file mode 100644 index 0000000..7f45aae --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.my.xlf @@ -0,0 +1,395 @@ + + + + + + This value should be false. + ဤတန်ဖိုးသည် false ဖြစ်ရမည်။ + + + This value should be true. + ဤတန်ဖိုးသည် true ဖြစ်ရမည်။ + + + This value should be of type {{ type }}. + ဤတန်ဖိုးသည် {{ type }} အမျိုးအစားဖြစ်ရမည်။ + + + This value should be blank. + ဤတန်ဖိုးသည် ကွပ်လပ်မဖြစ်သင့်ပါ။ + + + The value you selected is not a valid choice. + သင်ရွေးချယ်သောတန်ဖိုးသည် သင့်လျှော်သော် တန်ဖိုးမဟုတ်ပါ။ + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + သင်သည် အနည်းဆုံးရွေးချယ်မှု {{ limit }} ခုရွေးချယ်ရမည်။ + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + သင်သည်အများဆုံး {{ limit }} ခုသာရွေးချယ်ခွင့်ရှိသည်။ + + + One or more of the given values is invalid. + ပေးထားသောတန်ဖိုးတစ်ခု (သို့မဟုတ်) တစ်ခုထက်ပို၍မမှန်ကန်ပါ။ + + + This field was not expected. + ဤကွက်လပ်ကိုမမျှော်လင့်ထားပါ။ + + + This field is missing. + ဤကွက်လပ်ကိုမမျှော်လင့်ထားပါ။ + + + This value is not a valid date. + ဤတန်ဖိုးသည်မှန်ကန်သော်ရက်စွဲမဟုတ်ပါ။ + + + This value is not a valid datetime. + ဤတန်ဖိုးသည် မှန်ကန်သော် ရက်စွဲ/အချိန် မဟုတ်ပါ။ + + + This value is not a valid email address. + ဤတန်ဖိုးသည် မှန်ကန်သော် အီးမေးလိပ်စာ မဟုတ်ပါ။ + + + The file could not be found. + ဖိုင်ရှာမတွေ့ပါ။ + + + The file is not readable. + ဤဖိုင်ကို ဖတ်၍မရပါ။ + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + ဖိုင်အရွယ်အစား အလွန်ကြီးနေသည် ({{ size }} {{ suffix }}). ခွင့်ပြုထားသော အများဆုံး ဖိုင်ဆိုဒ်သည် {{ limit }} {{ suffix }} ဖြစ်သည်။ + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + ဖိုင်၏ mime အမျိုးအစားမမှန်ကန်ပါ ({{ type }})။ ခွင့်ပြုထားသော mime အမျိုးအစားများမှာ {{ types }}. + + + This value should be {{ limit }} or less. + ဤတန်ဖိုးသည် {{ limit }} (သို့မဟုတ်) {{ limit }} ထက်နည်းသင့်သည်။ + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + ဤတန်ဖိုးသည် အလွန်ရှည်လွန်းသည်။ ၎င်းတွင်အက္ခရာ {{ limit }} (သို့မဟုတ်) ၎င်းထက်နည်းသင့်သည်။ | ဤတန်ဖိုးသည် အလွန်ရှည်လွန်းသည်။ ၎င်းတွင်အက္ခရာ {{limit}} ခုနှင့်အထက်ရှိသင့်သည်။ + + + This value should be {{ limit }} or more. + ဤတန်ဖိုးသည် {{limit}} (သို့မဟုတ်) ထို့ထက်ပိုသင့်သည်။ + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + ဤတန်ဖိုးသည် အလွန်တိုလွန်းသည်။ ၎င်းတွင်အက္ခရာ {{limit}} (သို့မဟုတ်) ထို့ထက်ပိုရှိသင့်သည်။ | ဤတန်ဖိုးသည်တိုလွန်းသည်။ ၎င်းတွင်အက္ခရာ {{limit}} လုံးနှင့်အထက်ရှိသင့်သည်။ + + + This value should not be blank. + ဤတန်ဖိုးသည်ကွက်လပ်မဖြစ်သင့်ပါ။ + + + This value should not be null. + ဤတန်ဖိုးသည် null မဖြစ်သင့်ပါ။ + + + This value should be null. + ဤတန်ဖိုးသည် null ဖြစ်သင့်သည်။ + + + This value is not valid. + ဤတန်ဖိုးသည်မှန်ကန်သောတန်ဖိုးမဟုတ်ပါ။ + + + This value is not a valid time. + ဤတန်ဖိုးသည်မှန်ကန်သော အချိန်တန်ဖိုးမဟုတ်ပါ။ + + + This value is not a valid URL. + ဤတန်ဖိုးသည်မှန်ကန်သော URL တန်ဖိုးမဟုတ်ပါ။ + + + The two values should be equal. + တန်ဖိုးနှစ်ခုသည် တူညီသင့်သည်။ + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + ဤဖိုင်သည် အလွန်ကြီးသည်။ ခွင့်ပြုထားသည့်အများဆုံးဖိုင်အရွယ်အစားသည် {{ limit }} {{ suffix }} ဖြစ်သည်။ + + + The file is too large. + ဤဖိုင်သည် အလွန်ကြီးသည်။ + + + The file could not be uploaded. + ဤဖိုင်ကိုတင်၍မရပါ။ + + + This value should be a valid number. + ဤတန်ဖိုးသည်မှန်ကန်သောနံပါတ်ဖြစ်သင့်သည်။ + + + This file is not a valid image. + ဤဖိုင်သည်မှန်ကန်သော ဓါတ်ပုံမဟုတ်ပါ။ + + + This is not a valid IP address. + ၎င်းသည်တရားဝင် IP လိပ်စာမဟုတ်ပါ။ + + + This value is not a valid language. + ဤတန်ဖိုးသည် မှန်ကန်သောဘာသာစကားမဟုတ်ပါ။ + + + This value is not a valid locale. + ဤတန်ဖိုးသည်မှန်ကန်သောဘာသာပြန်မဟုတ်ပါ။ + + + This value is not a valid country. + ဤတန်ဖိုးသည်မှန်ကန်သောနိုင်ငံမဟုတ်ပါ။ + + + This value is already used. + ဤတန်ဖိုးသည် အသုံးပြုပြီးသားဖြစ်သည်။ + + + The size of the image could not be detected. + ဓါတ်ပုံအရွယ်အစားကိုရှာမတွေ့ပါ။ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + ပုံ၏အလျားသည် ကြီးလွန်းသည် ({{ width }}px)။ ခွင့်ပြုထားသည့်အများဆုံးအလျားသည် {{max_width}}px ဖြစ်သည်။ + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + ပုံ၏အလျားသည် သေးလွန်းသည် ({{ width }}px)။ ခွင့်ပြုထားသည့်အနည်းဆုံးအလျားသည် {{max_width}}px ဖြစ်သည်။ + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ပုံ၏အနံသည် ကြီးလွန်းသည် ({{ height }}px)။ ခွင့်ပြုထားသည့်အများဆုံးအနံသည် {{max_height}}px ဖြစ်သည်။ + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ပုံ၏အနံသည် သေးလွန်းသည် ({{ height }}px)။ ခွင့်ပြုထားသည့်အနည်းဆုံးအနံသည် {{min_height}}px ဖြစ်သည်။ + + + This value should be the user's current password. + ဤတန်ဖိုးသည်အသုံးပြုသူ၏ လက်ရှိစကားဝှက်ဖြစ်သင့်သည်။ + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ဤတန်ဖိုးသည်စာလုံး {{limit}} အတိအကျရှိသင့်သည်။ + + + The file was only partially uploaded. + ဤဖိုင်သည်တစ်စိတ်တစ်ပိုင်းသာ upload တင်ခဲ့သည်။ + + + No file was uploaded. + မည်သည့် ဖိုင်မျှ upload မလုပ်ခဲ့ပါ။ + + + No temporary folder was configured in php.ini. + php.ini တွင်ယာယီဖိုင်တွဲကိုပြင်ဆင်ထားခြင်းမရှိပါ၊ + + + Cannot write temporary file to disk. + ယာရီဖိုင်ကို disk မရေးနိုင်ပါ။ + + + A PHP extension caused the upload to fail. + PHP extension တစ်ခုကြောင့် upload တင်၍မရနိုင်ပါ။ + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + ဤ collection တွင် {{limit}} element (သို့မဟုတ်) ထို့ထက်မပိုသင့်ပါ။ + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + ဤ collection တွင် {{limit}} element (သို့မဟုတ်) ၎င်းထက်နည်းသင့်သည်။ + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + ဤစုစည်းမှုတွင် {{limit}} element အတိအကျပါသင့်သည်။ + + + Invalid card number. + ကဒ်နံပါတ်မမှန်ပါ။ + + + Unsupported card type or invalid card number. + ကဒ်အမျိုးအစားမမှန်ပါ (သို့မဟုတ်) ကဒ်နံပါတ်မမှန်ပါ။ + + + This is not a valid International Bank Account Number (IBAN). + ဤတန်ဖိုးသည် တရား၀င်နိုင်ငံတကာဘဏ်အကောင့်နံပါတ် (International Bank Account Number, IBAN) မဟုတ်ပါ။ + + + This value is not a valid ISBN-10. + ဤတန်ဖိုးသည် မှန်ကန်သော ISBN-10 တန်ဖိုးမဟုတ်ပါ၊ + + + This value is not a valid ISBN-13. + ဤတန်ဖိုးသည် မှန်ကန်သော ISBN-13 တန်ဖိုးမဟုတ်ပါ၊ + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + ဤတန်ဖိုးသည် သင့်လျှော်သော် ISBN-10 (သို့မဟုတ်) ISBN-13 တန်ဖိုးမဟုတ်ပါ၊ + + + This value is not a valid ISSN. + ဤတန်ဖိုးသည် သင့်လျှော်သော် ISSN တန်ဖိုးမဟုတ်ပါ။ + + + This value is not a valid currency. + ဤတန်ဖိုးသည် သင့်လျှော်သော် ငွေကြေးတန်ဖိုးမဟုတ်ပါ။ + + + This value should be equal to {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} နှင့်ညီသင့်သည်။ + + + This value should be greater than {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} ထက်ကြီးသင့်သည်။ + + + This value should be greater than or equal to {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} ထက်ကြီးသင့်သည် (သို့မဟုတ်) ဤတန်ဖိုးသည် {{ compared_value }} ညီသင့်သည်။ + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value_type }} {{ compared_value }} နှင့်ထပ်တူညီမျှသင့်သည်။ + + + This value should be less than {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} ထက်မနဲသောတဲ့ တန်ဖိုးဖြစ်သင့်သည်။ + + + This value should be less than or equal to {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} ထက် မနည်းသောတန်ဖိုး (သို့မဟုတ်) ညီမျှသောတန်ဖိုးဖြစ်သင့်သည်။ + + + This value should not be equal to {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value }} နှင့်မညီသင့်ပါ။ + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + ဤတန်ဖိုးသည် {{ compared_value_type }} {{ compared_value }} နှင့်ထပ်တူမညီမျှသင့်သည်။ + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + ဤဓာတ်ပုံအချိုးအစားသည်အလွန်ကြီးလွန်းသည်။ ({{ ratio }})။ ခွင့်ပြုထားသောဓာတ်ပုံအချိုးအသားသည် {{ max_ratio }} ဖြစ်သည်။ + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + ဤဓာတ်ပုံအချိုးအစားသည်အလွန်သေးလွန်းသည်။ ({{ ratio }})။ ခွင့်ပြုထားသောဓာတ်ပုံအချိုးအသားသည် {{ min_ratio }} ဖြစ်သည်။ + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + ဤဓာတ်ပုံသည် စတုရန်းဖြစ်နေသည် ({{ width }}x{{ height }}px)။ စတုရန်းဓာတ်ပုံများကို ခွင့်မပြုပါ။ + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + ဤဓာတ်ပုံသည် အလျှားလိုက်ဖြစ်နေသည် ({{ width }}x{{ height }}px). အလျှားလိုက်ဓာတ်ပုံများခွင့်မပြုပါ။ + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + ဤဓာတ်ပုံသည် ဒေါင်လိုက်ဖြစ်နေသည် ({{ width }}x{{ height }}px). ဒေါင်လိုက်ဓာတ်ပုံများခွင့်မပြုပါ။ + + + An empty file is not allowed. + ဖိုင်အလွတ်ကိုတင်ခွင့်မပြုပါ။ + + + The host could not be resolved. + host ဖြေရှင်း၍မနိုင်ပါ။ + + + This value does not match the expected {{ charset }} charset. + ဤတန်ဖိုးသည် မျှော်မှန်းထားသော {{ charset }} စားလုံးနှင့် ကိုက်ညီမှုမရှိပါ။ + + + This is not a valid Business Identifier Code (BIC). + ၎င်းသည်မှန်ကန်သော Business Identifier Code (BIC) မဟုတ်ပါ။ + + + Error + အမှား + + + This is not a valid UUID. + ဤတန်ဖိုးသည် သင့်လျှော်သော် UUID မဟုတ်ပါ။ + + + This value should be a multiple of {{ compared_value }}. + ဤတန်ဖိုးသည် {{compared_value}} ၏ စတူတန်ဖိုးဖြစ်သင့်သည်။ + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + ဤ Business Identifier Code (BIC) သည် IBAN {{ iban }} နှင့်ဆက်စပ်မှုမရှိပါ။ + + + This value should be valid JSON. + ဤတန်ဖိုးသည် သင့်လျှော်သော် JSON တန်ဖိုးဖြစ်သင့်သည်။ + + + This collection should contain only unique elements. + ဤ collection ကိုယ်ပိုင် elements များ ပါသင့်သည်။ + + + This value should be positive. + ဤတန်ဖိုးသည် အပေါင်းဖြစ်သင့်သည်။ + + + This value should be either positive or zero. + ဤတန်ဖိုးသည် အပေါင်း (သို့မဟုတ်) သုည ဖြစ်သင့်သည်။ + + + This value should be negative. + ဤတန်ဖိုးသည် အနုတ် ဖြစ်သင့်သည်။ + + + This value should be either negative or zero. + ဤတန်ဖိုးသည် အနုတ် (သို့မဟုတ်) သုည ဖြစ်သင့်သည်။ + + + This value is not a valid timezone. + ဤတန်ဖိုးသည် မှန်ကန်သော အချိန်ဇုန်မဟုတ်ပါ။ + + + This password has been leaked in a data breach, it must not be used. Please use another password. + ဤစကားဝှက် သည် ဒေတာပေါက်ကြားမှုတစ်ခုဖြစ်ခဲ့သည်။ ဤစကား၀ှက်ကိုအသုံးမပြုရပါ။ ကျေးဇူးပြု၍ အခြားစကားဝှက်ကိုသုံးပါ။ + + + This value should be between {{ min }} and {{ max }}. + ဤတန်ဖိုးသည် {{ min }} နှင့် {{ max }} ကြားရှိသင့်သည်။ + + + This value is not a valid hostname. + ဤတန်ဖိုးသည် သင့်လျှော်သော် hostname မဟုတ်ပါ။ + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + ဤ collection တွင်ပါပါ၀င်သော elements အရေအတွက်သည် {{ compared_value }} ၏ စတူဖြစ်သင့်သည်။ + + + This value should satisfy at least one of the following constraints: + ဤတန်ဖိုးသည် အောက်ပါကန့်သတ်ချက်များအနက်မှအနည်းဆုံးတစ်ခု ဖြည့်ဆည်းပေးသင့်သည်။ + + + Each element of this collection should satisfy its own set of constraints. + ဤ collection ၏ element တစ်ခုစီသည်၎င်း၏ကိုယ်ပိုင်ကန့်သတ်ချက်များကိုဖြည့်ဆည်းသင့်သည်။ + + + This value is not a valid International Securities Identification Number (ISIN). + ဤတန်ဖိုးသည် သင့်လျှော်သော် အပြည်ပြည်ဆိုင်ရာငွေချေးသက်သေခံနံပါတ် ,International Securities Identification Number (ISIN) မဟုတ်ပါ။ + + + This value should be a valid expression. + ဤတန်ဖိုးသည်မှန်ကန်သောစကားရပ်ဖြစ်သင့်သည်။ + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.nb.xlf b/vendor/symfony/validator/Resources/translations/validators.nb.xlf new file mode 100644 index 0000000..93132ec --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.nb.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Verdien må være usann. + + + This value should be true. + Verdien må være sann. + + + This value should be of type {{ type }}. + Verdien skal ha typen {{ type }}. + + + This value should be blank. + Verdien skal være blank. + + + The value you selected is not a valid choice. + Den valgte verdien er ikke gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maks velge {{ limit }} valg. + + + One or more of the given values is invalid. + En eller flere av de oppgitte verdiene er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Verdien er ikke en gyldig dato/tid. + + + This value is not a valid email address. + Verdien er ikke en gyldig e-postadresse. + + + The file could not be found. + Filen kunne ikke finnes. + + + The file is not readable. + Filen er ikke lesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må være {{ limit }} tegn lang eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må ha {{ limit }} tegn eller mindre. + + + This value should be {{ limit }} or more. + Verdien må være {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} tegn eller flere. + + + This value should not be blank. + Verdien kan ikke være blank. + + + This value should not be null. + Verdien kan ikke være tom (null). + + + This value should be null. + Verdien skal være tom (null). + + + This value is not valid. + Verdien er ugyldig. + + + This value is not a valid time. + Verdien er ikke en gyldig tid. + + + This value is not a valid URL. + Verdien er ikke en gyldig URL. + + + The two values should be equal. + Verdiene skal være identiske. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelsen er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke lastes opp. + + + This value should be a valid number. + Verdien skal være et gyldig tall. + + + This file is not a valid image. + Denne filen er ikke et gyldig bilde. + + + This is not a valid IP address. + Dette er ikke en gyldig IP adresse. + + + This value is not a valid language. + Verdien er ikke et gyldig språk. + + + This value is not a valid locale. + Verdien er ikke en gyldig lokalitet. + + + This value is not a valid country. + Verdien er ikke et gyldig navn på land. + + + This value is already used. + Verdien er allerede brukt. + + + The size of the image could not be detected. + Bildestørrelsen kunne ikke oppdages. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bildebredden er for stor ({{ width }} piksler). Tillatt maksimumsbredde er {{ max_width }} piksler. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bildebredden er for liten ({{ width }} piksler). Forventet minimumsbredde er {{ min_width }} piksler. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bildehøyden er for stor ({{ height }} piksler). Tillatt maksimumshøyde er {{ max_height }} piksler. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bildehøyden er for liten ({{ height }} piksler). Forventet minimumshøyde er {{ min_height }} piksler. + + + This value should be the user's current password. + Verdien skal være brukerens sitt nåværende passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien skal være nøyaktig {{ limit }} tegn. + + + The file was only partially uploaded. + Filen var kun delvis opplastet. + + + No file was uploaded. + Ingen fil var lastet opp. + + + No temporary folder was configured in php.ini. + Den midlertidige mappen (tmp) er ikke konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikke skrive midlertidig fil til disk. + + + A PHP extension caused the upload to fail. + En PHP-utvidelse forårsaket en feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlingen må inneholde {{ limit }} element eller flere.|Denne samlingen må inneholde {{ limit }} elementer eller flere. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlingen må inneholde {{ limit }} element eller færre.|Denne samlingen må inneholde {{ limit }} elementer eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlingen må inneholde nøyaktig {{ limit }} element.|Denne samlingen må inneholde nøyaktig {{ limit }} elementer. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikke støttet eller kortnummeret er ugyldig. + + + This is not a valid International Bank Account Number (IBAN). + Dette er ikke et gyldig IBAN-nummer. + + + This value is not a valid ISBN-10. + Verdien er ikke en gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Verdien er ikke en gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Verdien er hverken en gyldig ISBN-10 eller ISBN-13. + + + This value is not a valid ISSN. + Verdien er ikke en gyldig ISSN. + + + This value is not a valid currency. + Verdien er ikke gyldig valuta. + + + This value should be equal to {{ compared_value }}. + Verdien skal være lik {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Verdien skal være større enn {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Verdien skal være større enn eller lik {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal være identisk med {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Verdien skal være mindre enn {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Verdien skal være mindre enn eller lik {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Verdien skal ikke være lik {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal ikke være identisk med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Bildeforholdet er for stort ({{ ratio }}). Tillatt bildeforhold er maks {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Bildeforholdet er for lite ({{ ratio }}). Forventet bildeforhold er minst {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bildet er en kvadrat ({{ width }}x{{ height }}px). Kvadratiske bilder er ikke tillatt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bildet er i liggende retning ({{ width }}x{{ height }}px). Bilder i liggende retning er ikke tillatt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bildet er i stående retning ({{ width }}x{{ height }}px). Bilder i stående retning er ikke tillatt. + + + An empty file is not allowed. + Tomme filer er ikke tilatt. + + + The host could not be resolved. + Vertsnavn kunne ikke løses. + + + This value does not match the expected {{ charset }} charset. + Verdien samsvarer ikke med forventet tegnsett {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dette er ikke en gyldig BIC. + + + Error + Feil + + + This is not a valid UUID. + Dette er ikke en gyldig UUID. + + + This value should be a multiple of {{ compared_value }}. + Verdien skal være flertall av {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Business Identifier Code (BIC) er ikke tilknyttet en IBAN {{ iban }}. + + + This value should be valid JSON. + Verdien er ikke gyldig JSON. + + + This collection should contain only unique elements. + Samlingen kan kun inneholde unike elementer. + + + This value should be positive. + Denne verdien må være positiv. + + + This value should be either positive or zero. + Denne verdien må være positiv eller null. + + + This value should be negative. + Denne verdien må være negativ. + + + This value should be either negative or zero. + Denne verdien må være negativ eller null. + + + This value is not a valid timezone. + Verdien er ikke en gyldig tidssone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dette passordet er lekket i et datainnbrudd, det må ikke tas i bruk. Vennligst bruk et annet passord. + + + This value should be between {{ min }} and {{ max }}. + Verdien må være mellom {{ min }} og {{ max }}. + + + This value is not a valid hostname. + Denne verdien er ikke et gyldig vertsnavn. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Antall elementer i denne samlingen bør være et multiplum av {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Denne verdien skal tilfredsstille minst en av følgende begrensninger: + + + Each element of this collection should satisfy its own set of constraints. + Hvert element i denne samlingen skal tilfredsstille sitt eget sett med begrensninger. + + + This value is not a valid International Securities Identification Number (ISIN). + Denne verdien er ikke et gyldig International Securities Identification Number (ISIN). + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.nl.xlf b/vendor/symfony/validator/Resources/translations/validators.nl.xlf new file mode 100644 index 0000000..97d1da0 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.nl.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Deze waarde moet onwaar zijn. + + + This value should be true. + Deze waarde moet waar zijn. + + + This value should be of type {{ type }}. + Deze waarde moet van het type {{ type }} zijn. + + + This value should be blank. + Deze waarde moet leeg zijn. + + + The value you selected is not a valid choice. + De geselecteerde waarde is geen geldige optie. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Selecteer ten minste {{ limit }} optie.|Selecteer ten minste {{ limit }} opties. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Selecteer maximaal {{ limit }} optie.|Selecteer maximaal {{ limit }} opties. + + + One or more of the given values is invalid. + Eén of meer van de ingegeven waarden zijn ongeldig. + + + This field was not expected. + Dit veld werd niet verwacht. + + + This field is missing. + Dit veld ontbreekt. + + + This value is not a valid date. + Deze waarde is geen geldige datum. + + + This value is not a valid datetime. + Deze waarde is geen geldige datum en tijd. + + + This value is not a valid email address. + Deze waarde is geen geldig e-mailadres. + + + The file could not be found. + Het bestand kon niet gevonden worden. + + + The file is not readable. + Het bestand is niet leesbaar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Het bestand is te groot ({{ size }} {{ suffix }}). Toegestane maximum grootte is {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Het mime type van het bestand is ongeldig ({{ type }}). Toegestane mime types zijn {{ types }}. + + + This value should be {{ limit }} or less. + Deze waarde moet {{ limit }} of minder zijn. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Deze waarde is te lang. Hij mag maximaal {{ limit }} teken bevatten.|Deze waarde is te lang. Hij mag maximaal {{ limit }} tekens bevatten. + + + This value should be {{ limit }} or more. + Deze waarde moet {{ limit }} of meer zijn. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Deze waarde is te kort. Hij moet tenminste {{ limit }} teken bevatten.|Deze waarde is te kort. Hij moet tenminste {{ limit }} tekens bevatten. + + + This value should not be blank. + Deze waarde mag niet leeg zijn. + + + This value should not be null. + Deze waarde mag niet null zijn. + + + This value should be null. + Deze waarde moet null zijn. + + + This value is not valid. + Deze waarde is niet geldig. + + + This value is not a valid time. + Deze waarde is geen geldige tijd. + + + This value is not a valid URL. + Deze waarde is geen geldige URL. + + + The two values should be equal. + De twee waarden moeten gelijk zijn. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Het bestand is te groot. Toegestane maximum grootte is {{ limit }} {{ suffix }}. + + + The file is too large. + Het bestand is te groot. + + + The file could not be uploaded. + Het bestand kon niet worden geüpload. + + + This value should be a valid number. + Deze waarde moet een geldig getal zijn. + + + This file is not a valid image. + Dit bestand is geen geldige afbeelding. + + + This is not a valid IP address. + Dit is geen geldig IP-adres. + + + This value is not a valid language. + Deze waarde is geen geldige taal. + + + This value is not a valid locale. + Deze waarde is geen geldige locale. + + + This value is not a valid country. + Deze waarde is geen geldig land. + + + This value is already used. + Deze waarde wordt al gebruikt. + + + The size of the image could not be detected. + De grootte van de afbeelding kon niet bepaald worden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + De afbeelding is te breed ({{ width }}px). De maximaal toegestane breedte is {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + De afbeelding is niet breed genoeg ({{ width }}px). De minimaal verwachte breedte is {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + De afbeelding is te hoog ({{ height }}px). De maximaal toegestane hoogte is {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + De afbeelding is niet hoog genoeg ({{ height }}px). De minimaal verwachte hoogte is {{ min_height }}px. + + + This value should be the user's current password. + Deze waarde moet het huidige wachtwoord van de gebruiker zijn. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Deze waarde moet exact {{ limit }} teken lang zijn.|Deze waarde moet exact {{ limit }} tekens lang zijn. + + + The file was only partially uploaded. + Het bestand is slechts gedeeltelijk geüpload. + + + No file was uploaded. + Er is geen bestand geüpload. + + + No temporary folder was configured in php.ini. + Er is geen tijdelijke map geconfigureerd in php.ini, of de gespecificeerde map bestaat niet. + + + Cannot write temporary file to disk. + Kan het tijdelijke bestand niet wegschrijven op disk. + + + A PHP extension caused the upload to fail. + De upload is mislukt vanwege een PHP-extensie. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Deze collectie moet {{ limit }} element of meer bevatten.|Deze collectie moet {{ limit }} elementen of meer bevatten. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Deze collectie moet {{ limit }} element of minder bevatten.|Deze collectie moet {{ limit }} elementen of minder bevatten. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Deze collectie moet exact {{ limit }} element bevatten.|Deze collectie moet exact {{ limit }} elementen bevatten. + + + Invalid card number. + Ongeldig creditcardnummer. + + + Unsupported card type or invalid card number. + Niet-ondersteund type creditcard of ongeldig nummer. + + + This is not a valid International Bank Account Number (IBAN). + Dit is geen geldig internationaal bankrekeningnummer (IBAN). + + + This value is not a valid ISBN-10. + Deze waarde is geen geldige ISBN-10. + + + This value is not a valid ISBN-13. + Deze waarde is geen geldige ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Deze waarde is geen geldige ISBN-10 of ISBN-13 waarde. + + + This value is not a valid ISSN. + Deze waarde is geen geldige ISSN waarde. + + + This value is not a valid currency. + Deze waarde is geen geldige valuta. + + + This value should be equal to {{ compared_value }}. + Deze waarde moet gelijk zijn aan {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Deze waarde moet groter zijn dan {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Deze waarde moet groter dan of gelijk aan {{ compared_value }} zijn. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Deze waarde moet identiek zijn aan {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Deze waarde moet minder zijn dan {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Deze waarde moet minder dan of gelijk aan {{ compared_value }} zijn. + + + This value should not be equal to {{ compared_value }}. + Deze waarde mag niet gelijk zijn aan {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Deze waarde mag niet identiek zijn aan {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + De afbeeldingsverhouding is te groot ({{ ratio }}). Maximale verhouding is {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + De afbeeldingsverhouding is te klein ({{ ratio }}). Minimale verhouding is {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + De afbeelding is vierkant ({{ width }}x{{ height }}px). Vierkante afbeeldingen zijn niet toegestaan. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + De afbeelding is liggend ({{ width }}x{{ height }}px). Liggende afbeeldingen zijn niet toegestaan. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + De afbeelding is staand ({{ width }}x{{ height }}px). Staande afbeeldingen zijn niet toegestaan. + + + An empty file is not allowed. + Lege bestanden zijn niet toegestaan. + + + The host could not be resolved. + De hostnaam kon niet worden bepaald. + + + This value does not match the expected {{ charset }} charset. + Deze waarde is niet in de verwachte tekencodering {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dit is geen geldige bedrijfsidentificatiecode (BIC/SWIFT). + + + Error + Fout + + + This is not a valid UUID. + Dit is geen geldige UUID. + + + This value should be a multiple of {{ compared_value }}. + Deze waarde zou een meervoud van {{ compared_value }} moeten zijn. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Deze bedrijfsidentificatiecode (BIC) is niet gekoppeld aan IBAN {{ iban }}. + + + This value should be valid JSON. + Deze waarde moet geldige JSON zijn. + + + This collection should contain only unique elements. + Deze collectie moet alleen unieke elementen bevatten. + + + This value should be positive. + Deze waarde moet positief zijn. + + + This value should be either positive or zero. + Deze waarde moet positief of gelijk aan nul zijn. + + + This value should be negative. + Deze waarde moet negatief zijn. + + + This value should be either negative or zero. + Deze waarde moet negatief of gelijk aan nul zijn. + + + This value is not a valid timezone. + Deze waarde is geen geldige tijdzone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dit wachtwoord is gelekt vanwege een data-inbreuk, het moet niet worden gebruikt. Kies een ander wachtwoord. + + + This value should be between {{ min }} and {{ max }}. + Deze waarde moet zich tussen {{ min }} en {{ max }} bevinden. + + + This value is not a valid hostname. + Deze waarde is geen geldige hostnaam. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Het aantal elementen van deze collectie moet een veelvoud zijn van {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Deze waarde moet voldoen aan tenminste een van de volgende voorwaarden: + + + Each element of this collection should satisfy its own set of constraints. + Elk element van deze collectie moet voldoen aan zijn eigen set voorwaarden. + + + This value is not a valid International Securities Identification Number (ISIN). + Deze waarde is geen geldig International Securities Identification Number (ISIN). + + + This value should be a valid expression. + Deze waarde moet een geldige expressie zijn. + + + This value is not a valid CSS color. + Deze waarde is geen geldige CSS kleur. + + + This value is not a valid CIDR notation. + Deze waarde is geen geldige CIDR notatie. + + + The value of the netmask should be between {{ min }} and {{ max }}. + De waarde van de netmask moet zich tussen {{ min }} en {{ max }} bevinden. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.nn.xlf b/vendor/symfony/validator/Resources/translations/validators.nn.xlf new file mode 100644 index 0000000..8963ba2 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.nn.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Verdien skulle ha vore tom/nei. + + + This value should be true. + Verdien skulla ha vore satt/ja. + + + This value should be of type {{ type }}. + Verdien må vere av typen {{ type }}. + + + This value should be blank. + Verdien skal vere blank. + + + The value you selected is not a valid choice. + Verdien du valde er ikkje gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må gjere minst {{ limit }} val. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maksimalt gjere {{ limit }} val. + + + One or more of the given values is invalid. + Ein eller fleire av dei opplyste verdiane er ugyldige. + + + This field was not expected. + Dette feltet var ikkje forventa. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikkje ein gyldig dato. + + + This value is not a valid datetime. + Verdien er ikkje ein gyldig dato og tid. + + + This value is not a valid email address. + Verdien er ikkje ei gyldig e-postadresse. + + + The file could not be found. + Fila er ikkje funnen. + + + The file is not readable. + Fila kan ikkje lesast. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor ({{ size }} {{ suffix }}). Maksimal storleik er {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime-typen av fila er ugyldig ({{ type }}). Tillatne mime-typar er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må vere {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må vere {{ limit }} bokstavar eller mindre. + + + This value should be {{ limit }} or more. + Verdien må vere {{ limit }} eller meir. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} teikn eller fleire. + + + This value should not be blank. + Verdien kan ikkje vere blank. + + + This value should not be null. + Verdien kan ikkje vere tom (null). + + + This value should be null. + Verdien må vere tom (null). + + + This value is not valid. + Verdien er ikkje gyldig. + + + This value is not a valid time. + Verdien er ikkje ei gyldig tidseining. + + + This value is not a valid URL. + Verdien er ikkje ein gyldig URL. + + + The two values should be equal. + Dei to verdiane må vere like. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor. Den maksimale storleiken er {{ limit }} {{ suffix }}. + + + The file is too large. + Fila er for stor. + + + The file could not be uploaded. + Fila kunne ikkje bli lasta opp. + + + This value should be a valid number. + Verdien må vere eit gyldig tal. + + + This file is not a valid image. + Fila er ikkje eit gyldig bilete. + + + This is not a valid IP address. + Dette er ikkje ei gyldig IP-adresse. + + + This value is not a valid language. + Verdien er ikkje eit gyldig språk. + + + This value is not a valid locale. + Verdien er ikkje ein gyldig lokalitet (språk/region). + + + This value is not a valid country. + Verdien er ikkje eit gyldig land. + + + This value is already used. + Verdien er allereie i bruk. + + + The size of the image could not be detected. + Storleiken på biletet kunne ikkje oppdagast. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Biletbreidda er for stor, ({{ width }} pikslar). Tillaten maksimumsbreidde er {{ max_width }} pikslar. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bilethøgda er for stor, ({{ height }} pikslar). Tillaten maksimumshøgde er {{ max_height }} pikslar. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billethøgda er for låg, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. + + + This value should be the user's current password. + Verdien må vere brukaren sitt noverande passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien må vere nøyaktig {{ limit }} teikn. + + + The file was only partially uploaded. + Fila vart berre delvis lasta opp. + + + No file was uploaded. + Inga fil vart lasta opp. + + + No temporary folder was configured in php.ini. + Førebels mappe (tmp) er ikkje konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikkje skrive førebels fil til disk. + + + A PHP extension caused the upload to fail. + Ei PHP-udviding forårsaka feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlinga må innehalde {{ limit }} element eller meir.|Denne samlinga må innehalde {{ limit }} element eller meir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlinga må innehalde {{ limit }} element eller færre.|Denne samlinga må innehalde {{ limit }} element eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlinga må innehalde nøyaktig {{ limit }} element.|Denne samlinga må innehalde nøyaktig {{ limit }} element. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikkje støtta, eller kortnummeret er ugyldig. + + + This is not a valid International Bank Account Number (IBAN). + Dette er ikkje eit gyldig internasjonalt bankkontonummer (IBAN). + + + This value is not a valid ISBN-10. + Verdien er ikkje eit gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Verdien er ikkje eit gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Verdien er verken eit gyldig ISBN-10 eller eit gyldig ISBN-13. + + + This value is not a valid ISSN. + Verdien er ikkje eit gyldig ISSN. + + + This value is not a valid currency. + Verdien er ikkje ein gyldig valuta. + + + This value should be equal to {{ compared_value }}. + Verdien bør vera eins med {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Verdien bør vera større enn {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Verdien bør vera større enn eller eins med {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien bør vera eins med {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Verdien bør vera mindre enn {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Verdi bør vera mindre enn eller eins med {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Verdi bør ikkje vera eins med {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Denne verdien bør ikkje vera eins med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Sideforholdet til biletet er for stort ({{ ratio }}). Sideforholdet kan ikkje vere større enn {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Sideforholdet til biletet er for lite ({{ ratio }}). Sideforholdet kan ikkje vere mindre enn {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Biletet er kvadratisk ({{ width }}x{{ height }}px). Kvadratiske bilete er ikkje tillatne. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Biletet er landskapsorientert ({{ width }}x{{ height }}px). Landskapsorienterte bilete er ikkje tillatne. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Biletet er portrettorientert ({{ width }}x{{ height }}px). Portrettorienterte bilete er ikkje tillatne. + + + An empty file is not allowed. + Ei tom fil er ikkje tillate. + + + The host could not be resolved. + Verten kunne ikkje finnast. + + + This value does not match the expected {{ charset }} charset. + Verdien stemmer ikkje med forventa {{ charset }} charset. + + + This is not a valid Business Identifier Code (BIC). + Dette er ikkje ein gyldig Business Identifier Code (BIC). + + + Error + Feil + + + This is not a valid UUID. + Dette er ikkje ein gyldig UUID. + + + This value should be a multiple of {{ compared_value }}. + Verdien bør vera eit multipel av {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Denne Business Identifier Code (BIC) er ikkje kopla til IBAN {{ iban }}. + + + This value should be valid JSON. + Verdien bør vera gyldig JSON. + + + This collection should contain only unique elements. + Denne samlinga bør berre innehalda unike element. + + + This value should be positive. + Verdien bør vera positiv. + + + This value should be either positive or zero. + Verdien bør vera anten positiv eller null. + + + This value should be negative. + Verdien bør vera negativ. + + + This value should be either negative or zero. + Verdien bør vera negativ eller null. + + + This value is not a valid timezone. + Verdien er ikkje ei gyldig tidssone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dette passordet har lekt ut ved eit datainnbrot, det får ikkje nyttast. Gje opp eit anna passord. + + + This value should be between {{ min }} and {{ max }}. + Denne verdien bør liggje mellom {{ min }} og {{ max }}. + + + This value is not a valid hostname. + Verdien er ikkje eit gyldig vertsnamn. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Talet på element i denne samlinga bør vera eit multippel av {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Verdien burde oppfylla minst ein av følgjande avgrensingar: + + + Each element of this collection should satisfy its own set of constraints. + Kvart element i denne samlinga bør oppfylla sine eigne avgrensingar. + + + This value is not a valid International Securities Identification Number (ISIN). + Verdien er ikkje eit gyldig International Securities Identification Number (ISIN). + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.no.xlf b/vendor/symfony/validator/Resources/translations/validators.no.xlf new file mode 100644 index 0000000..93132ec --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.no.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Verdien må være usann. + + + This value should be true. + Verdien må være sann. + + + This value should be of type {{ type }}. + Verdien skal ha typen {{ type }}. + + + This value should be blank. + Verdien skal være blank. + + + The value you selected is not a valid choice. + Den valgte verdien er ikke gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maks velge {{ limit }} valg. + + + One or more of the given values is invalid. + En eller flere av de oppgitte verdiene er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikke en gyldig dato. + + + This value is not a valid datetime. + Verdien er ikke en gyldig dato/tid. + + + This value is not a valid email address. + Verdien er ikke en gyldig e-postadresse. + + + The file could not be found. + Filen kunne ikke finnes. + + + The file is not readable. + Filen er ikke lesbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må være {{ limit }} tegn lang eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må ha {{ limit }} tegn eller mindre. + + + This value should be {{ limit }} or more. + Verdien må være {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} tegn eller flere. + + + This value should not be blank. + Verdien kan ikke være blank. + + + This value should not be null. + Verdien kan ikke være tom (null). + + + This value should be null. + Verdien skal være tom (null). + + + This value is not valid. + Verdien er ugyldig. + + + This value is not a valid time. + Verdien er ikke en gyldig tid. + + + This value is not a valid URL. + Verdien er ikke en gyldig URL. + + + The two values should be equal. + Verdiene skal være identiske. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelsen er {{ limit }} {{ suffix }}. + + + The file is too large. + Filen er for stor. + + + The file could not be uploaded. + Filen kunne ikke lastes opp. + + + This value should be a valid number. + Verdien skal være et gyldig tall. + + + This file is not a valid image. + Denne filen er ikke et gyldig bilde. + + + This is not a valid IP address. + Dette er ikke en gyldig IP adresse. + + + This value is not a valid language. + Verdien er ikke et gyldig språk. + + + This value is not a valid locale. + Verdien er ikke en gyldig lokalitet. + + + This value is not a valid country. + Verdien er ikke et gyldig navn på land. + + + This value is already used. + Verdien er allerede brukt. + + + The size of the image could not be detected. + Bildestørrelsen kunne ikke oppdages. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bildebredden er for stor ({{ width }} piksler). Tillatt maksimumsbredde er {{ max_width }} piksler. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bildebredden er for liten ({{ width }} piksler). Forventet minimumsbredde er {{ min_width }} piksler. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bildehøyden er for stor ({{ height }} piksler). Tillatt maksimumshøyde er {{ max_height }} piksler. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bildehøyden er for liten ({{ height }} piksler). Forventet minimumshøyde er {{ min_height }} piksler. + + + This value should be the user's current password. + Verdien skal være brukerens sitt nåværende passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien skal være nøyaktig {{ limit }} tegn. + + + The file was only partially uploaded. + Filen var kun delvis opplastet. + + + No file was uploaded. + Ingen fil var lastet opp. + + + No temporary folder was configured in php.ini. + Den midlertidige mappen (tmp) er ikke konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikke skrive midlertidig fil til disk. + + + A PHP extension caused the upload to fail. + En PHP-utvidelse forårsaket en feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlingen må inneholde {{ limit }} element eller flere.|Denne samlingen må inneholde {{ limit }} elementer eller flere. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlingen må inneholde {{ limit }} element eller færre.|Denne samlingen må inneholde {{ limit }} elementer eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlingen må inneholde nøyaktig {{ limit }} element.|Denne samlingen må inneholde nøyaktig {{ limit }} elementer. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikke støttet eller kortnummeret er ugyldig. + + + This is not a valid International Bank Account Number (IBAN). + Dette er ikke et gyldig IBAN-nummer. + + + This value is not a valid ISBN-10. + Verdien er ikke en gyldig ISBN-10. + + + This value is not a valid ISBN-13. + Verdien er ikke en gyldig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Verdien er hverken en gyldig ISBN-10 eller ISBN-13. + + + This value is not a valid ISSN. + Verdien er ikke en gyldig ISSN. + + + This value is not a valid currency. + Verdien er ikke gyldig valuta. + + + This value should be equal to {{ compared_value }}. + Verdien skal være lik {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Verdien skal være større enn {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Verdien skal være større enn eller lik {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal være identisk med {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Verdien skal være mindre enn {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Verdien skal være mindre enn eller lik {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Verdien skal ikke være lik {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Verdien skal ikke være identisk med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Bildeforholdet er for stort ({{ ratio }}). Tillatt bildeforhold er maks {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Bildeforholdet er for lite ({{ ratio }}). Forventet bildeforhold er minst {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bildet er en kvadrat ({{ width }}x{{ height }}px). Kvadratiske bilder er ikke tillatt. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bildet er i liggende retning ({{ width }}x{{ height }}px). Bilder i liggende retning er ikke tillatt. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bildet er i stående retning ({{ width }}x{{ height }}px). Bilder i stående retning er ikke tillatt. + + + An empty file is not allowed. + Tomme filer er ikke tilatt. + + + The host could not be resolved. + Vertsnavn kunne ikke løses. + + + This value does not match the expected {{ charset }} charset. + Verdien samsvarer ikke med forventet tegnsett {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Dette er ikke en gyldig BIC. + + + Error + Feil + + + This is not a valid UUID. + Dette er ikke en gyldig UUID. + + + This value should be a multiple of {{ compared_value }}. + Verdien skal være flertall av {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Business Identifier Code (BIC) er ikke tilknyttet en IBAN {{ iban }}. + + + This value should be valid JSON. + Verdien er ikke gyldig JSON. + + + This collection should contain only unique elements. + Samlingen kan kun inneholde unike elementer. + + + This value should be positive. + Denne verdien må være positiv. + + + This value should be either positive or zero. + Denne verdien må være positiv eller null. + + + This value should be negative. + Denne verdien må være negativ. + + + This value should be either negative or zero. + Denne verdien må være negativ eller null. + + + This value is not a valid timezone. + Verdien er ikke en gyldig tidssone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Dette passordet er lekket i et datainnbrudd, det må ikke tas i bruk. Vennligst bruk et annet passord. + + + This value should be between {{ min }} and {{ max }}. + Verdien må være mellom {{ min }} og {{ max }}. + + + This value is not a valid hostname. + Denne verdien er ikke et gyldig vertsnavn. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Antall elementer i denne samlingen bør være et multiplum av {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Denne verdien skal tilfredsstille minst en av følgende begrensninger: + + + Each element of this collection should satisfy its own set of constraints. + Hvert element i denne samlingen skal tilfredsstille sitt eget sett med begrensninger. + + + This value is not a valid International Securities Identification Number (ISIN). + Denne verdien er ikke et gyldig International Securities Identification Number (ISIN). + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.pl.xlf b/vendor/symfony/validator/Resources/translations/validators.pl.xlf new file mode 100644 index 0000000..b983b2d --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.pl.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Ta wartość powinna być fałszem. + + + This value should be true. + Ta wartość powinna być prawdą. + + + This value should be of type {{ type }}. + Ta wartość powinna być typu {{ type }}. + + + This value should be blank. + Ta wartość powinna być pusta. + + + The value you selected is not a valid choice. + Ta wartość powinna być jedną z podanych opcji. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Powinieneś wybrać co najmniej {{ limit }} opcję.|Powinieneś wybrać co najmniej {{ limit }} opcje.|Powinieneś wybrać co najmniej {{ limit }} opcji. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Powinieneś wybrać maksymalnie {{ limit }} opcję.|Powinieneś wybrać maksymalnie {{ limit }} opcje.|Powinieneś wybrać maksymalnie {{ limit }} opcji. + + + One or more of the given values is invalid. + Jedna lub więcej z podanych wartości jest nieprawidłowa. + + + This field was not expected. + Tego pola się nie spodziewano. + + + This field is missing. + Tego pola brakuje. + + + This value is not a valid date. + Ta wartość nie jest prawidłową datą. + + + This value is not a valid datetime. + Ta wartość nie jest prawidłową datą i czasem. + + + This value is not a valid email address. + Ta wartość nie jest prawidłowym adresem email. + + + The file could not be found. + Plik nie mógł zostać odnaleziony. + + + The file is not readable. + Nie można odczytać pliku. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Plik jest za duży ({{ size }} {{ suffix }}). Maksymalny dozwolony rozmiar to {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Nieprawidłowy typ mime pliku ({{ type }}). Dozwolone typy mime to {{ types }}. + + + This value should be {{ limit }} or less. + Ta wartość powinna wynosić {{ limit }} lub mniej. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ta wartość jest zbyt długa. Powinna mieć {{ limit }} lub mniej znaków.|Ta wartość jest zbyt długa. Powinna mieć {{ limit }} lub mniej znaków.|Ta wartość jest zbyt długa. Powinna mieć {{ limit }} lub mniej znaków. + + + This value should be {{ limit }} or more. + Ta wartość powinna wynosić {{ limit }} lub więcej. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub więcej znaków.|Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub więcej znaków.|Ta wartość jest zbyt krótka. Powinna mieć {{ limit }} lub więcej znaków. + + + This value should not be blank. + Ta wartość nie powinna być pusta. + + + This value should not be null. + Ta wartość nie powinna być nullem. + + + This value should be null. + Ta wartość powinna być nullem. + + + This value is not valid. + Ta wartość jest nieprawidłowa. + + + This value is not a valid time. + Ta wartość nie jest prawidłowym czasem. + + + This value is not a valid URL. + Ta wartość nie jest prawidłowym adresem URL. + + + The two values should be equal. + Obie wartości powinny być równe. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Plik jest za duży. Maksymalny dozwolony rozmiar to {{ limit }} {{ suffix }}. + + + The file is too large. + Plik jest za duży. + + + The file could not be uploaded. + Plik nie mógł być wgrany. + + + This value should be a valid number. + Ta wartość powinna być prawidłową liczbą. + + + This file is not a valid image. + Ten plik nie jest obrazem. + + + This is not a valid IP address. + To nie jest prawidłowy adres IP. + + + This value is not a valid language. + Ta wartość nie jest prawidłowym językiem. + + + This value is not a valid locale. + Ta wartość nie jest prawidłową lokalizacją. + + + This value is not a valid country. + Ta wartość nie jest prawidłową nazwą kraju. + + + This value is already used. + Ta wartość jest już wykorzystywana. + + + The size of the image could not be detected. + Nie można wykryć rozmiaru obrazka. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Szerokość obrazka jest zbyt duża ({{ width }}px). Maksymalna dopuszczalna szerokość to {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Szerokość obrazka jest zbyt mała ({{ width }}px). Oczekiwana minimalna szerokość to {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Wysokość obrazka jest zbyt duża ({{ height }}px). Maksymalna dopuszczalna wysokość to {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Wysokość obrazka jest zbyt mała ({{ height }}px). Oczekiwana minimalna wysokość to {{ min_height }}px. + + + This value should be the user's current password. + Ta wartość powinna być aktualnym hasłem użytkownika. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ta wartość powinna mieć dokładnie {{ limit }} znak.|Ta wartość powinna mieć dokładnie {{ limit }} znaki.|Ta wartość powinna mieć dokładnie {{ limit }} znaków. + + + The file was only partially uploaded. + Plik został wgrany tylko częściowo. + + + No file was uploaded. + Żaden plik nie został wgrany. + + + No temporary folder was configured in php.ini. + Nie skonfigurowano folderu tymczasowego w php.ini lub skonfigurowany folder nie istnieje. + + + Cannot write temporary file to disk. + Nie można zapisać pliku tymczasowego na dysku. + + + A PHP extension caused the upload to fail. + Rozszerzenie PHP spowodowało błąd podczas wgrywania. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ten zbiór powinien zawierać {{ limit }} lub więcej elementów. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ten zbiór powinien zawierać {{ limit }} lub mniej elementów. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ten zbiór powinien zawierać dokładnie {{ limit }} element.|Ten zbiór powinien zawierać dokładnie {{ limit }} elementy.|Ten zbiór powinien zawierać dokładnie {{ limit }} elementów. + + + Invalid card number. + Nieprawidłowy numer karty. + + + Unsupported card type or invalid card number. + Nieobsługiwany rodzaj karty lub nieprawidłowy numer karty. + + + This is not a valid International Bank Account Number (IBAN). + Nieprawidłowy międzynarodowy numer rachunku bankowego (IBAN). + + + This value is not a valid ISBN-10. + Ta wartość nie jest prawidłowym numerem ISBN-10. + + + This value is not a valid ISBN-13. + Ta wartość nie jest prawidłowym numerem ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ta wartość nie jest prawidłowym numerem ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Ta wartość nie jest prawidłowym numerem ISSN. + + + This value is not a valid currency. + Ta wartość nie jest prawidłową walutą. + + + This value should be equal to {{ compared_value }}. + Ta wartość powinna być równa {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ta wartość powinna być większa niż {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ta wartość powinna być większa bądź równa {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ta wartość powinna być identycznego typu {{ compared_value_type }} oraz wartości {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ta wartość powinna być mniejsza niż {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ta wartość powinna być mniejsza bądź równa {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ta wartość nie powinna być równa {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ta wartość nie powinna być identycznego typu {{ compared_value_type }} oraz wartości {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Proporcje obrazu są zbyt duże ({{ ratio }}). Maksymalne proporcje to {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Proporcje obrazu są zbyt małe ({{ ratio }}). Minimalne proporcje to {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Obraz jest kwadratem ({{ width }}x{{ height }}px). Kwadratowe obrazy nie są akceptowane. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obraz jest panoramiczny ({{ width }}x{{ height }}px). Panoramiczne zdjęcia nie są akceptowane. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obraz jest portretowy ({{ width }}x{{ height }}px). Portretowe zdjęcia nie są akceptowane. + + + An empty file is not allowed. + Plik nie może być pusty. + + + The host could not be resolved. + Nazwa hosta nie została rozpoznana. + + + This value does not match the expected {{ charset }} charset. + Ta wartość nie pasuje do oczekiwanego zestawu znaków {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Ta wartość nie jest poprawnym kodem BIC (Business Identifier Code). + + + Error + Błąd + + + This is not a valid UUID. + To nie jest poprawne UUID. + + + This value should be a multiple of {{ compared_value }}. + Ta wartość powinna być wielokrotnością {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ten kod BIC (Business Identifier Code) nie jest powiązany z międzynarodowym numerem rachunku bankowego (IBAN) {{ iban }}. + + + This value should be valid JSON. + Ta wartość powinna być prawidłowym formatem JSON. + + + This collection should contain only unique elements. + Ten zbiór powinien zawierać tylko unikalne elementy. + + + This value should be positive. + Ta wartość powinna być dodatnia. + + + This value should be either positive or zero. + Ta wartość powinna być dodatnia lub równa zero. + + + This value should be negative. + Ta wartość powinna być ujemna. + + + This value should be either negative or zero. + Ta wartość powinna być ujemna lub równa zero. + + + This value is not a valid timezone. + Ta wartość nie jest prawidłową strefą czasową. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + To hasło wyciekło w wyniku naruszenia danych i nie może być użyte. Proszę użyć innego hasła. + + + This value should be between {{ min }} and {{ max }}. + Ta wartość powinna być pomiędzy {{ min }} a {{ max }}. + + + This value is not a valid hostname. + Ta wartość nie jest prawidłową nazwą hosta. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Liczba elementów w tym zbiorze powinna być wielokrotnością {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ta wartość powinna spełniać co najmniej jedną z następujących reguł: + + + Each element of this collection should satisfy its own set of constraints. + Każdy element w tym zbiorze powinien spełniać własny zestaw reguł. + + + This value is not a valid International Securities Identification Number (ISIN). + Ta wartość nie jest prawidłowym Międzynarodowym Numerem Identyfikacyjnym Papierów Wartościowych (ISIN). + + + This value should be a valid expression. + Ta wartość powinna być prawidłowym wyrażeniem. + + + This value is not a valid CSS color. + Ta wartość nie jest prawidłowym kolorem CSS. + + + This value is not a valid CIDR notation. + Ta wartość nie jest prawidłową notacją CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Wartość maski podsieci powinna być pomiędzy {{ min }} i {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.pt.xlf b/vendor/symfony/validator/Resources/translations/validators.pt.xlf new file mode 100644 index 0000000..090add6 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.pt.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Este valor deveria ser falso. + + + This value should be true. + Este valor deveria ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor deveria ser do tipo {{ type }}. + + + This value should be blank. + Este valor deveria ser vazio. + + + The value you selected is not a valid choice. + O valor selecionado não é uma opção válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Você deveria selecionar {{ limit }} opção no mínimo.|Você deveria selecionar {{ limit }} opções no mínimo. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Você deve selecionar, no máximo {{ limit }} opção.|Você deve selecionar, no máximo {{ limit }} opções. + + + One or more of the given values is invalid. + Um ou mais dos valores introduzidos não são válidos. + + + This field was not expected. + Este campo não era esperado. + + + This field is missing. + Este campo está faltando. + + + This value is not a valid date. + Este valor não é uma data válida. + + + This value is not a valid datetime. + Este valor não é uma data-hora válida. + + + This value is not a valid email address. + Este valor não é um endereço de e-mail válido. + + + The file could not be found. + O arquivo não pôde ser encontrado. + + + The file is not readable. + O arquivo não pôde ser lido. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande ({{ size }} {{ suffix }}). O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo é inválido ({{ type }}). Os tipos mime permitidos são {{ types }}. + + + This value should be {{ limit }} or less. + Este valor deveria ser {{ limit }} ou menor. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + O valor é muito longo. Deveria ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor deveria ser {{ limit }} ou mais. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + O valor é muito curto. Deveria de ter {{ limit }} caractere ou mais.|O valor é muito curto. Deveria de ter {{ limit }} caracteres ou mais. + + + This value should not be blank. + Este valor não deveria ser branco/vazio. + + + This value should not be null. + Este valor não deveria ser nulo. + + + This value should be null. + Este valor deveria ser nulo. + + + This value is not valid. + Este valor não é válido. + + + This value is not a valid time. + Este valor não é uma hora válida. + + + This value is not a valid URL. + Este valor não é um URL válido. + + + The two values should be equal. + Os dois valores deveriam ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande. O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The file is too large. + O ficheiro é muito grande. + + + The file could not be uploaded. + Não foi possível carregar o ficheiro. + + + This value should be a valid number. + Este valor deveria ser um número válido. + + + This file is not a valid image. + Este ficheiro não é uma imagem. + + + This is not a valid IP address. + Este endereço de IP não é válido. + + + This value is not a valid language. + Este valor não é uma linguagem válida. + + + This value is not a valid locale. + Este valor não é um 'locale' válido. + + + This value is not a valid country. + Este valor não é um País válido. + + + This value is already used. + Este valor já está a ser usado. + + + The size of the image could not be detected. + O tamanho da imagem não foi detetado. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imagem ({{ width }}px) é muito grande. A largura máxima da imagem é: {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imagem ({{ width }}px) é muito pequena. A largura miníma da imagem é de: {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imagem ({{ height }}px) é muito grande. A altura máxima da imagem é de: {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imagem ({{ height }}px) é muito pequena. A altura miníma da imagem é de: {{ min_height }}px. + + + This value should be the user's current password. + Este valor deveria ser a senha atual do usuário. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor deve possuir exatamente {{ limit }} caracteres. + + + The file was only partially uploaded. + Só foi enviada uma parte do arquivo. + + + No file was uploaded. + Nenhum arquivo foi enviado. + + + No temporary folder was configured in php.ini. + Não existe uma pasta temporária configurada no arquivo php.ini. + + + Cannot write temporary file to disk. + Não foi possível escrever os arquivos temporários no disco. + + + A PHP extension caused the upload to fail. + Uma extensão PHP causou a falha no envio. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + + + Invalid card number. + Número de cartão inválido. + + + Unsupported card type or invalid card number. + Tipo de cartão não suportado ou número de cartão inválido. + + + This is not a valid International Bank Account Number (IBAN). + Este não é um Número Internacional de Conta Bancária (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor não é um ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor não é um ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor não é um ISBN-10 ou ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor não é um ISSN válido. + + + This value is not a valid currency. + Este não é um valor monetário válido. + + + This value should be equal to {{ compared_value }}. + Este valor deve ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor deve ser superior a {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor deve ser igual ou superior a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor deve ser inferior a {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor deve ser igual ou inferior a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor não deve ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + O formato da imagem é muito grande ({{ ratio }}). O formato máximo é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + O formato da imagem é muito pequeno ({{ ratio }}). O formato mínimo esperado é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imagem é um quadrado ({{ width }}x{{ height }}px). Imagens quadradas não são permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imagem está em orientação de paisagem ({{ width }}x{{ height }}px). Imagens orientadas em paisagem não são permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imagem está em orientação de retrato ({{ width }}x{{ height }}px). Imagens orientadas em retrato não são permitidas. + + + An empty file is not allowed. + Um arquivo vazio não é permitido. + + + The host could not be resolved. + O host não pode ser resolvido. + + + This value does not match the expected {{ charset }} charset. + O valor não corresponde ao conjunto de caracteres {{ charset }} esperado. + + + This is not a valid Business Identifier Code (BIC). + O Código de Identificação de Empresa (BIC) não é válido. + + + Error + Erro + + + This is not a valid UUID. + Este valor não é um UUID válido. + + + This value should be a multiple of {{ compared_value }}. + Este valor deve ser um múltiplo de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + O Código de Identificação de Empresa (BIC) não está associado ao IBAN {{ iban }}. + + + This value should be valid JSON. + Este valor deve ser um JSON válido. + + + This collection should contain only unique elements. + Esta coleção deve conter só elementos únicos. + + + This value should be positive. + Este valor deve ser estritamente positivo. + + + This value should be either positive or zero. + Este valor deve ser superior ou igual a zero. + + + This value should be negative. + Este valor deve ser estritamente negativo. + + + This value should be either negative or zero. + Este valor deve ser inferior ou igual a zero. + + + This value is not a valid timezone. + Este valor não é um fuso horário válido. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Esta senha foi divulgada durante uma fuga de dados, não deve ser usada de novamente. Por favor usar uma senha outra. + + + This value should be between {{ min }} and {{ max }}. + Este valor deve situar-se entre {{ min }} e {{ max }}. + + + This value is not a valid hostname. + Este valor não é um nome de host válido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + O número de elementos desta coleção deve ser um múltiplo de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Este valor deve satisfazer pelo menos uma das seguintes restrições : + + + Each element of this collection should satisfy its own set of constraints. + Cada elemento desta coleção deve satisfazer o seu próprio conjunto de restrições. + + + This value is not a valid International Securities Identification Number (ISIN). + Este valor não é um Número Internacional de Identificação de Segurança (ISIN) válido. + + + This value should be a valid expression. + Este valor deve ser uma expressão válida. + + + This value is not a valid CSS color. + Este valor não é uma cor de CSS válida. + + + This value is not a valid CIDR notation. + Este valor não é uma notação CIDR válida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + O valor da máscara de rede deve estar entre {{ min }} e {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf b/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf new file mode 100644 index 0000000..e88b81f --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.pt_BR.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Este valor deve ser falso. + + + This value should be true. + Este valor deve ser verdadeiro. + + + This value should be of type {{ type }}. + Este valor deve ser do tipo {{ type }}. + + + This value should be blank. + Este valor deve ser vazio. + + + The value you selected is not a valid choice. + O valor selecionado não é uma opção válida. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Você deve selecionar, no mínimo, {{ limit }} opção.|Você deve selecionar, no mínimo, {{ limit }} opções. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Você deve selecionar, no máximo, {{ limit }} opção.|Você deve selecionar, no máximo, {{ limit }} opções. + + + One or more of the given values is invalid. + Um ou mais valores informados são inválidos. + + + This field was not expected. + Este campo não era esperado. + + + This field is missing. + Este campo está ausente. + + + This value is not a valid date. + Este valor não é uma data válida. + + + This value is not a valid datetime. + Este valor não é uma data e hora válida. + + + This value is not a valid email address. + Este valor não é um endereço de e-mail válido. + + + The file could not be found. + O arquivo não foi encontrado. + + + The file is not readable. + O arquivo não pode ser lido. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande ({{ size }} {{ suffix }}). O tamanho máximo permitido é {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + O tipo mime do arquivo é inválido ({{ type }}). Os tipos mime permitidos são {{ types }}. + + + This value should be {{ limit }} or less. + Este valor deve ser {{ limit }} ou menos. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Este valor é muito longo. Deve ter {{ limit }} caractere ou menos.|Este valor é muito longo. Deve ter {{ limit }} caracteres ou menos. + + + This value should be {{ limit }} or more. + Este valor deve ser {{ limit }} ou mais. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Este valor é muito curto. Deve ter {{ limit }} caractere ou mais.|Este valor é muito curto. Deve ter {{ limit }} caracteres ou mais. + + + This value should not be blank. + Este valor não deve ser vazio. + + + This value should not be null. + Este valor não deve ser nulo. + + + This value should be null. + Este valor deve ser nulo. + + + This value is not valid. + Este valor não é válido. + + + This value is not a valid time. + Este valor não é uma hora válida. + + + This value is not a valid URL. + Este valor não é uma URL válida. + + + The two values should be equal. + Os dois valores devem ser iguais. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + O arquivo é muito grande. O tamanho máximo permitido é de {{ limit }} {{ suffix }}. + + + The file is too large. + O arquivo é muito grande. + + + The file could not be uploaded. + O arquivo não pode ser enviado. + + + This value should be a valid number. + Este valor deve ser um número válido. + + + This file is not a valid image. + Este arquivo não é uma imagem válida. + + + This is not a valid IP address. + Este não é um endereço de IP válido. + + + This value is not a valid language. + Este valor não é um idioma válido. + + + This value is not a valid locale. + Este valor não é uma localidade válida. + + + This value is not a valid country. + Este valor não é um país válido. + + + This value is already used. + Este valor já está sendo usado. + + + The size of the image could not be detected. + O tamanho da imagem não pode ser detectado. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + A largura da imagem é muito grande ({{ width }}px). A largura máxima permitida é de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + A largura da imagem é muito pequena ({{ width }}px). A largura mínima esperada é de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + A altura da imagem é muito grande ({{ height }}px). A altura máxima permitida é de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + A altura da imagem é muito pequena ({{ height }}px). A altura mínima esperada é de {{ min_height }}px. + + + This value should be the user's current password. + Este valor deve ser a senha atual do usuário. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Este valor deve ter exatamente {{ limit }} caractere.|Este valor deve ter exatamente {{ limit }} caracteres. + + + The file was only partially uploaded. + O arquivo foi enviado apenas parcialmente. + + + No file was uploaded. + Nenhum arquivo foi enviado. + + + No temporary folder was configured in php.ini. + Nenhum diretório temporário foi configurado no php.ini. + + + Cannot write temporary file to disk. + Não foi possível escrever o arquivo temporário no disco. + + + A PHP extension caused the upload to fail. + Uma extensão PHP fez com que o envio falhasse. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + + + Invalid card number. + Número de cartão inválido. + + + Unsupported card type or invalid card number. + Tipo de cartão não suportado ou número de cartão inválido. + + + This is not a valid International Bank Account Number (IBAN). + Este não é um Número Internacional de Conta Bancária (IBAN) válido. + + + This value is not a valid ISBN-10. + Este valor não é um ISBN-10 válido. + + + This value is not a valid ISBN-13. + Este valor não é um ISBN-13 válido. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Este valor não é um ISBN-10 e nem um ISBN-13 válido. + + + This value is not a valid ISSN. + Este valor não é um ISSN válido. + + + This value is not a valid currency. + Este não é um valor monetário válido. + + + This value should be equal to {{ compared_value }}. + Este valor deve ser igual a {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Este valor deve ser maior que {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Este valor deve ser maior ou igual a {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Este valor deve ser menor que {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Este valor deve ser menor ou igual a {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Este valor não deve ser igual a {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Este valor não deve ser idêntico a {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + A proporção da imagem é muito grande ({{ ratio }}). A proporção máxima permitida é {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + A proporção da imagem é muito pequena ({{ ratio }}). A proporção mínima esperada é {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + A imagem está num formato quadrado ({{ width }}x{{ height }}px). Imagens com formato quadrado não são permitidas. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + A imagem está orientada à paisagem ({{ width }}x{{ height }}px). Imagens orientadas à paisagem não são permitidas. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + A imagem está orientada ao retrato ({{ width }}x{{ height }}px). Imagens orientadas ao retrato não são permitidas. + + + An empty file is not allowed. + Arquivo vazio não é permitido. + + + The host could not be resolved. + O host não pôde ser resolvido. + + + This value does not match the expected {{ charset }} charset. + Este valor não corresponde ao charset {{ charset }} esperado. + + + This is not a valid Business Identifier Code (BIC). + Este não é um Código Identificador Bancário (BIC) válido. + + + Error + Erro + + + This is not a valid UUID. + Este não é um UUID válido. + + + This value should be a multiple of {{ compared_value }}. + Este valor deve ser múltiplo de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Este Código Identificador Bancário (BIC) não está associado ao IBAN {{ iban }}. + + + This value should be valid JSON. + Este valor deve ser um JSON válido. + + + This collection should contain only unique elements. + Esta coleção deve conter somente elementos únicos. + + + This value should be positive. + Este valor deve ser positivo. + + + This value should be either positive or zero. + Este valor deve ser positivo ou zero. + + + This value should be negative. + Este valor deve ser negativo. + + + This value should be either negative or zero. + Este valor deve ser negativo ou zero. + + + This value is not a valid timezone. + Este valor não representa um fuso horário válido. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Esta senha foi divulgada num vazamento de dados e não deve ser utilizada. Por favor, utilize outra senha. + + + This value should be between {{ min }} and {{ max }}. + Este valor deve estar entre {{ min }} e {{ max }}. + + + This value is not a valid hostname. + Este valor não é um nome de host válido. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + O número de elementos desta coleção deve ser um múltiplo de {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Este valor deve satisfazer pelo menos uma das seguintes restrições: + + + Each element of this collection should satisfy its own set of constraints. + Cada elemento desta coleção deve satisfazer seu próprio grupo de restrições. + + + This value is not a valid International Securities Identification Number (ISIN). + Este valor não é um Número de Identificação de Títulos Internacionais (ISIN) válido. + + + This value should be a valid expression. + Este valor deve ser uma expressão válida. + + + This value is not a valid CSS color. + Este valor não é uma cor CSS válida. + + + This value is not a valid CIDR notation. + Este valor não é uma notação CIDR válida. + + + The value of the netmask should be between {{ min }} and {{ max }}. + O valor da máscara de rede deve estar entre {{ min }} e {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.ro.xlf b/vendor/symfony/validator/Resources/translations/validators.ro.xlf new file mode 100644 index 0000000..7fba2cd --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.ro.xlf @@ -0,0 +1,403 @@ + + + + + + This value should be false. + Această valoare ar trebui să fie falsă (false). + + + This value should be true. + Această valoare ar trebui să fie adevărată (true). + + + This value should be of type {{ type }}. + Această valoare ar trebui să fie de tipul {{ type }}. + + + This value should be blank. + Această valoare ar trebui sa fie goală. + + + The value you selected is not a valid choice. + Valoarea selectată nu este o opțiune validă. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Trebuie să selectați cel puțin {{ limit }} opțiune.|Trebuie să selectați cel puțin {{ limit }} opțiuni.|Trebuie să selectați cel puțin {{ limit }} de opțiuni + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Trebuie să selectați cel mult {{ limit }} opțiune.|Trebuie să selectați cel mult {{ limit }} opțiuni.|Trebuie să selectați cel mult {{ limit }} de opțiuni. + + + One or more of the given values is invalid. + Una sau mai multe dintre valorile furnizate sunt invalide. + + + This field was not expected. + Acest câmp nu era de aşteptat. + + + This field is missing. + Acest câmp este lipsă. + + + This value is not a valid date. + Această valoare nu reprezintă o dată validă. + + + This value is not a valid datetime. + Această valoare nu reprezintă o dată și oră validă. + + + This value is not a valid email address. + Această valoare nu reprezintă o adresă de e-mail validă. + + + The file could not be found. + Fișierul nu a putut fi găsit. + + + The file is not readable. + Fișierul nu poate fi citit. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fișierul este prea mare ({{ size }} {{ suffix }}). Dimensiunea maximă permisă este {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Tipul fișierului este invalid ({{ type }}). Tipurile permise de fișiere sunt ({{ types }}). + + + This value should be {{ limit }} or less. + Această valoare ar trebui să fie cel mult {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caracter.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} caractere.|Această valoare este prea lungă. Ar trebui să aibă maxim {{ limit }} de caractere. + + + This value should be {{ limit }} or more. + Această valoare ar trebui să fie cel puțin {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caracter.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} caractere.|Această valoare este prea scurtă. Ar trebui să aibă minim {{ limit }} de caractere. + + + This value should not be blank. + Această valoare nu ar trebui să fie goală. + + + This value should not be null. + Această valoare nu ar trebui să fie nulă (null). + + + This value should be null. + Această valoare ar trebui să fie nulă (null). + + + This value is not valid. + Această valoare nu este validă. + + + This value is not a valid time. + Această valoare nu reprezintă o oră validă. + + + This value is not a valid URL. + Această valoare nu reprezintă un URL (link) valid. + + + The two values should be equal. + Cele două valori ar trebui să fie egale. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fișierul este prea mare. Mărimea maximă permisă este {{ limit }} {{ suffix }}. + + + The file is too large. + Fișierul este prea mare. + + + The file could not be uploaded. + Fișierul nu a putut fi încărcat. + + + This value should be a valid number. + Această valoare nu reprezintă un număr valid. + + + This file is not a valid image. + Acest fișier nu este o imagine validă. + + + This is not a valid IP address. + Această valoare nu este o adresă IP validă. + + + This value is not a valid language. + Această valoare nu reprezintă o limbă corectă. + + + This value is not a valid locale. + Această valoare nu reprezintă un dialect (o limbă) corect. + + + This value is not a valid country. + Această valoare nu este o țară validă. + + + This value is already used. + Această valoare este folosită deja. + + + The size of the image could not be detected. + Mărimea imaginii nu a putut fi detectată. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Lățimea imaginii este prea mare ({{ width }}px). Lățimea maximă permisă este de {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Lățimea imaginii este prea mică ({{ width }}px). Lățimea minimă permisă este de {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Înălțimea imaginii este prea mare ({{ height }}px). Înălțimea maximă permisă este de {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Înălțimea imaginii este prea mică ({{ height }}px). Înălțimea minimă permisă este de {{ min_height }}px. + + + This value should be the user's current password. + Această valoare trebuie să fie parola curentă a utilizatorului. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Această valoare trebuie să conțină exact {{ limit }} caracter.|Această valoare trebuie să conțină exact {{ limit }} caractere.|Această valoare trebuie să conțină exact {{ limit }} de caractere. + + + The file was only partially uploaded. + Fișierul a fost încărcat parțial. + + + No file was uploaded. + Nu a fost încărcat nici un fișier. + + + No temporary folder was configured in php.ini. + Nu este configurat nici un director temporar in php.ini. + + + Cannot write temporary file to disk. + Nu a fost posibilă scrierea fișierului temporar pe disk. + + + A PHP extension caused the upload to fail. + O extensie PHP a prevenit încărcarea cu succes a fișierului. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Această colecție trebuie să conțină cel puțin {{ limit }} element.|Această colecție trebuie să conțină cel puțin {{ limit }} elemente.|Această colecție trebuie să conțină cel puțin {{ limit }} de elemente. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Această colecție trebuie să conțină cel mult {{ limit }} element.|Această colecție trebuie să conțină cel mult {{ limit }} elemente.|Această colecție trebuie să conțină cel mult {{ limit }} de elemente. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Această colecție trebuie să conțină {{ limit }} element.|Această colecție trebuie să conțină {{ limit }} elemente.|Această colecție trebuie să conțină {{ limit }} de elemente. + + + Invalid card number. + Numărul card invalid. + + + Unsupported card type or invalid card number. + Tipul sau numărul cardului nu sunt valide. + + + This is not a valid International Bank Account Number (IBAN). + Acesta nu este un cod IBAN (International Bank Account Number) valid. + + + This value is not a valid ISBN-10. + Această valoare nu este un cod ISBN-10 valid. + + + This value is not a valid ISBN-13. + Această valoare nu este un cod ISBN-13 valid. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Această valoare nu este un cod ISBN-10 sau ISBN-13 valid. + + + This value is not a valid ISSN. + Această valoare nu este un cod ISSN valid. + + + This value is not a valid currency. + Această valoare nu este o monedă validă. + + + This value should be equal to {{ compared_value }}. + Această valoare trebuie să fie egală cu {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Această valoare trebuie să fie mai mare de {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Această valoare trebuie să fie mai mare sau egală cu {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Această valoare trebuie identică cu {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Această valoare trebuie să fie mai mică de {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Această valoare trebuie să fie mai mică sau egală cu {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Această valoare nu trebuie să fie egală cu {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Această valoare nu trebuie să fie identică cu {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Raportul imaginii este prea mare ({{ ratio }}). Raportul maxim permis este {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Raportul imaginii este prea mic ({{ ratio }}). Raportul minim permis este {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Imaginea este un pătrat ({{ width }}x{{ height }}px). Imaginile pătrat nu sunt permise. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Imaginea are orientarea peisaj ({{ width }}x{{ height }}px). Imaginile cu orientare peisaj nu sunt permise. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Imaginea are orientarea portret ({{ width }}x{{ height }}px). Imaginile cu orientare portret nu sunt permise. + + + An empty file is not allowed. + Nu se permite un fișier gol. + + + The host could not be resolved. + Numele host nu a putut fi rezolvat către o adresă IP. + + + This value does not match the expected {{ charset }} charset. + Această valoare nu corespunde setului de caractere {{ charset }} așteptat. + + + This is not a valid Business Identifier Code (BIC). + Codul BIC (Business Identifier Code) nu este valid. + + + Error + Eroare + + + This is not a valid UUID. + Identificatorul universal unic (UUID) nu este valid. + + + This value should be a multiple of {{ compared_value }}. + Această valoare trebuie să fie un multiplu de {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Codul BIC (Business Identifier Code) nu este asociat cu codul IBAN {{ iban }}. + + + This value should be valid JSON. + Această valoare trebuie să fie un JSON valid. + + + This collection should contain only unique elements. + Acest set ar trebui să conțină numai elemente unice. + + + This value should be positive. + Această valoare ar trebui să fie pozitivă. + + + This value should be either positive or zero. + Această valoare trebuie să fie pozitivă sau zero. + + + This value should be negative. + Această valoare ar trebui să fie negativă. + + + This value should be either negative or zero. + Această valoare trebuie să fie negativă sau zero. + + + This value is not a valid timezone. + Această valoare nu este un fus orar valid. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Această parolă a fost compromisă și nu poate fi utilizată. Vă rugăm să utilizați o altă parolă. + + + This value should be between {{ min }} and {{ max }}. + Această valoare trebuie să fie între {{ min }} și {{ max }}. + + + This value is not a valid hostname. + Această valoare nu este un numele gazdei valid. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Numărul de elemente din această colecție ar trebui să fie un multiplu al {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Această valoare trebuie să îndeplinească cel puțin una dintre următoarele reguli: + + + Each element of this collection should satisfy its own set of constraints. + Fiecare element din acest set ar trebui să îndeplinească propriul set de reguli. + + + This value is not a valid International Securities Identification Number (ISIN). + Această valoare nu este un număr internațional de identificare (ISIN) valabil. + + + This value should be a valid expression. + Această valoare ar trebui să fie o expresie validă. + + + This value is not a valid CIDR notation. + Această valoare nu este o notație CIDR validă. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Valoarea netmask-ului trebuie sa fie intre {{ min }} si {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.ru.xlf b/vendor/symfony/validator/Resources/translations/validators.ru.xlf new file mode 100644 index 0000000..8705cbb --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.ru.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Значение должно быть ложным. + + + This value should be true. + Значение должно быть истинным. + + + This value should be of type {{ type }}. + Тип значения должен быть {{ type }}. + + + This value should be blank. + Значение должно быть пустым. + + + The value you selected is not a valid choice. + Выбранное Вами значение недопустимо. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Вы должны выбрать хотя бы {{ limit }} вариант.|Вы должны выбрать хотя бы {{ limit }} варианта.|Вы должны выбрать хотя бы {{ limit }} вариантов. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Вы должны выбрать не более чем {{ limit }} вариант.|Вы должны выбрать не более чем {{ limit }} варианта.|Вы должны выбрать не более чем {{ limit }} вариантов. + + + One or more of the given values is invalid. + Одно или несколько заданных значений недопустимо. + + + This field was not expected. + Это поле не ожидалось. + + + This field is missing. + Это поле отсутствует. + + + This value is not a valid date. + Значение не является правильной датой. + + + This value is not a valid datetime. + Значение даты и времени недопустимо. + + + This value is not a valid email address. + Значение адреса электронной почты недопустимо. + + + The file could not be found. + Файл не может быть найден. + + + The file is not readable. + Файл не может быть прочитан. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл слишком большой ({{ size }} {{ suffix }}). Максимально допустимый размер {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-тип файла недопустим ({{ type }}). Допустимы MIME-типы файлов {{ types }}. + + + This value should be {{ limit }} or less. + Значение должно быть {{ limit }} или меньше. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Значение слишком длинное. Должно быть равно {{ limit }} символу или меньше.|Значение слишком длинное. Должно быть равно {{ limit }} символам или меньше.|Значение слишком длинное. Должно быть равно {{ limit }} символам или меньше. + + + This value should be {{ limit }} or more. + Значение должно быть {{ limit }} или больше. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Значение слишком короткое. Должно быть равно {{ limit }} символу или больше.|Значение слишком короткое. Должно быть равно {{ limit }} символам или больше.|Значение слишком короткое. Должно быть равно {{ limit }} символам или больше. + + + This value should not be blank. + Значение не должно быть пустым. + + + This value should not be null. + Значение не должно быть null. + + + This value should be null. + Значение должно быть null. + + + This value is not valid. + Значение недопустимо. + + + This value is not a valid time. + Значение времени недопустимо. + + + This value is not a valid URL. + Значение не является допустимым URL. + + + The two values should be equal. + Оба значения должны быть одинаковыми. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл слишком большой. Максимально допустимый размер {{ limit }} {{ suffix }}. + + + The file is too large. + Файл слишком большой. + + + The file could not be uploaded. + Файл не может быть загружен. + + + This value should be a valid number. + Значение должно быть числом. + + + This file is not a valid image. + Файл не является допустимым форматом изображения. + + + This is not a valid IP address. + Значение не является допустимым IP адресом. + + + This value is not a valid language. + Значение не является допустимым языком. + + + This value is not a valid locale. + Значение не является допустимой локалью. + + + This value is not a valid country. + Значение не является допустимой страной. + + + This value is already used. + Это значение уже используется. + + + The size of the image could not be detected. + Не удалось определить размер изображения. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина изображения слишком велика ({{ width }}px). Максимально допустимая ширина {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина изображения слишком мала ({{ width }}px). Минимально допустимая ширина {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Высота изображения слишком велика ({{ height }}px). Максимально допустимая высота {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Высота изображения слишком мала ({{ height }}px). Минимально допустимая высота {{ min_height }}px. + + + This value should be the user's current password. + Значение должно быть текущим паролем пользователя. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Значение должно быть равно {{ limit }} символу.|Значение должно быть равно {{ limit }} символам.|Значение должно быть равно {{ limit }} символам. + + + The file was only partially uploaded. + Файл был загружен только частично. + + + No file was uploaded. + Файл не был загружен. + + + No temporary folder was configured in php.ini. + Не настроена временная директория в php.ini. + + + Cannot write temporary file to disk. + Невозможно записать временный файл на диск. + + + A PHP extension caused the upload to fail. + Расширение PHP вызвало ошибку при загрузке. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Эта коллекция должна содержать {{ limit }} элемент или больше.|Эта коллекция должна содержать {{ limit }} элемента или больше.|Эта коллекция должна содержать {{ limit }} элементов или больше. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Эта коллекция должна содержать {{ limit }} элемент или меньше.|Эта коллекция должна содержать {{ limit }} элемента или меньше.|Эта коллекция должна содержать {{ limit }} элементов или меньше. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Эта коллекция должна содержать ровно {{ limit }} элемент.|Эта коллекция должна содержать ровно {{ limit }} элемента.|Эта коллекция должна содержать ровно {{ limit }} элементов. + + + Invalid card number. + Неверный номер карты. + + + Unsupported card type or invalid card number. + Неподдерживаемый тип или неверный номер карты. + + + This is not a valid International Bank Account Number (IBAN). + Значение не является допустимым международным номером банковского счета (IBAN). + + + This value is not a valid ISBN-10. + Значение имеет неверный формат ISBN-10. + + + This value is not a valid ISBN-13. + Значение имеет неверный формат ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Значение не соответствует форматам ISBN-10 и ISBN-13. + + + This value is not a valid ISSN. + Значение не соответствует формату ISSN. + + + This value is not a valid currency. + Некорректный формат валюты. + + + This value should be equal to {{ compared_value }}. + Значение должно быть равно {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Значение должно быть больше чем {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Значение должно быть больше или равно {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Значение должно быть идентичным {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Значение должно быть меньше чем {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Значение должно быть меньше или равно {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Значение не должно быть равно {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Значение не должно быть идентичным {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Соотношение сторон изображения слишком велико ({{ ratio }}). Максимальное соотношение сторон {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Соотношение сторон изображения слишком мало ({{ ratio }}). Минимальное соотношение сторон {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Изображение квадратное ({{ width }}x{{ height }}px). Квадратные изображения не разрешены. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Изображение в альбомной ориентации ({{ width }}x{{ height }}px). Изображения в альбомной ориентации не разрешены. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Изображение в портретной ориентации ({{ width }}x{{ height }}px). Изображения в портретной ориентации не разрешены. + + + An empty file is not allowed. + Пустые файлы не разрешены. + + + The host could not be resolved. + Имя хоста не может быть разрешено. + + + This value does not match the expected {{ charset }} charset. + Значение не совпадает с ожидаемой {{ charset }} кодировкой. + + + This is not a valid Business Identifier Code (BIC). + Значение не соответствует формату BIC. + + + Error + Ошибка + + + This is not a valid UUID. + Значение не соответствует формату UUID. + + + This value should be a multiple of {{ compared_value }}. + Значение должно быть кратно {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Данный BIC не связан с IBAN {{ iban }}. + + + This value should be valid JSON. + Значение должно быть корректным JSON. + + + This collection should contain only unique elements. + Эта коллекция должна содержать только уникальные элементы. + + + This value should be positive. + Значение должно быть положительным. + + + This value should be either positive or zero. + Значение должно быть положительным или равным нулю. + + + This value should be negative. + Значение должно быть отрицательным. + + + This value should be either negative or zero. + Значение должно быть отрицательным или равным нулю. + + + This value is not a valid timezone. + Значение не является корректным часовым поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Данный пароль был скомпрометирован в результате утечки данных и не должен быть использован. Пожалуйста, используйте другой пароль. + + + This value should be between {{ min }} and {{ max }}. + Значение должно быть между {{ min }} и {{ max }}. + + + This value is not a valid hostname. + Значение не является корректным именем хоста. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Количество элементов в этой коллекции должно быть кратным {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Значение должно удовлетворять как минимум одному из следующих ограничений: + + + Each element of this collection should satisfy its own set of constraints. + Каждый элемент этой коллекции должен удовлетворять своему собственному набору ограничений. + + + This value is not a valid International Securities Identification Number (ISIN). + Значение не является корректным международным идентификационным номером ценных бумаг (ISIN). + + + This value should be a valid expression. + Это значение должно быть корректным выражением. + + + This value is not a valid CSS color. + Значение не является корректным CSS цветом. + + + This value is not a valid CIDR notation. + Значение не соответствует нотации CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Значение маски подсети должно быть от {{ min }} до {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sk.xlf b/vendor/symfony/validator/Resources/translations/validators.sk.xlf new file mode 100644 index 0000000..55a8111 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sk.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Táto hodnota by mala byť nastavená na false. + + + This value should be true. + Táto hodnota by mala byť nastavená na true. + + + This value should be of type {{ type }}. + Táto hodnota by mala byť typu {{ type }}. + + + This value should be blank. + Táto hodnota by mala byť prázdna. + + + The value you selected is not a valid choice. + Táto hodnota by mala byť jednou z poskytnutých možností. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Mali by ste vybrať minimálne {{ limit }} možnosť.|Mali by ste vybrať minimálne {{ limit }} možnosti.|Mali by ste vybrať minimálne {{ limit }} možností. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Mali by ste vybrať najviac {{ limit }} možnosť.|Mali by ste vybrať najviac {{ limit }} možnosti.|Mali by ste vybrať najviac {{ limit }} možností. + + + One or more of the given values is invalid. + Niektoré z uvedených hodnôt sú neplatné. + + + This field was not expected. + Toto pole sa neočakáva. + + + This field is missing. + Toto pole chýba. + + + This value is not a valid date. + Tato hodnota nemá platný formát dátumu. + + + This value is not a valid datetime. + Táto hodnota nemá platný formát dátumu a času. + + + This value is not a valid email address. + Táto hodnota nie je platná emailová adresa. + + + The file could not be found. + Súbor sa nenašiel. + + + The file is not readable. + Súbor nie je čitateľný. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Súbor je príliš veľký ({{ size }} {{ suffix }}). Maximálna povolená veľkosť je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Súbor typu ({{ type }}) nie je podporovaný. Podporované typy sú {{ types }}. + + + This value should be {{ limit }} or less. + Táto hodnota by mala byť {{ limit }} alebo menej. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovať najviac {{ limit }} znak.|Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovať najviac {{ limit }} znaky.|Táto hodnota obsahuje viac znakov ako je povolené. Mala by obsahovať najviac {{ limit }} znakov. + + + This value should be {{ limit }} or more. + Táto hodnota by mala byť viac ako {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Táto hodnota je príliš krátka. Musí obsahovať minimálne {{ limit }} znak.|Táto hodnota je príliš krátka. Musí obsahovať minimálne {{ limit }} znaky.|Táto hodnota je príliš krátka. Minimálny počet znakov je {{ limit }}. + + + This value should not be blank. + Táto hodnota by mala byť vyplnená. + + + This value should not be null. + Táto hodnota by nemala byť null. + + + This value should be null. + Táto hodnota by mala byť null. + + + This value is not valid. + Táto hodnota nie je platná. + + + This value is not a valid time. + Tato hodnota nemá správny formát času. + + + This value is not a valid URL. + Táto hodnota nie je platnou URL adresou. + + + The two values should be equal. + Tieto dve hodnoty by mali byť rovnaké. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Súbor je príliš veľký. Maximálna povolená veľkosť je {{ limit }} {{ suffix }}. + + + The file is too large. + Súbor je príliš veľký. + + + The file could not be uploaded. + Súbor sa nepodarilo nahrať. + + + This value should be a valid number. + Táto hodnota by mala byť číslo. + + + This file is not a valid image. + Tento súbor nie je obrázok. + + + This is not a valid IP address. + Toto nie je platná IP adresa. + + + This value is not a valid language. + Tento jazyk neexistuje. + + + This value is not a valid locale. + Táto lokalizácia neexistuje. + + + This value is not a valid country. + Táto krajina neexistuje. + + + This value is already used. + Táto hodnota sa už používa. + + + The size of the image could not be detected. + Nepodarilo sa zistiť rozmery obrázku. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Obrázok je príliš široký ({{ width }}px). Maximálna povolená šírka obrázku je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Obrázok je príliš úzky ({{ width }}px). Minimálna šírka obrázku by mala byť {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + >Obrázok je príliš vysoký ({{ height }}px). Maximálna povolená výška obrázku je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Obrázok je príliš nízky ({{ height }}px). Minimálna výška obrázku by mala byť {{ min_height }}px. + + + This value should be the user's current password. + Táto hodnota by mala byť aktuálne heslo používateľa. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Táto hodnota by mala mať presne {{ limit }} znak.|Táto hodnota by mala mať presne {{ limit }} znaky.|Táto hodnota by mala mať presne {{ limit }} znakov. + + + The file was only partially uploaded. + Bola nahraná len časť súboru. + + + No file was uploaded. + Žiadny súbor nebol nahraný. + + + No temporary folder was configured in php.ini. + V php.ini nie je nastavená cesta k addressáru pre dočasné súbory. + + + Cannot write temporary file to disk. + Dočasný súbor sa nepodarilo zapísať na disk. + + + A PHP extension caused the upload to fail. + Rozšírenie PHP zabránilo nahraniu súboru. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Táto kolekcia by mala obsahovať aspoň {{ limit }} prvok alebo viac.|Táto kolekcia by mala obsahovať aspoň {{ limit }} prvky alebo viac.|Táto kolekcia by mala obsahovať aspoň {{ limit }} prvkov alebo viac. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Táto kolekcia by mala maximálne {{ limit }} prvok.|Táto kolekcia by mala obsahovať maximálne {{ limit }} prvky.|Táto kolekcia by mala obsahovať maximálne {{ limit }} prvkov. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Táto kolekcia by mala obsahovať presne {{ limit }} prvok.|Táto kolekcia by mala obsahovať presne {{ limit }} prvky.|Táto kolekcia by mala obsahovať presne {{ limit }} prvkov. + + + Invalid card number. + Neplatné číslo karty. + + + Unsupported card type or invalid card number. + Nepodporovaný typ karty alebo neplatné číslo karty. + + + This is not a valid International Bank Account Number (IBAN). + Toto je neplatný IBAN. + + + This value is not a valid ISBN-10. + Táto hodnota je neplatné ISBN-10. + + + This value is not a valid ISBN-13. + Táto hodnota je neplatné ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Táto hodnota nie je platné ISBN-10 ani ISBN-13. + + + This value is not a valid ISSN. + Táto hodnota nie je platné ISSN. + + + This value is not a valid currency. + Táto hodnota nie je platná mena. + + + This value should be equal to {{ compared_value }}. + Táto hodnota by mala byť rovná {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Táto hodnota by mala byť väčšia ako {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Táto hodnota by mala byť väčšia alebo rovná {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Táto hodnota by mala byť typu {{ compared_value_type }} a zároveň by mala byť rovná {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Táto hodnota by mala byť menšia ako {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Táto hodnota by mala byť menšia alebo rovná {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Táto hodnota by nemala byť rovná {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Táto hodnota by nemala byť typu {{ compared_value_type }} a zároveň by nemala byť rovná {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Pomer strán obrázku je príliš veľký ({{ ratio }}). Maximálny povolený pomer strán obrázku je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Pomer strán obrázku je príliš malý ({{ ratio }}). Minimálny povolený pomer strán obrázku je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Strany obrázku sú štvorcové ({{ width }}x{{ height }}px). Štvorcové obrázky nie sú povolené. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Obrázok je orientovaný na šírku ({{ width }}x{{ height }}px). Obrázky orientované na šírku nie sú povolené. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Obrázok je orientovaný na výšku ({{ width }}x{{ height }}px). Obrázky orientované na výšku nie sú povolené. + + + An empty file is not allowed. + Súbor nesmie byť prázdny. + + + The host could not be resolved. + Hostiteľa nebolo možné rozpoznať. + + + This value does not match the expected {{ charset }} charset. + Táto hodnota nezodpovedá očakávanej znakovej sade {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Táto hodnota nie je platný identifikačný kód podniku (BIC). + + + Error + Chyba + + + This is not a valid UUID. + Táto hodnota nie je platný UUID. + + + This value should be a multiple of {{ compared_value }}. + Táto hodnota by mala byť násobkom {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Tento identifikačný kód podniku (BIC) nie je spojený s IBAN {{ iban }}. + + + This value should be valid JSON. + Táto hodnota by mala byť platný JSON. + + + This collection should contain only unique elements. + Táto kolekcia by mala obsahovať len unikátne prkvy. + + + This value should be positive. + Táto hodnota by mala byť kladná. + + + This value should be either positive or zero. + Táto hodnota by mala byť kladná alebo nulová. + + + This value should be negative. + Táto hodnota by mala byť záporná. + + + This value should be either negative or zero. + Táto hodnota by mala byť záporná alebo nulová. + + + This value is not a valid timezone. + Táto hodnota nie je platné časové pásmo. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Toto heslo uniklo pri narušení ochrany dát, nie je možné ho použiť. Prosím, použite iné heslo. + + + This value should be between {{ min }} and {{ max }}. + Táto hodnota by mala byť medzi {{ min }} a {{ max }}. + + + This value is not a valid hostname. + Táto hodnota nie je platný hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Počet prvkov v tejto kolekcii musí byť násobok {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Táto hodnota musí spĺňať aspoň jedno z nasledujúcich obmedzení: + + + Each element of this collection should satisfy its own set of constraints. + Každý prvok v tejto kolekcii musí spĺňať svoje vlastné obmedzenia. + + + This value is not a valid International Securities Identification Number (ISIN). + Táto hodnota nie je platné medzinárodné označenie cenného papiera (ISIN). + + + This value should be a valid expression. + Táto hodnota by mala byť platným výrazom. + + + This value is not a valid CSS color. + Táto hodnota nie je platná CSS farba. + + + This value is not a valid CIDR notation. + Táto hodnota nie je platnou notáciou CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Hodnota masky siete by mala byť medzi {{ min }} a {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sl.xlf b/vendor/symfony/validator/Resources/translations/validators.sl.xlf new file mode 100644 index 0000000..b956911 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sl.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Vrednost bi morala biti nepravilna (false). + + + This value should be true. + Vrednost bi morala biti pravilna (true). + + + This value should be of type {{ type }}. + Vrednost mora biti naslednjega tipa {{ type }}. + + + This value should be blank. + Vrednost mora biti prazna. + + + The value you selected is not a valid choice. + Vrednost, ki ste jo izbrali, ni veljavna možnost. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Izbrati morate vsaj {{ limit }} možnost.|Izbrati morate vsaj {{ limit }} možnosti.|Izbrati morate vsaj {{ limit }} možnosti.|Izbrati morate vsaj {{ limit }} možnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Izberete lahko največ {{ limit }} možnost.|Izberete lahko največ {{ limit }} možnosti.|Izberete lahko največ {{ limit }} možnosti.|Izberete lahko največ {{ limit }} možnosti. + + + One or more of the given values is invalid. + Ena ali več podanih vrednosti ni veljavnih. + + + This field was not expected. + To polje ni bilo pričakovati. + + + This field is missing. + To polje manjka. + + + This value is not a valid date. + Ta vrednost ni veljaven datum. + + + This value is not a valid datetime. + Ta vrednost ni veljaven datum in čas. + + + This value is not a valid email address. + Ta vrednost ni veljaven e-poštni naslov. + + + The file could not be found. + Datoteke ni mogoče najti. + + + The file is not readable. + Datoteke ni mogoče prebrati. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). Največja dovoljena velikost je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime tip datoteke je neveljaven ({{ type }}). Dovoljeni mime tipi so {{ types }}. + + + This value should be {{ limit }} or less. + Ta vrednost bi morala biti {{ limit }} ali manj. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ta vrednost je predolga. Morala bi imeti {{ limit }} znak ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znaka ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znake ali manj.|Ta vrednost je predolga. Morala bi imeti {{ limit }} znakov ali manj. + + + This value should be {{ limit }} or more. + Ta vrednost bi morala biti {{ limit }} ali več. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ta vrednost je prekratka. Morala bi imeti {{ limit }} znak ali več.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znaka ali več.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znake ali več.|Ta vrednost je prekratka. Morala bi imeti {{ limit }} znakov ali več. + + + This value should not be blank. + Ta vrednost ne bi smela biti prazna. + + + This value should not be null. + Ta vrednost ne bi smela biti nedefinirana (null). + + + This value should be null. + Ta vrednost bi morala biti nedefinirana (null). + + + This value is not valid. + Ta vrednost ni veljavna. + + + This value is not a valid time. + Ta vrednost ni veljaven čas. + + + This value is not a valid URL. + Ta vrednost ni veljaven URL. + + + The two values should be equal. + Ti dve vrednosti bi morali biti enaki. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika. Največja dovoljena velikost je {{ limit }} {{ suffix }}. + + + The file is too large. + Datoteka je prevelika. + + + The file could not be uploaded. + Datoteke ni bilo mogoče naložiti. + + + This value should be a valid number. + Ta vrednost bi morala biti veljavna številka. + + + This file is not a valid image. + Ta datoteka ni veljavna slika. + + + This is not a valid IP address. + To ni veljaven IP naslov. + + + This value is not a valid language. + Ta vrednost ni veljaven jezik. + + + This value is not a valid locale. + Ta vrednost ni veljavna lokalnost. + + + This value is not a valid country. + Ta vrednost ni veljavna država. + + + This value is already used. + Ta vrednost je že uporabljena. + + + The size of the image could not be detected. + Velikosti slike ni bilo mogoče zaznati. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina slike je preširoka ({{ width }}px). Največja dovoljena širina je {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina slike je premajhna ({{ width }}px). Najmanjša predvidena širina je {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Višina slike je prevelika ({{ height }}px). Največja dovoljena višina je {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Višina slike je premajhna ({{ height }}px). Najmanjša predvidena višina je {{ min_height }}px. + + + This value should be the user's current password. + Ta vrednost bi morala biti trenutno uporabnikovo geslo. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ta vrednost bi morala imeti točno {{ limit }} znak.|Ta vrednost bi morala imeti točno {{ limit }} znaka.|Ta vrednost bi morala imeti točno {{ limit }} znake.|Ta vrednost bi morala imeti točno {{ limit }} znakov. + + + The file was only partially uploaded. + Datoteka je bila le delno naložena. + + + No file was uploaded. + Nobena datoteka ni bila naložena. + + + No temporary folder was configured in php.ini. + Začasna mapa ni nastavljena v php.ini. + + + Cannot write temporary file to disk. + Začasne datoteke ni bilo mogoče zapisati na disk. + + + A PHP extension caused the upload to fail. + PHP razširitev je vzrok, da nalaganje ni uspelo. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ta zbirka bi morala vsebovati {{ limit }} element ali več.|Ta zbirka bi morala vsebovati {{ limit }} elementa ali več.|Ta zbirka bi morala vsebovati {{ limit }} elemente ali več.|Ta zbirka bi morala vsebovati {{ limit }} elementov ali več. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ta zbirka bi morala vsebovati {{ limit }} element ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elementa ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elemente ali manj.|Ta zbirka bi morala vsebovati {{ limit }} elementov ali manj. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ta zbirka bi morala vsebovati točno {{ limit }} element.|Ta zbirka bi morala vsebovati točno {{ limit }} elementa.|Ta zbirka bi morala vsebovati točno {{ limit }} elemente.|Ta zbirka bi morala vsebovati točno {{ limit }} elementov. + + + Invalid card number. + Neveljavna številka kartice. + + + Unsupported card type or invalid card number. + Nepodprti tip kartice ali neveljavna številka kartice. + + + This is not a valid International Bank Account Number (IBAN). + To ni veljavna mednarodna številka bančnega računa (IBAN). + + + This value is not a valid ISBN-10. + Neveljavna vrednost po ISBN-10. + + + This value is not a valid ISBN-13. + Neveljavna vrednost po ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Neveljavna vrednost po ISBN-10 ali po ISBN-13. + + + This value is not a valid ISSN. + Neveljavna vrednost ISSN. + + + This value is not a valid currency. + Ta vrednost ni veljavna valuta. + + + This value should be equal to {{ compared_value }}. + Ta vrednost bi morala biti enaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ta vrednost bi morala biti večja od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ta vrednost bi morala biti večja ali enaka {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ta vrednost bi morala biti identična {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ta vrednost bi morala biti manjša od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ta vrednost bi morala biti manjša ali enaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ta vrednost ne bi smela biti enaka {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ta vrednost ne bi smela biti identična {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmerje slike je preveliko ({{ ratio }}). Največje dovoljeno razmerje je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmerje slike je premajhno ({{ ratio }}). Najmanjše pričakovano razmerje je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadrat ({{ width }}x{{ height }}px). Kvadratne slike niso dovoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je ležeče usmerjena ({{ width }}x{{ height }}px). Ležeče usmerjene slike niso dovoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je pokončno usmerjena ({{ width }}x{{ height }}px). Pokončno usmerjene slike niso dovoljene. + + + An empty file is not allowed. + Prazna datoteka ni dovoljena. + + + The host could not be resolved. + Gostitelja ni bilo mogoče prepoznati. + + + This value does not match the expected {{ charset }} charset. + Ta vrednost se ne ujema s pričakovanim naborom znakov {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + To ni veljavna identifikacijska koda podjetja (BIC). + + + Error + Napaka + + + This is not a valid UUID. + To ni veljaven UUID. + + + This value should be a multiple of {{ compared_value }}. + Ta vrednost bi morala biti večkratnik od {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ta poslovna identifikacijska koda (BIC) ni povezana z IBAN {{ iban }}. + + + This value should be valid JSON. + Ta vrednost bi morala biti veljaven JSON. + + + This collection should contain only unique elements. + Ta zbirka bi morala vsebovati samo edinstvene elemente. + + + This value should be positive. + Ta vrednost bi morala biti pozitivna. + + + This value should be either positive or zero. + Ta vrednost bi morala biti pozitivna ali enaka nič. + + + This value should be negative. + Ta vrednost bi morala biti negativna. + + + This value should be either negative or zero. + Ta vrednost bi morala biti negativna ali enaka nič. + + + This value is not a valid timezone. + Ta vrednost ni veljaven časovni pas. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + To geslo je ušlo pri kršitvi varnosti podatkov in ga ne smete uporabljati. Prosimo, uporabite drugo geslo. + + + This value should be between {{ min }} and {{ max }}. + Ta vrednost bi morala biti med {{ min }} in {{ max }}. + + + This value is not a valid hostname. + Ta vrednost ni veljavno ime gostitelja. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Število elementov v tej zbirki bi moralo biti mnogokratnik {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ta vrednost bi morala zadostiti vsaj eni izmed sledečih omejitev: + + + Each element of this collection should satisfy its own set of constraints. + Vsak element te zbirke bi moral zadostiti svojemu lastnemu naboru omejitev. + + + This value is not a valid International Securities Identification Number (ISIN). + Ta vrednost ni veljavna mednarodna identifikacijska koda vrednostnih papirjev (ISIN). + + + This value should be a valid expression. + Ta vrednost bi morala biti veljaven izraz. + + + This value is not a valid CSS color. + Ta vrednost ni veljavna barva CSS. + + + This value is not a valid CIDR notation. + Ta vrednost ni veljaven zapis CIDR. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Vrednost omrežne maske mora biti med {{ min }} in {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sq.xlf b/vendor/symfony/validator/Resources/translations/validators.sq.xlf new file mode 100644 index 0000000..6c0acb9 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sq.xlf @@ -0,0 +1,391 @@ + + + + + + This value should be false. + Kjo vlerë duhet të jetë e pavërtetë (false). + + + This value should be true. + Kjo vlerë duhet të jetë e vërtetë (true). + + + This value should be of type {{ type }}. + Kjo vlerë duhet të jetë e llojit {{ type }}. + + + This value should be blank. + Kjo vlerë duhet të jetë e zbrazët. + + + The value you selected is not a valid choice. + Vlera që keni zgjedhur nuk është alternativë e vlefshme. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Duhet të zgjedhni së paku {{ limit }} alternativë.|Duhet të zgjedhni së paku {{ limit }} alternativa. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Duhet të zgjedhni më së shumti {{ limit }} alternativë.|Duhet të zgjedhni më së shumti {{ limit }} alternativa. + + + One or more of the given values is invalid. + Një apo më shumë nga vlerat e dhëna janë të pavlefshme. + + + This field was not expected. + Kjo fushë nuk pritej. + + + This field is missing. + Kjo fushë mungon. + + + This value is not a valid date. + Kjo vlerë nuk është datë e vlefshme. + + + This value is not a valid datetime. + Kjo vlerë nuk është datë-kohë e vlefshme. + + + This value is not a valid email address. + Kjo vlerë nuk është adresë email-i e vlefshme. + + + The file could not be found. + File nuk mund të gjindej. + + + The file is not readable. + File nuk është i lexueshëm. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + File është shumë i madh ({{ size }} {{ suffix }}). Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Lloji mime i file-it është i pavlefshëm ({{ type }}). Llojet mime të lejuara janë {{ types }}. + + + This value should be {{ limit }} or less. + Kjo vlerë duhet të jetë {{ limit }} ose më pak. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karakter ose më pak.|Kjo vlerë është shumë e gjatë. Duhet të përmbaj {{ limit }} karaktere ose më pak. + + + This value should be {{ limit }} or more. + Kjo vlerë duhet të jetë {{ limit }} ose më shumë. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karakter ose më shumë.|Kjo vlerë është shumë e shkurtër. Duhet të përmbaj {{ limit }} karaktere ose më shumë. + + + This value should not be blank. + Kjo vlerë nuk duhet të jetë e zbrazët. + + + This value should not be null. + Kjo vlerë nuk duhet të jetë null. + + + This value should be null. + Kjo vlerë duhet të jetë null. + + + This value is not valid. + Kjo vlerë nuk është e vlefshme. + + + This value is not a valid time. + Kjo vlerë nuk është kohë e vlefshme. + + + This value is not a valid URL. + Kjo vlerë nuk është URL e vlefshme. + + + The two values should be equal. + Këto dy vlera duhet të jenë të barabarta. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ky file është shumë i madh. Madhësia maksimale e lejuar është {{ limit }} {{ suffix }}. + + + The file is too large. + Ky file është shumë i madh. + + + The file could not be uploaded. + Ky file nuk mund të ngarkohet. + + + This value should be a valid number. + Kjo vlerë duhet të jetë numër i vlefshëm. + + + This file is not a valid image. + Ky file nuk është imazh i vlefshëm. + + + This is not a valid IP address. + Kjo adresë IP nuk është e vlefshme. + + + This value is not a valid language. + Kjo vlerë nuk është gjuhë e vlefshme. + + + This value is not a valid locale. + Kjo vlerë nuk është nje locale i vlefshëm. + + + This value is not a valid country. + Kjo vlerë nuk është shtet i vlefshëm. + + + This value is already used. + Kjo vlerë është tashmë në përdorim. + + + The size of the image could not be detected. + Madhësia e imazhit nuk mund të zbulohet. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Gjerësia e imazhit është shumë e madhe ({{ width }}px). Gjerësia maksimale e lejuar është {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Gjerësia e imazhit është shumë e vogël ({{ width }}px). Gjerësia minimale e pritur është {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Gjatësia e imazhit është shumë e madhe ({{ height }}px). Gjatësia maksimale e lejuar është {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Gjatësia e imazhit është shumë e vogël ({{ height }}px). Gjatësia minimale e pritur është {{ min_height }}px. + + + This value should be the user's current password. + Kjo vlerë duhet të jetë fjalëkalimi aktual i përdoruesit. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Kjo vlerë duhet të ketë saktësisht {{ limit }} karakter.|Kjo vlerë duhet të ketë saktësisht {{ limit }} karaktere. + + + The file was only partially uploaded. + Ky file është ngarkuar pjesërisht. + + + No file was uploaded. + Nuk është ngarkuar ndonjë file. + + + No temporary folder was configured in php.ini. + Asnjë folder i përkohshëm nuk është konfiguruar në php.ini. + + + Cannot write temporary file to disk. + Nuk mund të shkruhet file i përkohshëm në disk. + + + A PHP extension caused the upload to fail. + Një ekstension i PHP-së shkaktoi dështimin e ngarkimit. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ky koleksion duhet të përmbajë {{ limit }} element ose më shumë.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më shumë. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ky koleksion duhet të përmbajë {{ limit }} element ose më pak.|Ky koleksion duhet të përmbajë {{ limit }} elemente ose më pak. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ky koleksion duhet të përmbajë saktësisht {{ limit }} element.|Ky koleksion duhet të përmbajë saktësisht {{ limit }} elemente. + + + Invalid card number. + Numër karte i pavlefshëm. + + + Unsupported card type or invalid card number. + Lloj karte i papranuar ose numër karte i pavlefshëm. + + + This is not a valid International Bank Account Number (IBAN). + Ky nuk është një numër i vlefshëm ndërkombëtar i llogarisë bankare (IBAN). + + + This value is not a valid ISBN-10. + Kjo vlerë nuk është një ISBN-10 e vlefshme. + + + This value is not a valid ISBN-13. + Kjo vlerë nuk është një ISBN-13 e vlefshme. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Kjo vlerë nuk është as ISBN-10 e vlefshme as ISBN-13 e vlefshme. + + + This value is not a valid ISSN. + Kjo vlerë nuk është një ISSN e vlefshme. + + + This value is not a valid currency. + Kjo vlerë nuk është një monedhë e vlefshme. + + + This value should be equal to {{ compared_value }}. + Kjo vlerë duhet të jetë e barabartë me {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Kjo vlerë duhet të jetë më e madhe se {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Kjo vlerë duhet të jetë më e madhe ose e barabartë me {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Kjo vlerë duhet të jetë identike me {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Kjo vlerë duhet të jetë më vogël se {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Kjo vlerë duhet të jetë më e vogël ose e barabartë me {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Kjo vlerë nuk duhet të jetë e barabartë me {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Kjo vlerë nuk duhet të jetë identike me {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Raporti i imazhit është shumë i madh ({{ ratio }}). Raporti maksimal i lejuar është {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Raporti i imazhit është shumë i vogël ({{ ratio }}). Raporti minimal pritet të jetë {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Imazhi është katror ({{ width }}x{{ height }}px). Imazhet katrore nuk janë të lejuara. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Imazhi është i orientuar horizontalisht ({{ width }}x{{ height }}px). Imazhet e orientuara horizontalisht nuk lejohen. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Imazhi është i orientuar vertikalisht ({{ width }}x{{ height }}px). Imazhet orientuara vertikalisht nuk lejohen. + + + An empty file is not allowed. + Një file i zbrazët nuk lejohet. + + + The host could not be resolved. + Host-i nuk mund te zbulohej. + + + This value does not match the expected {{ charset }} charset. + Kjo vlerë nuk përputhet me kodifikimin e karaktereve {{ charset }} që pritej. + + + This is not a valid Business Identifier Code (BIC). + Ky nuk është një Kod Identifikues i Biznesit (BIC) i vleflshem. + + + Error + Gabim + + + This is not a valid UUID. + Ky nuk është një UUID i vlefshëm. + + + This value should be a multiple of {{ compared_value }}. + Kjo vlerë duhet të jetë një shumëfish i {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ky Kod Identifikues i Biznesit (BIC) nuk është i lidhur me IBAN {{ iban }}. + + + This value should be valid JSON. + Kjo vlerë duhet të jetë JSON i vlefshëm. + + + This collection should contain only unique elements. + Ky koleksion duhet të përmbajë vetëm elementë unikë. + + + This value should be positive. + Kjo vlerë duhet të jetë pozitive. + + + This value should be either positive or zero. + Kjo vlerë duhet të jetë pozitive ose zero. + + + This value should be negative. + Kjo vlerë duhet të jetë negative. + + + This value should be either negative or zero. + Kjo vlerë duhet të jetë negative ose zero. + + + This value is not a valid timezone. + Kjo vlerë nuk është një zonë e vlefshme kohore. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ky fjalëkalim është zbuluar në një shkelje të të dhënave, nuk duhet të përdoret. Ju lutemi përdorni një fjalëkalim tjetër. + + + This value should be between {{ min }} and {{ max }}. + Kjo vlerë duhet të jetë ndërmjet {{ min }} dhe {{ max }}. + + + This value is not a valid hostname. + Kjo vlerë nuk është një emër i vlefshëm hosti. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Numri i elementeve në këtë koleksion duhet të jetë një shumëfish i {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Kjo vlerë duhet të plotësojë të paktën njërën nga kufizimet e mëposhtme: + + + Each element of this collection should satisfy its own set of constraints. + Secili element i këtij koleksioni duhet të përmbushë kufizimet e veta. + + + This value is not a valid International Securities Identification Number (ISIN). + Kjo vlerë nuk është një numër i vlefshëm identifikues ndërkombëtar i sigurisë (ISIN). + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf b/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf new file mode 100644 index 0000000..03ef713 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sr_Cyrl.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Вредност треба да буде нетачна. + + + This value should be true. + Вредност треба да буде тачна. + + + This value should be of type {{ type }}. + Вредност треба да буде типа {{ type }}. + + + This value should be blank. + Вредност треба да буде празна. + + + The value you selected is not a valid choice. + Вредност треба да буде једна од понуђених. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Изаберите бар {{ limit }} могућност.|Изаберите бар {{ limit }} могућности.|Изаберите бар {{ limit }} могућности. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Изаберите највише {{ limit }} могућност.|Изаберите највише {{ limit }} могућности.|Изаберите највише {{ limit }} могућности. + + + One or more of the given values is invalid. + Једна или више вредности је невалидна. + + + This field was not expected. + Ово поље није било очекивано. + + + This field is missing. + Ово поље недостаје. + + + This value is not a valid date. + Вредност није валидан датум. + + + This value is not a valid datetime. + Вредност није валидан датум-време. + + + This value is not a valid email address. + Вредност није валидна адреса електронске поште. + + + The file could not be found. + Датотека не може бити пронађена. + + + The file is not readable. + Датотека није читљива. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Датотека је превелика ({{ size }} {{ suffix }}). Највећа дозвољена величина је {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Миме тип датотеке није валидан ({{ type }}). Дозвољени миме типови су {{ types }}. + + + This value should be {{ limit }} or less. + Вредност треба да буде {{ limit }} или мање. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Вредност је предугачка. Треба да има {{ limit }} карактер или мање.|Вредност је предугачка. Треба да има {{ limit }} карактера или мање.|Вредност је предугачка. Треба да има {{ limit }} карактера или мање. + + + This value should be {{ limit }} or more. + Вредност треба да буде {{ limit }} или више. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Вредност је прекратка. Треба да има {{ limit }} карактер или више.|Вредност је прекратка. Треба да има {{ limit }} карактера или више.|Вредност је прекратка. Треба да има {{ limit }} карактера или више. + + + This value should not be blank. + Вредност не треба да буде празна. + + + This value should not be null. + Вредност не треба да буде null. + + + This value should be null. + Вредност треба да буде null. + + + This value is not valid. + Вредност није валидна. + + + This value is not a valid time. + Вредност није валидно време. + + + This value is not a valid URL. + Вредност није валидан URL. + + + The two values should be equal. + Обе вредности треба да буду једнаке. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Датотека је превелика. Највећа дозвољена величина је {{ limit }} {{ suffix }}. + + + The file is too large. + Датотека је превелика. + + + The file could not be uploaded. + Датотека не може бити отпремљена. + + + This value should be a valid number. + Вредност треба да буде валидан број. + + + This file is not a valid image. + Ова датотека није валидна слика. + + + This is not a valid IP address. + Ово није валидна ИП адреса. + + + This value is not a valid language. + Вредност није валидан језик. + + + This value is not a valid locale. + Вредност није валидан локал. + + + This value is not a valid country. + Вредност није валидна земља. + + + This value is already used. + Вредност је већ искоришћена. + + + The size of the image could not be detected. + Величина слике не може бити одређена. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина слике је превелика ({{ width }}px). Најећа дозвољена ширина је {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина слике је премала ({{ width }}px). Најмања дозвољена ширина је {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Висина слике је превелика ({{ height }}px). Најећа дозвољена висина је {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Висина слике је премала ({{ height }}px). Најмања дозвољена висина је {{ min_height }}px. + + + This value should be the user's current password. + Вредност треба да буде тренутна корисничка лозинка. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Вредност треба да има тачно {{ limit }} карактер.|Вредност треба да има тачно {{ limit }} карактера.|Вредност треба да има тачно {{ limit }} карактера. + + + The file was only partially uploaded. + Датотека је само парцијално отпремљена. + + + No file was uploaded. + Датотека није отпремљена. + + + No temporary folder was configured in php.ini. + Привремени директоријум није конфигурисан у php.ini. + + + Cannot write temporary file to disk. + Немогуће писање привремене датотеке на диск. + + + A PHP extension caused the upload to fail. + PHP екстензија је проузроковала неуспех отпремања датотеке. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ова колекција треба да садржи {{ limit }} или више елемената.|Ова колекција треба да садржи {{ limit }} или више елемената.|Ова колекција треба да садржи {{ limit }} или више елемената. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ова колекција треба да садржи {{ limit }} или мање елемената.|Ова колекција треба да садржи {{ limit }} или мање елемената.|Ова колекција треба да садржи {{ limit }} или мање елемената. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ова колекција треба да садржи тачно {{ limit }} елемент.|Ова колекција треба да садржи тачно {{ limit }} елемента.|Ова колекција треба да садржи тачно {{ limit }} елемената. + + + Invalid card number. + Невалидан број картице. + + + Unsupported card type or invalid card number. + Невалидан број картице или тип картице није подржан. + + + This is not a valid International Bank Account Number (IBAN). + Ово није валидан међународни број банковног рачуна (IBAN). + + + This value is not a valid ISBN-10. + Ово није валидан ISBN-10. + + + This value is not a valid ISBN-13. + Ово није валидан ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ово није валидан ISBN-10 или ISBN-13. + + + This value is not a valid ISSN. + Ово није валидан ISSN. + + + This value is not a valid currency. + Ово није валидна валута. + + + This value should be equal to {{ compared_value }}. + Ова вредност треба да буде {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ова вредност треба да буде већа од {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ова вредност треба да буде већа или једнака {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ова вредност треба да буде идентична са {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ова вредност треба да буде мања од {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ова вредност треба да буде мања или једнака {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ова вредност не треба да буде једнака {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ова вредност не треба да буде идентична са {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Размера ове слике је превелика ({{ ratio }}). Максимална дозвољена размера је {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Размера ове слике је премала ({{ ratio }}). Минимална очекивана размера је {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Слика је квадратна ({{ width }}x{{ height }}px). Квадратне слике нису дозвољене. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Слика је оријентације пејзажа ({{ width }}x{{ height }}px). Пејзажна оријентација слика није дозвољена. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Слика је оријантације портрета ({{ width }}x{{ height }}px). Портретна оријентација слика није дозвољена. + + + An empty file is not allowed. + Празна датотека није дозвољена. + + + The host could not be resolved. + Име хоста не може бити разрешено. + + + This value does not match the expected {{ charset }} charset. + Вредност се не поклапа са очекиваним {{ charset }} сетом карактера. + + + This is not a valid Business Identifier Code (BIC). + Ово није валидан међународни идентификацијски код банке (BIC). + + + Error + Грешка + + + This is not a valid UUID. + Ово није валидан универзални уникатни идентификатор (UUID). + + + This value should be a multiple of {{ compared_value }}. + Ова вредност би требало да буде дељива са {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + BIC код није повезан са IBAN {{ iban }}. + + + This value should be valid JSON. + Ова вредност би требало да буде валидан JSON. + + + This collection should contain only unique elements. + Ова колекција би требала да садржи само јединствене елементе. + + + This value should be positive. + Ова вредност би требала бити позитивна. + + + This value should be either positive or zero. + Ова вредност би требала бити позитивна или нула. + + + This value should be negative. + Ова вредност би требала бити негативна. + + + This value should be either negative or zero. + Ова вредност би требала бити позитивна или нула. + + + This value is not a valid timezone. + Ова вредност није валидна временска зона. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ова лозинка је компромитована приликом претходних напада, немојте је користити. Користите другу лозинку. + + + This value should be between {{ min }} and {{ max }}. + Ова вредност треба да буде између {{ min }} и {{ max }}. + + + This value is not a valid hostname. + Ова вредност није исправно име хоста. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Број елемената у овој колекцији би требало да буде дељив са {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ова вредност би требало да задовољава најмање једно од наредних ограничења: + + + Each element of this collection should satisfy its own set of constraints. + Сваки елемент ове колекције би требало да задовољи сопствени скуп ограничења. + + + This value is not a valid International Securities Identification Number (ISIN). + Ова вредност није исправна међународна идентификациона ознака хартија од вредности (ISIN). + + + This value should be a valid expression. + Ова вредност треба да буде валидан израз. + + + This value is not a valid CSS color. + Ова вредност није исправна CSS боја. + + + This value is not a valid CIDR notation. + Ова вредност није исправна CIDR нотација. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Вредност мрежне маске треба бити између {{ min }} и {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf new file mode 100644 index 0000000..86453ad --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sr_Latn.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Vrednost bi trebalo da bude netačna. + + + This value should be true. + Vrednost bi trebalo da bude tačna. + + + This value should be of type {{ type }}. + Vrednost bi trebalo da bude tipa {{ type }}. + + + This value should be blank. + Vrednost bi trebalo da bude prazna. + + + The value you selected is not a valid choice. + Odabrana vrednost nije validan izbor. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Morate odabrati bar {{ limit }} mogućnost.|Morate odabrati bar {{ limit }} mogućnosti.|Morate odabrati bar {{ limit }} mogućnosti. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Morate odabrati najviše {{ limit }} mogućnost.|Morate odabrati najviše {{ limit }} mogućnosti.|Morate odabrati najviše {{ limit }} mogućnosti. + + + One or more of the given values is invalid. + Jedna ili više vrednosti nisu validne. + + + This field was not expected. + Ovo polje nije bilo očekivano. + + + This field is missing. + Ovo polje nedostaje. + + + This value is not a valid date. + Vrednost nije validan datum. + + + This value is not a valid datetime. + Vrednost nije validno vreme. + + + This value is not a valid email address. + Vrednost nije validna adresa elektronske pošte. + + + The file could not be found. + Datoteka ne može biti pronađena. + + + The file is not readable. + Datoteka nije čitljiva. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika ({{ size }} {{ suffix }}). Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME tip datoteke nije validan ({{ type }}). Dozvoljeni MIME tipovi su {{ types }}. + + + This value should be {{ limit }} or less. + Vrednost bi trebalo da bude {{ limit }} ili manje. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Vrednost je predugačka. Trebalo bi da ima {{ limit }} karakter ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje.|Vrednost je predugačka. Trebalo bi da ima {{ limit }} karaktera ili manje. + + + This value should be {{ limit }} or more. + Vrednost bi trebalo da bude {{ limit }} ili više. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Vrednost je prekratka. Trebalo bi da ima {{ limit }} karakter ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više.|Vrednost je prekratka. Trebalo bi da ima {{ limit }} karaktera ili više. + + + This value should not be blank. + Vrednost ne bi trebalo da bude prazna. + + + This value should not be null. + Vrednost ne bi trebalo da bude prazna. + + + This value should be null. + Vrednost bi trebalo da bude prazna. + + + This value is not valid. + Vrednost nije validna. + + + This value is not a valid time. + Vrednost nije validno vreme. + + + This value is not a valid URL. + Vrednost nije validan URL. + + + The two values should be equal. + Obe vrednosti bi trebalo da budu jednake. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Datoteka je prevelika. Najveća dozvoljena veličina je {{ limit }} {{ suffix }}. + + + The file is too large. + Datoteka je prevelika. + + + The file could not be uploaded. + Datoteka ne može biti otpremljena. + + + This value should be a valid number. + Vrednost bi trebalo da bude validan broj. + + + This file is not a valid image. + Ova datoteka nije validna slika. + + + This is not a valid IP address. + Ovo nije validna IP adresa. + + + This value is not a valid language. + Vrednost nije validan jezik. + + + This value is not a valid locale. + Vrednost nije validna međunarodna oznaka jezika. + + + This value is not a valid country. + Vrednost nije validna država. + + + This value is already used. + Vrednost je već iskorišćena. + + + The size of the image could not be detected. + Veličina slike ne može biti određena. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Širina slike je prevelika ({{ width }} piksela). Najveća dozvoljena širina je {{ max_width }} piksela. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Širina slike je premala ({{ width }} piksela). Najmanja dozvoljena širina je {{ min_width }} piksela. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Visina slike je prevelika ({{ height }} piksela). Najveća dozvoljena visina je {{ max_height }} piksela. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Visina slike je premala ({{ height }} piksela). Najmanja dozvoljena visina je {{ min_height }} piksela. + + + This value should be the user's current password. + Vrednost bi trebalo da bude trenutna korisnička lozinka. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Vrednost bi trebalo da ima tačno {{ limit }} karakter.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera.|Vrednost bi trebalo da ima tačno {{ limit }} karaktera. + + + The file was only partially uploaded. + Datoteka je samo parcijalno otpremljena. + + + No file was uploaded. + Datoteka nije otpremljena. + + + No temporary folder was configured in php.ini. + Privremeni direktorijum nije konfigurisan u php.ini. + + + Cannot write temporary file to disk. + Nemoguće pisanje privremene datoteke na disk. + + + A PHP extension caused the upload to fail. + PHP ekstenzija je prouzrokovala neuspeh otpremanja datoteke. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili više elemenata. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija bi trebalo da sadrži {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ova kolekcija bi trebalo da sadrži tačno {{ limit }} element.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elementa.|Ova kolekcija bi trebalo da sadrži tačno {{ limit }} elemenata. + + + Invalid card number. + Broj kartice nije validan. + + + Unsupported card type or invalid card number. + Tip kartice nije podržan ili broj kartice nije validan. + + + This is not a valid International Bank Account Number (IBAN). + Ovo nije validan međunarodni broj bankovnog računa (IBAN). + + + This value is not a valid ISBN-10. + Ovo nije validan ISBN-10. + + + This value is not a valid ISBN-13. + Ovo nije validan ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ovo nije validan ISBN-10 ili ISBN-13. + + + This value is not a valid ISSN. + Ovo nije validan ISSN. + + + This value is not a valid currency. + Ovo nije validna valuta. + + + This value should be equal to {{ compared_value }}. + Ova vrednost bi trebalo da bude jednaka {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ova vrednost bi trebalo da bude veća od {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ova vrednost bi trebalo da bude veća ili jednaka {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrednost bi trebalo da bude identična sa {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ova vrednost bi trebalo da bude manja od {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ova vrednost bi trebalo da bude manja ili jednaka {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ova vrednost ne bi trebalo da bude jednaka {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ova vrednost ne bi trebalo da bude identična sa {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Razmera ove slike je prevelika ({{ ratio }}). Maksimalna dozvoljena razmera je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Razmera ove slike je premala ({{ ratio }}). Minimalna očekivana razmera je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratna ({{ width }}x{{ height }} piksela). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je pejzažno orijentisana ({{ width }}x{{ height }} piksela). Pejzažna orijentisane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je portretno orijentisana ({{ width }}x{{ height }} piksela). Portretno orijentisane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Ime hosta ne može biti razrešeno. + + + This value does not match the expected {{ charset }} charset. + Vrednost se ne poklapa sa očekivanim {{ charset }} setom karaktera. + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan BIC. + + + Error + Greška + + + This is not a valid UUID. + Ovo nije validan univerzalni unikatni identifikator (UUID). + + + This value should be a multiple of {{ compared_value }}. + Ova vrednost bi trebalo da bude deljiva sa {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + BIC kod nije povezan sa IBAN {{ iban }}. + + + This value should be valid JSON. + Ova vrednost bi trebalo da bude validan JSON. + + + This collection should contain only unique elements. + Ova kolekcija bi trebala da sadrži samo jedinstvene elemente. + + + This value should be positive. + Ova vrednost bi trebala biti pozitivna. + + + This value should be either positive or zero. + Ova vrednost bi trebala biti pozitivna ili nula. + + + This value should be negative. + Ova vrednost bi trebala biti negativna. + + + This value should be either negative or zero. + Ova vrednost bi trebala biti negativna ili nula. + + + This value is not a valid timezone. + Ova vrednost nije validna vremenska zona. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ova lozinka je kompromitovana prilikom prethodnih napada, nemojte je koristiti. Koristite drugu lozinku. + + + This value should be between {{ min }} and {{ max }}. + Ova vrednost treba da bude između {{ min }} i {{ max }}. + + + This value is not a valid hostname. + Ova vrednost nije ispravno ime poslužitelja (hostname). + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Broj elemenata u ovoj kolekciji bi trebalo da bude deljiv sa {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ova vrednost bi trebalo da zadovoljava namjanje jedno od narednih ograničenja: + + + Each element of this collection should satisfy its own set of constraints. + Svaki element ove kolekcije bi trebalo da zadovolji sopstveni skup ograničenja. + + + This value is not a valid International Securities Identification Number (ISIN). + Ova vrednost nije ispravna međunarodna identifikaciona oznaka hartija od vrednosti (ISIN). + + + This value should be a valid expression. + Ova vrednost treba da bude validan izraz. + + + This value is not a valid CSS color. + Ova vrednost nije ispravna CSS boja. + + + This value is not a valid CIDR notation. + Ova vrednost nije ispravna CIDR notacija. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Vrednost mrežne maske treba biti između {{ min }} i {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.sv.xlf b/vendor/symfony/validator/Resources/translations/validators.sv.xlf new file mode 100644 index 0000000..fca7bdc --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.sv.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Värdet ska vara falskt. + + + This value should be true. + Värdet ska vara sant. + + + This value should be of type {{ type }}. + Värdet ska vara av typen {{ type }}. + + + This value should be blank. + Värdet ska vara tomt. + + + The value you selected is not a valid choice. + Värdet ska vara ett av de givna valen. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du måste välja minst {{ limit }} val.|Du måste välja minst {{ limit }} val. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan som mest välja {{ limit }} val.|Du kan som mest välja {{ limit }} val. + + + One or more of the given values is invalid. + Ett eller fler av de angivna värdena är ogiltigt. + + + This field was not expected. + Det här fältet förväntades inte. + + + This field is missing. + Det här fältet saknas. + + + This value is not a valid date. + Värdet är inte ett giltigt datum. + + + This value is not a valid datetime. + Värdet är inte ett giltigt datum med tid. + + + This value is not a valid email address. + Värdet är inte en giltig e-postadress. + + + The file could not be found. + Filen kunde inte hittas. + + + The file is not readable. + Filen är inte läsbar. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Filen är för stor ({{ size }} {{ suffix }}). Största tillåtna storlek är {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Filens MIME-typ ({{ type }}) är ogiltig. De tillåtna typerna är {{ types }}. + + + This value should be {{ limit }} or less. + Värdet ska vara {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Värdet är för långt. Det ska ha {{ limit }} tecken eller färre.|Värdet är för långt. Det ska ha {{ limit }} tecken eller färre. + + + This value should be {{ limit }} or more. + Värdet ska vara {{ limit }} eller mer. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Värdet är för kort. Det ska ha {{ limit }} tecken eller mer.|Värdet är för kort. Det ska ha {{ limit }} tecken eller mer. + + + This value should not be blank. + Värdet kan inte vara tomt. + + + This value should not be null. + Värdet kan inte vara null. + + + This value should be null. + Värdet ska vara null. + + + This value is not valid. + Värdet är inte giltigt. + + + This value is not a valid time. + Värdet är inte en giltig tid. + + + This value is not a valid URL. + Värdet är inte en giltig URL. + + + The two values should be equal. + De två värdena måste vara lika. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Filen är för stor. Tillåten maximal storlek är {{ limit }} {{ suffix }}. + + + The file is too large. + Filen är för stor. + + + The file could not be uploaded. + Filen kunde inte laddas upp. + + + This value should be a valid number. + Värdet ska vara ett giltigt nummer. + + + This file is not a valid image. + Filen är ingen giltig bild. + + + This is not a valid IP address. + Det här är inte en giltig IP-adress. + + + This value is not a valid language. + Värdet är inte ett giltigt språk. + + + This value is not a valid locale. + Värdet är inte en giltig plats. + + + This value is not a valid country. + Värdet är inte ett giltigt land. + + + This value is already used. + Värdet används redan. + + + The size of the image could not be detected. + Det gick inte att fastställa storleken på bilden. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Bildens bredd är för stor ({{ width }}px). Tillåten maximal bredd är {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Bildens bredd är för liten ({{ width }}px). Minsta förväntade bredd är {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bildens höjd är för stor ({{ height }}px). Tillåten maximal bredd är {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Bildens höjd är för liten ({{ height }}px). Minsta förväntade höjd är {{ min_height }}px. + + + This value should be the user's current password. + Värdet ska vara användarens nuvarande lösenord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Värdet ska ha exakt {{ limit }} tecken.|Värdet ska ha exakt {{ limit }} tecken. + + + The file was only partially uploaded. + Filen laddades bara upp delvis. + + + No file was uploaded. + Ingen fil laddades upp. + + + No temporary folder was configured in php.ini. + Det finns ingen temporär mapp konfigurerad i php.ini. + + + Cannot write temporary file to disk. + Kan inte skriva temporär fil till disken. + + + A PHP extension caused the upload to fail. + En PHP extension gjorde att uppladdningen misslyckades. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Den här samlingen ska innehålla {{ limit }} element eller mer.|Den här samlingen ska innehålla {{ limit }} element eller mer. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Den här samlingen ska innehålla {{ limit }} element eller mindre.|Den här samlingen ska innehålla {{ limit }} element eller mindre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Den här samlingen ska innehålla exakt {{ limit }} element.|Den här samlingen ska innehålla exakt {{ limit }} element. + + + Invalid card number. + Ogiltigt kortnummer. + + + Unsupported card type or invalid card number. + Okänd korttyp eller ogiltigt kortnummer. + + + This is not a valid International Bank Account Number (IBAN). + Det här är inte en giltig International Bank Account Number (IBANK). + + + This value is not a valid ISBN-10. + Värdet är inte en giltig ISBN-10. + + + This value is not a valid ISBN-13. + Värdet är inte en giltig ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Värdet är varken en giltig ISBN-10 eller en giltig ISBN-13. + + + This value is not a valid ISSN. + Värdet är inte en giltig ISSN. + + + This value is not a valid currency. + Värdet är inte en giltig valuta. + + + This value should be equal to {{ compared_value }}. + Värdet ska vara detsamma som {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Värdet ska vara större än {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Värdet ska bara större än eller detsamma som {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Värdet ska vara identiskt till {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Värdet ska vara mindre än {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Värdet ska vara mindre än eller detsamma som {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Värdet ska inte vara detsamma som {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Värdet ska inte vara identiskt med {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Förhållandet mellan bildens bredd och höjd är för stort ({{ ratio }}). Högsta tillåtna förhållande är {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Förhållandet mellan bildens bredd och höjd är för litet ({{ ratio }}). Minsta tillåtna förhållande är {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bilden är kvadratisk ({{ width }}x{{ height }}px). Kvadratiska bilder tillåts inte. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bilden är landskapsorienterad ({{ width }}x{{ height }}px). Landskapsorienterade bilder tillåts inte. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bilden är porträttsorienterad ({{ width }}x{{ height }}px). Porträttsorienterade bilder tillåts inte. + + + An empty file is not allowed. + En tom fil är inte tillåten. + + + The host could not be resolved. + Värddatorn kunde inte hittas. + + + This value does not match the expected {{ charset }} charset. + Detta värde har inte den förväntade teckenkodningen {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Detta är inte en giltig BIC-kod. + + + Error + Fel + + + This is not a valid UUID. + Detta är inte ett giltigt UUID. + + + This value should be a multiple of {{ compared_value }}. + Detta värde ska vara en multipel av {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Denna BIC-koden är inte associerad med IBAN {{ iban }}. + + + This value should be valid JSON. + Detta värde ska vara giltig JSON. + + + This collection should contain only unique elements. + Denna samling bör endast innehålla unika element. + + + This value should be positive. + Detta värde bör vara positivt. + + + This value should be either positive or zero. + Detta värde bör vara antingen positivt eller noll. + + + This value should be negative. + Detta värde bör vara negativt. + + + This value should be either negative or zero. + Detta värde bör vara antingen negativt eller noll. + + + This value is not a valid timezone. + Detta värde är inte en giltig tidszon. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Det här lösenordet har läckt ut vid ett dataintrång, det får inte användas. Använd ett annat lösenord. + + + This value should be between {{ min }} and {{ max }}. + Detta värde bör ligga mellan {{ min }} och {{ max }}. + + + This value is not a valid hostname. + Värdet är inte ett giltigt servernamn. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Antalet element i samlingen ska vara en multipel av {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Det här värdet skall uppfylla minst ett av följande krav: + + + Each element of this collection should satisfy its own set of constraints. + Varje element i samlingen skall uppfylla sin egen uppsättning av krav. + + + This value is not a valid International Securities Identification Number (ISIN). + Det här värdet är inte ett giltigt "International Securities Identification Number" (ISIN). + + + This value should be a valid expression. + Det här värdet bör vara ett giltigt uttryck. + + + This value is not a valid CSS color. + Det här värdet är inte en giltig CSS-färg. + + + This value is not a valid CIDR notation. + Det här värdet är inte en giltig CIDR-notation. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Värdet på nätmasken bör vara mellan {{ min }} och {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.th.xlf b/vendor/symfony/validator/Resources/translations/validators.th.xlf new file mode 100644 index 0000000..26affc5 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.th.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + ค่านี้ควรเป็น false + + + This value should be true. + ค่านี้ควรเป็น true + + + This value should be of type {{ type }}. + ค่านี้ควรเป็น {{ type }} + + + This value should be blank. + ควรเป็นค่าว่าง + + + The value you selected is not a valid choice. + คุณเลือกค่าที่ไม่ตรงกับตัวเลือก + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + คุณต้องเลือกอย่างน้อย {{ limit }} ตัวเลือก + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + คุณเลือกได้มากที่สุด {{ limit }} ตัวเลือก + + + One or more of the given values is invalid. + มีบางค่าที่ส่งมาไม่ถูกต้อง + + + This field was not expected. + ไม่ควรมีฟิลด์นี้ + + + This field is missing. + ฟิลด์นี้หายไป + + + This value is not a valid date. + ค่าของวันที่ไม่ถูกต้อง + + + This value is not a valid datetime. + ค่าของวันที่และเวลาไม่ถูกต้อง + + + This value is not a valid email address. + ค่าของอีเมล์ไม่ถูกต้อง + + + The file could not be found. + ไม่พบไฟล์ + + + The file is not readable. + ไฟล์ไม่อยู่ในสถานะที่สามารถอ่านได้ + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + ไฟล์ใหญ่เกิน ({{ size }} {{ suffix }}) อนุญาตให้ใหญ่ที่สุดได้ไม่เกิน {{ limit }} {{ suffix }} + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime type ของไฟล์ไม่ถูกต้อง ({{ type }}) Mime types ที่อนุญาตคือ {{ types }} + + + This value should be {{ limit }} or less. + ค่านี้ควรจะเป็น {{ limit }} หรือน้อยกว่านั้น + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + ค่านี้ยาวเกินไป ควรจะมีแค่ {{ limit }} ตัวอักษรหรือน้อยกว่านั้น + + + This value should be {{ limit }} or more. + ค่านี้ควรจะมี {{ limit }} หรือมากกว่านั้น + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + ค่านี้สั้นเกินไป ควรจะมี {{ limit }} ตัวอักษรหรือมากกว่านั้น + + + This value should not be blank. + ค่านี้ไม่ควรเป็นค่าว่าง + + + This value should not be null. + ค่านี้ไม่ควรเป็นค่า null + + + This value should be null. + ค่านี้ควรเป็นค่า null + + + This value is not valid. + ค่านี้ไม่ถูกต้อง + + + This value is not a valid time. + ค่าของเวลาไม่ถูกต้อง + + + This value is not a valid URL. + ค่าของ URL ไม่ถูกต้อง + + + The two values should be equal. + ค่าทั้งสองค่าควรจะเหมือนกัน + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + ขนาดไฟล์ใหญ่เกินไป อนุญาตให้ไฟล์ขนาดใหญ่ได้ไม่เกิน {{ limit }} {{ suffix }} + + + The file is too large. + ขนาดไฟล์ใหญ่เกินไป + + + The file could not be uploaded. + ไม่สามารถอัปโหลดไฟล์ได้ + + + This value should be a valid number. + ค่าของตัวเลขไม่ถูกต้อง + + + This file is not a valid image. + ไฟล์นี้ไม่ใช่ไฟล์รูปภาพ + + + This is not a valid IP address. + ค่าของ IP ไม่ถูกต้อง + + + This value is not a valid language. + ค่าของภาษาไม่ถูกต้อง + + + This value is not a valid locale. + ค่าของภูมิภาค (Locale) ไม่ถูกต้อง + + + This value is not a valid country. + ค่าของประเทศไม่ถูกต้อง + + + This value is already used. + ค่านี้ถูกใช้งานไปแล้ว + + + The size of the image could not be detected. + ไม่สามารถตรวจสอบขนาดไฟล์ของภาพได้ + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + ความกว้างของภาพเกินขนาด ({{ width }}px) อนุญาตให้กว้างได้มากที่สุด {{ max_width }}px + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + ความกว้างของภาพต่ำเกินไป ({{ width }}px) อนุญาตให้ความกว้างไม่ต่ำกว่า {{ min_width }}px + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + ความสูงของภาพเกินขนาด ({{ height }}px) อนุญาตให้สูงได้มากที่สุด {{ max_height }}px + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + ความสูงของภาพเล็กเกินไป ({{ height }}px) อนุญาตให้ความสูงไม่ควรต่ำกว่า {{ min_height }}px + + + This value should be the user's current password. + ค่านี้ควรจะเป็นรหัสผ่านปัจจุบันของผู้ใช้ + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + ค่านี้ควรจะมีความยาว {{ limit }} ตัวอักษร + + + The file was only partially uploaded. + อัปโหลดไฟล์ได้เพียงบางส่วนเท่านั้น + + + No file was uploaded. + ไม่มีไฟล์ใดถูกอัปโหลด + + + No temporary folder was configured in php.ini. + ไม่พบการตั้งค่าโฟลเดอร์ชั่วคราว (temporary folder) ใน php.ini + + + Cannot write temporary file to disk. + ไม่สามารถเขียนไฟล์ชั่วคราว (temporary file) ลงดิสก์ได้ + + + A PHP extension caused the upload to fail. + PHP extension ทำให้การอัปโหลดมีปัญหา + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + คอเล็กชั่นนี้ควรจะประกอบไปด้วยอย่างน้อย {{ limit }} สมาชิก + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + คอเล็กชั่นนี้ไม่ควรมีสมาชิกเกิน {{ limit }} + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + คอเล็กชั่นนี้ควรจะมี {{ limit }} สมาชิกเท่านั้น + + + Invalid card number. + หมายเลขบัตรไม่ถูกต้อง + + + Unsupported card type or invalid card number. + ไม่รู้จักประเภทของบัตร หรือหมายเลขบัตรไม่ถูกต้อง + + + This is not a valid International Bank Account Number (IBAN). + ค่านี้ไม่ใช่ International Bank Account Number (IBAN) ที่ถูกต้อง + + + This value is not a valid ISBN-10. + ค่านี้ไม่ใช่ ISBN-10 ที่ถูกต้อง + + + This value is not a valid ISBN-13. + ค่านี้ไม่ใช่ ISBN-13 ที่ถูกต้อง + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + ค่านี้ไม่ใช่ ISBN-10 หรือ ISBN-13 ที่ถูกต้อง + + + This value is not a valid ISSN. + ค่านี้ไม่ใช่ ISSN ที่ถูกต้อง + + + This value is not a valid currency. + ค่านี้ไม่ใช่สกุลเงินที่ถูกต้อง + + + This value should be equal to {{ compared_value }}. + ค่านี้ควรตรงกับ {{ compared_value }} + + + This value should be greater than {{ compared_value }}. + ค่านี้ควรจะมากกว่า {{ compared_value }} + + + This value should be greater than or equal to {{ compared_value }}. + ค่านี้ควรจะมากกว่าหรือตรงกับ {{ compared_value }} + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + ค่านี้ควรจะเหมือนกันกับ {{ compared_value_type }} {{ compared_value }} + + + This value should be less than {{ compared_value }}. + ค่านี้ควรจะน้อยกว่า {{ compared_value }} + + + This value should be less than or equal to {{ compared_value }}. + ค่านี้ควรจะน้อยกว่าหรือเท่ากับ {{ compared_value }} + + + This value should not be equal to {{ compared_value }}. + ค่านี้ไม่ควรเท่ากันกับ {{ compared_value }} + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + ค่านี้ไม่ควรเหมือนกันกับ {{ compared_value_type }} {{ compared_value }} + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + สัดส่วนของภาพใหญ่เกิน ({{ ratio }}) สัดส่วนใหญ่ที่สุดที่ใช้ได้คือ {{ max_ratio }} + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + สัดส่วนของภาพเล็กเกิน ({{ ratio }}) สัดส่วนเล็กที่สุดที่ใช้ได้คือ {{ min_ratio }} + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + รูปภาพเป็นจุตรัส ({{ width }}x{{ height }}px) ไม่อนุญาตภาพที่เป็นสี่เหลี่ยมจตุรัส + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + ภาพนี้เป็นแนวนอน ({{ width }}x{{ height }}px) ไม่อนุญาตภาพที่เป็นแนวนอน + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + ภาพนี้เป็นแนวตั้ง ({{ width }}x{{ height }}px) ไม่อนุญาตภาพที่เป็นแนวตั้ง + + + An empty file is not allowed. + ไม่อนุญาตให้ใช้ไฟล์ว่าง + + + The host could not be resolved. + ไม่สามารถแก้ไขชื่อโฮสต์ + + + This value does not match the expected {{ charset }} charset. + ค่านี้ไม่ตรงกับการเข้ารหัส {{ charset }} + + + This is not a valid Business Identifier Code (BIC). + นี่ไม่ถูกต้องตามรหัสสำหรับระบุธุรกิจนี้ (BIC) + + + Error + เกิดข้อผิดพลาด + + + This is not a valid UUID. + นี่ไม่ใช่ UUID ที่ถูกต้อง + + + This value should be a multiple of {{ compared_value }}. + ค่านี้ควรเป็น {{ compared_value }} หลายตัว + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + รหัสสำหรับระบุธุรกิจนี้ (BIC) ไม่เกี่ยวข้องกับ IBAN {{ iban }} + + + This value should be valid JSON. + ค่านี้ควรอยู่ในรูปแบบ JSON ที่ถูกต้อง + + + This collection should contain only unique elements. + คอเล็กชั่นนี้ควรมีเฉพาะสมาชิกที่ไม่ซ้ำกันเท่านั้น + + + This value should be positive. + ค่านี้ควรเป็นค่าบวก + + + This value should be either positive or zero. + ค่านี้ควรเป็นค่าบวกหรือค่าศูนย์ + + + This value should be negative. + ค่านี้ควรเป็นค่าลบ + + + This value should be either negative or zero. + ค่านี้ควรเป็นค่าลบหรือค่าศูนย์ + + + This value is not a valid timezone. + ค่าเขตเวลาไม่ถูกต้อง + + + This password has been leaked in a data breach, it must not be used. Please use another password. + รหัสผ่านนี้ได้เคยรั่วไหลออกไปโดยถูกการละเมิดข้อมูล ซึ่งไม่ควรนำกลับมาใช้ กรุณาใช้รหัสผ่านอื่น + + + This value should be between {{ min }} and {{ max }}. + ค่านี้ควรอยู่ระหว่าง {{ min }} ถึง {{ max }} + + + This value is not a valid hostname. + ค่าโฮสต์เนมไม่ถูกต้อง + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + จำนวนของสมาชิกในคอเล็กชั่นควรเป็นพหุคูณของ {{ compared_value }} + + + This value should satisfy at least one of the following constraints: + ค่านี้ควรเป็นไปตามข้อจำกัดอย่างน้อยหนึ่งข้อจากข้อจำกัดเหล่านี้: + + + Each element of this collection should satisfy its own set of constraints. + สมาชิกแต่ละตัวในคอเล็กชั่นควรเป็นไปตามข้อจำกัดของคอเล็กชั่นนั้นๆ + + + This value is not a valid International Securities Identification Number (ISIN). + ค่ารหัสหลักทรัพย์สากล (ISIN) ไม่ถูกต้อง + + + This value should be a valid expression. + ค่านี้ควรเป็นนิพจน์ที่ถูกต้อง + + + This value is not a valid CSS color. + ค่านี้ไม่ใช่สี CSS ที่ถูกต้อง + + + This value is not a valid CIDR notation. + ค่านี้ไม่ใช่รูปแบบ CIDR ที่ถูกต้อง + + + The value of the netmask should be between {{ min }} and {{ max }}. + ค่าของ netmask ควรมีค่าระหว่าง {{ min }} ถึง {{ max }} + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.tl.xlf b/vendor/symfony/validator/Resources/translations/validators.tl.xlf new file mode 100644 index 0000000..74d5ed5 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.tl.xlf @@ -0,0 +1,399 @@ + + + + + + This value should be false. + Ang halaga nito ay dapat na huwad. + + + This value should be true. + Ang halaga nito ay dapat totoo. + + + This value should be of type {{ type }}. + Ang halaga nito ay dapat sa uri {{ type }}. + + + This value should be blank. + Ang halaga nito ay dapat walang laman. + + + The value you selected is not a valid choice. + Ang halaga ng iyong pinili ay hindi balidong pagpili. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Kailangan mong pumili ng pinakamababang {{ limit }} ng pagpilian.|Kailangan mong pumili ng pinakamababang {{ limit }} ng mga pagpipilian. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Kailangan mong pumili ng pinakamataas {{ limit }} ng pagpipilian.|Kailangan mong pumili ng pinakamataas {{ limit }} ng mga pagpipilian. + + + One or more of the given values is invalid. + Isa o higit pang mga halaga na binigay ay hindi balido. + + + This field was not expected. + Ang larangang ito ay hindi inaasahan. + + + This field is missing. + Ang patlang na ito ay nawawala. + + + This value is not a valid date. + Ang halagang ito ay hindi balidong petsa. + + + This value is not a valid datetime. + Ang halagang ito ay hindi wastong petsa/oras. + + + This value is not a valid email address. + Ang halagang ito ay hindi balidong address ng email. + + + The file could not be found. + Ang file na ito ay hindi makita. + + + The file is not readable. + Ang file na ito ay hindi mabasa. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Ang file na ito ay masyadong malaki ({{ size }} {{ suffix }}). Ang pinakamalaking sukat {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Ang uri ng file ng mime ay hindi balido ({{ type }}). Ang mga pinapayagang uri ng mime ay ang {{ types }}. + + + This value should be {{ limit }} or less. + Ang halaga nito ay dapat na {{ limit }} or maliit pa. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Ang halaga nito ay masyadong mahaba. Ito ay dapat na {{ limit }} karakter o maliit pa.|Ang halaga nito ay masyadong mahaba. Ito ay dapat na {{ limit }} mga karakter o maliit pa. + + + This value should be {{ limit }} or more. + Ang halaga nito ay dapat na {{ limit }} o mas marami pa. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Ang halaga nito ay masyadong maliit. Ito ay dapat na {{ limit }} karakter o marami pa.|Ang halaga nito ay masyadong maliit. Ito ay dapat na {{ limit }} mga karakter o marami pa. + + + This value should not be blank. + Ang halaga na ito ay dapat na may laman. + + + This value should not be null. + Meron dapt itong halaga. + + + This value should be null. + Wala dapat itong halaga. + + + This value is not valid. + Hindi balido ang halagang ito. + + + This value is not a valid time. + Ang halagang ito ay hindi wastong oras. + + + This value is not a valid URL. + Hindi ito isang balidong URL. + + + The two values should be equal. + Ang dalwang halaga ay dapat magkapareha. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Ang file ay masyadong malaki. Ang pinapayagan halaga lamang ay {{ limit}} {{ suffix }}. + + + The file is too large. + Ang file na ito ay masyadong malaki. + + + The file could not be uploaded. + Ang file na ito ay hindi ma-upload. + + + This value should be a valid number. + Ang halaga nito ay dapat na wastong numero. + + + This file is not a valid image. + Ang file na ito ay hindi wastong imahe. + + + This is not a valid IP address. + Ito ay hindi wastong IP address. + + + This value is not a valid language. + Ang halaga na ito ay hindi balidong wika. + + + This value is not a valid locale. + Ito ay isang hindi wastong locale na halaga. + + + This value is not a valid country. + ng halaga na ito ay hindi wastong bansa. + + + This value is already used. + Ang halaga na ito ay ginamit na. + + + The size of the image could not be detected. + Ang sukat ng imahe ay hindi madetect. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ang lapad ng imahe ay masyadong malaki ({{ width }}px). Ang pinapayagang lapay ay {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ang lapad ng imahe ay masyadong maliit ({{ width }}px). Ang pinakamaliit na pinapayagang lapad ay {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Ang haba ng imahe ay masyadong mataas ({{ height }}px). Ang pinakmataas na haba ay {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Ang haba ng imahe ay masyadong maliit ({{ height }}px). Ang inaasahang haba ay {{ min_height }}px. + + + This value should be the user's current password. + Ang halagang ito ay dapat na password ng kasalukuyang gumagamit. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Ang halagang ito ay dapat na eksakto sa {{ limit}} karakter.|Ang halagang ito ay dapat na eksakto sa {{ limit }} mga karakter. + + + The file was only partially uploaded. + Ang file na ito ay kahalating na upload lamang. + + + No file was uploaded. + Walang na upload na file. + + + No temporary folder was configured in php.ini. + Walang temporaryong folder ang naayos sa php.ini. + + + Cannot write temporary file to disk. + Temporaryong hindi makasulat ng file sa disk. + + + A PHP extension caused the upload to fail. + Ang dahilan ng pagkabigo ng pagupload ng files ay isang extension ng PHP. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ang koleksyon na ito ay dapat magkaroon ng {{ limit }} elemento o marami pa.|Ang koleksyon na ito ay dapat magkaroon ng {{ limit }} mga elemento o marami pa. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ang koleksyon na ito ay dapat magkaroon ng {{ limit }} elemento o maliit pa.|Ang koleksyon na ito ay dapat magkaroon ng {{ limit }} mga elemento o maliit pa. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ang koleksyong ito ay magkaroon ng eksaktong {{ limit }} elemento.|Ang koleksyong ito ay magkaroon ng eksaktong {{ limit }} mga elemento. + + + Invalid card number. + Hindi wastong numero ng kard. + + + Unsupported card type or invalid card number. + Hindi supportadong uri ng kard o hindi wastong numero ng kard. + + + This is not a valid International Bank Account Number (IBAN). + Ito ay hindi isang balidong International Bank Account Number (IBAN). + + + This value is not a valid ISBN-10. + Ang halagang ito ay hindi balidong SBN-10. + + + This value is not a valid ISBN-13. + Ang halagang ito ay hindi balidong ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Ang halagang ito ay pwdeng isang balidong ISBN-10 o isang balidong ISBN-13. + + + This value is not a valid ISSN. + Ang halangang ito ay hindi isang balidong ISSN. + + + This value is not a valid currency. + Ang halagang ito ay hindi balidong pera. + + + This value should be equal to {{ compared_value }}. + Ito ay hindi dapat magkapareho sa {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Ang halagang ito ay dapat tataas sa {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Ang halagang ito ay dapat mas mataas o magkapareha sa {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Ang halagang ito ay dapat kapareha ng {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Ang halagang ito ay dapat mas maliit sa {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Ang halagang ito ay dapat mas maliit o magkapareha sa {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Ang halagang ito ay hindi dapat magkapareha sa {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Ang halagang ito ay hindi dapat magkapareha sa {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Ang ratio ng imahe ay masyadong malaki ({{ ratio }}). Ang pinakamalaking ratio ay {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Ang ratio ng imahe ay masyadong maliit ({{ ratio }}). Ang pinakamaliit na ratio ay {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Ang imahe ay kwadrado ({{ width }}x{{ height }}px). Ang mga kwadradong imahe ay hindi pwede. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Ang orientasyon ng imahe ay nakalandscape ({{ width }}x{{ height }}px). Ang mga imaheng nakalandscape ang orientasyon ay hindi pwede. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Ang orientasyon ng imahe ay nakaportrait ({{ width }}x{{ height }}px). Ang mga imaheng nakaportrait ang orientasyon ay hindi pwede. + + + An empty file is not allowed. + Ang file na walang laman ay hindi pwede. + + + The host could not be resolved. + Hindi maresolba ang host. + + + This value does not match the expected {{ charset }} charset. + Ang halaga ay hindi kapareha sa inaasahang {{ charset }} set ng karater. + + + This is not a valid Business Identifier Code (BIC). + Ito ay hindi isang balidong Business Identifier Code (BIC). + + + Error + Error + + + This is not a valid UUID. + Ito ay hindi wastong UUID. + + + This value should be a multiple of {{ compared_value }}. + Ang halagang ito ay dapat multiple ng {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ang Business Identifier Code (BIC) na ito ay walang kaugnayan sa IBAN {{ iban }}. + + + This value should be valid JSON. + Ang halagang ito ay dapat naka wastong JSON. + + + This collection should contain only unique elements. + Ang mga elemento ng koleksyong ito ay dapat magkakaiba. + + + This value should be positive. + Ang halagang ito ay dapat positibo. + + + This value should be either positive or zero. + Ang halagang ito ay dapat positibo o zero. + + + This value should be negative. + Ang halagang ito ay dapat negatibo. + + + This value should be either negative or zero. + Ang halagang ito ay dapat negatibo o zero. + + + This value is not a valid timezone. + Ang halagang ito ay hindi wastong timezone. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Naikalat ang password na ito sa isang data breach at hindi na dapat gamitin. Mangyaring gumamit ng ibang pang password. + + + This value should be between {{ min }} and {{ max }}. + Ang halagang ito ay dapat nasa pagitan ng {{ min }} at {{ max }}. + + + This value is not a valid hostname. + Ang halagang ito ay hindi wastong hostname. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Ang bilang ng mga elemento sa koleksyon na ito ay dapat multiple ng {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Ang halagang ito ay dapat masunod ang kahit na isang sumusunod na batayan. + + + Each element of this collection should satisfy its own set of constraints. + Ang bawat elemento sa koleksyon na ito ay dapat masunod ang nararapat na batayan. + + + This value is not a valid International Securities Identification Number (ISIN). + Ang halagang ito ay hindi wastong International Securities Identification Number (ISIN). + + + This value should be a valid expression. + Ang halagang ito ay dapat wastong ekspresyon. + + + This value is not a valid CSS color. + Ang halagang ito ay hindi wastong kulay ng CSS. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.tr.xlf b/vendor/symfony/validator/Resources/translations/validators.tr.xlf new file mode 100644 index 0000000..715137d --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.tr.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Bu değer olumsuz olmalıdır. + + + This value should be true. + Bu değer olumlu olmalıdır. + + + This value should be of type {{ type }}. + Bu değerin tipi {{ type }} olmalıdır. + + + This value should be blank. + Bu değer boş olmalıdır. + + + The value you selected is not a valid choice. + Seçtiğiniz değer geçerli bir seçenek değil. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + En az {{ limit }} seçenek belirtmelisiniz. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + En çok {{ limit }} seçenek belirtmelisiniz. + + + One or more of the given values is invalid. + Verilen değerlerden bir veya daha fazlası geçersiz. + + + This field was not expected. + Bu alan beklenen olmadı. + + + This field is missing. + Bu alan, eksik + + + This value is not a valid date. + Bu değer doğru bir tarih biçimi değildir. + + + This value is not a valid datetime. + Bu değer doğru bir tarihsaat biçimi değildir. + + + This value is not a valid email address. + Bu değer doğru bir e-mail adresi değildir. + + + The file could not be found. + Dosya bulunamadı. + + + The file is not readable. + Dosya okunabilir değil. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Dosya çok büyük ({{ size }} {{ suffix }}). İzin verilen en büyük dosya boyutu {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Dosyanın mime tipi geçersiz ({{ type }}). İzin verilen mime tipleri {{ types }}. + + + This value should be {{ limit }} or less. + Bu değer {{ limit }} ve altında olmalıdır. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Bu değer çok uzun. {{ limit }} karakter veya daha az olmalıdır. + + + This value should be {{ limit }} or more. + Bu değer {{ limit }} veya daha fazla olmalıdır. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Bu değer çok kısa. {{ limit }} karakter veya daha fazla olmalıdır. + + + This value should not be blank. + Bu değer boş bırakılmamalıdır. + + + This value should not be null. + Bu değer boş bırakılmamalıdır. + + + This value should be null. + Bu değer boş bırakılmalıdır. + + + This value is not valid. + Bu değer geçerli değil. + + + This value is not a valid time. + Bu değer doğru bir saat değil. + + + This value is not a valid URL. + Bu değer doğru bir URL değil. + + + The two values should be equal. + İki değer eşit olmalıdır. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Dosya çok büyük. İzin verilen en büyük dosya boyutu {{ limit }} {{ suffix }}. + + + The file is too large. + Dosya çok büyük. + + + The file could not be uploaded. + Dosya yüklenemiyor. + + + This value should be a valid number. + Bu değer geçerli bir rakam olmalıdır. + + + This file is not a valid image. + Bu dosya geçerli bir resim değildir. + + + This is not a valid IP address. + Bu geçerli bir IP adresi değildir. + + + This value is not a valid language. + Bu değer geçerli bir lisan değil. + + + This value is not a valid locale. + Bu değer geçerli bir yer değildir. + + + This value is not a valid country. + Bu değer geçerli bir ülke değildir. + + + This value is already used. + Bu değer şu anda kullanımda. + + + The size of the image could not be detected. + Resmin boyutu saptanamıyor. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Resmin genişliği çok büyük ({{ width }}px). İzin verilen en büyük genişlik {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Resmin genişliği çok küçük ({{ width }}px). En az {{ min_width }}px olmalıdır. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Resmin yüksekliği çok büyük ({{ height }}px). İzin verilen en büyük yükseklik {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Resmin yüksekliği çok küçük ({{ height }}px). En az {{ min_height }}px olmalıdır. + + + This value should be the user's current password. + Bu değer kullanıcının şu anki şifresi olmalıdır. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Bu değer tam olarak {{ limit }} karakter olmaldır. + + + The file was only partially uploaded. + Dosya sadece kısmen yüklendi. + + + No file was uploaded. + Hiçbir dosya yüklenmedi. + + + No temporary folder was configured in php.ini. + php.ini içerisinde geçici dizin tanımlanmadı. + + + Cannot write temporary file to disk. + Geçici dosya diske yazılamıyor. + + + A PHP extension caused the upload to fail. + Bir PHP eklentisi dosyanın yüklemesini başarısız kıldı. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Bu derlem {{ limit }} veya daha çok eleman içermelidir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Bu derlem {{ limit }} veya daha az eleman içermelidir. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Bu derlem {{ limit }} eleman içermelidir. + + + Invalid card number. + Geçersiz kart numarası. + + + Unsupported card type or invalid card number. + Desteklenmeyen kart tipi veya geçersiz kart numarası. + + + This is not a valid International Bank Account Number (IBAN). + Bu geçerli bir Uluslararası Banka Hesap Numarası (IBAN) değildir. + + + This value is not a valid ISBN-10. + Bu değer geçerli bir ISBN-10 değildir. + + + This value is not a valid ISBN-13. + Bu değer geçerli bir ISBN-13 değildir. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Bu değer geçerli bir ISBN-10 veya ISBN-13 değildir. + + + This value is not a valid ISSN. + Bu değer geçerli bir ISSN değildir. + + + This value is not a valid currency. + Bu değer geçerli bir para birimi değil. + + + This value should be equal to {{ compared_value }}. + Bu değer {{ compared_value }} ile eşit olmalıdır. + + + This value should be greater than {{ compared_value }}. + Bu değer {{ compared_value }} değerinden büyük olmalıdır. + + + This value should be greater than or equal to {{ compared_value }}. + Bu değer {{ compared_value }} ile eşit veya büyük olmalıdır. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Bu değer {{ compared_value_type }} {{ compared_value }} ile aynı olmalıdır. + + + This value should be less than {{ compared_value }}. + Bu değer {{ compared_value }} değerinden düşük olmalıdır. + + + This value should be less than or equal to {{ compared_value }}. + .Bu değer {{ compared_value }} ile eşit veya düşük olmalıdır. + + + This value should not be equal to {{ compared_value }}. + Bu değer {{ compared_value }} ile eşit olmamalıdır. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Bu değer {{ compared_value_type }} {{ compared_value }} ile aynı olmamalıdır. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Resim oranı çok büyük ({{ ratio }}). İzin verilen maksimum oran: {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Resim oranı çok ufak ({{ ratio }}). Beklenen minimum oran {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Resim karesi ({{ width }}x{{ height }}px). Kare resimlerine izin verilmiyor. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Resim manzara odaklı ({{ width }}x{{ height }}px). Manzara odaklı resimlere izin verilmiyor. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Resim portre odaklı ({{ width }}x{{ height }}px). Portre odaklı resimlere izin verilmiyor. + + + An empty file is not allowed. + Boş bir dosyaya izin verilmiyor. + + + The host could not be resolved. + Sunucu çözülemedi. + + + This value does not match the expected {{ charset }} charset. + Bu değer beklenen {{ charset }} karakter kümesiyle eşleşmiyor. + + + This is not a valid Business Identifier Code (BIC). + Bu geçerli bir İşletme Tanımlayıcı Kodu (BIC) değildir. + + + Error + Hata + + + This is not a valid UUID. + Bu geçerli bir UUID değildir. + + + This value should be a multiple of {{ compared_value }}. + Bu değer {{ compare_value }} değerinin katlarından biri olmalıdır. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Bu İşletme Tanımlayıcı Kodu (BIC), IBAN {{ iban }} ile ilişkili değildir. + + + This value should be valid JSON. + Bu değer için geçerli olmalıdır JSON. + + + This collection should contain only unique elements. + Bu grup yalnızca benzersiz öğeler içermelidir. + + + This value should be positive. + Bu değer pozitif olmalı. + + + This value should be either positive or zero. + Bu değer pozitif veya sıfır olmalıdır. + + + This value should be negative. + Bu değer negatif olmalıdır. + + + This value should be either negative or zero. + Bu değer, negatif veya sıfır olmalıdır. + + + This value is not a valid timezone. + Bu değer, geçerli bir saat dilimi değil. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Bu parola, bir veri ihlali nedeniyle sızdırılmıştır ve kullanılmamalıdır. Lütfen başka bir şifre kullanın. + + + This value should be between {{ min }} and {{ max }}. + Bu değer arasında olmalıdır {{ min }} ve {{ max }}. + + + This value is not a valid hostname. + Bu değer, geçerli bir ana bilgisayar adı değil. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Bu gruptaki öğe sayısı birden fazla olmalıdır {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Bu değer aşağıdaki kısıtlamalardan birini karşılamalıdır: + + + Each element of this collection should satisfy its own set of constraints. + Bu gruptaki her öğe kendi kısıtlamalarını karşılamalıdır. + + + This value is not a valid International Securities Identification Number (ISIN). + Bu değer geçerli bir Uluslararası Menkul Kıymetler Kimlik Numarası değil (ISIN). + + + This value should be a valid expression. + Bu değer geçerli bir ifade olmalıdır. + + + This value is not a valid CSS color. + Bu değer geçerli bir CSS rengi değil. + + + This value is not a valid CIDR notation. + Bu değer geçerli bir CIDR yazımı değil. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Netmask'in değeri {{ min }} ve {{ max }} arasında olmaldır. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.uk.xlf b/vendor/symfony/validator/Resources/translations/validators.uk.xlf new file mode 100644 index 0000000..c11f851 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.uk.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Значення повинно бути Ні. + + + This value should be true. + Значення повинно бути Так. + + + This value should be of type {{ type }}. + Тип значення повинен бути {{ type }}. + + + This value should be blank. + Значення повинно бути пустим. + + + The value you selected is not a valid choice. + Обране вами значення недопустиме. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Ви повинні обрати хоча б {{ limit }} варіант.|Ви повинні обрати хоча б {{ limit }} варіанти.|Ви повинні обрати хоча б {{ limit }} варіантів. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Ви повинні обрати не більше ніж {{ limit }} варіантів. + + + One or more of the given values is invalid. + Одне або кілька заданих значень є недопустимі. + + + This field was not expected. + Це поле не очікується. + + + This field is missing. + Це поле не вистачає. + + + This value is not a valid date. + Дане значення не є вірною датою. + + + This value is not a valid datetime. + Дане значення дати та часу недопустиме. + + + This value is not a valid email address. + Значення адреси электронної пошти недопустиме. + + + The file could not be found. + Файл не знайдено. + + + The file is not readable. + Файл не читається. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадто великий ({{ size }} {{ suffix }}). Дозволений максимальний розмір {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + MIME-тип файлу недопустимий ({{ type }}). Допустимі MIME-типи файлів {{ types }}. + + + This value should be {{ limit }} or less. + Значення повинно бути {{ limit }} або менше. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Значення занадто довге. Повинно бути рівне {{ limit }} символу або менше.|Значення занадто довге. Повинно бути рівне {{ limit }} символам або менше.|Значення занадто довге. Повинно бути рівне {{ limit }} символам або менше. + + + This value should be {{ limit }} or more. + Значення повинно бути {{ limit }} або більше. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Значення занадто коротке. Повинно бути рівне {{ limit }} символу або більше.|Значення занадто коротке. Повинно бути рівне {{ limit }} символам або більше.|Значення занадто коротке. Повинно бути рівне {{ limit }} символам або більше. + + + This value should not be blank. + Значення не повинно бути пустим. + + + This value should not be null. + Значення не повинно бути null. + + + This value should be null. + Значення повинно бути null. + + + This value is not valid. + Значення недопустиме. + + + This value is not a valid time. + Значення часу недопустиме. + + + This value is not a valid URL. + Значення URL недопустиме. + + + The two values should be equal. + Обидва занчення повинні бути одинаковими. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Файл занадто великий. Максимальний допустимий розмір {{ limit }} {{ suffix }}. + + + The file is too large. + Файл занадто великий. + + + The file could not be uploaded. + Файл не можливо завантажити. + + + This value should be a valid number. + Значення має бути допустимим числом. + + + This file is not a valid image. + Цей файл не є допустимим форматом зображення. + + + This is not a valid IP address. + Це некоректна IP адреса. + + + This value is not a valid language. + Це некоректна мова. + + + This value is not a valid locale. + Це некоректна локалізація. + + + This value is not a valid country. + Це некоректна країна. + + + This value is already used. + Це значення вже використовується. + + + The size of the image could not be detected. + Не вдалося визначити розмір зображення. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Ширина зображення занадто велика ({{ width }}px). Максимально допустима ширина {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Ширина зображення занадто мала ({{ width }}px). Мінімально допустима ширина {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Висота зображення занадто велика ({{ height }}px). Максимально допустима висота {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Висота зображення занадто мала ({{ height }}px). Мінімально допустима висота {{ min_height }}px. + + + This value should be the user's current password. + Значення має бути поточним паролем користувача. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Значення повиино бути рівним {{ limit }} символу.|Значення повиино бути рівним {{ limit }} символам.|Значення повиино бути рівним {{ limit }} символам. + + + The file was only partially uploaded. + Файл був завантажений лише частково. + + + No file was uploaded. + Файл не був завантажений. + + + No temporary folder was configured in php.ini. + Не налаштована тимчасова директорія в php.ini. + + + Cannot write temporary file to disk. + Неможливо записати тимчасовий файл на диск. + + + A PHP extension caused the upload to fail. + Розширення PHP викликало помилку при завантаженні. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ця колекція повинна містити {{ limit }} елемент чи більше.|Ця колекція повинна містити {{ limit }} елемента чи більше.|Ця колекція повинна містити {{ limit }} елементів чи більше. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ця колекція повинна містити {{ limit }} елемент чи менше.|Ця колекція повинна містити {{ limit }} елемента чи менше.|Ця колекція повинна містити {{ limit }} елементов чи менше. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ця колекція повинна містити рівно {{ limit }} елемент.|Ця колекція повинна містити рівно {{ limit }} елемента.|Ця колекція повинна містити рівно {{ limit }} елементів. + + + Invalid card number. + Невірний номер карти. + + + Unsupported card type or invalid card number. + Непідтримуваний тип карти або невірний номер карти. + + + This is not a valid International Bank Account Number (IBAN). + Це не дійсний міжнародний номер банківського рахунку (IBAN). + + + This value is not a valid ISBN-10. + Значення не у форматі ISBN-10. + + + This value is not a valid ISBN-13. + Значення не у форматі ISBN-13. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Значення не відповідає форматам ISBN-10 та ISBN-13. + + + This value is not a valid ISSN. + Значення має невірний формат ISSN. + + + This value is not a valid currency. + Значення має невірний формат валюти. + + + This value should be equal to {{ compared_value }}. + Значення повинно дорівнювати {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Значення має бути більше ніж {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Значення має бути більше або дорівнювати {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Значення має бути ідентичним {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Значення повинно бути менше ніж {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Значення повинно бути менше або дорівнювати {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Значення не повинно дорівнювати {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Значення не повинно бути ідентичним {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Співвідношення сторін зображення занадто велике ({{ ratio }}). Максимальне співвідношення сторін {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Співвідношення сторін зображення занадто мало ({{ ratio }}). Мінімальне співвідношення сторін {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Зображення квадратне ({{ width }}x{{ height }}px). Квадратні зображення не дозволені. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Зображення альбомної орієнтації ({{ width }}x{{ height }}px). Зображення альбомної орієнтації не дозволені. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Зображення в портретній орієнтації ({{ width }}x{{ height }}px). Зображення в портретної орієнтації не дозволені. + + + An empty file is not allowed. + Порожні файли не дозволені. + + + The host could not be resolved. + Ім'я хоста не знайдено. + + + This value does not match the expected {{ charset }} charset. + Значення не збігається з очікуваним {{ charset }} кодуванням. + + + This is not a valid Business Identifier Code (BIC). + Це не дійсний банківський код (BIC). + + + Error + Помилка + + + This is not a valid UUID. + Це не валідне значення UUID. + + + This value should be a multiple of {{ compared_value }}. + Це значення повинне бути кратним {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Банківський код (BIC) не пов’язаний із міжнародним номером банківського рахунку (IBAN) {{ iban }}. + + + This value should be valid JSON. + Значення має бути корректним JSON. + + + This collection should contain only unique elements. + Ця колекція повинна мати тільки унікальни значення. + + + This value should be positive. + Значення має бути позитивним. + + + This value should be either positive or zero. + Значення має бути позитивним або дорівнювати нулю. + + + This value should be negative. + Значення має бути негативним. + + + This value should be either negative or zero. + Значення має бути негативним або дорівнювати нулю. + + + This value is not a valid timezone. + Значення не є дійсним часовим поясом. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Цей пароль був скомпрометований в результаті витоку даних та не повинен використовуватися. Будь ласка, використовуйте інший пароль. + + + This value should be between {{ min }} and {{ max }}. + Значення має бути між {{ min }} та {{ max }}. + + + This value is not a valid hostname. + Значення не є дійсним іменем хоста. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Кількість елементів у цій колекції повинна бути кратною {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Значення повинно задовольняти хоча б одному з наступних обмежень: + + + Each element of this collection should satisfy its own set of constraints. + Кожен елемент цієї колекції повинен задовольняти власному набору обмежень. + + + This value is not a valid International Securities Identification Number (ISIN). + Це значення не є дійсним міжнародним ідентифікаційним номером цінних паперів (ISIN). + + + This value should be a valid expression. + Це значення має бути дійсним виразом. + + + This value is not a valid CSS color. + Це значення не є дійсним CSS кольором. + + + This value is not a valid CIDR notation. + Це значення не є дійсною CIDR нотаціею. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Значення в мережевій масці має бути між {{ min }} та {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.uz.xlf b/vendor/symfony/validator/Resources/translations/validators.uz.xlf new file mode 100644 index 0000000..d1ecaf1 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.uz.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Qiymat noto'g'ri bo'lishi kerak. + + + This value should be true. + Qiymat to'g'ri bo'lishi kerak. + + + This value should be of type {{ type }}. + Qiymat turi {{ type }} bo'lishi kerak. + + + This value should be blank. + Qiymat bo'sh bo'lishi kerak. + + + The value you selected is not a valid choice. + Tanlangan qiymat to'g'ri emas. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Siz hech bo'lmaganda {{ limit }} ta qiymat tanlashingiz kerak.|Siz kamida {{ limit }} ta qiymat tanlashingiz kerak. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Siz {{ limit }} ta qiymatni tanlashingiz kerak.|Siz {{ limit }} dan ortiq qiymat tanlashingiz kerak. + + + One or more of the given values is invalid. + Belgilangan qiymatlarning bir yoki bir nechtasi noto'g'ri. + + + This field was not expected. + Ushbu maydon kutilmagan edi. + + + This field is missing. + Bu maydon majvud emas. + + + This value is not a valid date. + Ushbu sana noto'g'ri. + + + This value is not a valid datetime. + Sana va vaqt qiymati noto'g'ri. + + + This value is not a valid email address. + Elektron pochta manzili noto'g'ri. + + + The file could not be found. + Fayl topilmadi. + + + The file is not readable. + Faylni o'qib bo'lmadi. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl hajmi katta ({{ size }} {{ suffix }}). Maksimal ruxsat etilgan hajim {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Faylning MIME turi noto'g'ri ({{ type }}). Ruxsat etilgan MIME turlar {{ types }}. + + + This value should be {{ limit }} or less. + Qiymat {{ limit }} ga teng yoki kam bo'lishi kerak. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Qiymat juda uzun. {{ limit }} ga teng yoki kam bo'lishi kerak.|Qiymat juda uzun. {{ limit }} yoki undan kam belgidan iborat bo'lishi kerak. + + + This value should be {{ limit }} or more. + Qiymat {{ limit }} yoki undan ortiq bo'lishi kerak. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Qiymat juda qisqa. {{ limit }} ta yoki undan ortiq belgidan iborat bo'lishi kerak.|Qiymat juda qisqa. {{ limit }} yoki undan ko'p belgidan iborat bo'lishi kerak + + + This value should not be blank. + Qiymatni bo'sh kirtish mumkin emas. + + + This value should not be null. + Qiymat null bo'lmasligi kerak. + + + This value should be null. + Qiymat null bo'lishi kerak. + + + This value is not valid. + Qiymat noto'g'ri. + + + This value is not a valid time. + Vaqt noto'g'ri. + + + This value is not a valid URL. + URL noto'g'ri + + + The two values should be equal. + Ikkala qiymat ham bir xil bo'lishi kerak. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fayl hajmi katta. Maksimal ruxsat berilgan hajim {{ limit }} {{ suffix }}. + + + The file is too large. + Fayl hajmi katta. + + + The file could not be uploaded. + Faylni yuklab bo'lmadi. + + + This value should be a valid number. + Qiymat raqam bo'lishi kerak. + + + This file is not a valid image. + Fayl yaroqli rasm formati emas. + + + This is not a valid IP address. + Ip manzil noto'g'ri. + + + This value is not a valid language. + Noto'g'ri til. + + + This value is not a valid locale. + Ushbu qiymat mahalliy qiymat emas. + + + This value is not a valid country. + Mamlakat qiymati noto'g'ri. + + + This value is already used. + Ushbu qiymat allaqachon ishlatilgan. + + + The size of the image could not be detected. + Rasm o'lchamini aniqlab bo'lmadi. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Rasm kengligi juda katta ({{ width }}px). Maksimal ruxsat etilgan kenglik {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Rasm kengligi juda kichkina ({{ width }}px). Minimal ruxsat etilgan kenglik {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Rasm bo'yi juda katta ({{ height }}px). Maksimal ruxsat etilgan balandlik {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Rasm bo'yi juda kichkina ({{ height }}px). Minimal ruxsat etilgan balandlik {{ min_height }}px. + + + This value should be the user's current password. + Qiymat joriy foydalanuvchi paroli bo'lishi kerak. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Qiymat {{ limit }} ta belgidan iborat bo'lishi kerak.|Qiymat {{ limit }} belgidan iborat bo'lishi kerak. + + + The file was only partially uploaded. + Fayl faqat qisman yuklangan. + + + No file was uploaded. + Fayl yuklanmagan. + + + No temporary folder was configured in php.ini. + php.ini da vaqtinchalik katalog sozlanmagan. + + + Cannot write temporary file to disk. + Diskka vaqtinchalik faylni yozib bo'lmadi. + + + A PHP extension caused the upload to fail. + PHP kengaytmasi yuklash paytida xatolik yuz berdi. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Ushbu to'plam {{ limit }} ta yoki undan ko'p narsalarni o'z ichiga olishi kerak.|Ushbu to'plam {{ limit }} yoki undan ortiq narsalarni o'z ichiga olishi kerak. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Ushbu to'plam {{ limit }} ta yoki undan kam narsalarni o'z ichiga olishi kerak.|Ushbu to'plamda {{ limit }} yoki undan kam element bo'lishi kerak. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Ushbu to'plam to'liq {{ limit }} narsani o'z ichiga olishi kerak.|Ushbu to'plamda to'liq {{ limit }} ta ma'lumotlar bo'lishi kerak. + + + Invalid card number. + Kata raqami noto'g'ri. + + + Unsupported card type or invalid card number. + Qo'llab-quvvatlanmaydigan karta turi yoki yaroqsiz karta raqami. + + + This is not a valid International Bank Account Number (IBAN). + Qiymat haqiqiy xalqaro hisob raqamining raqami (IBAN) emas. + + + This value is not a valid ISBN-10. + Qiymat to'g'ri ISBN-10 formatida emas. + + + This value is not a valid ISBN-13. + Qiymat to'g'ri ISBN-13 formatida emas. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Qiymat ISBN-10 va ISBN-13 formatlariga mos kelmaydi. + + + This value is not a valid ISSN. + Qiymat ISSN formatiga mos kelmaydi. + + + This value is not a valid currency. + Noto'g'ri valyuta formati. + + + This value should be equal to {{ compared_value }}. + Qiymat {{ compared_value }} ga teng bo'lishi shart. + + + This value should be greater than {{ compared_value }}. + Qiymat {{ compared_value }} dan katta bo'lishi shart. + + + This value should be greater than or equal to {{ compared_value }}. + Qiymat {{ compared_value }} dan katta yoki teng bo'lishi shart. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Значение должно быть идентичным {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Qiymat bir xil bo'lishi kerak {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Qiymat {{ compared_value }} dan kichik yoki teng bo'lishi shart. + + + This value should not be equal to {{ compared_value }}. + Qiymat {{ compared_value }} ga teng bo'lmasligi kerak. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Qiymat bir xil bo'lishi kerak emas {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Rasmning tomonlari nisbati juda katta ({{ ratio }}). Maksimal tomonlar nisbati {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Rasmning format nisbati juda kichik ({{ ratio }}). Minimal tomonlar nisbati {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Rasm kvadrat shaklida ({{ width }}x{{ height }}px). Kvadrat shaklida tasvirlarga ruxsat berilmaydi. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Landshaft tasvir ({{ width }}x{{ height }}px). Landshaft rasmlarga ruxsat berilmaydi. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Portret rasm ({{ width }}x{{ height }}px). Portretlarga ruxsat berilmaydi. + + + An empty file is not allowed. + Bo'sh fayllarga ruxsat berilmagan. + + + The host could not be resolved. + Xost nomini nomiga ruxsat berilmagan. + + + This value does not match the expected {{ charset }} charset. + Qiymat kutilgan {{ charset }} kodlashiga mos kelmaydi. + + + This is not a valid Business Identifier Code (BIC). + Qiymat BIC formatida emas. + + + Error + Xatolik + + + This is not a valid UUID. + Qiymat UUID formatida emas. + + + This value should be a multiple of {{ compared_value }}. + Qiymat {{ compared_value }} ning ko'paytmasi bo'lishi kerak. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Ushbu BIC IBAN {{ iban }} bilan bog'liq emas.. + + + This value should be valid JSON. + Qiymat to'g'ri JSON bo'lishi kerak. + + + This collection should contain only unique elements. + Ushbu kolleksiyada takroriy elementlar bo'lmasligi kerak. + + + This value should be positive. + Qiymat musbat bo'lishi kerak. + + + This value should be either positive or zero. + Qiymat musbat yoki 0 ga teng bo'lishi kerak. + + + This value should be negative. + Qiymat manfiy bo'lishi kerak. + + + This value should be either negative or zero. + Qiymat manfiy yoki 0 ga teng bo'lishi kerak. + + + This value is not a valid timezone. + Qiymat to'g'ri vaqt zonasi emas. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ushbu parol ma'lumotlarning tarqalishi tufayli buzilgan va uni ishlatmaslik kerak. Boshqa paroldan foydalaning. + + + This value should be between {{ min }} and {{ max }}. + Qiymat {{ min }} va {{ max }} oralig'ida bo'lishi shart. + + + This value is not a valid hostname. + Qiymat to'g'ri xost nomi emas. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Ushbu to'plamdagi narsalar soni {{ compared_value }} dan ko'p bo'lishi kerak. + + + This value should satisfy at least one of the following constraints: + Qiymat quyidagi cheklovlardan kamida bittasiga javob berishi kerak: + + + Each element of this collection should satisfy its own set of constraints. + Ushbu to'plamdagi har bir narsa o'ziga xos cheklovlarni qondirishi kerak. + + + This value is not a valid International Securities Identification Number (ISIN). + Qiymat Qimmatli qog'ozlarning xalqaro identifikatsiya raqami (ISIN) ga mos emas. + + + This value should be a valid expression. + Ushbu qiymat to'g'ri ifoda bo'lishi kerak. + + + This value is not a valid CSS color. + Bu qiymat haqiqiy CSS rangi emas. + + + This value is not a valid CIDR notation. + Qiymat CIDR belgisiga mos kelmaydi. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Tarmoq niqobining qiymati {{ min }} va {{ max }} oralig'ida bo'lishi kerak. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.vi.xlf b/vendor/symfony/validator/Resources/translations/validators.vi.xlf new file mode 100644 index 0000000..0020179 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.vi.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + Giá trị này phải là sai. + + + This value should be true. + Giá trị này phải là đúng. + + + This value should be of type {{ type }}. + Giá trị này phải là kiểu {{ type }}. + + + This value should be blank. + Giá trị này phải rỗng. + + + The value you selected is not a valid choice. + Giá trị bạn vừa chọn không hợp lệ. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Bạn phải chọn ít nhất {{ limit }} lựa chọn.|Bạn phải chọn ít nhất {{ limit }} lựa chọn. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Bạn phải chọn nhiều nhất {{ limit }} lựa chọn.|Bạn phải chọn nhiều nhất {{ limit }} lựa chọn. + + + One or more of the given values is invalid. + Một hoặc nhiều giá trị được chọn không hợp lệ. + + + This field was not expected. + Lĩnh vực này không được dự kiến. + + + This field is missing. + Lĩnh vực này bị thiếu. + + + This value is not a valid date. + Giá trị không phải là ngày hợp lệ. + + + This value is not a valid datetime. + Giá trị không phải là ngày tháng hợp lệ. + + + This value is not a valid email address. + Giá trị này không phải là email hợp lệ. + + + The file could not be found. + Tập tin không tìm thấy. + + + The file is not readable. + Tập tin không thể đọc được. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Tập tin quá lớn ({{ size }} {{ suffix }}). Kích thước tối đa cho phép {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Kiểu mime của tập tin không hợp lệ ({{ type }}). Kiểu hợp lệ là {{ types }}. + + + This value should be {{ limit }} or less. + Giá trị phải bằng hoặc nhỏ hơn {{ limit }}. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Giá trị quá dài. Phải bằng hoặc ít hơn {{ limit }} kí tự.|Giá trị quá dài. Phải bằng hoặc ít hơn {{ limit }} kí tự. + + + This value should be {{ limit }} or more. + Giá trị phải lớn hơn hoặc bằng {{ limit }}. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Giá trị quá ngắn. Phải hơn hoặc bằng {{ limit }} kí tự.|Giá trị quá ngắn. Phải hơn hoặc bằng {{ limit }} kí tự. + + + This value should not be blank. + Giá trị không được phép để trống. + + + This value should not be null. + Giá trị không được phép rỗng. + + + This value should be null. + Giá trị phải rỗng. + + + This value is not valid. + Giá trị không hợp lệ. + + + This value is not a valid time. + Giá trị không phải là thời gian hợp lệ. + + + This value is not a valid URL. + Giá trị không phải là địa chỉ URL hợp lệ. + + + The two values should be equal. + Hai giá trị phải bằng nhau. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Tập tin quá lớn. Kích thước tối đa cho phép là {{ limit }} {{ suffix }}. + + + The file is too large. + Tập tin quá lớn. + + + The file could not be uploaded. + Tập tin không thể tải lên. + + + This value should be a valid number. + Giá trị phải là con số. + + + This file is not a valid image. + Tập tin không phải là hình ảnh hợp lệ. + + + This is not a valid IP address. + Địa chỉ IP không hợp lệ. + + + This value is not a valid language. + Giá trị không phải là ngôn ngữ hợp lệ. + + + This value is not a valid locale. + Giá trị không phải là một bản địa địa phương hợp lệ. + + + This value is not a valid country. + Giá trị không phải là quốc gia hợp lệ. + + + This value is already used. + Giá trị đã được sử dụng. + + + The size of the image could not be detected. + Kích thước của hình ảnh không thể xác định. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Chiều rộng của hình quá lớn ({{ width }}px). Chiều rộng tối đa phải là {{ max_width }}px. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Chiều rộng của hình quá thấp ({{ width }}px). Chiều rộng tối thiểu phải là {{ min_width }}px. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Chiều cao của hình quá cao ({{ height }}px). Chiều cao tối đa phải là {{ max_height }}px. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Chiều cao của hình quá thấp ({{ height }}px). Chiều cao tối thiểu phải là {{ min_height }}px. + + + This value should be the user's current password. + Giá trị này phải là mật khẩu hiện tại của người dùng. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Giá trị này phải có chính xác {{ limit }} kí tự.|Giá trị này phải có chính xác {{ limit }} kí tự. + + + The file was only partially uploaded. + Tập tin chỉ được tải lên một phần. + + + No file was uploaded. + Tập tin không được tải lên. + + + No temporary folder was configured in php.ini. + Thư mục tạm không được định nghĩa trong php.ini. + + + Cannot write temporary file to disk. + Không thể ghi tập tin tạm ra đĩa. + + + A PHP extension caused the upload to fail. + Một PHP extension đã phá hỏng quá trình tải lên của tập tin. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc nhiều hơn. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn.|Danh sách phải chứa {{ limit }} thành phần hoặc ít hơn. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Danh sách phải chứa chính xác {{ limit }} thành phần.|Danh sách phải chứa chính xác {{ limit }} thành phần. + + + Invalid card number. + Số thẻ không hợp lệ. + + + Unsupported card type or invalid card number. + Thẻ không được hỗ trợ hoặc số thẻ không hợp lệ. + + + This is not a valid International Bank Account Number (IBAN). + Giá trị không phải là International Bank Account Number (IBAN) hợp lệ. + + + This value is not a valid ISBN-10. + Giá trị không phải là ISBN-10 hợp lệ. + + + This value is not a valid ISBN-13. + Giá trị không phải là ISBN-13 hợp lệ. + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + Giá trị không phải là ISBN-10 hoặc ISBN-13 hợp lệ. + + + This value is not a valid ISSN. + Giá trị không phải là ISSN hợp lệ. + + + This value is not a valid currency. + Giá trị không phải là đơn vị tiền tệ hợp lệ. + + + This value should be equal to {{ compared_value }}. + Giá trị phải bằng {{ compared_value }}. + + + This value should be greater than {{ compared_value }}. + Giá trị phải lớn hơn {{ compared_value }}. + + + This value should be greater than or equal to {{ compared_value }}. + Giá trị phải lớn hơn hoặc bằng {{ compared_value }}. + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + Giá trị phải giống {{ compared_value_type }} {{ compared_value }}. + + + This value should be less than {{ compared_value }}. + Giá trị phải bé hơn {{ compared_value }}. + + + This value should be less than or equal to {{ compared_value }}. + Giá trị phải nhỏ hơn hoặc bằng {{ compared_value }}. + + + This value should not be equal to {{ compared_value }}. + Giá trị không được phép bằng {{ compared_value }}. + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + Giá trị không được phép giống như {{ compared_value_type }} {{ compared_value }}. + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Tỷ lệ bức ảnh quá lớn ({{ ratio }}). Tỷ lệ tối đa cho phép là {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Tỷ lệ bức ảnh quá nhỏ ({{ ratio }}). Tỷ lệ tối thiểu mong muốn là {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Bức ảnh là hình vuông ({{ width }}x{{ height }}px). Ảnh hình vuông không được phép. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Bức ảnh theo chiều ngang ({{ width }}x{{ height }}px). Ảnh chiều ngang không được phép. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Bức ảnh theo chiều dọc ({{ width }}x{{ height }}px). Ảnh chiều dọc không được phép. + + + An empty file is not allowed. + Một file rỗng không được phép. + + + The host could not be resolved. + Máy chủ không thể được tìm thấy. + + + This value does not match the expected {{ charset }} charset. + Giá trị này không đúng định dạng bộ ký tự mong muốn {{ charset }}. + + + This is not a valid Business Identifier Code (BIC). + Giá trị này không đúng định dạng mã định danh doanh nghiệp (BIC). + + + Error + Lỗi + + + This is not a valid UUID. + Giá trị này không đúng định dạng UUID. + + + This value should be a multiple of {{ compared_value }}. + Giá trị này nên là bội số của {{ compared_value }}. + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + Mã định danh doanh nghiệp (BIC) này không liên kết với IBAN {{ iban }}. + + + This value should be valid JSON. + Giá trị này nên đúng định dạng JSON. + + + This collection should contain only unique elements. + Danh sách này chỉ nên chứa các phần tử khác nhau. + + + This value should be positive. + Giá trị này có thể thực hiện được. + + + This value should be either positive or zero. + Giá trị này có thể thực hiện được hoặc bằng không. + + + This value should be negative. + Giá trị này nên bị từ chối. + + + This value should be either negative or zero. + Giá trị này nên bị từ chối hoặc bằng không. + + + This value is not a valid timezone. + Giá trị này không phải là múi giờ hợp lệ. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Mật khẩu này đã bị rò rỉ dữ liệu, không được sử dụng nữa. Xin vui lòng sử dụng mật khẩu khác. + + + This value should be between {{ min }} and {{ max }}. + Giá trị này nên thuộc giữa {{ min }} và {{ max }}. + + + This value is not a valid hostname. + Giá trị này không phải là tên máy chủ hợp lệ. + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + Số lượng các phần tử trong bộ sưu tập này nên là bội số của {{ compared_value }}. + + + This value should satisfy at least one of the following constraints: + Giá trị này nên thỏa mãn ít nhất một trong những ràng buộc sau: + + + Each element of this collection should satisfy its own set of constraints. + Mỗi phần tử trong bộ sưu tập này nên thỏa mãn những ràng buộc của nó. + + + This value is not a valid International Securities Identification Number (ISIN). + Giá trị này không phải là mã số chứng khoán quốc tế (ISIN) hợp lệ. + + + This value should be a valid expression. + Giá trị này phải là một biểu thức hợp lệ. + + + This value is not a valid CSS color. + Giá trị này không phải là màu CSS hợp lệ. + + + This value is not a valid CIDR notation. + Giá trị này không phải là ký hiệu CIDR hợp lệ. + + + The value of the netmask should be between {{ min }} and {{ max }}. + Giá trị của mặt nạ mạng phải nằm trong khoảng từ {{ min }} đến {{ max }}. + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf b/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf new file mode 100644 index 0000000..a7d49ba --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.zh_CN.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + 该变量的值应为 false 。 + + + This value should be true. + 该变量的值应为 true 。 + + + This value should be of type {{ type }}. + 该变量的类型应为 {{ type }} 。 + + + This value should be blank. + 该变量值应为空。 + + + The value you selected is not a valid choice. + 选定变量的值不是有效的选项。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + 您至少要选择 {{ limit }} 个选项。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + 您最多能选择 {{ limit }} 个选项。 + + + One or more of the given values is invalid. + 一个或者多个给定的值无效。 + + + This field was not expected. + 此字段是多余的。 + + + This field is missing. + 此字段缺失。 + + + This value is not a valid date. + 该值不是一个有效的日期(date)。 + + + This value is not a valid datetime. + 该值不是一个有效的日期时间(datetime)。 + + + This value is not a valid email address. + 该值不是一个有效的邮件地址。 + + + The file could not be found. + 文件未找到。 + + + The file is not readable. + 文件不可读。 + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + 文件太大 ({{ size }} {{ suffix }})。文件大小不可以超过 {{ limit }} {{ suffix }} 。 + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + 无效的文件类型 ({{ type }}) 。允许的文件类型有 {{ types }} 。 + + + This value should be {{ limit }} or less. + 这个变量的值应该小于或等于 {{ limit }}。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 字符串太长,长度不可超过 {{ limit }} 个字符。 + + + This value should be {{ limit }} or more. + 该变量的值应该大于或等于 {{ limit }}。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 字符串太短,长度不可少于 {{ limit }} 个字符。 + + + This value should not be blank. + 该变量不应为空。 + + + This value should not be null. + 该变量不应为 null 。 + + + This value should be null. + 该变量应为空 null 。 + + + This value is not valid. + 该变量值无效 。 + + + This value is not a valid time. + 该值不是一个有效的时间。 + + + This value is not a valid URL. + 该值不是一个有效的 URL 。 + + + The two values should be equal. + 这两个变量的值应该相等。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + 文件太大,文件大小不可以超过 {{ limit }} {{ suffix }}。 + + + The file is too large. + 文件太大。 + + + The file could not be uploaded. + 无法上传此文件。 + + + This value should be a valid number. + 该值应该为有效的数字。 + + + This file is not a valid image. + 该文件不是有效的图片。 + + + This is not a valid IP address. + 该值不是有效的IP地址。 + + + This value is not a valid language. + 该值不是有效的语言名。 + + + This value is not a valid locale. + 该值不是有效的区域值(locale)。 + + + This value is not a valid country. + 该值不是有效的国家名。 + + + This value is already used. + 该值已经被使用。 + + + The size of the image could not be detected. + 不能解析图片大小。 + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + 图片太宽 ({{ width }}px),最大宽度为 {{ max_width }}px 。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + 图片宽度不够 ({{ width }}px),最小宽度为 {{ min_width }}px 。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + 图片太高 ({{ height }}px),最大高度为 {{ max_height }}px 。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + 图片高度不够 ({{ height }}px),最小高度为 {{ min_height }}px 。 + + + This value should be the user's current password. + 该变量的值应为用户当前的密码。 + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + 该变量应为 {{ limit }} 个字符。 + + + The file was only partially uploaded. + 该文件的上传不完整。 + + + No file was uploaded. + 没有上传任何文件。 + + + No temporary folder was configured in php.ini. + php.ini 里没有配置临时文件目录。 + + + Cannot write temporary file to disk. + 临时文件写入磁盘失败。 + + + A PHP extension caused the upload to fail. + 某个 PHP 扩展造成上传失败。 + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + 该集合最少应包含 {{ limit }} 个元素。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + 该集合最多包含 {{ limit }} 个元素。 + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + 该集合应包含 {{ limit }} 个元素 element 。 + + + Invalid card number. + 无效的信用卡号。 + + + Unsupported card type or invalid card number. + 不支持的信用卡类型或无效的信用卡号。 + + + This is not a valid International Bank Account Number (IBAN). + 该值不是有效的国际银行帐号(IBAN)。 + + + This value is not a valid ISBN-10. + 该值不是有效的10位国际标准书号(ISBN-10)。 + + + This value is not a valid ISBN-13. + 该值不是有效的13位国际标准书号(ISBN-13)。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 该值不是有效的国际标准书号(ISBN-10 或 ISBN-13)。 + + + This value is not a valid ISSN. + 该值不是有效的国际标准期刊号(ISSN)。 + + + This value is not a valid currency. + 该值不是有效的货币名(currency)。 + + + This value should be equal to {{ compared_value }}. + 该值应等于 {{ compared_value }} 。 + + + This value should be greater than {{ compared_value }}. + 该值应大于 {{ compared_value }} 。 + + + This value should be greater than or equal to {{ compared_value }}. + 该值应大于或等于 {{ compared_value }} 。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + 该值应与 {{ compared_value_type }} {{ compared_value }} 相同。 + + + This value should be less than {{ compared_value }}. + 该值应小于 {{ compared_value }} 。 + + + This value should be less than or equal to {{ compared_value }}. + 该值应小于或等于 {{ compared_value }} 。 + + + This value should not be equal to {{ compared_value }}. + 该值不应先等于 {{ compared_value }} 。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + 该值不应与 {{ compared_value_type }} {{ compared_value }} 相同。 + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + 图片宽高比太大 ({{ ratio }})。允许的最大宽高比为 {{ max_ratio }}。 + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + 图片宽高比太小 ({{ ratio }})。允许的最大宽高比为 {{ min_ratio }}。 + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + 图片是方形的 ({{ width }}x{{ height }}px)。不允许使用方形的图片。 + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + 图片是横向的 ({{ width }}x{{ height }}px)。不允许使用横向的图片。 + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + 图片是纵向的 ({{ width }}x{{ height }}px)。不允许使用纵向的图片。 + + + An empty file is not allowed. + 不允许使用空文件。 + + + The host could not be resolved. + 主机名无法解析。 + + + This value does not match the expected {{ charset }} charset. + 该值不符合 {{ charset }} 编码。 + + + This is not a valid Business Identifier Code (BIC). + 这不是有效的业务标识符代码(BIC)。 + + + Error + 错误 + + + This is not a valid UUID. + 这不是有效的UUID。 + + + This value should be a multiple of {{ compared_value }}. + 此值应为 {{ compared_value }} 的倍数。 + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + 此业务标识符代码(BIC)与IBAN {{ iban }} 无关。 + + + This value should be valid JSON. + 该值应该是有效的JSON。 + + + This collection should contain only unique elements. + 该集合应仅包含独一无二的元素。 + + + This value should be positive. + 数值应为正数。 + + + This value should be either positive or zero. + 数值应是正数,或为零。 + + + This value should be negative. + 数值应为负数。 + + + This value should be either negative or zero. + 数值应是负数,或为零。 + + + This value is not a valid timezone. + 无效时区。 + + + This password has been leaked in a data breach, it must not be used. Please use another password. + 此密码已被泄露,切勿使用。请更换密码。 + + + This value should be between {{ min }} and {{ max }}. + 该数值应在 {{ min }} 和 {{ max }} 之间。 + + + This value is not a valid hostname. + 该值不是有效的主机名称。 + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + 该集合内的元素数量得是 {{ compared_value }} 的倍数。 + + + This value should satisfy at least one of the following constraints: + 该值需符合以下其中一个约束: + + + Each element of this collection should satisfy its own set of constraints. + 该集合内的每个元素需符合元素本身规定的约束。 + + + This value is not a valid International Securities Identification Number (ISIN). + 该值不是有效的国际证券识别码 (ISIN)。 + + + This value should be a valid expression. + 该值需为一个有效的表达式。 + + + This value is not a valid CSS color. + 该值不是有效的CSS颜色。 + + + This value is not a valid CIDR notation. + 该值不是一个有效的CIDR表示。 + + + The value of the netmask should be between {{ min }} and {{ max }}. + 网络掩码的值应当在 {{ min }} 和 {{ max }} 之间。 + + + + diff --git a/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf b/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf new file mode 100644 index 0000000..b1f7fb4 --- /dev/null +++ b/vendor/symfony/validator/Resources/translations/validators.zh_TW.xlf @@ -0,0 +1,407 @@ + + + + + + This value should be false. + 該變數的值應為 false 。 + + + This value should be true. + 該變數的值應為 true 。 + + + This value should be of type {{ type }}. + 該變數的類型應為 {{ type }} 。 + + + This value should be blank. + 該變數應為空。 + + + The value you selected is not a valid choice. + 選定變數的值不是有效的選項。 + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + 您至少要選擇 {{ limit }} 個選項。 + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + 您最多能選擇 {{ limit }} 個選項。 + + + One or more of the given values is invalid. + 一個或者多個給定的值無效。 + + + This field was not expected. + 此字段是沒有預料到。 + + + This field is missing. + 此字段缺失。 + + + This value is not a valid date. + 該值不是一個有效的日期(date)。 + + + This value is not a valid datetime. + 該值不是一個有效的日期時間(datetime)。 + + + This value is not a valid email address. + 該值不是一個有效的郵件地址。 + + + The file could not be found. + 找不到檔案。 + + + The file is not readable. + 無法讀取檔案。 + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + 檔案太大 ({{ size }} {{ suffix }})。檔案大小不可以超過 {{ limit }} {{ suffix }} 。 + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + 無效的檔案類型 ({{ type }}) 。允許的檔案類型有 {{ types }} 。 + + + This value should be {{ limit }} or less. + 這個變數的值應該小於或等於 {{ limit }}。 + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + 字串太長,長度不可超過 {{ limit }} 個字元。 + + + This value should be {{ limit }} or more. + 該變數的值應該大於或等於 {{ limit }}。 + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + 字串太短,長度不可少於 {{ limit }} 個字元。 + + + This value should not be blank. + 該變數不應為空白。 + + + This value should not be null. + 該值不應為 null 。 + + + This value should be null. + 該值應為 null 。 + + + This value is not valid. + 無效的數值 。 + + + This value is not a valid time. + 該值不是一個有效的時間。 + + + This value is not a valid URL. + 該值不是一個有效的 URL 。 + + + The two values should be equal. + 這兩個變數的值應該相等。 + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + 檔案太大,檔案大小不可以超過 {{ limit }} {{ suffix }}。 + + + The file is too large. + 檔案太大。 + + + The file could not be uploaded. + 無法上傳此檔案。 + + + This value should be a valid number. + 該值應該為有效的數字。 + + + This file is not a valid image. + 該檔案不是有效的圖片。 + + + This is not a valid IP address. + 該值不是有效的IP地址。 + + + This value is not a valid language. + 該值不是有效的語言名。 + + + This value is not a valid locale. + 該值不是有效的區域值(locale)。 + + + This value is not a valid country. + 該值不是有效的國家名。 + + + This value is already used. + 該值已經被使用。 + + + The size of the image could not be detected. + 不能解析圖片大小。 + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + 圖片太寬 ({{ width }}px),最大寬度為 {{ max_width }}px 。 + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + 圖片寬度不夠 ({{ width }}px),最小寬度為 {{ min_width }}px 。 + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + 圖片太高 ({{ height }}px),最大高度為 {{ max_height }}px 。 + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + 圖片高度不夠 ({{ height }}px),最小高度為 {{ min_height }}px 。 + + + This value should be the user's current password. + 該變數的值應為用戶目前的密碼。 + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + 該變數應為 {{ limit }} 個字元。 + + + The file was only partially uploaded. + 該檔案的上傳不完整。 + + + No file was uploaded. + 沒有上傳任何檔案。 + + + No temporary folder was configured in php.ini. + php.ini 裡沒有配置臨時目錄。 + + + Cannot write temporary file to disk. + 暫存檔寫入磁碟失敗。 + + + A PHP extension caused the upload to fail. + 某個 PHP 擴展造成上傳失敗。 + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + 該集合最少應包含 {{ limit }} 個元素。 + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + 該集合最多包含 {{ limit }} 個元素。 + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + 該集合應包含 {{ limit }} 個元素 element 。 + + + Invalid card number. + 無效的信用卡號。 + + + Unsupported card type or invalid card number. + 不支援的信用卡類型或無效的信用卡號。 + + + This is not a valid International Bank Account Number (IBAN). + 該值不是有效的國際銀行帳號(IBAN)。 + + + This value is not a valid ISBN-10. + 該值不是有效的10位國際標準書號(ISBN-10)。 + + + This value is not a valid ISBN-13. + 該值不是有效的13位國際標準書號(ISBN-13)。 + + + This value is neither a valid ISBN-10 nor a valid ISBN-13. + 該值不是有效的國際標準書號(ISBN-10 或 ISBN-13)。 + + + This value is not a valid ISSN. + 該值不是有效的國際標準期刊號(ISSN)。 + + + This value is not a valid currency. + 該值不是有效的貨幣名(currency)。 + + + This value should be equal to {{ compared_value }}. + 該值應等於 {{ compared_value }} 。 + + + This value should be greater than {{ compared_value }}. + 該值應大於 {{ compared_value }} 。 + + + This value should be greater than or equal to {{ compared_value }}. + 該值應大於或等於 {{ compared_value }} 。 + + + This value should be identical to {{ compared_value_type }} {{ compared_value }}. + 該值應與 {{ compared_value_type }} {{ compared_value }} 相同。 + + + This value should be less than {{ compared_value }}. + 該值應小於 {{ compared_value }} 。 + + + This value should be less than or equal to {{ compared_value }}. + 該值應小於或等於 {{ compared_value }} 。 + + + This value should not be equal to {{ compared_value }}. + 該值應不等於 {{ compared_value }} 。 + + + This value should not be identical to {{ compared_value_type }} {{ compared_value }}. + 該值不應與 {{ compared_value_type }} {{ compared_value }} 相同。 + + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + 圖像格式過大 ({{ ratio }})。 最大允許尺寸 {{ max_ratio }}。 + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + 圖像格式過小 ({{ ratio }})。最小尺寸 {{ min_ratio }}。 + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + 方形圖像 ({{ width }}x{{ height }}px)。不接受方形圖像。 + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + 紀念冊布局圖像 ({{ width }}x{{ height }}px)。 不接受紀念冊布局圖像。 + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + 書籍布局圖像 ({{ width }}x{{ height }}px)。不接受圖像書籍布局。 + + + An empty file is not allowed. + 不接受空白文件。 + + + The host could not be resolved. + 未找到服務器。 + + + This value does not match the expected {{ charset }} charset. + 該數值不符合預期 {{ charset }} 符號編碼。 + + + This is not a valid Business Identifier Code (BIC). + 無效企業識別碼 (BIC)。 + + + Error. + 錯誤。 + + + This is not a valid UUID. + 無效的通用唯壹標識符 (UUID)。 + + + This value should be a multiple of {{ compared_value }}. + 該值必須是倍數 {{ compared_value }}。 + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + 該企業識別碼 (BIC) 與銀行賬戶國際編號不壹致 (IBAN) {{ iban }}。 + + + This value should be valid JSON. + 該數值必須序列化為JSON格式。 + + + This collection should contain only unique elements. + 該集合應僅包含唯壹元素。 + + + This value should be positive. + 數值應為正數。 + + + This value should be either positive or zero. + 數值應是正數,或為零。 + + + This value should be negative. + 數值應為負數。 + + + This value should be either negative or zero. + 數值應是負數,或為零。 + + + This value is not a valid timezone. + 無效時區。 + + + This password has been leaked in a data breach, it must not be used. Please use another password. + 此密碼已被泄露,切勿使用。請更換密碼。 + + + This value should be between {{ min }} and {{ max }}. + 該數值應在 {{ min }} 和 {{ max }} 之間。 + + + This value is not a valid hostname. + 該數值不是有效的主機名稱。 + + + The number of elements in this collection should be a multiple of {{ compared_value }}. + 該集合內的元素數量得是 {{ compared_value }} 的倍數。 + + + This value should satisfy at least one of the following constraints: + 該數值需符合以下其中一個約束: + + + Each element of this collection should satisfy its own set of constraints. + 該集合內的每個元素需符合元素本身規定的約束。 + + + This value is not a valid International Securities Identification Number (ISIN). + 該數值不是有效的國際證券識別碼 (ISIN)。 + + + This value should be a valid expression. + 該值需為一個有效的表達式。 + + + This value is not a valid CSS color. + 該值不是有效的CSS顏色。 + + + This value is not a valid CIDR notation. + 該值不是一個有效的CIDR表示。 + + + The value of the netmask should be between {{ min }} and {{ max }}. + 網絡掩碼的值應當在 {{ min }} 和 {{ max }} 之間。 + + + + diff --git a/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php b/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php new file mode 100644 index 0000000..bee4639 --- /dev/null +++ b/vendor/symfony/validator/Test/ConstraintValidatorTestCase.php @@ -0,0 +1,584 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Test; + +use PHPUnit\Framework\Assert; +use PHPUnit\Framework\Constraint\IsIdentical; +use PHPUnit\Framework\Constraint\IsInstanceOf; +use PHPUnit\Framework\Constraint\IsNull; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\ExpectationFailedException; +use PHPUnit\Framework\TestCase; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintValidatorInterface; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationInterface; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\ConstraintViolationListInterface; +use Symfony\Component\Validator\Context\ExecutionContext; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\PropertyMetadata; +use Symfony\Component\Validator\Validator\ContextualValidatorInterface; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * A test case to ease testing Constraint Validators. + * + * @author Bernhard Schussek + */ +abstract class ConstraintValidatorTestCase extends TestCase +{ + /** + * @var ExecutionContextInterface + */ + protected $context; + + /** + * @var ConstraintValidatorInterface + */ + protected $validator; + + protected $group; + protected $metadata; + protected $object; + protected $value; + protected $root; + protected $propertyPath; + protected $constraint; + protected $defaultTimezone; + private $defaultLocale; + private $expectedViolations; + private $call; + + protected function setUp(): void + { + $this->group = 'MyGroup'; + $this->metadata = null; + $this->object = null; + $this->value = 'InvalidValue'; + $this->root = 'root'; + $this->propertyPath = 'property.path'; + + // Initialize the context with some constraint so that we can + // successfully build a violation. + $this->constraint = new NotNull(); + + $this->context = $this->createContext(); + $this->validator = $this->createValidator(); + $this->validator->initialize($this->context); + + $this->defaultLocale = \Locale::getDefault(); + \Locale::setDefault('en'); + + $this->expectedViolations = []; + $this->call = 0; + + $this->setDefaultTimezone('UTC'); + } + + protected function tearDown(): void + { + $this->restoreDefaultTimezone(); + + \Locale::setDefault($this->defaultLocale); + } + + protected function setDefaultTimezone(?string $defaultTimezone) + { + // Make sure this method cannot be called twice before calling + // also restoreDefaultTimezone() + if (null === $this->defaultTimezone) { + $this->defaultTimezone = date_default_timezone_get(); + date_default_timezone_set($defaultTimezone); + } + } + + protected function restoreDefaultTimezone() + { + if (null !== $this->defaultTimezone) { + date_default_timezone_set($this->defaultTimezone); + $this->defaultTimezone = null; + } + } + + protected function createContext() + { + $translator = $this->createMock(TranslatorInterface::class); + $translator->expects($this->any())->method('trans')->willReturnArgument(0); + $validator = $this->createMock(ValidatorInterface::class); + $validator->expects($this->any()) + ->method('validate') + ->willReturnCallback(function () { + return $this->expectedViolations[$this->call++] ?? new ConstraintViolationList(); + }); + + $context = new ExecutionContext($validator, $this->root, $translator); + $context->setGroup($this->group); + $context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + $context->setConstraint($this->constraint); + + $contextualValidator = $this->getMockBuilder(AssertingContextualValidator::class) + ->setConstructorArgs([$context]) + ->setMethods([ + 'atPath', + 'validate', + 'validateProperty', + 'validatePropertyValue', + 'getViolations', + ]) + ->getMock(); + $contextualValidator->expects($this->any()) + ->method('atPath') + ->willReturnCallback(function ($path) use ($contextualValidator) { + return $contextualValidator->doAtPath($path); + }); + $contextualValidator->expects($this->any()) + ->method('validate') + ->willReturnCallback(function ($value, $constraints = null, $groups = null) use ($contextualValidator) { + return $contextualValidator->doValidate($value, $constraints, $groups); + }); + $contextualValidator->expects($this->any()) + ->method('validateProperty') + ->willReturnCallback(function ($object, $propertyName, $groups = null) use ($contextualValidator) { + return $contextualValidator->validateProperty($object, $propertyName, $groups); + }); + $contextualValidator->expects($this->any()) + ->method('validatePropertyValue') + ->willReturnCallback(function ($objectOrClass, $propertyName, $value, $groups = null) use ($contextualValidator) { + return $contextualValidator->doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups); + }); + $contextualValidator->expects($this->any()) + ->method('getViolations') + ->willReturnCallback(function () use ($contextualValidator) { + return $contextualValidator->doGetViolations(); + }); + $validator->expects($this->any()) + ->method('inContext') + ->with($context) + ->willReturn($contextualValidator); + + return $context; + } + + protected function setGroup(?string $group) + { + $this->group = $group; + $this->context->setGroup($group); + } + + protected function setObject($object) + { + $this->object = $object; + $this->metadata = \is_object($object) + ? new ClassMetadata(\get_class($object)) + : null; + + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setProperty($object, $property) + { + $this->object = $object; + $this->metadata = \is_object($object) + ? new PropertyMetadata(\get_class($object), $property) + : null; + + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setValue($value) + { + $this->value = $value; + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function setRoot($root) + { + $this->root = $root; + $this->context = $this->createContext(); + $this->validator->initialize($this->context); + } + + protected function setPropertyPath(string $propertyPath) + { + $this->propertyPath = $propertyPath; + $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); + } + + protected function expectNoValidate() + { + $validator = $this->context->getValidator()->inContext($this->context); + $validator->expectNoValidate(); + } + + protected function expectValidateAt(int $i, string $propertyPath, $value, $group) + { + $validator = $this->context->getValidator()->inContext($this->context); + $validator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) { + $expectedConstraints = new LogicalOr(); + $expectedConstraints->setConstraints([new IsNull(), new IsIdentical([]), new IsInstanceOf(Valid::class)]); + + Assert::assertThat($passedConstraints, $expectedConstraints); + }); + } + + protected function expectValidateValue(int $i, $value, array $constraints = [], $group = null) + { + $contextualValidator = $this->context->getValidator()->inContext($this->context); + $contextualValidator->expectValidation($i, null, $value, $group, function ($passedConstraints) use ($constraints) { + if (\is_array($constraints) && !\is_array($passedConstraints)) { + $passedConstraints = [$passedConstraints]; + } + + Assert::assertEquals($constraints, $passedConstraints); + }); + } + + protected function expectFailingValueValidation(int $i, $value, array $constraints, $group, ConstraintViolationInterface $violation) + { + $contextualValidator = $this->context->getValidator()->inContext($this->context); + $contextualValidator->expectValidation($i, null, $value, $group, function ($passedConstraints) use ($constraints) { + if (\is_array($constraints) && !\is_array($passedConstraints)) { + $passedConstraints = [$passedConstraints]; + } + + Assert::assertEquals($constraints, $passedConstraints); + }, $violation); + } + + protected function expectValidateValueAt(int $i, string $propertyPath, $value, $constraints, $group = null) + { + $contextualValidator = $this->context->getValidator()->inContext($this->context); + $contextualValidator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) use ($constraints) { + Assert::assertEquals($constraints, $passedConstraints); + }); + } + + protected function expectViolationsAt($i, $value, Constraint $constraint) + { + $context = $this->createContext(); + + $validatorClassname = $constraint->validatedBy(); + + $validator = new $validatorClassname(); + $validator->initialize($context); + $validator->validate($value, $constraint); + + $this->expectedViolations[] = $context->getViolations(); + + return $context->getViolations(); + } + + protected function assertNoViolation() + { + $this->assertSame(0, $violationsCount = \count($this->context->getViolations()), sprintf('0 violation expected. Got %u.', $violationsCount)); + } + + /** + * @return ConstraintViolationAssertion + */ + protected function buildViolation($message) + { + return new ConstraintViolationAssertion($this->context, $message, $this->constraint); + } + + abstract protected function createValidator(); +} + +final class ConstraintViolationAssertion +{ + /** + * @var ExecutionContextInterface + */ + private $context; + + /** + * @var ConstraintViolationAssertion[] + */ + private $assertions; + + private $message; + private $parameters = []; + private $invalidValue = 'InvalidValue'; + private $propertyPath = 'property.path'; + private $plural; + private $code; + private $constraint; + private $cause; + + /** + * @internal + */ + public function __construct(ExecutionContextInterface $context, string $message, Constraint $constraint = null, array $assertions = []) + { + $this->context = $context; + $this->message = $message; + $this->constraint = $constraint; + $this->assertions = $assertions; + } + + /** + * @return $this + */ + public function atPath(string $path) + { + $this->propertyPath = $path; + + return $this; + } + + /** + * @return $this + */ + public function setParameter(string $key, string $value) + { + $this->parameters[$key] = $value; + + return $this; + } + + /** + * @return $this + */ + public function setParameters(array $parameters) + { + $this->parameters = $parameters; + + return $this; + } + + /** + * @return $this + */ + public function setTranslationDomain($translationDomain) + { + // no-op for BC + + return $this; + } + + /** + * @return $this + */ + public function setInvalidValue($invalidValue) + { + $this->invalidValue = $invalidValue; + + return $this; + } + + /** + * @return $this + */ + public function setPlural(int $number) + { + $this->plural = $number; + + return $this; + } + + /** + * @return $this + */ + public function setCode(string $code) + { + $this->code = $code; + + return $this; + } + + /** + * @return $this + */ + public function setCause($cause) + { + $this->cause = $cause; + + return $this; + } + + public function buildNextViolation(string $message): self + { + $assertions = $this->assertions; + $assertions[] = $this; + + return new self($this->context, $message, $this->constraint, $assertions); + } + + public function assertRaised() + { + $expected = []; + foreach ($this->assertions as $assertion) { + $expected[] = $assertion->getViolation(); + } + $expected[] = $this->getViolation(); + + $violations = iterator_to_array($this->context->getViolations()); + + Assert::assertSame($expectedCount = \count($expected), $violationsCount = \count($violations), sprintf('%u violation(s) expected. Got %u.', $expectedCount, $violationsCount)); + + reset($violations); + + foreach ($expected as $violation) { + Assert::assertEquals($violation, current($violations)); + next($violations); + } + } + + private function getViolation(): ConstraintViolation + { + return new ConstraintViolation( + $this->message, + $this->message, + $this->parameters, + $this->context->getRoot(), + $this->propertyPath, + $this->invalidValue, + $this->plural, + $this->code, + $this->constraint, + $this->cause + ); + } +} + +/** + * @internal + */ +class AssertingContextualValidator implements ContextualValidatorInterface +{ + private $context; + private $expectNoValidate = false; + private $atPathCalls = -1; + private $expectedAtPath = []; + private $validateCalls = -1; + private $expectedValidate = []; + + public function __construct(ExecutionContextInterface $context) + { + $this->context = $context; + } + + public function __destruct() + { + if ($this->expectedAtPath) { + throw new ExpectationFailedException('Some expected validation calls for paths were not done.'); + } + + if ($this->expectedValidate) { + throw new ExpectationFailedException('Some expected validation calls for values were not done.'); + } + } + + public function atPath(string $path) + { + } + + /** + * @return $this + */ + public function doAtPath(string $path) + { + Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.'); + + if (!isset($this->expectedAtPath[++$this->atPathCalls])) { + throw new ExpectationFailedException(sprintf('Validation for property path "%s" was not expected.', $path)); + } + + $expectedPath = $this->expectedAtPath[$this->atPathCalls]; + unset($this->expectedAtPath[$this->atPathCalls]); + + Assert::assertSame($expectedPath, $path); + + return $this; + } + + public function validate($value, $constraints = null, $groups = null) + { + } + + /** + * @return $this + */ + public function doValidate($value, $constraints = null, $groups = null) + { + Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.'); + + if (!isset($this->expectedValidate[++$this->validateCalls])) { + return $this; + } + + [$expectedValue, $expectedGroup, $expectedConstraints, $violation] = $this->expectedValidate[$this->validateCalls]; + unset($this->expectedValidate[$this->validateCalls]); + + Assert::assertSame($expectedValue, $value); + $expectedConstraints($constraints); + Assert::assertSame($expectedGroup, $groups); + + if (null !== $violation) { + $this->context->addViolation($violation->getMessage(), $violation->getParameters()); + } + + return $this; + } + + public function validateProperty(object $object, string $propertyName, $groups = null) + { + } + + /** + * @return $this + */ + public function doValidateProperty(object $object, string $propertyName, $groups = null) + { + return $this; + } + + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) + { + } + + /** + * @return $this + */ + public function doValidatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) + { + return $this; + } + + public function getViolations(): ConstraintViolationListInterface + { + } + + public function doGetViolations() + { + return $this->context->getViolations(); + } + + public function expectNoValidate() + { + $this->expectNoValidate = true; + } + + public function expectValidation(string $call, ?string $propertyPath, $value, $group, callable $constraints, ConstraintViolationInterface $violation = null) + { + if (null !== $propertyPath) { + $this->expectedAtPath[$call] = $propertyPath; + } + + $this->expectedValidate[$call] = [$value, $group, $constraints, $violation]; + } +} diff --git a/vendor/symfony/validator/Util/PropertyPath.php b/vendor/symfony/validator/Util/PropertyPath.php new file mode 100644 index 0000000..973b6f2 --- /dev/null +++ b/vendor/symfony/validator/Util/PropertyPath.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Util; + +/** + * Contains utility methods for dealing with property paths. + * + * For more extensive functionality, use Symfony's PropertyAccess component. + * + * @author Bernhard Schussek + */ +class PropertyPath +{ + /** + * Appends a path to a given property path. + * + * If the base path is empty, the appended path will be returned unchanged. + * If the base path is not empty, and the appended path starts with a + * squared opening bracket ("["), the concatenation of the two paths is + * returned. Otherwise, the concatenation of the two paths is returned, + * separated by a dot ("."). + * + * @return string + */ + public static function append(string $basePath, string $subPath) + { + if ('' !== $subPath) { + if ('[' === $subPath[0]) { + return $basePath.$subPath; + } + + return '' !== $basePath ? $basePath.'.'.$subPath : $subPath; + } + + return $basePath; + } + + /** + * Not instantiable. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/validator/Validation.php b/vendor/symfony/validator/Validation.php new file mode 100644 index 0000000..4d08072 --- /dev/null +++ b/vendor/symfony/validator/Validation.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Symfony\Component\Validator\Exception\ValidationFailedException; +use Symfony\Component\Validator\Validator\ValidatorInterface; + +/** + * Entry point for the Validator component. + * + * @author Bernhard Schussek + */ +final class Validation +{ + /** + * Creates a callable chain of constraints. + * + * @param Constraint|ValidatorInterface|null $constraintOrValidator + * + * @return callable($value) + */ + public static function createCallable($constraintOrValidator = null, Constraint ...$constraints): callable + { + $validator = self::createIsValidCallable($constraintOrValidator, ...$constraints); + + return static function ($value) use ($validator) { + if (!$validator($value, $violations)) { + throw new ValidationFailedException($value, $violations); + } + + return $value; + }; + } + + /** + * Creates a callable that returns true/false instead of throwing validation exceptions. + * + * @param Constraint|ValidatorInterface|null $constraintOrValidator + * + * @return callable($value, &$violations = null): bool + */ + public static function createIsValidCallable($constraintOrValidator = null, Constraint ...$constraints): callable + { + $validator = $constraintOrValidator; + + if ($constraintOrValidator instanceof Constraint) { + $constraints = \func_get_args(); + $validator = null; + } elseif (null !== $constraintOrValidator && !$constraintOrValidator instanceof ValidatorInterface) { + throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a "%s" or a "%s" object, "%s" given.', __METHOD__, Constraint::class, ValidatorInterface::class, get_debug_type($constraintOrValidator))); + } + + $validator = $validator ?? self::createValidator(); + + return static function ($value, &$violations = null) use ($constraints, $validator) { + $violations = $validator->validate($value, $constraints); + + return 0 === $violations->count(); + }; + } + + /** + * Creates a new validator. + * + * If you want to configure the validator, use + * {@link createValidatorBuilder()} instead. + */ + public static function createValidator(): ValidatorInterface + { + return self::createValidatorBuilder()->getValidator(); + } + + /** + * Creates a configurable builder for validator objects. + */ + public static function createValidatorBuilder(): ValidatorBuilder + { + return new ValidatorBuilder(); + } + + /** + * This class cannot be instantiated. + */ + private function __construct() + { + } +} diff --git a/vendor/symfony/validator/Validator/ContextualValidatorInterface.php b/vendor/symfony/validator/Validator/ContextualValidatorInterface.php new file mode 100644 index 0000000..1063a53 --- /dev/null +++ b/vendor/symfony/validator/Validator/ContextualValidatorInterface.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\ConstraintViolationListInterface; + +/** + * A validator in a specific execution context. + * + * @author Bernhard Schussek + */ +interface ContextualValidatorInterface +{ + /** + * Appends the given path to the property path of the context. + * + * If called multiple times, the path will always be reset to the context's + * original path with the given path appended to it. + * + * @return $this + */ + public function atPath(string $path); + + /** + * Validates a value against a constraint or a list of constraints. + * + * If no constraint is passed, the constraint + * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. + * + * @param mixed $value The value to validate + * @param Constraint|Constraint[]|null $constraints The constraint(s) to validate against + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return $this + */ + public function validate($value, $constraints = null, $groups = null); + + /** + * Validates a property of an object against the constraints specified + * for this property. + * + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return $this + */ + public function validateProperty(object $object, string $propertyName, $groups = null); + + /** + * Validates a value against the constraints specified for an object's + * property. + * + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return $this + */ + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null); + + /** + * Returns the violations that have been generated so far in the context + * of the validator. + * + * @return ConstraintViolationListInterface + */ + public function getViolations(); +} diff --git a/vendor/symfony/validator/Validator/LazyProperty.php b/vendor/symfony/validator/Validator/LazyProperty.php new file mode 100644 index 0000000..a70eeed --- /dev/null +++ b/vendor/symfony/validator/Validator/LazyProperty.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +/** + * A wrapper for a callable initializing a property from a getter. + * + * @internal + */ +class LazyProperty +{ + private $propertyValueCallback; + + public function __construct(\Closure $propertyValueCallback) + { + $this->propertyValueCallback = $propertyValueCallback; + } + + public function getPropertyValue() + { + return ($this->propertyValueCallback)(); + } +} diff --git a/vendor/symfony/validator/Validator/RecursiveContextualValidator.php b/vendor/symfony/validator/Validator/RecursiveContextualValidator.php new file mode 100644 index 0000000..7380171 --- /dev/null +++ b/vendor/symfony/validator/Validator/RecursiveContextualValidator.php @@ -0,0 +1,782 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Composite; +use Symfony\Component\Validator\Constraints\Existence; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContext; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; +use Symfony\Component\Validator\Exception\NoSuchMetadataException; +use Symfony\Component\Validator\Exception\RuntimeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; +use Symfony\Component\Validator\Exception\UnsupportedMetadataException; +use Symfony\Component\Validator\Exception\ValidatorException; +use Symfony\Component\Validator\Mapping\CascadingStrategy; +use Symfony\Component\Validator\Mapping\ClassMetadataInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; +use Symfony\Component\Validator\Mapping\GenericMetadata; +use Symfony\Component\Validator\Mapping\GetterMetadata; +use Symfony\Component\Validator\Mapping\MetadataInterface; +use Symfony\Component\Validator\Mapping\PropertyMetadataInterface; +use Symfony\Component\Validator\Mapping\TraversalStrategy; +use Symfony\Component\Validator\ObjectInitializerInterface; +use Symfony\Component\Validator\Util\PropertyPath; + +/** + * Recursive implementation of {@link ContextualValidatorInterface}. + * + * @author Bernhard Schussek + */ +class RecursiveContextualValidator implements ContextualValidatorInterface +{ + private $context; + private $defaultPropertyPath; + private $defaultGroups; + private $metadataFactory; + private $validatorFactory; + private $objectInitializers; + + /** + * Creates a validator for the given context. + * + * @param ObjectInitializerInterface[] $objectInitializers The object initializers + */ + public function __construct(ExecutionContextInterface $context, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = []) + { + $this->context = $context; + $this->defaultPropertyPath = $context->getPropertyPath(); + $this->defaultGroups = [$context->getGroup() ?: Constraint::DEFAULT_GROUP]; + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->objectInitializers = $objectInitializers; + } + + /** + * {@inheritdoc} + */ + public function atPath(string $path) + { + $this->defaultPropertyPath = $this->context->getPropertyPath($path); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validate($value, $constraints = null, $groups = null) + { + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + $previousConstraint = null; + + if ($this->context instanceof ExecutionContext || method_exists($this->context, 'getConstraint')) { + $previousConstraint = $this->context->getConstraint(); + } + + // If explicit constraints are passed, validate the value against + // those constraints + if (null !== $constraints) { + // You can pass a single constraint or an array of constraints + // Make sure to deal with an array in the rest of the code + if (!\is_array($constraints)) { + $constraints = [$constraints]; + } + + $metadata = new GenericMetadata(); + $metadata->addConstraints($constraints); + + $this->validateGenericNode( + $value, + $previousObject, + \is_object($value) ? $this->generateCacheKey($value) : null, + $metadata, + $this->defaultPropertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + if (null !== $previousConstraint) { + $this->context->setConstraint($previousConstraint); + } + + return $this; + } + + // If an object is passed without explicit constraints, validate that + // object against the constraints defined for the object's class + if (\is_object($value)) { + $this->validateObject( + $value, + $this->defaultPropertyPath, + $groups, + TraversalStrategy::IMPLICIT, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + // If an array is passed without explicit constraints, validate each + // object in the array + if (\is_array($value)) { + $this->validateEachObjectIn( + $value, + $this->defaultPropertyPath, + $groups, + $this->context + ); + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + throw new RuntimeException(sprintf('Cannot validate values of type "%s" automatically. Please provide a constraint.', get_debug_type($value))); + } + + /** + * {@inheritdoc} + */ + public function validateProperty(object $object, string $propertyName, $groups = null) + { + $classMetadata = $this->metadataFactory->getMetadataFor($object); + + if (!$classMetadata instanceof ClassMetadataInterface) { + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', get_debug_type($classMetadata))); + } + + $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + $cacheKey = $this->generateCacheKey($object); + $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + + foreach ($propertyMetadatas as $propertyMetadata) { + $propertyValue = $propertyMetadata->getPropertyValue($object); + + $this->validateGenericNode( + $propertyValue, + $object, + $cacheKey.':'.\get_class($object).':'.$propertyName, + $propertyMetadata, + $propertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + } + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) + { + $classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass); + + if (!$classMetadata instanceof ClassMetadataInterface) { + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', get_debug_type($classMetadata))); + } + + $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); + $groups = $groups ? $this->normalizeGroups($groups) : $this->defaultGroups; + + if (\is_object($objectOrClass)) { + $object = $objectOrClass; + $class = \get_class($object); + $cacheKey = $this->generateCacheKey($objectOrClass); + $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName); + } else { + // $objectOrClass contains a class name + $object = null; + $class = $objectOrClass; + $cacheKey = null; + $propertyPath = $this->defaultPropertyPath; + } + + $previousValue = $this->context->getValue(); + $previousObject = $this->context->getObject(); + $previousMetadata = $this->context->getMetadata(); + $previousPath = $this->context->getPropertyPath(); + $previousGroup = $this->context->getGroup(); + + foreach ($propertyMetadatas as $propertyMetadata) { + $this->validateGenericNode( + $value, + $object, + $cacheKey.':'.$class.':'.$propertyName, + $propertyMetadata, + $propertyPath, + $groups, + null, + TraversalStrategy::IMPLICIT, + $this->context + ); + } + + $this->context->setNode($previousValue, $previousObject, $previousMetadata, $previousPath); + $this->context->setGroup($previousGroup); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getViolations() + { + return $this->context->getViolations(); + } + + /** + * Normalizes the given group or list of groups to an array. + * + * @param string|GroupSequence|array $groups The groups to normalize + * + * @return array + */ + protected function normalizeGroups($groups) + { + if (\is_array($groups)) { + return $groups; + } + + return [$groups]; + } + + /** + * Validates an object against the constraints defined for its class. + * + * If no metadata is available for the class, but the class is an instance + * of {@link \Traversable} and the selected traversal strategy allows + * traversal, the object will be iterated and each nested object will be + * validated instead. + * + * @throws NoSuchMetadataException If the object has no associated metadata + * and does not implement {@link \Traversable} + * or if traversal is disabled via the + * $traversalStrategy argument + * @throws UnsupportedMetadataException If the metadata returned by the + * metadata factory does not implement + * {@link ClassMetadataInterface} + */ + private function validateObject(object $object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context) + { + try { + $classMetadata = $this->metadataFactory->getMetadataFor($object); + + if (!$classMetadata instanceof ClassMetadataInterface) { + throw new UnsupportedMetadataException(sprintf('The metadata factory should return instances of "Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', get_debug_type($classMetadata))); + } + + $this->validateClassNode( + $object, + $this->generateCacheKey($object), + $classMetadata, + $propertyPath, + $groups, + null, + $traversalStrategy, + $context + ); + } catch (NoSuchMetadataException $e) { + // Rethrow if not Traversable + if (!$object instanceof \Traversable) { + throw $e; + } + + // Rethrow unless IMPLICIT or TRAVERSE + if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { + throw $e; + } + + $this->validateEachObjectIn( + $object, + $propertyPath, + $groups, + $context + ); + } + } + + /** + * Validates each object in a collection against the constraints defined + * for their classes. + * + * Nested arrays are also iterated. + */ + private function validateEachObjectIn(iterable $collection, string $propertyPath, array $groups, ExecutionContextInterface $context) + { + foreach ($collection as $key => $value) { + if (\is_array($value)) { + // Also traverse nested arrays + $this->validateEachObjectIn( + $value, + $propertyPath.'['.$key.']', + $groups, + $context + ); + + continue; + } + + // Scalar and null values in the collection are ignored + if (\is_object($value)) { + $this->validateObject( + $value, + $propertyPath.'['.$key.']', + $groups, + TraversalStrategy::IMPLICIT, + $context + ); + } + } + } + + /** + * Validates a class node. + * + * A class node is a combination of an object with a {@link ClassMetadataInterface} + * instance. Each class node (conceptionally) has zero or more succeeding + * property nodes: + * + * (Article:class node) + * \ + * ($title:property node) + * + * This method validates the passed objects against all constraints defined + * at class level. It furthermore triggers the validation of each of the + * class' properties against the constraints for that property. + * + * If the selected traversal strategy allows traversal, the object is + * iterated and each nested object is validated against its own constraints. + * The object is not traversed if traversal is disabled in the class + * metadata. + * + * If the passed groups contain the group "Default", the validator will + * check whether the "Default" group has been replaced by a group sequence + * in the class metadata. If this is the case, the group sequence is + * validated instead. + * + * @throws UnsupportedMetadataException If a property metadata does not + * implement {@link PropertyMetadataInterface} + * @throws ConstraintDefinitionException If traversal was enabled but the + * object does not implement + * {@link \Traversable} + * + * @see TraversalStrategy + */ + private function validateClassNode(object $object, ?string $cacheKey, ClassMetadataInterface $metadata, string $propertyPath, array $groups, ?array $cascadedGroups, int $traversalStrategy, ExecutionContextInterface $context) + { + $context->setNode($object, $object, $metadata, $propertyPath); + + if (!$context->isObjectInitialized($cacheKey)) { + foreach ($this->objectInitializers as $initializer) { + $initializer->initialize($object); + } + + $context->markObjectAsInitialized($cacheKey); + } + + foreach ($groups as $key => $group) { + // If the "Default" group is replaced by a group sequence, remember + // to cascade the "Default" group when traversing the group + // sequence + $defaultOverridden = false; + + // Use the object hash for group sequences + $groupHash = \is_object($group) ? $this->generateCacheKey($group, true) : $group; + + if ($context->isGroupValidated($cacheKey, $groupHash)) { + // Skip this group when validating the properties and when + // traversing the object + unset($groups[$key]); + + continue; + } + + $context->markGroupAsValidated($cacheKey, $groupHash); + + // Replace the "Default" group by the group sequence defined + // for the class, if applicable. + // This is done after checking the cache, so that + // spl_object_hash() isn't called for this sequence and + // "Default" is used instead in the cache. This is useful + // if the getters below return different group sequences in + // every call. + if (Constraint::DEFAULT_GROUP === $group) { + if ($metadata->hasGroupSequence()) { + // The group sequence is statically defined for the class + $group = $metadata->getGroupSequence(); + $defaultOverridden = true; + } elseif ($metadata->isGroupSequenceProvider()) { + // The group sequence is dynamically obtained from the validated + // object + /* @var \Symfony\Component\Validator\GroupSequenceProviderInterface $object */ + $group = $object->getGroupSequence(); + $defaultOverridden = true; + + if (!$group instanceof GroupSequence) { + $group = new GroupSequence($group); + } + } + } + + // If the groups (=[,G3,G4]) contain a group sequence + // (=), then call validateClassNode() with each entry of the + // group sequence and abort if necessary (G1, G2) + if ($group instanceof GroupSequence) { + $this->stepThroughGroupSequence( + $object, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + $defaultOverridden ? Constraint::DEFAULT_GROUP : null, + $context + ); + + // Skip the group sequence when validating properties, because + // stepThroughGroupSequence() already validates the properties + unset($groups[$key]); + + continue; + } + + $this->validateInGroup($object, $cacheKey, $metadata, $group, $context); + } + + // If no more groups should be validated for the property nodes, + // we can safely quit + if (0 === \count($groups)) { + return; + } + + // Validate all properties against their constraints + foreach ($metadata->getConstrainedProperties() as $propertyName) { + // If constraints are defined both on the getter of a property as + // well as on the property itself, then getPropertyMetadata() + // returns two metadata objects, not just one + foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { + if (!$propertyMetadata instanceof PropertyMetadataInterface) { + throw new UnsupportedMetadataException(sprintf('The property metadata instances should implement "Symfony\Component\Validator\Mapping\PropertyMetadataInterface", got: "%s".', get_debug_type($propertyMetadata))); + } + + if ($propertyMetadata instanceof GetterMetadata) { + $propertyValue = new LazyProperty(static function () use ($propertyMetadata, $object) { + return $propertyMetadata->getPropertyValue($object); + }); + } else { + $propertyValue = $propertyMetadata->getPropertyValue($object); + } + + $this->validateGenericNode( + $propertyValue, + $object, + $cacheKey.':'.\get_class($object).':'.$propertyName, + $propertyMetadata, + PropertyPath::append($propertyPath, $propertyName), + $groups, + $cascadedGroups, + TraversalStrategy::IMPLICIT, + $context + ); + } + } + + // If no specific traversal strategy was requested when this method + // was called, use the traversal strategy of the class' metadata + if ($traversalStrategy & TraversalStrategy::IMPLICIT) { + $traversalStrategy = $metadata->getTraversalStrategy(); + } + + // Traverse only if IMPLICIT or TRAVERSE + if (!($traversalStrategy & (TraversalStrategy::IMPLICIT | TraversalStrategy::TRAVERSE))) { + return; + } + + // If IMPLICIT, stop unless we deal with a Traversable + if ($traversalStrategy & TraversalStrategy::IMPLICIT && !$object instanceof \Traversable) { + return; + } + + // If TRAVERSE, fail if we have no Traversable + if (!$object instanceof \Traversable) { + throw new ConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', get_debug_type($object))); + } + + $this->validateEachObjectIn( + $object, + $propertyPath, + $groups, + $context + ); + } + + /** + * Validates a node that is not a class node. + * + * Currently, two such node types exist: + * + * - property nodes, which consist of the value of an object's + * property together with a {@link PropertyMetadataInterface} instance + * - generic nodes, which consist of a value and some arbitrary + * constraints defined in a {@link MetadataInterface} container + * + * In both cases, the value is validated against all constraints defined + * in the passed metadata object. Then, if the value is an instance of + * {@link \Traversable} and the selected traversal strategy permits it, + * the value is traversed and each nested object validated against its own + * constraints. If the value is an array, it is traversed regardless of + * the given strategy. + * + * @see TraversalStrategy + */ + private function validateGenericNode($value, ?object $object, ?string $cacheKey, ?MetadataInterface $metadata, string $propertyPath, array $groups, ?array $cascadedGroups, int $traversalStrategy, ExecutionContextInterface $context) + { + $context->setNode($value, $object, $metadata, $propertyPath); + + foreach ($groups as $key => $group) { + if ($group instanceof GroupSequence) { + $this->stepThroughGroupSequence( + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + null, + $context + ); + + // Skip the group sequence when cascading, as the cascading + // logic is already done in stepThroughGroupSequence() + unset($groups[$key]); + + continue; + } + + $this->validateInGroup($value, $cacheKey, $metadata, $group, $context); + } + + if (0 === \count($groups)) { + return; + } + + if (null === $value) { + return; + } + + $cascadingStrategy = $metadata->getCascadingStrategy(); + + // Quit unless we cascade + if (!($cascadingStrategy & CascadingStrategy::CASCADE)) { + return; + } + + // If no specific traversal strategy was requested when this method + // was called, use the traversal strategy of the node's metadata + if ($traversalStrategy & TraversalStrategy::IMPLICIT) { + $traversalStrategy = $metadata->getTraversalStrategy(); + } + + // The $cascadedGroups property is set, if the "Default" group is + // overridden by a group sequence + // See validateClassNode() + $cascadedGroups = null !== $cascadedGroups && \count($cascadedGroups) > 0 ? $cascadedGroups : $groups; + + if ($value instanceof LazyProperty) { + $value = $value->getPropertyValue(); + + if (null === $value) { + return; + } + } + + if (\is_array($value)) { + // Arrays are always traversed, independent of the specified + // traversal strategy + $this->validateEachObjectIn( + $value, + $propertyPath, + $cascadedGroups, + $context + ); + + return; + } + + if (!\is_object($value)) { + throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: "%s".', \gettype($value))); + } + + $this->validateObject( + $value, + $propertyPath, + $cascadedGroups, + $traversalStrategy, + $context + ); + + // Currently, the traversal strategy can only be TRAVERSE for a + // generic node if the cascading strategy is CASCADE. Thus, traversable + // objects will always be handled within validateObject() and there's + // nothing more to do here. + + // see GenericMetadata::addConstraint() + } + + /** + * Sequentially validates a node's value in each group of a group sequence. + * + * If any of the constraints generates a violation, subsequent groups in the + * group sequence are skipped. + */ + private function stepThroughGroupSequence($value, ?object $object, ?string $cacheKey, ?MetadataInterface $metadata, string $propertyPath, int $traversalStrategy, GroupSequence $groupSequence, ?string $cascadedGroup, ExecutionContextInterface $context) + { + $violationCount = \count($context->getViolations()); + $cascadedGroups = $cascadedGroup ? [$cascadedGroup] : null; + + foreach ($groupSequence->groups as $groupInSequence) { + $groups = (array) $groupInSequence; + + if ($metadata instanceof ClassMetadataInterface) { + $this->validateClassNode( + $value, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context + ); + } else { + $this->validateGenericNode( + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context + ); + } + + // Abort sequence validation if a violation was generated + if (\count($context->getViolations()) > $violationCount) { + break; + } + } + } + + /** + * Validates a node's value against all constraints in the given group. + * + * @param mixed $value The validated value + */ + private function validateInGroup($value, ?string $cacheKey, MetadataInterface $metadata, string $group, ExecutionContextInterface $context) + { + $context->setGroup($group); + + foreach ($metadata->findConstraints($group) as $constraint) { + if ($constraint instanceof Existence) { + continue; + } + + // Prevent duplicate validation of constraints, in the case + // that constraints belong to multiple validated groups + if (null !== $cacheKey) { + $constraintHash = $this->generateCacheKey($constraint, true); + // instanceof Valid: In case of using a Valid constraint with many groups + // it makes a reference object get validated by each group + if ($constraint instanceof Composite || $constraint instanceof Valid) { + $constraintHash .= $group; + } + + if ($context->isConstraintValidated($cacheKey, $constraintHash)) { + continue; + } + + $context->markConstraintAsValidated($cacheKey, $constraintHash); + } + + $context->setConstraint($constraint); + + $validator = $this->validatorFactory->getInstance($constraint); + $validator->initialize($context); + + if ($value instanceof LazyProperty) { + $value = $value->getPropertyValue(); + } + + try { + $validator->validate($value, $constraint); + } catch (UnexpectedValueException $e) { + $context->buildViolation('This value should be of type {{ type }}.') + ->setParameter('{{ type }}', $e->getExpectedType()) + ->addViolation(); + } + } + } + + private function generateCacheKey(object $object, bool $dependsOnPropertyPath = false): string + { + if ($this->context instanceof ExecutionContext) { + $cacheKey = $this->context->generateCacheKey($object); + } else { + $cacheKey = spl_object_hash($object); + } + + if ($dependsOnPropertyPath) { + $cacheKey .= $this->context->getPropertyPath(); + } + + return $cacheKey; + } +} diff --git a/vendor/symfony/validator/Validator/RecursiveValidator.php b/vendor/symfony/validator/Validator/RecursiveValidator.php new file mode 100644 index 0000000..d57c908 --- /dev/null +++ b/vendor/symfony/validator/Validator/RecursiveValidator.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; +use Symfony\Component\Validator\ObjectInitializerInterface; + +/** + * Recursive implementation of {@link ValidatorInterface}. + * + * @author Bernhard Schussek + */ +class RecursiveValidator implements ValidatorInterface +{ + protected $contextFactory; + protected $metadataFactory; + protected $validatorFactory; + protected $objectInitializers; + + /** + * Creates a new validator. + * + * @param ObjectInitializerInterface[] $objectInitializers The object initializers + */ + public function __construct(ExecutionContextFactoryInterface $contextFactory, MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, array $objectInitializers = []) + { + $this->contextFactory = $contextFactory; + $this->metadataFactory = $metadataFactory; + $this->validatorFactory = $validatorFactory; + $this->objectInitializers = $objectInitializers; + } + + /** + * {@inheritdoc} + */ + public function startContext($root = null) + { + return new RecursiveContextualValidator( + $this->contextFactory->createContext($this, $root), + $this->metadataFactory, + $this->validatorFactory, + $this->objectInitializers + ); + } + + /** + * {@inheritdoc} + */ + public function inContext(ExecutionContextInterface $context) + { + return new RecursiveContextualValidator( + $context, + $this->metadataFactory, + $this->validatorFactory, + $this->objectInitializers + ); + } + + /** + * {@inheritdoc} + */ + public function getMetadataFor($object) + { + return $this->metadataFactory->getMetadataFor($object); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($object) + { + return $this->metadataFactory->hasMetadataFor($object); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $constraints = null, $groups = null) + { + return $this->startContext($value) + ->validate($value, $constraints, $groups) + ->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validateProperty(object $object, string $propertyName, $groups = null) + { + return $this->startContext($object) + ->validateProperty($object, $propertyName, $groups) + ->getViolations(); + } + + /** + * {@inheritdoc} + */ + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) + { + // If a class name is passed, take $value as root + return $this->startContext(\is_object($objectOrClass) ? $objectOrClass : $value) + ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) + ->getViolations(); + } +} diff --git a/vendor/symfony/validator/Validator/TraceableValidator.php b/vendor/symfony/validator/Validator/TraceableValidator.php new file mode 100644 index 0000000..8c1d966 --- /dev/null +++ b/vendor/symfony/validator/Validator/TraceableValidator.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Contracts\Service\ResetInterface; + +/** + * Collects some data about validator calls. + * + * @author Maxime Steinhausser + */ +class TraceableValidator implements ValidatorInterface, ResetInterface +{ + private $validator; + private $collectedData = []; + + public function __construct(ValidatorInterface $validator) + { + $this->validator = $validator; + } + + /** + * @return array + */ + public function getCollectedData() + { + return $this->collectedData; + } + + public function reset() + { + $this->collectedData = []; + } + + /** + * {@inheritdoc} + */ + public function getMetadataFor($value) + { + return $this->validator->getMetadataFor($value); + } + + /** + * {@inheritdoc} + */ + public function hasMetadataFor($value) + { + return $this->validator->hasMetadataFor($value); + } + + /** + * {@inheritdoc} + */ + public function validate($value, $constraints = null, $groups = null) + { + $violations = $this->validator->validate($value, $constraints, $groups); + + $trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 7); + + $file = $trace[0]['file']; + $line = $trace[0]['line']; + + for ($i = 1; $i < 7; ++$i) { + if (isset($trace[$i]['class'], $trace[$i]['function']) + && 'validate' === $trace[$i]['function'] + && is_a($trace[$i]['class'], ValidatorInterface::class, true) + ) { + $file = $trace[$i]['file']; + $line = $trace[$i]['line']; + + while (++$i < 7) { + if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && !str_starts_with($trace[$i]['function'], 'call_user_func')) { + $file = $trace[$i]['file']; + $line = $trace[$i]['line']; + + break; + } + } + break; + } + } + + $name = str_replace('\\', '/', $file); + $name = substr($name, strrpos($name, '/') + 1); + + $this->collectedData[] = [ + 'caller' => compact('name', 'file', 'line'), + 'context' => compact('value', 'constraints', 'groups'), + 'violations' => iterator_to_array($violations), + ]; + + return $violations; + } + + /** + * {@inheritdoc} + */ + public function validateProperty(object $object, string $propertyName, $groups = null) + { + return $this->validator->validateProperty($object, $propertyName, $groups); + } + + /** + * {@inheritdoc} + */ + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) + { + return $this->validator->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); + } + + /** + * {@inheritdoc} + */ + public function startContext() + { + return $this->validator->startContext(); + } + + /** + * {@inheritdoc} + */ + public function inContext(ExecutionContextInterface $context) + { + return $this->validator->inContext($context); + } +} diff --git a/vendor/symfony/validator/Validator/ValidatorInterface.php b/vendor/symfony/validator/Validator/ValidatorInterface.php new file mode 100644 index 0000000..e6aa7d7 --- /dev/null +++ b/vendor/symfony/validator/Validator/ValidatorInterface.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Validator; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\ConstraintViolationListInterface; +use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; + +/** + * Validates PHP values against constraints. + * + * @author Bernhard Schussek + */ +interface ValidatorInterface extends MetadataFactoryInterface +{ + /** + * Validates a value against a constraint or a list of constraints. + * + * If no constraint is passed, the constraint + * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. + * + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations + * If the list is empty, validation + * succeeded + */ + public function validate($value, $constraints = null, $groups = null); + + /** + * Validates a property of an object against the constraints specified + * for this property. + * + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations + * If the list is empty, validation + * succeeded + */ + public function validateProperty(object $object, string $propertyName, $groups = null); + + /** + * Validates a value against the constraints specified for an object's + * property. + * + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed + * + * @return ConstraintViolationListInterface A list of constraint violations + * If the list is empty, validation + * succeeded + */ + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null); + + /** + * Starts a new validation context and returns a validator for that context. + * + * The returned validator collects all violations generated within its + * context. You can access these violations with the + * {@link ContextualValidatorInterface::getViolations()} method. + * + * @return ContextualValidatorInterface + */ + public function startContext(); + + /** + * Returns a validator in the given execution context. + * + * The returned validator adds all generated violations to the given + * context. + * + * @return ContextualValidatorInterface + */ + public function inContext(ExecutionContextInterface $context); +} diff --git a/vendor/symfony/validator/ValidatorBuilder.php b/vendor/symfony/validator/ValidatorBuilder.php new file mode 100644 index 0000000..8df048b --- /dev/null +++ b/vendor/symfony/validator/ValidatorBuilder.php @@ -0,0 +1,444 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator; + +use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\Common\Annotations\CachedReader; +use Doctrine\Common\Annotations\PsrCachedReader; +use Doctrine\Common\Annotations\Reader; +use Doctrine\Common\Cache\ArrayCache; +use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; +use Symfony\Component\Validator\Context\ExecutionContextFactory; +use Symfony\Component\Validator\Exception\LogicException; +use Symfony\Component\Validator\Exception\ValidatorException; +use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; +use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader; +use Symfony\Component\Validator\Mapping\Loader\LoaderChain; +use Symfony\Component\Validator\Mapping\Loader\LoaderInterface; +use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; +use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader; +use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; +use Symfony\Component\Validator\Validator\RecursiveValidator; +use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Contracts\Translation\LocaleAwareInterface; +use Symfony\Contracts\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorTrait; + +// Help opcache.preload discover always-needed symbols +class_exists(TranslatorInterface::class); +class_exists(LocaleAwareInterface::class); +class_exists(TranslatorTrait::class); + +/** + * @author Bernhard Schussek + */ +class ValidatorBuilder +{ + private $initializers = []; + private $loaders = []; + private $xmlMappings = []; + private $yamlMappings = []; + private $methodMappings = []; + + /** + * @var Reader|null + */ + private $annotationReader; + private $enableAnnotationMapping = false; + + /** + * @var MetadataFactoryInterface|null + */ + private $metadataFactory; + + /** + * @var ConstraintValidatorFactoryInterface|null + */ + private $validatorFactory; + + /** + * @var CacheItemPoolInterface|null + */ + private $mappingCache; + + /** + * @var TranslatorInterface|null + */ + private $translator; + + /** + * @var string|null + */ + private $translationDomain; + + /** + * Adds an object initializer to the validator. + * + * @return $this + */ + public function addObjectInitializer(ObjectInitializerInterface $initializer) + { + $this->initializers[] = $initializer; + + return $this; + } + + /** + * Adds a list of object initializers to the validator. + * + * @param ObjectInitializerInterface[] $initializers + * + * @return $this + */ + public function addObjectInitializers(array $initializers) + { + $this->initializers = array_merge($this->initializers, $initializers); + + return $this; + } + + /** + * Adds an XML constraint mapping file to the validator. + * + * @return $this + */ + public function addXmlMapping(string $path) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->xmlMappings[] = $path; + + return $this; + } + + /** + * Adds a list of XML constraint mapping files to the validator. + * + * @param string[] $paths The paths to the mapping files + * + * @return $this + */ + public function addXmlMappings(array $paths) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->xmlMappings = array_merge($this->xmlMappings, $paths); + + return $this; + } + + /** + * Adds a YAML constraint mapping file to the validator. + * + * @param string $path The path to the mapping file + * + * @return $this + */ + public function addYamlMapping(string $path) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->yamlMappings[] = $path; + + return $this; + } + + /** + * Adds a list of YAML constraint mappings file to the validator. + * + * @param string[] $paths The paths to the mapping files + * + * @return $this + */ + public function addYamlMappings(array $paths) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->yamlMappings = array_merge($this->yamlMappings, $paths); + + return $this; + } + + /** + * Enables constraint mapping using the given static method. + * + * @return $this + */ + public function addMethodMapping(string $methodName) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->methodMappings[] = $methodName; + + return $this; + } + + /** + * Enables constraint mapping using the given static methods. + * + * @param string[] $methodNames The names of the methods + * + * @return $this + */ + public function addMethodMappings(array $methodNames) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->methodMappings = array_merge($this->methodMappings, $methodNames); + + return $this; + } + + /** + * Enables annotation based constraint mapping. + * + * @param bool $skipDoctrineAnnotations + * + * @return $this + */ + public function enableAnnotationMapping(/* bool $skipDoctrineAnnotations = true */) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot enable annotation mapping after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $skipDoctrineAnnotations = 1 > \func_num_args() ? false : func_get_arg(0); + if (false === $skipDoctrineAnnotations || null === $skipDoctrineAnnotations) { + trigger_deprecation('symfony/validator', '5.2', 'Not passing true as first argument to "%s" is deprecated. Pass true and call "addDefaultDoctrineAnnotationReader()" if you want to enable annotation mapping with Doctrine Annotations.', __METHOD__); + $this->addDefaultDoctrineAnnotationReader(); + } elseif ($skipDoctrineAnnotations instanceof Reader) { + trigger_deprecation('symfony/validator', '5.2', 'Passing an instance of "%s" as first argument to "%s" is deprecated. Pass true instead and call setDoctrineAnnotationReader() if you want to enable annotation mapping with Doctrine Annotations.', get_debug_type($skipDoctrineAnnotations), __METHOD__); + $this->setDoctrineAnnotationReader($skipDoctrineAnnotations); + } elseif (true !== $skipDoctrineAnnotations) { + throw new \TypeError(sprintf('"%s": Argument 1 is expected to be a boolean, "%s" given.', __METHOD__, get_debug_type($skipDoctrineAnnotations))); + } + + $this->enableAnnotationMapping = true; + + return $this; + } + + /** + * Disables annotation based constraint mapping. + * + * @return $this + */ + public function disableAnnotationMapping() + { + $this->enableAnnotationMapping = false; + $this->annotationReader = null; + + return $this; + } + + /** + * @return $this + */ + public function setDoctrineAnnotationReader(?Reader $reader): self + { + $this->annotationReader = $reader; + + return $this; + } + + /** + * @return $this + */ + public function addDefaultDoctrineAnnotationReader(): self + { + $this->annotationReader = $this->createAnnotationReader(); + + return $this; + } + + /** + * Sets the class metadata factory used by the validator. + * + * @return $this + */ + public function setMetadataFactory(MetadataFactoryInterface $metadataFactory) + { + if (\count($this->xmlMappings) > 0 || \count($this->yamlMappings) > 0 || \count($this->methodMappings) > 0 || $this->enableAnnotationMapping) { + throw new ValidatorException('You cannot set a custom metadata factory after adding custom mappings. You should do either of both.'); + } + + $this->metadataFactory = $metadataFactory; + + return $this; + } + + /** + * Sets the cache for caching class metadata. + * + * @return $this + */ + public function setMappingCache(CacheItemPoolInterface $cache) + { + if (null !== $this->metadataFactory) { + throw new ValidatorException('You cannot set a custom mapping cache after setting a custom metadata factory. Configure your metadata factory instead.'); + } + + $this->mappingCache = $cache; + + return $this; + } + + /** + * Sets the constraint validator factory used by the validator. + * + * @return $this + */ + public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory) + { + $this->validatorFactory = $validatorFactory; + + return $this; + } + + /** + * Sets the translator used for translating violation messages. + * + * @return $this + */ + public function setTranslator(TranslatorInterface $translator) + { + $this->translator = $translator; + + return $this; + } + + /** + * Sets the default translation domain of violation messages. + * + * The same message can have different translations in different domains. + * Pass the domain that is used for violation messages by default to this + * method. + * + * @return $this + */ + public function setTranslationDomain(?string $translationDomain) + { + $this->translationDomain = $translationDomain; + + return $this; + } + + /** + * @return $this + */ + public function addLoader(LoaderInterface $loader) + { + $this->loaders[] = $loader; + + return $this; + } + + /** + * @return LoaderInterface[] + */ + public function getLoaders() + { + $loaders = []; + + foreach ($this->xmlMappings as $xmlMapping) { + $loaders[] = new XmlFileLoader($xmlMapping); + } + + foreach ($this->yamlMappings as $yamlMappings) { + $loaders[] = new YamlFileLoader($yamlMappings); + } + + foreach ($this->methodMappings as $methodName) { + $loaders[] = new StaticMethodLoader($methodName); + } + + if ($this->enableAnnotationMapping) { + $loaders[] = new AnnotationLoader($this->annotationReader); + } + + return array_merge($loaders, $this->loaders); + } + + /** + * Builds and returns a new validator object. + * + * @return ValidatorInterface + */ + public function getValidator() + { + $metadataFactory = $this->metadataFactory; + + if (!$metadataFactory) { + $loaders = $this->getLoaders(); + $loader = null; + + if (\count($loaders) > 1) { + $loader = new LoaderChain($loaders); + } elseif (1 === \count($loaders)) { + $loader = $loaders[0]; + } + + $metadataFactory = new LazyLoadingMetadataFactory($loader, $this->mappingCache); + } + + $validatorFactory = $this->validatorFactory ?? new ConstraintValidatorFactory(); + $translator = $this->translator; + + if (null === $translator) { + $translator = new class() implements TranslatorInterface, LocaleAwareInterface { + use TranslatorTrait; + }; + // Force the locale to be 'en' when no translator is provided rather than relying on the Intl default locale + // This avoids depending on Intl or the stub implementation being available. It also ensures that Symfony + // validation messages are pluralized properly even when the default locale gets changed because they are in + // English. + $translator->setLocale('en'); + } + + $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain); + + return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); + } + + private function createAnnotationReader(): Reader + { + if (!class_exists(AnnotationReader::class)) { + throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.'); + } + + if (class_exists(ArrayAdapter::class)) { + return new PsrCachedReader(new AnnotationReader(), new ArrayAdapter()); + } + + if (class_exists(CachedReader::class) && class_exists(ArrayCache::class)) { + trigger_deprecation('symfony/validator', '5.4', 'Enabling annotation based constraint mapping without having symfony/cache installed is deprecated.'); + + return new CachedReader(new AnnotationReader(), new ArrayCache()); + } + + throw new LogicException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and symfony/cache to be installed.'); + } +} diff --git a/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php b/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php new file mode 100644 index 0000000..9e198c6 --- /dev/null +++ b/vendor/symfony/validator/Violation/ConstraintViolationBuilder.php @@ -0,0 +1,174 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Violation; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintViolation; +use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\Util\PropertyPath; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * Default implementation of {@link ConstraintViolationBuilderInterface}. + * + * @author Bernhard Schussek + * + * @internal since version 2.5. Code against ConstraintViolationBuilderInterface instead. + */ +class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface +{ + private $violations; + private $message; + private $parameters; + private $root; + private $invalidValue; + private $propertyPath; + private $translator; + private $translationDomain; + private $plural; + private $constraint; + private $code; + + /** + * @var mixed + */ + private $cause; + + /** + * @param string $message The error message as a string or a stringable object + */ + public function __construct(ConstraintViolationList $violations, ?Constraint $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, TranslatorInterface $translator, $translationDomain = null) + { + $this->violations = $violations; + $this->message = $message; + $this->parameters = $parameters; + $this->root = $root; + $this->propertyPath = $propertyPath; + $this->invalidValue = $invalidValue; + $this->translator = $translator; + $this->translationDomain = $translationDomain; + $this->constraint = $constraint; + } + + /** + * {@inheritdoc} + */ + public function atPath(string $path) + { + $this->propertyPath = PropertyPath::append($this->propertyPath, $path); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameter(string $key, string $value) + { + $this->parameters[$key] = $value; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setParameters(array $parameters) + { + $this->parameters = $parameters; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setTranslationDomain(string $translationDomain) + { + $this->translationDomain = $translationDomain; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setInvalidValue($invalidValue) + { + $this->invalidValue = $invalidValue; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setPlural(int $number) + { + $this->plural = $number; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCode(?string $code) + { + $this->code = $code; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function setCause($cause) + { + $this->cause = $cause; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function addViolation() + { + if (null === $this->plural) { + $translatedMessage = $this->translator->trans( + $this->message, + $this->parameters, + $this->translationDomain + ); + } else { + $translatedMessage = $this->translator->trans( + $this->message, + ['%count%' => $this->plural] + $this->parameters, + $this->translationDomain + ); + } + + $this->violations->add(new ConstraintViolation( + $translatedMessage, + $this->message, + $this->parameters, + $this->root, + $this->propertyPath, + $this->invalidValue, + $this->plural, + $this->code, + $this->constraint, + $this->cause + )); + } +} diff --git a/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php b/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php new file mode 100644 index 0000000..9ac1b8b --- /dev/null +++ b/vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Violation; + +/** + * Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} + * objects. + * + * Use the various methods on this interface to configure the built violation. + * Finally, call {@link addViolation()} to add the violation to the current + * execution context. + * + * @author Bernhard Schussek + */ +interface ConstraintViolationBuilderInterface +{ + /** + * Stores the property path at which the violation should be generated. + * + * The passed path will be appended to the current property path of the + * execution context. + * + * @param string $path The property path + * + * @return $this + */ + public function atPath(string $path); + + /** + * Sets a parameter to be inserted into the violation message. + * + * @param string $key The name of the parameter + * @param string $value The value to be inserted in the parameter's place + * + * @return $this + */ + public function setParameter(string $key, string $value); + + /** + * Sets all parameters to be inserted into the violation message. + * + * @param array $parameters An array with the parameter names as keys and + * the values to be inserted in their place as + * values + * + * @return $this + */ + public function setParameters(array $parameters); + + /** + * Sets the translation domain which should be used for translating the + * violation message. + * + * @param string $translationDomain The translation domain + * + * @return $this + * + * @see \Symfony\Contracts\Translation\TranslatorInterface + */ + public function setTranslationDomain(string $translationDomain); + + /** + * Sets the invalid value that caused this violation. + * + * @param mixed $invalidValue The invalid value + * + * @return $this + */ + public function setInvalidValue($invalidValue); + + /** + * Sets the number which determines how the plural form of the violation + * message is chosen when it is translated. + * + * @param int $number The number for determining the plural form + * + * @return $this + * + * @see \Symfony\Contracts\Translation\TranslatorInterface::trans() + */ + public function setPlural(int $number); + + /** + * Sets the violation code. + * + * @param string|null $code The violation code + * + * @return $this + */ + public function setCode(?string $code); + + /** + * Sets the cause of the violation. + * + * @param mixed $cause The cause of the violation + * + * @return $this + */ + public function setCause($cause); + + /** + * Adds the violation to the current execution context. + */ + public function addViolation(); +} diff --git a/vendor/symfony/validator/composer.json b/vendor/symfony/validator/composer.json new file mode 100644 index 0000000..0ce4d0d --- /dev/null +++ b/vendor/symfony/validator/composer.json @@ -0,0 +1,80 @@ +{ + "name": "symfony/validator", + "type": "library", + "description": "Provides tools to validate values", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22", + "symfony/translation-contracts": "^1.1|^2|^3" + }, + "require-dev": { + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^5.1|^6.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.0|^6.0", + "symfony/property-info": "^5.3|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "doctrine/annotations": "^1.13", + "doctrine/cache": "^1.11|^2.0", + "egulias/email-validator": "^2.1.10|^3" + }, + "conflict": { + "doctrine/annotations": "<1.13", + "doctrine/cache": "<1.11", + "doctrine/lexer": "<1.1", + "phpunit/phpunit": "<5.4.3", + "symfony/dependency-injection": "<4.4", + "symfony/expression-language": "<5.1", + "symfony/http-kernel": "<4.4", + "symfony/intl": "<4.4", + "symfony/property-info": "<5.3", + "symfony/translation": "<4.4", + "symfony/yaml": "<4.4" + }, + "suggest": { + "psr/cache-implementation": "For using the mapping cache.", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/translation": "For translating validation errors.", + "symfony/yaml": "", + "symfony/config": "", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/property-info": "To automatically add NotNull and Type constraints", + "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Validator\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/symfony/web-profiler-bundle/CHANGELOG.md b/vendor/symfony/web-profiler-bundle/CHANGELOG.md new file mode 100644 index 0000000..f0974a6 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/CHANGELOG.md @@ -0,0 +1,95 @@ +CHANGELOG +========= + +5.4 +--- + + * Add a "preview" tab in mailer profiler for HTML email + +5.2.0 +----- + + * added session usage + +5.0.0 +----- + + * removed the `ExceptionController`, use `ExceptionPanelController` instead + * removed the `TemplateManager::templateExists()` method + +4.4.0 +----- + + * added support for the Mailer component + * added support for the HttpClient component + * added button to clear the ajax request tab + * deprecated the `ExceptionController::templateExists()` method + * deprecated the `TemplateManager::templateExists()` method + * deprecated the `ExceptionController` in favor of `ExceptionPanelController` + * marked all classes of the WebProfilerBundle as internal + * added a section with the stamps of a message after it is dispatched in the Messenger panel + +4.3.0 +----- + + * Replaced the canvas performance graph renderer with an SVG renderer + +4.1.0 +----- + + * added information about orphaned events + * made the toolbar auto-update with info from ajax reponses when they set the + `Symfony-Debug-Toolbar-Replace header` to `1` + +4.0.0 +----- + + * removed the `WebProfilerExtension::dumpValue()` method + * removed the `getTemplates()` method of the `TemplateManager` class in favor of the ``getNames()`` method + * removed the `web_profiler.position` config option and the + `web_profiler.debug_toolbar.position` container parameter + +3.4.0 +----- + + * Deprecated the `web_profiler.position` config option (in 4.0 version the toolbar + will always be displayed at the bottom) and the `web_profiler.debug_toolbar.position` + container parameter. + +3.1.0 +----- + + * added information about redirected and forwarded requests to the profiler + +3.0.0 +----- + + * removed profiler:import and profiler:export commands + +2.8.0 +----- + + * deprecated profiler:import and profiler:export commands + +2.7.0 +----- + + * [BC BREAK] if you are using a DB to store profiles, the table must be dropped + * added the HTTP status code to profiles + +2.3.0 +----- + + * draw retina canvas if devicePixelRatio is bigger than 1 + +2.1.0 +----- + + * deprecated the verbose setting (not relevant anymore) + * [BC BREAK] You must clear old profiles after upgrading to 2.1 (don't forget + to remove the table if you are using a DB) + * added support for the request method + * added a routing panel + * added a timeline panel + * The toolbar position can now be configured via the `position` option (can + be `top` or `bottom`) diff --git a/vendor/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php b/vendor/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php new file mode 100644 index 0000000..4941208 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Controller/ExceptionPanelController.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Controller; + +use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Profiler\Profiler; + +/** + * Renders the exception panel. + * + * @author Yonel Ceruto + * + * @internal + */ +class ExceptionPanelController +{ + private $errorRenderer; + private $profiler; + + public function __construct(HtmlErrorRenderer $errorRenderer, Profiler $profiler = null) + { + $this->errorRenderer = $errorRenderer; + $this->profiler = $profiler; + } + + /** + * Renders the exception panel stacktrace for the given token. + */ + public function body(string $token): Response + { + if (null === $this->profiler) { + throw new NotFoundHttpException('The profiler must be enabled.'); + } + + $exception = $this->profiler->loadProfile($token) + ->getCollector('exception') + ->getException() + ; + + return new Response($this->errorRenderer->getBody($exception), 200, ['Content-Type' => 'text/html']); + } + + /** + * Renders the exception panel stylesheet. + */ + public function stylesheet(): Response + { + return new Response($this->errorRenderer->getStylesheet(), 200, ['Content-Type' => 'text/css']); + } +} diff --git a/vendor/symfony/web-profiler-bundle/Controller/ProfilerController.php b/vendor/symfony/web-profiler-bundle/Controller/ProfilerController.php new file mode 100644 index 0000000..2ad7df3 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Controller/ProfilerController.php @@ -0,0 +1,391 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Controller; + +use Symfony\Bundle\FullStack; +use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler; +use Symfony\Bundle\WebProfilerBundle\Profiler\TemplateManager; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; +use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; +use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Profiler\Profiler; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Twig\Environment; + +/** + * @author Fabien Potencier + * + * @internal + */ +class ProfilerController +{ + private $templateManager; + private $generator; + private $profiler; + private $twig; + private $templates; + private $cspHandler; + private $baseDir; + + public function __construct(UrlGeneratorInterface $generator, Profiler $profiler = null, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, string $baseDir = null) + { + $this->generator = $generator; + $this->profiler = $profiler; + $this->twig = $twig; + $this->templates = $templates; + $this->cspHandler = $cspHandler; + $this->baseDir = $baseDir; + } + + /** + * Redirects to the last profiles. + * + * @throws NotFoundHttpException + */ + public function homeAction(): RedirectResponse + { + $this->denyAccessIfProfilerDisabled(); + + return new RedirectResponse($this->generator->generate('_profiler_search_results', ['token' => 'empty', 'limit' => 10]), 302, ['Content-Type' => 'text/html']); + } + + /** + * Renders a profiler panel for the given token. + * + * @throws NotFoundHttpException + */ + public function panelAction(Request $request, string $token): Response + { + $this->denyAccessIfProfilerDisabled(); + + if (null !== $this->cspHandler) { + $this->cspHandler->disableCsp(); + } + + $panel = $request->query->get('panel'); + $page = $request->query->get('page', 'home'); + + if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) { + $token = $latest['token']; + } + + if (!$profile = $this->profiler->loadProfile($token)) { + return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/info.html.twig', ['about' => 'no_token', 'token' => $token, 'request' => $request]); + } + + if (null === $panel) { + $panel = 'request'; + + foreach ($profile->getCollectors() as $collector) { + if ($collector instanceof ExceptionDataCollector && $collector->hasException()) { + $panel = $collector->getName(); + + break; + } + + if ($collector instanceof DumpDataCollector && $collector->getDumpsCount() > 0) { + $panel = $collector->getName(); + } + } + } + + if (!$profile->hasCollector($panel)) { + throw new NotFoundHttpException(sprintf('Panel "%s" is not available for token "%s".', $panel, $token)); + } + + return $this->renderWithCspNonces($request, $this->getTemplateManager()->getName($profile, $panel), [ + 'token' => $token, + 'profile' => $profile, + 'collector' => $profile->getCollector($panel), + 'panel' => $panel, + 'page' => $page, + 'request' => $request, + 'templates' => $this->getTemplateManager()->getNames($profile), + 'is_ajax' => $request->isXmlHttpRequest(), + 'profiler_markup_version' => 2, // 1 = original profiler, 2 = Symfony 2.8+ profiler + ]); + } + + /** + * Renders the Web Debug Toolbar. + * + * @throws NotFoundHttpException + */ + public function toolbarAction(Request $request, string $token = null): Response + { + if (null === $this->profiler) { + throw new NotFoundHttpException('The profiler must be enabled.'); + } + + if ($request->hasSession() && ($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) { + // keep current flashes for one more request if using AutoExpireFlashBag + $session->getFlashBag()->setAll($session->getFlashBag()->peekAll()); + } + + if ('empty' === $token || null === $token) { + return new Response('', 200, ['Content-Type' => 'text/html']); + } + + $this->profiler->disable(); + + if (!$profile = $this->profiler->loadProfile($token)) { + return new Response('', 404, ['Content-Type' => 'text/html']); + } + + $url = null; + try { + $url = $this->generator->generate('_profiler', ['token' => $token], UrlGeneratorInterface::ABSOLUTE_URL); + } catch (\Exception $e) { + // the profiler is not enabled + } + + return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/toolbar.html.twig', [ + 'full_stack' => class_exists(FullStack::class), + 'request' => $request, + 'profile' => $profile, + 'templates' => $this->getTemplateManager()->getNames($profile), + 'profiler_url' => $url, + 'token' => $token, + 'profiler_markup_version' => 2, // 1 = original toolbar, 2 = Symfony 2.8+ toolbar + ]); + } + + /** + * Renders the profiler search bar. + * + * @throws NotFoundHttpException + */ + public function searchBarAction(Request $request): Response + { + $this->denyAccessIfProfilerDisabled(); + + if (null !== $this->cspHandler) { + $this->cspHandler->disableCsp(); + } + + if (!$request->hasSession()) { + $ip = + $method = + $statusCode = + $url = + $start = + $end = + $limit = + $token = null; + } else { + $session = $request->getSession(); + + $ip = $request->query->get('ip', $session->get('_profiler_search_ip')); + $method = $request->query->get('method', $session->get('_profiler_search_method')); + $statusCode = $request->query->get('status_code', $session->get('_profiler_search_status_code')); + $url = $request->query->get('url', $session->get('_profiler_search_url')); + $start = $request->query->get('start', $session->get('_profiler_search_start')); + $end = $request->query->get('end', $session->get('_profiler_search_end')); + $limit = $request->query->get('limit', $session->get('_profiler_search_limit')); + $token = $request->query->get('token', $session->get('_profiler_search_token')); + } + + return new Response( + $this->twig->render('@WebProfiler/Profiler/search.html.twig', [ + 'token' => $token, + 'ip' => $ip, + 'method' => $method, + 'status_code' => $statusCode, + 'url' => $url, + 'start' => $start, + 'end' => $end, + 'limit' => $limit, + 'request' => $request, + ]), + 200, + ['Content-Type' => 'text/html'] + ); + } + + /** + * Renders the search results. + * + * @throws NotFoundHttpException + */ + public function searchResultsAction(Request $request, string $token): Response + { + $this->denyAccessIfProfilerDisabled(); + + if (null !== $this->cspHandler) { + $this->cspHandler->disableCsp(); + } + + $profile = $this->profiler->loadProfile($token); + + $ip = $request->query->get('ip'); + $method = $request->query->get('method'); + $statusCode = $request->query->get('status_code'); + $url = $request->query->get('url'); + $start = $request->query->get('start', null); + $end = $request->query->get('end', null); + $limit = $request->query->get('limit'); + + return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/results.html.twig', [ + 'request' => $request, + 'token' => $token, + 'profile' => $profile, + 'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode), + 'ip' => $ip, + 'method' => $method, + 'status_code' => $statusCode, + 'url' => $url, + 'start' => $start, + 'end' => $end, + 'limit' => $limit, + 'panel' => null, + ]); + } + + /** + * Narrows the search bar. + * + * @throws NotFoundHttpException + */ + public function searchAction(Request $request): Response + { + $this->denyAccessIfProfilerDisabled(); + + $ip = $request->query->get('ip'); + $method = $request->query->get('method'); + $statusCode = $request->query->get('status_code'); + $url = $request->query->get('url'); + $start = $request->query->get('start', null); + $end = $request->query->get('end', null); + $limit = $request->query->get('limit'); + $token = $request->query->get('token'); + + if ($request->hasSession()) { + $session = $request->getSession(); + + $session->set('_profiler_search_ip', $ip); + $session->set('_profiler_search_method', $method); + $session->set('_profiler_search_status_code', $statusCode); + $session->set('_profiler_search_url', $url); + $session->set('_profiler_search_start', $start); + $session->set('_profiler_search_end', $end); + $session->set('_profiler_search_limit', $limit); + $session->set('_profiler_search_token', $token); + } + + if (!empty($token)) { + return new RedirectResponse($this->generator->generate('_profiler', ['token' => $token]), 302, ['Content-Type' => 'text/html']); + } + + $tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode); + + return new RedirectResponse($this->generator->generate('_profiler_search_results', [ + 'token' => $tokens ? $tokens[0]['token'] : 'empty', + 'ip' => $ip, + 'method' => $method, + 'status_code' => $statusCode, + 'url' => $url, + 'start' => $start, + 'end' => $end, + 'limit' => $limit, + ]), 302, ['Content-Type' => 'text/html']); + } + + /** + * Displays the PHP info. + * + * @throws NotFoundHttpException + */ + public function phpinfoAction(): Response + { + $this->denyAccessIfProfilerDisabled(); + + if (null !== $this->cspHandler) { + $this->cspHandler->disableCsp(); + } + + ob_start(); + phpinfo(); + $phpinfo = ob_get_clean(); + + return new Response($phpinfo, 200, ['Content-Type' => 'text/html']); + } + + /** + * Displays the source of a file. + * + * @throws NotFoundHttpException + */ + public function openAction(Request $request): Response + { + if (null === $this->baseDir) { + throw new NotFoundHttpException('The base dir should be set.'); + } + + if ($this->profiler) { + $this->profiler->disable(); + } + + $file = $request->query->get('file'); + $line = $request->query->get('line'); + + $filename = $this->baseDir.\DIRECTORY_SEPARATOR.$file; + + if (preg_match("'(^|[/\\\\])\.'", $file) || !is_readable($filename)) { + throw new NotFoundHttpException(sprintf('The file "%s" cannot be opened.', $file)); + } + + return $this->renderWithCspNonces($request, '@WebProfiler/Profiler/open.html.twig', [ + 'filename' => $filename, + 'file' => $file, + 'line' => $line, + ]); + } + + /** + * Gets the Template Manager. + */ + protected function getTemplateManager(): TemplateManager + { + if (null === $this->templateManager) { + $this->templateManager = new TemplateManager($this->profiler, $this->twig, $this->templates); + } + + return $this->templateManager; + } + + private function denyAccessIfProfilerDisabled() + { + if (null === $this->profiler) { + throw new NotFoundHttpException('The profiler must be enabled.'); + } + + $this->profiler->disable(); + } + + private function renderWithCspNonces(Request $request, string $template, array $variables, int $code = 200, array $headers = ['Content-Type' => 'text/html']): Response + { + $response = new Response('', $code, $headers); + + $nonces = $this->cspHandler ? $this->cspHandler->getNonces($request, $response) : []; + + $variables['csp_script_nonce'] = $nonces['csp_script_nonce'] ?? null; + $variables['csp_style_nonce'] = $nonces['csp_style_nonce'] ?? null; + + $response->setContent($this->twig->render($template, $variables)); + + return $response; + } +} diff --git a/vendor/symfony/web-profiler-bundle/Controller/RouterController.php b/vendor/symfony/web-profiler-bundle/Controller/RouterController.php new file mode 100644 index 0000000..50560e0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Controller/RouterController.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Controller; + +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Profiler\Profiler; +use Symfony\Component\Routing\Matcher\TraceableUrlMatcher; +use Symfony\Component\Routing\Matcher\UrlMatcherInterface; +use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\Routing\RouterInterface; +use Twig\Environment; + +/** + * @author Fabien Potencier + * + * @internal + */ +class RouterController +{ + private $profiler; + private $twig; + private $matcher; + private $routes; + + /** + * @var ExpressionFunctionProviderInterface[] + */ + private $expressionLanguageProviders = []; + + public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = []) + { + $this->profiler = $profiler; + $this->twig = $twig; + $this->matcher = $matcher; + $this->routes = (null === $routes && $matcher instanceof RouterInterface) ? $matcher->getRouteCollection() : $routes; + $this->expressionLanguageProviders = $expressionLanguageProviders; + } + + /** + * Renders the profiler panel for the given token. + * + * @throws NotFoundHttpException + */ + public function panelAction(string $token): Response + { + if (null === $this->profiler) { + throw new NotFoundHttpException('The profiler must be enabled.'); + } + + $this->profiler->disable(); + + if (null === $this->matcher || null === $this->routes) { + return new Response('The Router is not enabled.', 200, ['Content-Type' => 'text/html']); + } + + $profile = $this->profiler->loadProfile($token); + + /** @var RequestDataCollector $request */ + $request = $profile->getCollector('request'); + + return new Response($this->twig->render('@WebProfiler/Router/panel.html.twig', [ + 'request' => $request, + 'router' => $profile->getCollector('router'), + 'traces' => $this->getTraces($request, $profile->getMethod()), + ]), 200, ['Content-Type' => 'text/html']); + } + + /** + * Returns the routing traces associated to the given request. + */ + private function getTraces(RequestDataCollector $request, string $method): array + { + $traceRequest = Request::create( + $request->getPathInfo(), + $request->getRequestServer(true)->get('REQUEST_METHOD'), + \in_array($request->getMethod(), ['DELETE', 'PATCH', 'POST', 'PUT'], true) ? $request->getRequestRequest()->all() : $request->getRequestQuery()->all(), + $request->getRequestCookies(true)->all(), + [], + $request->getRequestServer(true)->all() + ); + + $context = $this->matcher->getContext(); + $context->setMethod($method); + $matcher = new TraceableUrlMatcher($this->routes, $context); + foreach ($this->expressionLanguageProviders as $provider) { + $matcher->addExpressionLanguageProvider($provider); + } + + return $matcher->getTracesForRequest($traceRequest); + } +} diff --git a/vendor/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php b/vendor/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php new file mode 100644 index 0000000..ce24136 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Csp/ContentSecurityPolicyHandler.php @@ -0,0 +1,270 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Csp; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +/** + * Handles Content-Security-Policy HTTP header for the WebProfiler Bundle. + * + * @author Romain Neutron + * + * @internal + */ +class ContentSecurityPolicyHandler +{ + private $nonceGenerator; + private $cspDisabled = false; + + public function __construct(NonceGenerator $nonceGenerator) + { + $this->nonceGenerator = $nonceGenerator; + } + + /** + * Returns an array of nonces to be used in Twig templates and Content-Security-Policy headers. + * + * Nonce can be provided by; + * - The request - In case HTML content is fetched via AJAX and inserted in DOM, it must use the same nonce as origin + * - The response - A call to getNonces() has already been done previously. Same nonce are returned + * - They are otherwise randomly generated + */ + public function getNonces(Request $request, Response $response): array + { + if ($request->headers->has('X-SymfonyProfiler-Script-Nonce') && $request->headers->has('X-SymfonyProfiler-Style-Nonce')) { + return [ + 'csp_script_nonce' => $request->headers->get('X-SymfonyProfiler-Script-Nonce'), + 'csp_style_nonce' => $request->headers->get('X-SymfonyProfiler-Style-Nonce'), + ]; + } + + if ($response->headers->has('X-SymfonyProfiler-Script-Nonce') && $response->headers->has('X-SymfonyProfiler-Style-Nonce')) { + return [ + 'csp_script_nonce' => $response->headers->get('X-SymfonyProfiler-Script-Nonce'), + 'csp_style_nonce' => $response->headers->get('X-SymfonyProfiler-Style-Nonce'), + ]; + } + + $nonces = [ + 'csp_script_nonce' => $this->generateNonce(), + 'csp_style_nonce' => $this->generateNonce(), + ]; + + $response->headers->set('X-SymfonyProfiler-Script-Nonce', $nonces['csp_script_nonce']); + $response->headers->set('X-SymfonyProfiler-Style-Nonce', $nonces['csp_style_nonce']); + + return $nonces; + } + + /** + * Disables Content-Security-Policy. + * + * All related headers will be removed. + */ + public function disableCsp() + { + $this->cspDisabled = true; + } + + /** + * Cleanup temporary headers and updates Content-Security-Policy headers. + * + * @return array Nonces used by the bundle in Content-Security-Policy header + */ + public function updateResponseHeaders(Request $request, Response $response): array + { + if ($this->cspDisabled) { + $this->removeCspHeaders($response); + + return []; + } + + $nonces = $this->getNonces($request, $response); + $this->cleanHeaders($response); + $this->updateCspHeaders($response, $nonces); + + return $nonces; + } + + private function cleanHeaders(Response $response) + { + $response->headers->remove('X-SymfonyProfiler-Script-Nonce'); + $response->headers->remove('X-SymfonyProfiler-Style-Nonce'); + } + + private function removeCspHeaders(Response $response) + { + $response->headers->remove('X-Content-Security-Policy'); + $response->headers->remove('Content-Security-Policy'); + $response->headers->remove('Content-Security-Policy-Report-Only'); + } + + /** + * Updates Content-Security-Policy headers in a response. + */ + private function updateCspHeaders(Response $response, array $nonces = []): array + { + $nonces = array_replace([ + 'csp_script_nonce' => $this->generateNonce(), + 'csp_style_nonce' => $this->generateNonce(), + ], $nonces); + + $ruleIsSet = false; + + $headers = $this->getCspHeaders($response); + + $types = [ + 'script-src' => 'csp_script_nonce', + 'script-src-elem' => 'csp_script_nonce', + 'style-src' => 'csp_style_nonce', + 'style-src-elem' => 'csp_style_nonce', + ]; + + foreach ($headers as $header => $directives) { + foreach ($types as $type => $tokenName) { + if ($this->authorizesInline($directives, $type)) { + continue; + } + if (!isset($headers[$header][$type])) { + if (null === $fallback = $this->getDirectiveFallback($directives, $type)) { + continue; + } + + if (['\'none\''] === $fallback) { + // Fallback came from "default-src: 'none'" + // 'none' is invalid if it's not the only expression in the source list, so we leave it out + $fallback = []; + } + + $headers[$header][$type] = $fallback; + } + $ruleIsSet = true; + if (!\in_array('\'unsafe-inline\'', $headers[$header][$type], true)) { + $headers[$header][$type][] = '\'unsafe-inline\''; + } + $headers[$header][$type][] = sprintf('\'nonce-%s\'', $nonces[$tokenName]); + } + } + + if (!$ruleIsSet) { + return $nonces; + } + + foreach ($headers as $header => $directives) { + $response->headers->set($header, $this->generateCspHeader($directives)); + } + + return $nonces; + } + + /** + * Generates a valid Content-Security-Policy nonce. + */ + private function generateNonce(): string + { + return $this->nonceGenerator->generate(); + } + + /** + * Converts a directive set array into Content-Security-Policy header. + */ + private function generateCspHeader(array $directives): string + { + return array_reduce(array_keys($directives), function ($res, $name) use ($directives) { + return ('' !== $res ? $res.'; ' : '').sprintf('%s %s', $name, implode(' ', $directives[$name])); + }, ''); + } + + /** + * Converts a Content-Security-Policy header value into a directive set array. + */ + private function parseDirectives(string $header): array + { + $directives = []; + + foreach (explode(';', $header) as $directive) { + $parts = explode(' ', trim($directive)); + if (\count($parts) < 1) { + continue; + } + $name = array_shift($parts); + $directives[$name] = $parts; + } + + return $directives; + } + + /** + * Detects if the 'unsafe-inline' is prevented for a directive within the directive set. + */ + private function authorizesInline(array $directivesSet, string $type): bool + { + if (isset($directivesSet[$type])) { + $directives = $directivesSet[$type]; + } elseif (null === $directives = $this->getDirectiveFallback($directivesSet, $type)) { + return false; + } + + return \in_array('\'unsafe-inline\'', $directives, true) && !$this->hasHashOrNonce($directives); + } + + private function hasHashOrNonce(array $directives): bool + { + foreach ($directives as $directive) { + if (!str_ends_with($directive, '\'')) { + continue; + } + if ('\'nonce-' === substr($directive, 0, 7)) { + return true; + } + if (\in_array(substr($directive, 0, 8), ['\'sha256-', '\'sha384-', '\'sha512-'], true)) { + return true; + } + } + + return false; + } + + private function getDirectiveFallback(array $directiveSet, string $type) + { + if (\in_array($type, ['script-src-elem', 'style-src-elem'], true) || !isset($directiveSet['default-src'])) { + // Let the browser fallback on it's own + return null; + } + + return $directiveSet['default-src']; + } + + /** + * Retrieves the Content-Security-Policy headers (either X-Content-Security-Policy or Content-Security-Policy) from + * a response. + */ + private function getCspHeaders(Response $response): array + { + $headers = []; + + if ($response->headers->has('Content-Security-Policy')) { + $headers['Content-Security-Policy'] = $this->parseDirectives($response->headers->get('Content-Security-Policy')); + } + + if ($response->headers->has('Content-Security-Policy-Report-Only')) { + $headers['Content-Security-Policy-Report-Only'] = $this->parseDirectives($response->headers->get('Content-Security-Policy-Report-Only')); + } + + if ($response->headers->has('X-Content-Security-Policy')) { + $headers['X-Content-Security-Policy'] = $this->parseDirectives($response->headers->get('X-Content-Security-Policy')); + } + + return $headers; + } +} diff --git a/vendor/symfony/web-profiler-bundle/Csp/NonceGenerator.php b/vendor/symfony/web-profiler-bundle/Csp/NonceGenerator.php new file mode 100644 index 0000000..19af849 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Csp/NonceGenerator.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Csp; + +/** + * Generates Content-Security-Policy nonce. + * + * @author Romain Neutron + * + * @internal + */ +class NonceGenerator +{ + public function generate(): string + { + return bin2hex(random_bytes(16)); + } +} diff --git a/vendor/symfony/web-profiler-bundle/DependencyInjection/Configuration.php b/vendor/symfony/web-profiler-bundle/DependencyInjection/Configuration.php new file mode 100644 index 0000000..041c335 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/DependencyInjection/Configuration.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * This class contains the configuration information for the bundle. + * + * This information is solely responsible for how the different configuration + * sections are normalized, and merged. + * + * @author Fabien Potencier + */ +class Configuration implements ConfigurationInterface +{ + /** + * Generates the configuration tree builder. + * + * @return TreeBuilder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder('web_profiler'); + + $treeBuilder->getRootNode() + ->children() + ->booleanNode('toolbar')->defaultFalse()->end() + ->booleanNode('intercept_redirects')->defaultFalse()->end() + ->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end() + ->end() + ; + + return $treeBuilder; + } +} diff --git a/vendor/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php b/vendor/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php new file mode 100644 index 0000000..0bb949c --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/DependencyInjection/WebProfilerExtension.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection; + +use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Reference; + +/** + * WebProfilerExtension. + * + * Usage: + * + * + * + * @author Fabien Potencier + */ +class WebProfilerExtension extends Extension +{ + /** + * Loads the web profiler configuration. + * + * @param array $configs An array of configuration settings + */ + public function load(array $configs, ContainerBuilder $container) + { + $configuration = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($configuration, $configs); + + $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('profiler.php'); + + if ($config['toolbar'] || $config['intercept_redirects']) { + $loader->load('toolbar.php'); + $container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(4, $config['excluded_ajax_paths']); + $container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']); + $container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED); + } + + $container->getDefinition('debug.file_link_formatter') + ->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format'))); + } + + /** + * {@inheritdoc} + */ + public function getXsdValidationBasePath() + { + return __DIR__.'/../Resources/config/schema'; + } + + public function getNamespace() + { + return 'http://symfony.com/schema/dic/webprofiler'; + } +} diff --git a/vendor/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php b/vendor/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php new file mode 100644 index 0000000..b2e7db2 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\EventListener; + +use Symfony\Bundle\FullStack; +use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; +use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; +use Symfony\Component\HttpKernel\Event\ResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Twig\Environment; + +/** + * WebDebugToolbarListener injects the Web Debug Toolbar. + * + * The onKernelResponse method must be connected to the kernel.response event. + * + * The WDT is only injected on well-formed HTML (with a proper tag). + * This means that the WDT is never included in sub-requests or ESI requests. + * + * @author Fabien Potencier + * + * @final + */ +class WebDebugToolbarListener implements EventSubscriberInterface +{ + public const DISABLED = 1; + public const ENABLED = 2; + + protected $twig; + protected $urlGenerator; + protected $interceptRedirects; + protected $mode; + protected $excludedAjaxPaths; + private $cspHandler; + private $dumpDataCollector; + + public function __construct(Environment $twig, bool $interceptRedirects = false, int $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null, DumpDataCollector $dumpDataCollector = null) + { + $this->twig = $twig; + $this->urlGenerator = $urlGenerator; + $this->interceptRedirects = $interceptRedirects; + $this->mode = $mode; + $this->excludedAjaxPaths = $excludedAjaxPaths; + $this->cspHandler = $cspHandler; + $this->dumpDataCollector = $dumpDataCollector; + } + + public function isEnabled(): bool + { + return self::DISABLED !== $this->mode; + } + + public function setMode(int $mode): void + { + if (self::DISABLED !== $mode && self::ENABLED !== $mode) { + throw new \InvalidArgumentException(sprintf('Invalid value provided for mode, use one of "%s::DISABLED" or "%s::ENABLED".', self::class, self::class)); + } + + $this->mode = $mode; + } + + public function onKernelResponse(ResponseEvent $event) + { + $response = $event->getResponse(); + $request = $event->getRequest(); + + if ($response->headers->has('X-Debug-Token') && null !== $this->urlGenerator) { + try { + $response->headers->set( + 'X-Debug-Token-Link', + $this->urlGenerator->generate('_profiler', ['token' => $response->headers->get('X-Debug-Token')], UrlGeneratorInterface::ABSOLUTE_URL) + ); + } catch (\Exception $e) { + $response->headers->set('X-Debug-Error', \get_class($e).': '.preg_replace('/\s+/', ' ', $e->getMessage())); + } + } + + if (!$event->isMainRequest()) { + return; + } + + $nonces = []; + if ($this->cspHandler) { + if ($this->dumpDataCollector && $this->dumpDataCollector->getDumpsCount() > 0) { + $this->cspHandler->disableCsp(); + } + + $nonces = $this->cspHandler->updateResponseHeaders($request, $response); + } + + // do not capture redirects or modify XML HTTP Requests + if ($request->isXmlHttpRequest()) { + return; + } + + if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects && 'html' === $request->getRequestFormat()) { + if ($request->hasSession() && ($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) { + // keep current flashes for one more request if using AutoExpireFlashBag + $session->getFlashBag()->setAll($session->getFlashBag()->peekAll()); + } + + $response->setContent($this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' => $response->headers->get('Location')])); + $response->setStatusCode(200); + $response->headers->remove('Location'); + } + + if (self::DISABLED === $this->mode + || !$response->headers->has('X-Debug-Token') + || $response->isRedirection() + || ($response->headers->has('Content-Type') && !str_contains($response->headers->get('Content-Type'), 'html')) + || 'html' !== $request->getRequestFormat() + || false !== stripos($response->headers->get('Content-Disposition', ''), 'attachment;') + ) { + return; + } + + $this->injectToolbar($response, $request, $nonces); + } + + /** + * Injects the web debug toolbar into the given Response. + */ + protected function injectToolbar(Response $response, Request $request, array $nonces) + { + $content = $response->getContent(); + $pos = strripos($content, ''); + + if (false !== $pos) { + $toolbar = "\n".str_replace("\n", '', $this->twig->render( + '@WebProfiler/Profiler/toolbar_js.html.twig', + [ + 'full_stack' => class_exists(FullStack::class), + 'excluded_ajax_paths' => $this->excludedAjaxPaths, + 'token' => $response->headers->get('X-Debug-Token'), + 'request' => $request, + 'csp_script_nonce' => $nonces['csp_script_nonce'] ?? null, + 'csp_style_nonce' => $nonces['csp_style_nonce'] ?? null, + ] + ))."\n"; + $content = substr($content, 0, $pos).$toolbar.substr($content, $pos); + $response->setContent($content); + } + } + + public static function getSubscribedEvents(): array + { + return [ + KernelEvents::RESPONSE => ['onKernelResponse', -128], + ]; + } +} diff --git a/vendor/symfony/web-profiler-bundle/LICENSE b/vendor/symfony/web-profiler-bundle/LICENSE new file mode 100644 index 0000000..88bf75b --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2022 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/web-profiler-bundle/Profiler/TemplateManager.php b/vendor/symfony/web-profiler-bundle/Profiler/TemplateManager.php new file mode 100644 index 0000000..f962e69 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Profiler/TemplateManager.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Profiler; + +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Profiler\Profile; +use Symfony\Component\HttpKernel\Profiler\Profiler; +use Twig\Environment; + +/** + * @author Fabien Potencier + * @author Artur Wielogórski + * + * @internal + */ +class TemplateManager +{ + protected $twig; + protected $templates; + protected $profiler; + + public function __construct(Profiler $profiler, Environment $twig, array $templates) + { + $this->profiler = $profiler; + $this->twig = $twig; + $this->templates = $templates; + } + + /** + * Gets the template name for a given panel. + * + * @return mixed + * + * @throws NotFoundHttpException + */ + public function getName(Profile $profile, string $panel) + { + $templates = $this->getNames($profile); + + if (!isset($templates[$panel])) { + throw new NotFoundHttpException(sprintf('Panel "%s" is not registered in profiler or is not present in viewed profile.', $panel)); + } + + return $templates[$panel]; + } + + /** + * Gets template names of templates that are present in the viewed profile. + * + * @throws \UnexpectedValueException + */ + public function getNames(Profile $profile): array + { + $loader = $this->twig->getLoader(); + $templates = []; + + foreach ($this->templates as $arguments) { + if (null === $arguments) { + continue; + } + + [$name, $template] = $arguments; + + if (!$this->profiler->has($name) || !$profile->hasCollector($name)) { + continue; + } + + if (str_ends_with($template, '.html.twig')) { + $template = substr($template, 0, -10); + } + + if (!$loader->exists($template.'.html.twig')) { + throw new \UnexpectedValueException(sprintf('The profiler template "%s.html.twig" for data collector "%s" does not exist.', $template, $name)); + } + + $templates[$name] = $template.'.html.twig'; + } + + return $templates; + } +} diff --git a/vendor/symfony/web-profiler-bundle/README.md b/vendor/symfony/web-profiler-bundle/README.md new file mode 100644 index 0000000..e3c1400 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/README.md @@ -0,0 +1,16 @@ +WebProfilerBundle +================= + +WebProfilerBundle provides a **development tool** that gives detailed +information about the execution of any request. + +**Never** enable it on production servers as it will lead to major security +vulnerabilities in your project. + +Resources +--------- + + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/web-profiler-bundle/Resources/ICONS_LICENSE.txt b/vendor/symfony/web-profiler-bundle/Resources/ICONS_LICENSE.txt new file mode 100644 index 0000000..2e20272 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/ICONS_LICENSE.txt @@ -0,0 +1,5 @@ +Icons License +============= + +Icons created by Sensio (http://www.sensio.com/) are shared under a Creative +Commons Attribution license (http://creativecommons.org/licenses/by-sa/3.0/). \ No newline at end of file diff --git a/vendor/symfony/web-profiler-bundle/Resources/config/profiler.php b/vendor/symfony/web-profiler-bundle/Resources/config/profiler.php new file mode 100644 index 0000000..85c64f2 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/config/profiler.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\WebProfilerBundle\Controller\ExceptionPanelController; +use Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController; +use Symfony\Bundle\WebProfilerBundle\Controller\RouterController; +use Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler; +use Symfony\Bundle\WebProfilerBundle\Csp\NonceGenerator; +use Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; + +return static function (ContainerConfigurator $container) { + $container->services() + + ->set('web_profiler.controller.profiler', ProfilerController::class) + ->public() + ->args([ + service('router')->nullOnInvalid(), + service('profiler')->nullOnInvalid(), + service('twig'), + param('data_collector.templates'), + service('web_profiler.csp.handler'), + param('kernel.project_dir'), + ]) + + ->set('web_profiler.controller.router', RouterController::class) + ->public() + ->args([ + service('profiler')->nullOnInvalid(), + service('twig'), + service('router')->nullOnInvalid(), + null, + tagged_iterator('routing.expression_language_provider'), + ]) + + ->set('web_profiler.controller.exception_panel', ExceptionPanelController::class) + ->public() + ->args([ + service('error_handler.error_renderer.html'), + service('profiler')->nullOnInvalid(), + ]) + + ->set('web_profiler.csp.handler', ContentSecurityPolicyHandler::class) + ->args([ + inline_service(NonceGenerator::class), + ]) + + ->set('twig.extension.webprofiler', WebProfilerExtension::class) + ->args([ + inline_service(HtmlDumper::class) + ->args([null, param('kernel.charset'), HtmlDumper::DUMP_LIGHT_ARRAY]) + ->call('setDisplayOptions', [['maxStringLength' => 4096, 'fileLinkFormat' => service('debug.file_link_formatter')]]), + ]) + ->tag('twig.extension') + + ->set('debug.file_link_formatter', FileLinkFormatter::class) + ->args([ + param('debug.file_link_format'), + service('request_stack')->ignoreOnInvalid(), + param('kernel.project_dir'), + '/_profiler/open?file=%%f&line=%%l#line%%l', + ]) + + ->set('debug.file_link_formatter.url_format', 'string') + ->factory([FileLinkFormatter::class, 'generateUrlFormat']) + ->args([ + service('router'), + '_profiler_open_file', + '?file=%%f&line=%%l#line%%l', + ]) + ; +}; diff --git a/vendor/symfony/web-profiler-bundle/Resources/config/routing/profiler.xml b/vendor/symfony/web-profiler-bundle/Resources/config/routing/profiler.xml new file mode 100644 index 0000000..f20cba0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/config/routing/profiler.xml @@ -0,0 +1,47 @@ + + + + + + web_profiler.controller.profiler::homeAction + + + + web_profiler.controller.profiler::searchAction + + + + web_profiler.controller.profiler::searchBarAction + + + + web_profiler.controller.profiler::phpinfoAction + + + + web_profiler.controller.profiler::searchResultsAction + + + + web_profiler.controller.profiler::openAction + + + + web_profiler.controller.profiler::panelAction + + + + web_profiler.controller.router::panelAction + + + + web_profiler.controller.exception_panel::body + + + + web_profiler.controller.exception_panel::stylesheet + + + diff --git a/vendor/symfony/web-profiler-bundle/Resources/config/routing/wdt.xml b/vendor/symfony/web-profiler-bundle/Resources/config/routing/wdt.xml new file mode 100644 index 0000000..0f7e960 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/config/routing/wdt.xml @@ -0,0 +1,10 @@ + + + + + + web_profiler.controller.profiler::toolbarAction + + diff --git a/vendor/symfony/web-profiler-bundle/Resources/config/schema/webprofiler-1.0.xsd b/vendor/symfony/web-profiler-bundle/Resources/config/schema/webprofiler-1.0.xsd new file mode 100644 index 0000000..e22105a --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/config/schema/webprofiler-1.0.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/vendor/symfony/web-profiler-bundle/Resources/config/toolbar.php b/vendor/symfony/web-profiler-bundle/Resources/config/toolbar.php new file mode 100644 index 0000000..473b363 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/config/toolbar.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener; + +return static function (ContainerConfigurator $container) { + $container->services() + + ->set('web_profiler.debug_toolbar', WebDebugToolbarListener::class) + ->args([ + service('twig'), + param('web_profiler.debug_toolbar.intercept_redirects'), + param('web_profiler.debug_toolbar.mode'), + service('router')->ignoreOnInvalid(), + abstract_arg('paths that should be excluded from the AJAX requests shown in the toolbar'), + service('web_profiler.csp.handler'), + service('data_collector.dump')->ignoreOnInvalid(), + ]) + ->tag('kernel.event_subscriber') + ; +}; diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/ajax.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/ajax.html.twig new file mode 100644 index 0000000..e4e7d64 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/ajax.html.twig @@ -0,0 +1,35 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% set icon %} + {{ include('@WebProfiler/Icon/ajax.svg') }} + 0 + {% endset %} + + {% set text %} +
+ + + (Clear) + +
+
+ + + + + + + + + + + + + +
#ProfileMethodTypeStatusURLTime
+
+ {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false }) }} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/cache.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/cache.html.twig new file mode 100644 index 0000000..0c406e9 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/cache.html.twig @@ -0,0 +1,153 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% if collector.totals.calls > 0 %} + {% set icon %} + {{ include('@WebProfiler/Icon/cache.svg') }} + {{ collector.totals.calls }} + + in + {{ '%0.2f'|format(collector.totals.time * 1000) }} + ms + + {% endset %} + {% set text %} +
+ Cache Calls + {{ collector.totals.calls }} +
+
+ Total time + {{ '%0.2f'|format(collector.totals.time * 1000) }} ms +
+
+ Cache hits + {{ collector.totals.hits }} / {{ collector.totals.reads }}{% if collector.totals.hit_read_ratio is not null %} ({{ collector.totals.hit_read_ratio }}%){% endif %} +
+
+ Cache writes + {{ collector.totals.writes }} +
+ {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + + {{ include('@WebProfiler/Icon/cache.svg') }} + + Cache + +{% endblock %} + +{% block panel %} +

Cache

+ + {% if collector.totals.calls == 0 %} +
+

No cache calls were made.

+
+ {% else %} +
+
+ {{ collector.totals.calls }} + Total calls +
+
+ {{ '%0.2f'|format(collector.totals.time * 1000) }} ms + Total time +
+
+
+ {{ collector.totals.reads }} + Total reads +
+
+ {{ collector.totals.writes }} + Total writes +
+
+ {{ collector.totals.deletes }} + Total deletes +
+
+
+ {{ collector.totals.hits }} + Total hits +
+
+ {{ collector.totals.misses }} + Total misses +
+
+ + {{ collector.totals.hit_read_ratio ?? 0 }} % + + Hits/reads +
+
+ +

Pools

+
+ {% for name, calls in collector.calls %} +
+

{{ name }} {{ collector.statistics[name].calls }}

+ +
+ {% if calls|length == 0 %} +
+

No calls were made for {{ name }} pool.

+
+ {% else %} +

Metrics

+
+ {% for key, value in collector.statistics[name] %} +
+ + {% if key == 'time' %} + {{ '%0.2f'|format(1000 * value) }} ms + {% elseif key == 'hit_read_ratio' %} + {{ value ?? 0 }} % + {% else %} + {{ value }} + {% endif %} + + {{ key == 'hit_read_ratio' ? 'Hits/reads' : key|capitalize }} +
+ {% if key == 'time' or key == 'deletes' %} +
+ {% endif %} + {% endfor %} +
+ +

Calls

+ + + + + + + + + + + {% for call in calls %} + + + + + + + {% endfor %} + +
#TimeCallHit
{{ loop.index }}{{ '%0.2f'|format((call.end - call.start) * 1000) }} ms{{ call.name }}(){{ profiler_dump(call.value.result, maxDepth=2) }}
+ {% endif %} +
+
+ {% endfor %} +
+ {% endif %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/config.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/config.html.twig new file mode 100644 index 0000000..6dfd27b --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/config.html.twig @@ -0,0 +1,226 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% if 'unknown' == collector.symfonyState %} + {% set block_status = '' %} + {% set symfony_version_status = 'Unable to retrieve information about the Symfony version.' %} + {% elseif 'eol' == collector.symfonyState %} + {% set block_status = 'red' %} + {% set symfony_version_status = 'This Symfony version will no longer receive security fixes.' %} + {% elseif 'eom' == collector.symfonyState %} + {% set block_status = 'yellow' %} + {% set symfony_version_status = 'This Symfony version will only receive security fixes.' %} + {% elseif 'dev' == collector.symfonyState %} + {% set block_status = 'yellow' %} + {% set symfony_version_status = 'This Symfony version is still in the development phase.' %} + {% else %} + {% set block_status = '' %} + {% set symfony_version_status = '' %} + {% endif %} + + {% set icon %} + + {{ include('@WebProfiler/Icon/symfony.svg') }} + + {{ collector.symfonyState is defined ? collector.symfonyversion : 'n/a' }} + {% endset %} + + {% set text %} +
+
+ Profiler token + + {% if profiler_url %} + {{ collector.token }} + {% else %} + {{ collector.token }} + {% endif %} + +
+ + {% if 'n/a' is not same as(collector.env) %} +
+ Environment + {{ collector.env }} +
+ {% endif %} + + {% if 'n/a' is not same as(collector.debug) %} +
+ Debug + {{ collector.debug ? 'enabled' : 'disabled' }} +
+ {% endif %} +
+ +
+
+ PHP version + + {{ collector.phpversion }} +   View phpinfo() + +
+ +
+ PHP Extensions + xdebug {{ collector.hasxdebug ? '✓' : '✗' }} + APCu {{ collector.hasapcu ? '✓' : '✗' }} + OPcache {{ collector.haszendopcache ? '✓' : '✗' }} +
+ +
+ PHP SAPI + {{ collector.sapiName }} +
+
+ +
+ {% if collector.symfonyversion is defined %} + + + {% endif %} +
+ {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right', block_attrs: 'title="' ~ symfony_version_status ~ '"' }) }} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/config.svg') }} + Configuration + +{% endblock %} + +{% block panel %} +

Symfony Configuration

+ +
+
+ {{ collector.symfonyversion }} + Symfony version +
+ + {% if 'n/a' is not same as(collector.env) %} +
+ {{ collector.env }} + Environment +
+ {% endif %} + + {% if 'n/a' is not same as(collector.debug) %} +
+ {{ collector.debug ? 'enabled' : 'disabled' }} + Debug +
+ {% endif %} +
+ + {% set symfony_status = { dev: 'Unstable Version', stable: 'Stable Version', eom: 'Maintenance Ended', eol: 'Version Expired' } %} + {% set symfony_status_class = { dev: 'warning', stable: 'success', eom: 'warning', eol: 'error' } %} + + + + + + + + + + + + + + + + + +
Symfony StatusBugs {{ collector.symfonystate in ['eom', 'eol'] ? 'were' : 'are' }} fixed untilSecurity issues {{ collector.symfonystate == 'eol' ? 'were' : 'are' }} fixed until
+ {{ symfony_status[collector.symfonystate]|upper }} + {% if collector.symfonylts %} +   Long-Term Support + {% endif %} + {{ collector.symfonyeom }}{{ collector.symfonyeol }} + View roadmap +
+ +

PHP Configuration

+ +
+
+ {{ collector.phpversion }}{% if collector.phpversionextra %} {{ collector.phpversionextra }}{% endif %} + PHP version +
+ +
+ {{ collector.phparchitecture }} bits + Architecture +
+ +
+ {{ collector.phpintllocale }} + Intl locale +
+ +
+ {{ collector.phptimezone }} + Timezone +
+
+ +
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.haszendopcache ? 'yes' : 'no') ~ '.svg') }} + OPcache +
+ +
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasapcu ? 'yes' : 'no-gray') ~ '.svg') }} + APCu +
+ +
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasxdebug ? 'yes' : 'no-gray') ~ '.svg') }} + Xdebug +
+
+ +

+ View full PHP configuration +

+ + {% if collector.bundles %} +

Enabled Bundles ({{ collector.bundles|length }})

+ + + + + + + + + {% for name in collector.bundles|keys|sort %} + + + + + {% endfor %} + +
NameClass
{{ name }}{{ profiler_dump(collector.bundles[name]) }}
+ {% endif %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/events.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/events.html.twig new file mode 100644 index 0000000..c0be48a --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/events.html.twig @@ -0,0 +1,119 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% import _self as helper %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/event.svg') }} + Events + +{% endblock %} + +{% block panel %} +

Event Dispatcher

+ + {% if collector.calledlisteners is empty %} +
+

No events have been recorded. Check that debugging is enabled in the kernel.

+
+ {% else %} +
+
+

Called Listeners {{ collector.calledlisteners|length }}

+ +
+ {{ helper.render_table(collector.calledlisteners) }} +
+
+ +
+

Not Called Listeners {{ collector.notcalledlisteners|length }}

+
+ {% if collector.notcalledlisteners is empty %} +
+

+ There are no uncalled listeners. +

+

+ All listeners were called for this request or an error occurred + when trying to collect uncalled listeners (in which case check the + logs to get more information). +

+
+ {% else %} + {{ helper.render_table(collector.notcalledlisteners) }} + {% endif %} +
+
+ +
+

Orphaned Events {{ collector.orphanedEvents|length }}

+
+ {% if collector.orphanedEvents is empty %} +
+

+ There are no orphaned events. +

+

+ All dispatched events were handled or an error occurred + when trying to collect orphaned events (in which case check the + logs to get more information). +

+
+ {% else %} + + + + + + + + {% for event in collector.orphanedEvents %} + + + + {% endfor %} + +
Event
{{ event }}
+ {% endif %} +
+
+
+ {% endif %} +{% endblock %} + +{% macro render_table(listeners) %} + + + + + + + + + {% set previous_event = (listeners|first).event %} + {% for listener in listeners %} + {% if loop.first or listener.event != previous_event %} + {% if not loop.first %} + + {% endif %} + + + + + + + {% set previous_event = listener.event %} + {% endif %} + + + + + + + {% if loop.last %} + + {% endif %} + {% endfor %} +
PriorityListener
{{ listener.event }}
{{ listener.priority|default('-') }}{{ profiler_dump(listener.stub) }}
+{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.css.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.css.twig new file mode 100644 index 0000000..aad7625 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.css.twig @@ -0,0 +1,32 @@ +.container { + max-width: none; + margin: 0; + padding: 0; +} +.container .container { + padding: 0; +} + +.exception-summary { + background: var(--base-0); + border: var(--border); + box-shadow: 0 0 1px rgba(128, 128, 128, .2); + margin: 1em 0; + padding: 10px; +} +.exception-summary.exception-without-message { + display: none; +} + +.exception-message { + color: var(--color-error); +} + +.exception-metadata, +.exception-illustration { + display: none; +} + +.exception-message-wrapper .container { + min-height: unset; +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.html.twig new file mode 100644 index 0000000..1fe0f5d --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/exception.html.twig @@ -0,0 +1,37 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block head %} + {% if collector.hasexception %} + + {% endif %} + {{ parent() }} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/exception.svg') }} + Exception + {% if collector.hasexception %} + + 1 + + {% endif %} + +{% endblock %} + +{% block panel %} +

Exceptions

+ + {% if not collector.hasexception %} +
+

No exception was thrown and caught during the request.

+
+ {% else %} +
+ {{ render(controller('web_profiler.controller.exception_panel::body', { token: token })) }} +
+ {% endif %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/form.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/form.html.twig new file mode 100644 index 0000000..db97100 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/form.html.twig @@ -0,0 +1,730 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% from _self import form_tree_entry, form_tree_details %} + +{% block toolbar %} + {% if collector.data.nb_errors > 0 or collector.data.forms|length %} + {% set status_color = collector.data.nb_errors ? 'red' %} + {% set icon %} + {{ include('@WebProfiler/Icon/form.svg') }} + + {{ collector.data.nb_errors ?: collector.data.forms|length }} + + {% endset %} + + {% set text %} +
+ Number of forms + {{ collector.data.forms|length }} +
+
+ Number of errors + {{ collector.data.nb_errors }} +
+ {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/form.svg') }} + Forms + {% if collector.data.nb_errors > 0 %} + + {{ collector.data.nb_errors }} + + {% endif %} + +{% endblock %} + +{% block head %} + {{ parent() }} + + +{% endblock %} + +{% block panel %} +

Forms

+ + {% if collector.data.forms|length %} +
+
    + {% for formName, formData in collector.data.forms %} + {{ form_tree_entry(formName, formData, true) }} + {% endfor %} +
+
+ +
+ {% for formName, formData in collector.data.forms %} + {{ form_tree_details(formName, formData, collector.data.forms_by_hash, loop.first) }} + {% endfor %} +
+ {% else %} +
+

No forms were submitted for this request.

+
+ {% endif %} + + +{% endblock %} + +{% macro form_tree_entry(name, data, is_root) %} + {% import _self as tree %} + {% set has_error = data.errors is defined and data.errors|length > 0 %} +
  • +
    + {% if has_error %} +
    {{ data.errors|length }}
    + {% endif %} + + {% if data.children is not empty %} + + {% else %} +
    + {% endif %} + + + {{ name|default('(no name)') }} + +
    + + {% if data.children is not empty %} +
      + {% for childName, childData in data.children %} + {{ tree.form_tree_entry(childName, childData, false) }} + {% endfor %} +
    + {% endif %} +
  • +{% endmacro %} + +{% macro form_tree_details(name, data, forms_by_hash, show) %} + {% import _self as tree %} +
    +

    {{ name|default('(no name)') }}

    + {% if data.type_class is defined %} +

    {{ profiler_dump(data.type_class) }}

    + {% endif %} + + {% if data.errors is defined and data.errors|length > 0 %} +
    +

    + + Errors + +

    + + + + + + + + + + + {% for error in data.errors %} + + + + + + {% endfor %} + +
    MessageOriginCause
    {{ error.message }} + {% if error.origin is empty %} + This form. + {% elseif forms_by_hash[error.origin] is not defined %} + Unknown. + {% else %} + {{ forms_by_hash[error.origin].name }} + {% endif %} + + {% if error.trace %} + Caused by: + {% for stacked in error.trace %} + {{ profiler_dump(stacked) }} + {% endfor %} + {% else %} + Unknown. + {% endif %} +
    +
    + {% endif %} + + {% if data.default_data is defined %} +

    + + Default Data + +

    + +
    + + + + + + + + + + + + + + + + + + + + + +
    PropertyValue
    Model Format + {% if data.default_data.model is defined %} + {{ profiler_dump(data.default_data.seek('model')) }} + {% else %} + same as normalized format + {% endif %} +
    Normalized Format{{ profiler_dump(data.default_data.seek('norm')) }}
    View Format + {% if data.default_data.view is defined %} + {{ profiler_dump(data.default_data.seek('view')) }} + {% else %} + same as normalized format + {% endif %} +
    +
    + {% endif %} + + {% if data.submitted_data is defined %} +

    + + Submitted Data + +

    + +
    + {% if data.submitted_data.norm is defined %} + + + + + + + + + + + + + + + + + + + + + +
    PropertyValue
    View Format + {% if data.submitted_data.view is defined %} + {{ profiler_dump(data.submitted_data.seek('view')) }} + {% else %} + same as normalized format + {% endif %} +
    Normalized Format{{ profiler_dump(data.submitted_data.seek('norm')) }}
    Model Format + {% if data.submitted_data.model is defined %} + {{ profiler_dump(data.submitted_data.seek('model')) }} + {% else %} + same as normalized format + {% endif %} +
    + {% else %} +
    +

    This form was not submitted.

    +
    + {% endif %} +
    + {% endif %} + + {% if data.passed_options is defined %} +

    + + Passed Options + +

    + +
    + {% if data.passed_options|length %} + + + + + + + + + + {% for option, value in data.passed_options %} + + + + + + {% endfor %} + +
    OptionPassed ValueResolved Value
    {{ option }}{{ profiler_dump(value) }} + {# values can be stubs #} + {% set option_value = value.value|default(value) %} + {% set resolved_option_value = data.resolved_options[option].value|default(data.resolved_options[option]) %} + {% if resolved_option_value == option_value %} + same as passed value + {% else %} + {{ profiler_dump(data.resolved_options.seek(option)) }} + {% endif %} +
    + {% else %} +
    +

    No options were passed when constructing this form.

    +
    + {% endif %} +
    + {% endif %} + + {% if data.resolved_options is defined %} +

    + + Resolved Options + +

    + + + {% endif %} + + {% if data.view_vars is defined %} +

    + + View Variables + +

    + + + {% endif %} +
    + + {% for childName, childData in data.children %} + {{ tree.form_tree_details(childName, childData, forms_by_hash) }} + {% endfor %} +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/http_client.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/http_client.html.twig new file mode 100644 index 0000000..8496ef1 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/http_client.html.twig @@ -0,0 +1,131 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% if collector.requestCount %} + {% set icon %} + {{ include('@WebProfiler/Icon/http-client.svg') }} + {% set status_color = '' %} + {{ collector.requestCount }} + {% endset %} + + {% set text %} +
    + Total requests + {{ collector.requestCount }} +
    +
    + HTTP errors + {{ collector.errorCount }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/http-client.svg') }} + HTTP Client + {% if collector.requestCount %} + + {{ collector.requestCount }} + + {% endif %} + +{% endblock %} + +{% block panel %} +

    HTTP Client

    + {% if collector.requestCount == 0 %} +
    +

    No HTTP requests were made.

    +
    + {% else %} +
    +
    + {{ collector.requestCount }} + Total requests +
    +
    + {{ collector.errorCount }} + HTTP errors +
    +
    +

    Clients

    +
    + {% for name, client in collector.clients %} +
    +

    {{ name }} {{ client.traces|length }}

    +
    + {% if client.traces|length == 0 %} +
    +

    No requests were made with the "{{ name }}" service.

    +
    + {% else %} +

    Requests

    + {% for trace in client.traces %} + {% set profiler_token = '' %} + {% set profiler_link = '' %} + {% if trace.info.response_headers is defined %} + {% for header in trace.info.response_headers %} + {% if header matches '/^x-debug-token: .*$/i' %} + {% set profiler_token = (header.getValue | slice('x-debug-token: ' | length)) %} + {% endif %} + {% if header matches '/^x-debug-token-link: .*$/i' %} + {% set profiler_link = (header.getValue | slice('x-debug-token-link: ' | length)) %} + {% endif %} + {% endfor %} + {% endif %} + + + + + + {% if profiler_token and profiler_link %} + + {% endif %} + + + + + + + {% if profiler_token and profiler_link %} + + {% endif %} + + +
    + {{ trace.method }} + + {{ trace.url }} + {% if trace.options is not empty %} + {{ profiler_dump(trace.options, maxDepth=1) }} + {% endif %} + + Profile +
    + {% if trace.http_code >= 500 %} + {% set responseStatus = 'error' %} + {% elseif trace.http_code >= 400 %} + {% set responseStatus = 'warning' %} + {% else %} + {% set responseStatus = 'success' %} + {% endif %} + + {{ trace.http_code }} + + + {{ profiler_dump(trace.info, maxDepth=1) }} + + {{ profiler_token }} +
    + {% endfor %} + {% endif %} +
    +
    + {% endfor %} + {% endif %} +
    +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/logger.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/logger.html.twig new file mode 100644 index 0000000..df2679d --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/logger.html.twig @@ -0,0 +1,274 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% import _self as helper %} + +{% block toolbar %} + {% if collector.counterrors or collector.countdeprecations or collector.countwarnings %} + {% set icon %} + {% set status_color = collector.counterrors ? 'red' : collector.countwarnings ? 'yellow' : 'none' %} + {{ include('@WebProfiler/Icon/logger.svg') }} + {{ collector.counterrors ?: (collector.countdeprecations + collector.countwarnings) }} + {% endset %} + + {% set text %} +
    + Errors + {{ collector.counterrors|default(0) }} +
    + +
    + Warnings + {{ collector.countwarnings|default(0) }} +
    + +
    + Deprecations + {{ collector.countdeprecations|default(0) }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/logger.svg') }} + Logs + {% if collector.counterrors or collector.countdeprecations or collector.countwarnings %} + + {{ collector.counterrors ?: (collector.countdeprecations + collector.countwarnings) }} + + {% endif %} + +{% endblock %} + +{% block panel %} +

    Log Messages

    + + {% if collector.processedLogs is empty %} +
    +

    No log messages available.

    +
    + {% else %} + {% set has_error_logs = collector.processedLogs|column('type')|filter(type => 'error' == type)|length > 0 %} + {% set has_deprecation_logs = collector.processedLogs|column('type')|filter(type => 'deprecation' == type)|length > 0 %} + + {% set filters = collector.filters %} +
    +
    +
      +
    • + + +
    • + +
    • + + +
    • + +
    • + + +
    • +
    +
    + +
    + + {{ include('@WebProfiler/Icon/filter.svg') }} + Level ({{ filters.priority|length - 1 }}) + + +
    +
    + + +
    + + {% for label, value in filters.priority %} +
    + + +
    + {% endfor %} +
    +
    + +
    + + {{ include('@WebProfiler/Icon/filter.svg') }} + Channel ({{ filters.channel|length - 1 }}) + + +
    +
    + + +
    + + {% for value in filters.channel %} +
    + + +
    + {% endfor %} +
    +
    +
    + + + + + + + + + + + + + + {% for log in collector.processedLogs %} + {% set css_class = 'error' == log.type ? 'error' + : (log.priorityName == 'WARNING' or 'deprecation' == log.type) ? 'warning' + : 'silenced' == log.type ? 'silenced' + %} + + + + + + {% endfor %} + +
    TimeMessage
    + + + {% if log.type in ['error', 'deprecation', 'silenced'] or 'WARNING' == log.priorityName %} + + {% if 'error' == log.type or 'WARNING' == log.priorityName %} + {{ log.priorityName|lower }} + {% else %} + {{ log.type|lower }} + {% endif %} + + {% else %} + + {{ log.priorityName|lower }} + + {% endif %} + + {{ helper.render_log_message('debug', loop.index, log) }} +
    + +
    +

    There are no log messages.

    +
    + + + {% endif %} + + {% set compilerLogTotal = 0 %} + {% for logs in collector.compilerLogs %} + {% set compilerLogTotal = compilerLogTotal + logs|length %} + {% endfor %} + +
    + +

    Container Compilation Logs ({{ compilerLogTotal }})

    +

    Log messages generated during the compilation of the service container.

    +
    + + {% if collector.compilerLogs is empty %} +
    +

    There are no compiler log messages.

    +
    + {% else %} + + + + + + + + + + {% for class, logs in collector.compilerLogs %} + + + + + {% endfor %} + +
    MessagesClass
    {{ logs|length }} + {% set context_id = 'context-compiler-' ~ loop.index %} + + + +
    +
      + {% for log in logs %} +
    • {{ profiler_dump_log(log.message) }}
    • + {% endfor %} +
    +
    +
    + {% endif %} +
    +{% endblock %} + +{% macro render_log_message(category, log_index, log) %} + {% set has_context = log.context is defined and log.context is not empty %} + {% set has_trace = log.context.exception.trace is defined %} + + {% if not has_context %} + {{ profiler_dump_log(log.message) }} + {% else %} + {{ profiler_dump_log(log.message, log.context) }} + {% endif %} + + +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/mailer.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/mailer.html.twig new file mode 100644 index 0000000..dab2e9c --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/mailer.html.twig @@ -0,0 +1,217 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% set events = collector.events %} + + {% if events.messages|length %} + {% set icon %} + {% include('@WebProfiler/Icon/mailer.svg') %} + {{ events.messages|length }} + {% endset %} + + {% set text %} +
    + Queued messages + {{ events.events|filter(e => e.isQueued())|length }} +
    +
    + Sent messages + {{ events.events|filter(e => not e.isQueued())|length }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': profiler_url }) }} + {% endif %} +{% endblock %} + +{% block head %} + {{ parent() }} + +{% endblock %} + +{% block menu %} + {% set events = collector.events %} + + + {{ include('@WebProfiler/Icon/mailer.svg') }} + + E-mails + {% if events.messages|length > 0 %} + + {{ events.messages|length }} + + {% endif %} + +{% endblock %} + +{% block panel %} + {% set events = collector.events %} + +

    Emails

    + + {% if not events.messages|length %} +
    +

    No emails were sent.

    +
    + {% endif %} + +
    +
    + {{ events.events|filter(e => e.isQueued())|length }} + Queued +
    + +
    + {{ events.events|filter(e => not e.isQueued())|length }} + Sent +
    +
    + + {% for transport in events.transports %} +
    +
    + {% for event in events.events(transport) %} + {% set message = event.message %} +
    +

    Email {{ event.isQueued() ? 'queued' : 'sent via ' ~ transport }}

    +
    +
    + {% if message.headers is not defined %} + {# RawMessage instance #} +
    +
    {{ message.toString() }}
    +
    + {% else %} + {# Message instance #} +
    +
    +
    +

    Headers

    +
    + Subject +

    {{ message.headers.get('subject').bodyAsString() ?? '(empty)' }}

    +
    +
    + From +
    {{ (message.headers.get('from').bodyAsString() ?? '(empty)')|replace({'From:': ''}) }}
    + + To +
    {{ (message.headers.get('to').bodyAsString() ?? '(empty)')|replace({'To:': ''}) }}
    +
    +
    + Headers +
    {% for header in message.headers.all|filter(header => (header.name ?? '') not in ['Subject', 'From', 'To']) %}
    +                                                                {{- header.toString }}
    +                                                            {%~ endfor %}
    +
    +
    +
    +
    + {% if message.htmlBody is defined %} + {# Email instance #} + {% set htmlBody = message.htmlBody() %} + {% if htmlBody is not null %} +
    +

    HTML Preview

    +
    +
    +                                                                
    +                                                            
    +
    +
    +
    +

    HTML Content

    +
    +
    +                                                                {%- if message.htmlCharset() %}
    +                                                                    {{- htmlBody|convert_encoding('UTF-8', message.htmlCharset()) }}
    +                                                                {%- else %}
    +                                                                    {{- htmlBody }}
    +                                                                {%- endif -%}
    +                                                            
    +
    +
    + {% endif %} + {% set textBody = message.textBody() %} + {% if textBody is not null %} +
    +

    Text Content

    +
    +
    +                                                                {%- if message.textCharset() %}
    +                                                                    {{- textBody|convert_encoding('UTF-8', message.textCharset()) }}
    +                                                                {%- else %}
    +                                                                    {{- textBody }}
    +                                                                {%- endif -%}
    +                                                            
    +
    +
    + {% endif %} + {% for attachment in message.attachments %} +
    +

    Attachment #{{ loop.index }}

    +
    +
    {{ attachment.toString() }}
    +
    +
    + {% endfor %} + {% endif %} +
    +

    Parts Hierarchy

    +
    +
    {{ message.body().asDebugString() }}
    +
    +
    +
    +

    Raw

    +
    +
    {{ message.toString() }}
    +
    +
    +
    +
    + {% endif %} +
    +
    +
    + {% endfor %} +
    +
    + {% endfor %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/memory.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/memory.html.twig new file mode 100644 index 0000000..1336a57 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/memory.html.twig @@ -0,0 +1,24 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% set icon %} + {% set status_color = (collector.memory / 1024 / 1024) > 50 ? 'yellow' %} + {{ include('@WebProfiler/Icon/memory.svg') }} + {{ '%.1f'|format(collector.memory / 1024 / 1024) }} + MiB + {% endset %} + + {% set text %} +
    + Peak memory usage + {{ '%.1f'|format(collector.memory / 1024 / 1024) }} MiB +
    + +
    + PHP memory limit + {{ collector.memoryLimit == -1 ? 'Unlimited' : '%.0f MiB'|format(collector.memoryLimit / 1024 / 1024) }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, name: 'time', status: status_color }) }} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/messenger.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/messenger.html.twig new file mode 100644 index 0000000..b48aaa8 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/messenger.html.twig @@ -0,0 +1,201 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% import _self as helper %} + +{% block toolbar %} + {% if collector.messages|length > 0 %} + {% set status_color = collector.exceptionsCount ? 'red' %} + {% set icon %} + {{ include('@WebProfiler/Icon/messenger.svg') }} + {{ collector.messages|length }} + {% endset %} + + {% set text %} + {% for bus in collector.buses %} + {% set exceptionsCount = collector.exceptionsCount(bus) %} +
    + {{ bus }} + + {{ collector.messages(bus)|length }} + +
    + {% endfor %} + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: 'messenger', status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/messenger.svg') }} + Messages + {% if collector.exceptionsCount > 0 %} + + {{ collector.exceptionsCount }} + + {% endif %} + +{% endblock %} + +{% block head %} + {{ parent() }} + +{% endblock %} + +{% block panel %} + {% import _self as helper %} + +

    Messages

    + + {% if collector.messages is empty %} +
    +

    No messages have been collected.

    +
    + {% else %} +
    +
    + {% set messages = collector.messages %} + {% set exceptionsCount = collector.exceptionsCount %} +

    All{{ messages|length }}

    + +
    +

    Ordered list of dispatched messages across all your buses

    + {{ helper.render_bus_messages(messages, true) }} +
    +
    + + {% for bus in collector.buses %} +
    + {% set messages = collector.messages(bus) %} + {% set exceptionsCount = collector.exceptionsCount(bus) %} +

    {{ bus }}{{ messages|length }}

    + +
    +

    Ordered list of messages dispatched on the {{ bus }} bus

    + {{ helper.render_bus_messages(messages) }} +
    +
    + {% endfor %} +
    + {% endif %} + +{% endblock %} + +{% macro render_bus_messages(messages, showBus = false) %} + {% set discr = random() %} + {% for dispatchCall in messages %} + + + + + + + + + + + {% if showBus %} + + + + + {% endif %} + + + + + + + + + {% if dispatchCall.stamps_after_dispatch is defined %} + + + + + {% endif %} + {% if dispatchCall.exception is defined %} + + + + + {% endif %} + +
    + {{ profiler_dump(dispatchCall.message.type) }} + {% if showBus %} + {{ dispatchCall.bus }} + {% endif %} + {% if dispatchCall.exception is defined %} + exception + {% endif %} + + {{ include('@WebProfiler/images/icon-minus-square.svg') }} + {{ include('@WebProfiler/images/icon-plus-square.svg') }} + +
    + + + +
    Bus{{ dispatchCall.bus }}
    Message{{ profiler_dump(dispatchCall.message.value, maxDepth=2) }}
    Envelope stamps when dispatching + {% for item in dispatchCall.stamps %} + {{ profiler_dump(item) }} + {% else %} + No items + {% endfor %} +
    Envelope stamps after dispatch + {% for item in dispatchCall.stamps_after_dispatch %} + {{ profiler_dump(item) }} + {% else %} + No items + {% endfor %} +
    Exception + {{ profiler_dump(dispatchCall.exception.value, maxDepth=1) }} +
    + {% endfor %} +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/notifier.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/notifier.html.twig new file mode 100644 index 0000000..dd17fab --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/notifier.html.twig @@ -0,0 +1,168 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% set events = collector.events %} + + {% if events.messages|length %} + {% set icon %} + {% include('@WebProfiler/Icon/notifier.svg') %} + {{ events.messages|length }} + {% endset %} + + {% set text %} +
    + Sent notifications + {{ events.messages|length }} +
    + + {% for transport in events.transports %} +
    + {{ transport }} + {{ events.messages(transport)|length }} +
    + {% endfor %} + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': profiler_url }) }} + {% endif %} +{% endblock %} + +{% block head %} + {{ parent() }} + +{% endblock %} + +{% block menu %} + {% set events = collector.events %} + + + {{ include('@WebProfiler/Icon/notifier.svg') }} + + Notifications + {% if events.messages|length > 0 %} + + {{ events.messages|length }} + + {% endif %} + +{% endblock %} + +{% block panel %} + {% set events = collector.events %} + +

    Notifications

    + + {% if not events.messages|length %} +
    +

    No notifications were sent.

    +
    + {% endif %} + +
    + {% for transport in events.transports %} +
    + {{ events.messages(transport)|length }} + {{ transport }} +
    + {% endfor %} +
    + + {% for transport in events.transports %} +

    {{ transport }}

    + +
    +
    + {% for event in events.events(transport) %} + {% set message = event.message %} +
    +

    Message #{{ loop.index }} ({{ event.isQueued() ? 'queued' : 'sent' }})

    +
    +
    +
    + Subject +

    {{ message.getSubject() ?? '(empty)' }}

    +
    + {% if message.getNotification is defined %} +
    +
    +
    + Content +
    {{ message.getNotification().getContent() ?? '(empty)' }}
    + Importance +
    {{ message.getNotification().getImportance() }}
    +
    +
    +
    + {% endif %} +
    +
    + {% if message.getNotification is defined %} +
    +

    Notification

    + {% set notification = event.message.getNotification() %} +
    +
    +                                                            {{- 'Subject: ' ~ notification.getSubject() }}
    + {{- 'Content: ' ~ notification.getContent() }}
    + {{- 'Importance: ' ~ notification.getImportance() }}
    + {{- 'Emoji: ' ~ (notification.getEmoji() is empty ? '(empty)' : notification.getEmoji()) }}
    + {{- 'Exception: ' ~ notification.getException() ?? '(empty)' }}
    + {{- 'ExceptionAsString: ' ~ (notification.getExceptionAsString() is empty ? '(empty)' : notification.getExceptionAsString()) }} +
    +
    +
    + {% endif %} +
    +

    Message Options

    +
    +
    +                                                            {%- if message.getOptions() is null %}
    +                                                                {{- '(empty)' }}
    +                                                            {%- else %}
    +                                                                {{- message.getOptions()|json_encode(constant('JSON_PRETTY_PRINT')) }}
    +                                                            {%- endif %}
    +                                                        
    +
    +
    +
    +
    +
    +
    +
    + {% endfor %} +
    +
    + {% endfor %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/request.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/request.html.twig new file mode 100644 index 0000000..18311c1 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/request.html.twig @@ -0,0 +1,392 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% import _self as helper %} + {% set request_handler %} + {{ helper.set_handler(collector.controller) }} + {% endset %} + + {% if collector.redirect %} + {% set redirect_handler %} + {{ helper.set_handler(collector.redirect.controller, collector.redirect.route, 'GET' != collector.redirect.method ? collector.redirect.method) }} + {% endset %} + {% endif %} + + {% if collector.forwardtoken %} + {% set forward_profile = profile.childByToken(collector.forwardtoken) %} + {% set forward_handler %} + {{ helper.set_handler(forward_profile ? forward_profile.collector('request').controller : 'n/a') }} + {% endset %} + {% endif %} + + {% set request_status_code_color = (collector.statuscode >= 400) ? 'red' : (collector.statuscode >= 300) ? 'yellow' : 'green' %} + + {% set icon %} + {{ collector.statuscode }} + {% if collector.route %} + {% if collector.redirect %}{{ include('@WebProfiler/Icon/redirect.svg') }}{% endif %} + {% if collector.forwardtoken %}{{ include('@WebProfiler/Icon/forward.svg') }}{% endif %} + {{ 'GET' != collector.method ? collector.method }} @ + {{ collector.route }} + {% endif %} + {% endset %} + + {% set text %} +
    +
    + HTTP status + {{ collector.statuscode }} {{ collector.statustext }} +
    + + {% if 'GET' != collector.method -%} +
    + Method + {{ collector.method }} +
    + {%- endif %} + +
    + Controller + {{ request_handler }} +
    + +
    + Route name + {{ collector.route|default('n/a') }} +
    + +
    + Has session + {% if collector.sessionmetadata|length %}yes{% else %}no{% endif %} +
    + +
    + Stateless Check + {% if collector.statelesscheck %}yes{% else %}no{% endif %} +
    +
    + + {% if redirect_handler is defined -%} +
    +
    + + {{ collector.redirect.status_code }} + Redirect from + + + {{ redirect_handler }} + ({{ collector.redirect.token }}) + +
    +
    + {% endif %} + + {% if forward_handler is defined %} +
    +
    + Forwarded to + + {{ forward_handler }} + ({{ collector.forwardtoken }}) + +
    +
    + {% endif %} + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/request.svg') }} + Request / Response + +{% endblock %} + +{% block panel %} + {% import _self as helper %} + +

    + {{ helper.set_handler(collector.controller) }} +

    + +
    +
    +

    Request

    + +
    +

    GET Parameters

    + + {% if collector.requestquery.all is empty %} +
    +

    No GET parameters

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestquery, maxDepth: 1 }, with_context = false) }} + {% endif %} + +

    POST Parameters

    + + {% if collector.requestrequest.all is empty %} +
    +

    No POST parameters

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestrequest, maxDepth: 1 }, with_context = false) }} + {% endif %} + +

    Uploaded Files

    + + {% if collector.requestfiles is empty %} +
    +

    No files were uploaded

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestfiles, maxDepth: 1 }, with_context = false) }} + {% endif %} + +

    Request Attributes

    + + {% if collector.requestattributes.all is empty %} +
    +

    No attributes

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestattributes }, with_context = false) }} + {% endif %} + +

    Request Headers

    + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestheaders, labels: ['Header', 'Value'], maxDepth: 1 }, with_context = false) }} + +

    Request Content

    + + {% if collector.content == false %} +
    +

    Request content not available (it was retrieved as a resource).

    +
    + {% elseif collector.content %} +
    + {% set prettyJson = collector.isJsonRequest ? collector.prettyJson : null %} + {% if prettyJson is not null %} +
    +

    Pretty

    +
    +
    +
    {{ prettyJson }}
    +
    +
    +
    + {% endif %} + +
    +

    Raw

    +
    +
    +
    {{ collector.content }}
    +
    +
    +
    +
    + {% else %} +
    +

    No content

    +
    + {% endif %} +
    +
    + +
    +

    Response

    + +
    +

    Response Headers

    + + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.responseheaders, labels: ['Header', 'Value'], maxDepth: 1 }, with_context = false) }} +
    +
    + +
    +

    Cookies

    + +
    +

    Request Cookies

    + + {% if collector.requestcookies.all is empty %} +
    +

    No request cookies

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestcookies }, with_context = false) }} + {% endif %} + +

    Response Cookies

    + + {% if collector.responsecookies.all is empty %} +
    +

    No response cookies

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.responsecookies }, with_context = true) }} + {% endif %} +
    +
    + + + +
    +

    Flashes

    + +
    +

    Flashes

    + + {% if collector.flashes is empty %} +
    +

    No flash messages were created.

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/table.html.twig', { data: collector.flashes }, with_context = false) }} + {% endif %} +
    +
    + +
    +

    Server Parameters

    +
    +

    Server Parameters

    +

    Defined in .env

    + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.dotenvvars }, with_context = false) }} + +

    Defined as regular env variables

    + {% set requestserver = [] %} + {% for key, value in collector.requestserver|filter((_, key) => key not in collector.dotenvvars.keys) %} + {% set requestserver = requestserver|merge({(key): value}) %} + {% endfor %} + {{ include('@WebProfiler/Profiler/table.html.twig', { data: requestserver }, with_context = false) }} +
    +
    + + {% if profile.parent %} +
    +

    Parent Request

    + +
    +

    + Return to parent request + (token = {{ profile.parent.token }}) +

    + + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: profile.parent.getcollector('request').requestattributes }, with_context = false) }} +
    +
    + {% endif %} + + {% if profile.children|length %} +
    +

    Sub Requests {{ profile.children|length }}

    + +
    + {% for child in profile.children %} +

    + {{ helper.set_handler(child.getcollector('request').controller) }} + (token = {{ child.token }}) +

    + + {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: child.getcollector('request').requestattributes }, with_context = false) }} + {% endfor %} +
    +
    + {% endif %} +
    +{% endblock %} + +{% macro set_handler(controller, route, method) %} + {% if controller.class is defined -%} + {%- if method|default(false) %}{{ method }}{% endif -%} + {%- set link = controller.file|file_link(controller.line) %} + {%- if link %}{% else %}{% endif %} + + {%- if route|default(false) -%} + @{{ route }} + {%- else -%} + {{- controller.class|abbr_class|striptags -}} + {{- controller.method ? ' :: ' ~ controller.method -}} + {%- endif -%} + + {%- if link %}{% else %}
    {% endif %} + {%- else -%} + {{ route|default(controller) }} + {%- endif %} +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/router.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/router.html.twig new file mode 100644 index 0000000..a1449c2 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/router.html.twig @@ -0,0 +1,14 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %}{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/router.svg') }} + Routing + +{% endblock %} + +{% block panel %} + {{ render(controller('web_profiler.controller.router::panelAction', { token: token })) }} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.css.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.css.twig new file mode 100644 index 0000000..b64b6ff --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.css.twig @@ -0,0 +1,64 @@ +/* Legend */ + +.sf-profiler-timeline .legends .timeline-category { + border: none; + background: none; + border-left: 1em solid transparent; + line-height: 1em; + margin: 0 1em 0 0; + padding: 0 0.5em; + display: none; + opacity: 0.5; +} + +.sf-profiler-timeline .legends .timeline-category.active { + opacity: 1; +} + +.sf-profiler-timeline .legends .timeline-category.present { + display: inline-block; +} + +.timeline-graph { + margin: 1em 0; + width: 100%; + background-color: var(--table-background); + border: 1px solid var(--table-border); +} + +/* Typography */ + +.timeline-graph .timeline-label { + font-family: var(--font-sans-serif); + font-size: 12px; + line-height: 12px; + font-weight: normal; + fill: var(--color-text); +} + +.timeline-graph .timeline-label .timeline-sublabel { + margin-left: 1em; + fill: var(--color-muted); +} + +.timeline-graph .timeline-subrequest, +.timeline-graph .timeline-border { + fill: none; + stroke: var(--table-border); + stroke-width: 1px; +} + +.timeline-graph .timeline-subrequest { + fill: url(#subrequest); + fill-opacity: 0.5; +} + +.timeline-subrequest-pattern { + fill: var(--table-border); +} + +/* Timeline periods */ + +.timeline-graph .timeline-period { + stroke-width: 0; +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.html.twig new file mode 100644 index 0000000..0ed3ddc --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.html.twig @@ -0,0 +1,214 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% import _self as helper %} + +{% block toolbar %} + {% set has_time_events = collector.events|length > 0 %} + {% set total_time = has_time_events ? '%.0f'|format(collector.duration) : 'n/a' %} + {% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %} + {% set status_color = has_time_events and collector.duration > 1000 ? 'yellow' %} + + {% set icon %} + {{ include('@WebProfiler/Icon/time.svg') }} + {{ total_time }} + ms + {% endset %} + + {% set text %} +
    + Total time + {{ total_time }} ms +
    +
    + Initialization time + {{ initialization_time }} ms +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/time.svg') }} + Performance + +{% endblock %} + +{% block panel %} + {% set has_time_events = collector.events|length > 0 %} +

    Performance metrics

    + +
    +
    + {{ '%.0f'|format(collector.duration) }} ms + Total execution time +
    + +
    + {{ '%.0f'|format(collector.inittime) }} ms + Symfony initialization +
    + + {% if profile.collectors.memory %} +
    + {{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} MiB + Peak memory usage +
    + {% endif %} + + {% if profile.children|length > 0 %} +
    + +
    + {{ profile.children|length }} + Sub-Request{{ profile.children|length > 1 ? 's' }} +
    + + {% if has_time_events %} + {% set subrequests_time = 0 %} + {% for child in profile.children %} + {% set subrequests_time = subrequests_time + child.getcollector('time').events.__section__.duration %} + {% endfor %} + {% else %} + {% set subrequests_time = 'n/a' %} + {% endif %} + +
    + {{ subrequests_time }} ms + Sub-Request{{ profile.children|length > 1 ? 's' }} time +
    + {% endif %} +
    + +

    Execution timeline

    + + {% if not collector.isStopwatchInstalled() %} +
    +

    The Stopwatch component is not installed. If you want to see timing events, run: composer require symfony/stopwatch.

    +
    + {% elseif collector.events is empty %} +
    +

    No timing events have been recorded. Check that symfony/stopwatch is installed and debugging enabled in the kernel.

    +
    + {% else %} + {{ block('panelContent') }} + {% endif %} +{% endblock %} + +{% block panelContent %} +
    + + + ms + (timeline only displays events with a duration longer than this threshold) +
    + + {% if profile.parent %} +

    + Sub-Request {{ profiler_dump(profile.getcollector('request').requestattributes.get('_controller')) }} + + {{ collector.events.__section__.duration }} ms + Return to parent request + +

    + {% elseif profile.children|length > 0 %} +

    + Main Request {{ collector.events.__section__.duration }} ms +

    + {% endif %} + + {{ helper.display_timeline(token, collector.events, collector.events.__section__.origin) }} + + {% if profile.children|length %} +

    Note: sections with a striped background correspond to sub-requests.

    + +

    Sub-requests ({{ profile.children|length }})

    + + {% for child in profile.children %} + {% set events = child.getcollector('time').events %} +

    + {{ child.getcollector('request').identifier }} + {{ events.__section__.duration }} ms +

    + + {{ helper.display_timeline(child.token, events, collector.events.__section__.origin) }} + {% endfor %} + {% endif %} + + + + + + + + + + +{% endblock %} + +{% macro dump_request_data(token, events, origin) %} +{% autoescape 'js' %} +{% from _self import dump_events %} +{ + id: "{{ token }}", + left: {{ "%F"|format(events.__section__.origin - origin) }}, + end: "{{ '%F'|format(events.__section__.endtime) }}", + events: [ {{ dump_events(events) }} ], +} +{% endautoescape %} +{% endmacro %} + +{% macro dump_events(events) %} +{% autoescape 'js' %} +{% for name, event in events %} +{% if '__section__' != name %} +{ + name: "{{ name }}", + category: "{{ event.category }}", + origin: {{ "%F"|format(event.origin) }}, + starttime: {{ "%F"|format(event.starttime) }}, + endtime: {{ "%F"|format(event.endtime) }}, + duration: {{ "%F"|format(event.duration) }}, + memory: {{ "%.1F"|format(event.memory / 1024 / 1024) }}, + elements: {}, + periods: [ + {%- for period in event.periods -%} + { + start: {{ "%F"|format(period.starttime) }}, + end: {{ "%F"|format(period.endtime) }}, + duration: {{ "%F"|format(period.duration) }}, + elements: {} + }, + {%- endfor -%} + ], +}, +{% endif %} +{% endfor %} +{% endautoescape %} +{% endmacro %} + +{% macro display_timeline(token, events, origin) %} +{% import _self as helper %} +
    +
    + + +
    +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.js b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.js new file mode 100644 index 0000000..156c934 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/time.js @@ -0,0 +1,457 @@ +'use strict'; + +class TimelineEngine { + /** + * @param {Theme} theme + * @param {Renderer} renderer + * @param {Legend} legend + * @param {Element} threshold + * @param {Object} request + * @param {Number} eventHeight + * @param {Number} horizontalMargin + */ + constructor(theme, renderer, legend, threshold, request, eventHeight = 36, horizontalMargin = 10) { + this.theme = theme; + this.renderer = renderer; + this.legend = legend; + this.threshold = threshold; + this.request = request; + this.scale = renderer.width / request.end; + this.eventHeight = eventHeight; + this.horizontalMargin = horizontalMargin; + this.labelY = Math.round(this.eventHeight * 0.48); + this.periodY = Math.round(this.eventHeight * 0.66); + this.FqcnMatcher = /\\([^\\]+)$/i; + this.origin = null; + + this.createEventElements = this.createEventElements.bind(this); + this.createBackground = this.createBackground.bind(this); + this.createPeriod = this.createPeriod.bind(this); + this.render = this.render.bind(this); + this.renderEvent = this.renderEvent.bind(this); + this.renderPeriod = this.renderPeriod.bind(this); + this.onResize = this.onResize.bind(this); + this.isActive = this.isActive.bind(this); + + this.threshold.addEventListener('change', this.render); + this.legend.addEventListener('change', this.render); + + window.addEventListener('resize', this.onResize); + + this.createElements(); + this.render(); + } + + onResize() { + this.renderer.measure(); + this.setScale(this.renderer.width / this.request.end); + } + + setScale(scale) { + if (scale !== this.scale) { + this.scale = scale; + this.render(); + } + } + + createElements() { + this.origin = this.renderer.setFullVerticalLine(this.createBorder(), 0); + this.renderer.add(this.origin); + + this.request.events + .filter(event => event.category === 'section') + .map(this.createBackground) + .forEach(this.renderer.add); + + this.request.events + .map(this.createEventElements) + .forEach(this.renderer.add); + } + + createBackground(event) { + const subrequest = event.name === '__section__.child'; + const background = this.renderer.create('rect', subrequest ? 'timeline-subrequest' : 'timeline-border'); + + event.elements = Object.assign(event.elements || {}, { background }); + + return background; + } + + createEventElements(event) { + const { name, category, duration, memory, periods } = event; + const border = this.renderer.setFullHorizontalLine(this.createBorder(), 0); + const lines = periods.map(period => this.createPeriod(period, category)); + const label = this.createLabel(this.getShortName(name), duration, memory, periods[0]); + const title = this.renderer.createTitle(name); + const group = this.renderer.group([title, border, label].concat(lines), this.theme.getCategoryColor(event.category)); + + event.elements = Object.assign(event.elements || {}, { group, label, border }); + + this.legend.add(event.category) + + return group; + } + + createLabel(name, duration, memory, period) { + const label = this.renderer.createText(name, period.start * this.scale, this.labelY, 'timeline-label'); + const sublabel = this.renderer.createTspan(` ${duration} ms / ${memory} MiB`, 'timeline-sublabel'); + + label.appendChild(sublabel); + + return label; + } + + createPeriod(period, category) { + const timeline = this.renderer.createPath(null, 'timeline-period', this.theme.getCategoryColor(category)); + + period.draw = category === 'section' ? this.renderer.setSectionLine : this.renderer.setPeriodLine; + period.elements = Object.assign(period.elements || {}, { timeline }); + + return timeline; + } + + createBorder() { + return this.renderer.createPath(null, 'timeline-border'); + } + + isActive(event) { + const { duration, category } = event; + + return duration >= this.threshold.value && this.legend.isActive(category); + } + + render() { + const events = this.request.events.filter(this.isActive); + const width = this.renderer.width + this.horizontalMargin * 2; + const height = this.eventHeight * events.length; + + // Set view box + this.renderer.setViewBox(-this.horizontalMargin, 0, width, height); + + // Show 0ms origin + this.renderer.setFullVerticalLine(this.origin, 0); + + // Render all events + this.request.events.forEach(event => this.renderEvent(event, events.indexOf(event))); + } + + renderEvent(event, index) { + const { name, category, duration, memory, periods, elements } = event; + const { group, label, border, background } = elements; + const visible = index >= 0; + + group.setAttribute('visibility', visible ? 'visible' : 'hidden'); + + if (background) { + background.setAttribute('visibility', visible ? 'visible' : 'hidden'); + + if (visible) { + const [min, max] = this.getEventLimits(event); + + this.renderer.setFullRectangle(background, min * this.scale, max * this.scale); + } + } + + if (visible) { + // Position the group + group.setAttribute('transform', `translate(0, ${index * this.eventHeight})`); + + // Update top border + this.renderer.setFullHorizontalLine(border, 0); + + // render label and ensure it doesn't escape the viewport + this.renderLabel(label, event); + + // Update periods + periods.forEach(this.renderPeriod); + } + } + + renderLabel(label, event) { + const width = this.getLabelWidth(label); + const [min, max] = this.getEventLimits(event); + const alignLeft = (min * this.scale) + width <= this.renderer.width; + + label.setAttribute('x', (alignLeft ? min : max) * this.scale); + label.setAttribute('text-anchor', alignLeft ? 'start' : 'end'); + } + + renderPeriod(period) { + const { elements, start, duration } = period; + + period.draw(elements.timeline, start * this.scale, this.periodY, Math.max(duration * this.scale, 1)); + } + + getLabelWidth(label) { + if (typeof label.width === 'undefined') { + label.width = label.getBBox().width; + } + + return label.width; + } + + getEventLimits(event) { + if (typeof event.limits === 'undefined') { + const { periods } = event; + + event.limits = [ + periods[0].start, + periods[periods.length - 1].end + ]; + } + + return event.limits; + } + + getShortName(name) { + const matches = this.FqcnMatcher.exec(name); + + if (matches) { + return matches[1]; + } + + return name; + } +} + +class Legend { + constructor(element, theme) { + this.element = element; + this.theme = theme; + + this.toggle = this.toggle.bind(this); + this.createCategory = this.createCategory.bind(this); + + this.categories = []; + this.theme.getDefaultCategories().forEach(this.createCategory); + } + + add(category) { + this.get(category).classList.add('present'); + } + + createCategory(category) { + const element = document.createElement('button'); + element.className = `timeline-category active`; + element.style.borderColor = this.theme.getCategoryColor(category); + element.innerText = category; + element.value = category; + element.type = 'button'; + element.addEventListener('click', this.toggle); + + this.element.appendChild(element); + + this.categories.push(element); + + return element; + } + + toggle(event) { + event.target.classList.toggle('active'); + + this.emit('change'); + } + + isActive(category) { + return this.get(category).classList.contains('active'); + } + + get(category) { + return this.categories.find(element => element.value === category) || this.createCategory(category); + } + + emit(name) { + this.element.dispatchEvent(new Event(name)); + } + + addEventListener(name, callback) { + this.element.addEventListener(name, callback); + } + + removeEventListener(name, callback) { + this.element.removeEventListener(name, callback); + } +} + +class SvgRenderer { + /** + * @param {SVGElement} element + */ + constructor(element) { + this.ns = 'http://www.w3.org/2000/svg'; + this.width = null; + this.viewBox = {}; + this.element = element; + + this.add = this.add.bind(this); + + this.setViewBox(0, 0, 0, 0); + this.measure(); + } + + setViewBox(x, y, width, height) { + this.viewBox = { x, y, width, height }; + this.element.setAttribute('viewBox', `${x} ${y} ${width} ${height}`); + } + + measure() { + this.width = this.element.getBoundingClientRect().width; + } + + add(element) { + this.element.appendChild(element); + } + + group(elements, className) { + const group = this.create('g', className); + + elements.forEach(element => group.appendChild(element)); + + return group; + } + + setHorizontalLine(element, x, y, width) { + element.setAttribute('d', `M${x},${y} h${width}`); + + return element; + } + + setVerticalLine(element, x, y, height) { + element.setAttribute('d', `M${x},${y} v${height}`); + + return element; + } + + setFullHorizontalLine(element, y) { + return this.setHorizontalLine(element, this.viewBox.x, y, this.viewBox.width); + } + + setFullVerticalLine(element, x) { + return this.setVerticalLine(element, x, this.viewBox.y, this.viewBox.height); + } + + setFullRectangle(element, min, max) { + element.setAttribute('x', min); + element.setAttribute('y', this.viewBox.y); + element.setAttribute('width', max - min); + element.setAttribute('height', this.viewBox.height); + } + + setSectionLine(element, x, y, width, height = 4, markerSize = 6) { + const totalHeight = height + markerSize; + const maxMarkerWidth = Math.min(markerSize, width / 2); + const widthWithoutMarker = Math.max(0, width - (maxMarkerWidth * 2)); + + element.setAttribute('d', `M${x},${y + totalHeight} v${-totalHeight} h${width} v${totalHeight} l${-maxMarkerWidth} ${-markerSize} h${-widthWithoutMarker} Z`); + } + + setPeriodLine(element, x, y, width, height = 4, markerWidth = 2, markerHeight = 4) { + const totalHeight = height + markerHeight; + const maxMarkerWidth = Math.min(markerWidth, width); + + element.setAttribute('d', `M${x + maxMarkerWidth},${y + totalHeight} h${-maxMarkerWidth} v${-totalHeight} h${width} v${height} h${maxMarkerWidth-width}Z`); + } + + createText(content, x, y, className) { + const element = this.create('text', className); + + element.setAttribute('x', x); + element.setAttribute('y', y); + element.textContent = content; + + return element; + } + + createTspan(content, className) { + const element = this.create('tspan', className); + + element.textContent = content; + + return element; + } + + createTitle(content) { + const element = this.create('title'); + + element.textContent = content; + + return element; + } + + createPath(path = null, className = null, color = null) { + const element = this.create('path', className); + + if (path) { + element.setAttribute('d', path); + } + + if (color) { + element.setAttribute('fill', color); + } + + return element; + } + + create(name, className = null) { + const element = document.createElementNS(this.ns, name); + + if (className) { + element.setAttribute('class', className); + } + + return element; + } +} + +class Theme { + constructor(element) { + this.reservedCategoryColors = { + 'default': '#777', + 'section': '#999', + 'event_listener': '#00b8f5', + 'template': '#66cc00', + 'doctrine': '#ff6633', + 'messenger_middleware': '#bdb81e', + 'controller.argument_value_resolver': '#8c5de6', + 'http_client': '#ffa333', + }; + + this.customCategoryColors = [ + '#dbab09', // dark yellow + '#ea4aaa', // pink + '#964b00', // brown + '#22863a', // dark green + '#0366d6', // dark blue + '#17a2b8', // teal + ]; + + this.getCategoryColor = this.getCategoryColor.bind(this); + this.getDefaultCategories = this.getDefaultCategories.bind(this); + } + + getDefaultCategories() { + return Object.keys(this.reservedCategoryColors); + } + + getCategoryColor(category) { + return this.reservedCategoryColors[category] || this.getRandomColor(category); + } + + getRandomColor(category) { + // instead of pure randomness, colors are assigned deterministically based on the + // category name, to ensure that each custom category always displays the same color + return this.customCategoryColors[this.hash(category) % this.customCategoryColors.length]; + } + + // copied from https://github.com/darkskyapp/string-hash + hash(string) { + var hash = 5381; + var i = string.length; + + while(i) { + hash = (hash * 33) ^ string.charCodeAt(--i); + } + + return hash >>> 0; + } +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/translation.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/translation.html.twig new file mode 100644 index 0000000..a8a5c27 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/translation.html.twig @@ -0,0 +1,210 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% import _self as helper %} + +{% block toolbar %} + {% if collector.messages|length %} + {% set icon %} + {{ include('@WebProfiler/Icon/translation.svg') }} + {% set status_color = collector.countMissings ? 'red' : collector.countFallbacks ? 'yellow' %} + {% set error_count = collector.countMissings + collector.countFallbacks %} + {{ error_count ?: collector.countDefines }} + {% endset %} + + {% set text %} +
    + Default locale + + {{ collector.locale|default('-') }} + +
    +
    + Missing messages + + {{ collector.countMissings }} + +
    + +
    + Fallback messages + + {{ collector.countFallbacks }} + +
    + +
    + Defined messages + {{ collector.countDefines }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/translation.svg') }} + Translation + {% if collector.countMissings or collector.countFallbacks %} + {% set error_count = collector.countMissings + collector.countFallbacks %} + + {{ error_count }} + + {% endif %} + +{% endblock %} + +{% block panel %} +

    Translation

    + +
    +
    + {{ collector.locale|default('-') }} + Default locale +
    +
    + {{ collector.fallbackLocales|join(', ')|default('-') }} + Fallback locale{{ collector.fallbackLocales|length != 1 ? 's' }} +
    +
    + +

    Messages

    + + {% if collector.messages is empty %} +
    +

    No translations have been called.

    +
    + {% else %} + {% block messages %} + + {# sort translation messages in groups #} + {% set messages_defined, messages_missing, messages_fallback = [], [], [] %} + {% for message in collector.messages %} + {% if message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED') %} + {% set messages_defined = messages_defined|merge([message]) %} + {% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING') %} + {% set messages_missing = messages_missing|merge([message]) %} + {% elseif message.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %} + {% set messages_fallback = messages_fallback|merge([message]) %} + {% endif %} + {% endfor %} + +
    +
    +

    Defined {{ collector.countDefines }}

    + +
    +

    + These messages are correctly translated into the given locale. +

    + + {% if messages_defined is empty %} +
    +

    None of the used translation messages are defined for the given locale.

    +
    + {% else %} + {% block defined_messages %} + {{ helper.render_table(messages_defined) }} + {% endblock %} + {% endif %} +
    +
    + +
    +

    Fallback {{ collector.countFallbacks }}

    + +
    +

    + These messages are not available for the given locale + but Symfony found them in the fallback locale catalog. +

    + + {% if messages_fallback is empty %} +
    +

    No fallback translation messages were used.

    +
    + {% else %} + {% block fallback_messages %} + {{ helper.render_table(messages_fallback, true) }} + {% endblock %} + {% endif %} +
    +
    + +
    +

    Missing {{ collector.countMissings }}

    + +
    +

    + These messages are not available for the given locale and cannot + be found in the fallback locales. Add them to the translation + catalogue to avoid Symfony outputting untranslated contents. +

    + + {% if messages_missing is empty %} +
    +

    There are no messages of this category.

    +
    + {% else %} + {% block missing_messages %} + {{ helper.render_table(messages_missing) }} + {% endblock %} + {% endif %} +
    +
    +
    + + + + {% endblock messages %} + {% endif %} + +{% endblock %} + +{% macro render_table(messages, is_fallback) %} + + + + + {% if is_fallback %} + + {% endif %} + + + + + + + + {% for message in messages %} + + + {% if is_fallback %} + + {% endif %} + + + + + + {% endfor %} + +
    LocaleFallback localeDomainTimes usedMessage IDMessage Preview
    {{ message.locale }}{{ message.fallbackLocale|default('-') }}{{ message.domain }}{{ message.count }} + {{ message.id }} + + {% if message.transChoiceNumber is not null %} + (pluralization is used) + {% endif %} + + {% if message.parameters|length > 0 %} + + + + {% endif %} + {{ message.translation }}
    +{% endmacro %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/twig.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/twig.html.twig new file mode 100644 index 0000000..be84c19 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/twig.html.twig @@ -0,0 +1,115 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% set time = collector.templatecount ? '%0.0f'|format(collector.time) : 'n/a' %} + {% set icon %} + {{ include('@WebProfiler/Icon/twig.svg') }} + {{ time }} + ms + {% endset %} + + {% set text %} +
    + Render Time + {{ time }} ms +
    +
    + Template Calls + {{ collector.templatecount }} +
    +
    + Block Calls + {{ collector.blockcount }} +
    +
    + Macro Calls + {{ collector.macrocount }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/twig.svg') }} + Twig + +{% endblock %} + +{% block panel %} + {% if collector.templatecount == 0 %} +

    Twig

    + +
    +

    No Twig templates were rendered for this request.

    +
    + {% else %} +

    Twig Metrics

    + +
    +
    + {{ '%0.0f'|format(collector.time) }} ms + Render time +
    + +
    + {{ collector.templatecount }} + Template calls +
    + +
    + {{ collector.blockcount }} + Block calls +
    + +
    + {{ collector.macrocount }} + Macro calls +
    +
    + +

    + Render time includes sub-requests rendering time (if any). +

    + +

    Rendered Templates

    + + + + + + + + + + {% for template, count in collector.templates %} + + {%- set file = collector.templatePaths[template]|default(false) -%} + {%- set link = file ? file|file_link(1) : false -%} + + + + {% endfor %} + +
    Template Name & PathRender Count
    + {{ include('@WebProfiler/Icon/twig.svg') }} + {% if link %} + {{ template }} + + {% else %} + {{ template }} + {% endif %} + {{ count }}
    + +

    Rendering Call Graph

    + +
    + {{ collector.htmlcallgraph }} +
    + {% endif %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Collector/validator.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/validator.html.twig new file mode 100644 index 0000000..f3b7b76 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Collector/validator.html.twig @@ -0,0 +1,103 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% block toolbar %} + {% if collector.violationsCount > 0 or collector.calls|length %} + {% set status_color = collector.violationsCount ? 'red' %} + {% set icon %} + {{ include('@WebProfiler/Icon/validator.svg') }} + + {{ collector.violationsCount ?: collector.calls|length }} + + {% endset %} + + {% set text %} +
    + Validator calls + {{ collector.calls|length }} +
    +
    + Number of violations + {{ collector.violationsCount }} +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} + {% endif %} +{% endblock %} + +{% block menu %} + + {{ include('@WebProfiler/Icon/validator.svg') }} + Validator + {% if collector.violationsCount > 0 %} + + {{ collector.violationsCount }} + + {% endif %} + +{% endblock %} + +{% block panel %} +

    Validator calls

    + + {% for call in collector.calls %} +
    + + + + + + + {% if call.violations|length %} + + + + + + + + + + {% for violation in call.violations %} + + + + + + + {% endfor %} +
    PathMessageInvalid valueViolation
    {{ violation.propertyPath }}{{ violation.message }}{{ profiler_dump(violation.seek('invalidValue')) }}{{ profiler_dump(violation) }}
    + {% else %} + No violations + {% endif %} +
    + {% else %} +
    +

    No calls to the validator were collected during this request.

    +
    + {% endfor %} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/ajax.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/ajax.svg new file mode 100644 index 0000000..4019e32 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/ajax.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/cache.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/cache.svg new file mode 100644 index 0000000..7981989 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/cache.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/close.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/close.svg new file mode 100644 index 0000000..6038d73 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/close.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/config.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/config.svg new file mode 100644 index 0000000..ba51407 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/config.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/event.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/event.svg new file mode 100644 index 0000000..76eaa32 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/event.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/exception.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/exception.svg new file mode 100644 index 0000000..0e4df2b --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/exception.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/filter.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/filter.svg new file mode 100644 index 0000000..8800f1c --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/filter.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/form.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/form.svg new file mode 100644 index 0000000..e130796 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/form.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/forward.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/forward.svg new file mode 100644 index 0000000..28a960a --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/forward.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/http-client.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/http-client.svg new file mode 100644 index 0000000..e6b1fb2 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/http-client.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/logger.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/logger.svg new file mode 100644 index 0000000..ae8c5aa --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/logger.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/mailer.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/mailer.svg new file mode 100644 index 0000000..ed649d0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/mailer.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/memory.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/memory.svg new file mode 100644 index 0000000..deb047f --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/memory.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/menu.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/menu.svg new file mode 100644 index 0000000..afccc7f --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/menu.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/messenger.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/messenger.svg new file mode 100644 index 0000000..3af5178 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/messenger.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no-gray.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no-gray.svg new file mode 100644 index 0000000..ea00891 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no-gray.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no.svg new file mode 100644 index 0000000..5ffc020 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/no.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/notifier.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/notifier.svg new file mode 100644 index 0000000..0648f12 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/notifier.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/redirect.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/redirect.svg new file mode 100644 index 0000000..8c329d0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/redirect.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/request.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/request.svg new file mode 100644 index 0000000..67d6c64 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/request.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/router.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/router.svg new file mode 100644 index 0000000..e16c617 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/router.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/search.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/search.svg new file mode 100644 index 0000000..cae0a67 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/search.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/symfony.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/symfony.svg new file mode 100644 index 0000000..c3beff6 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/symfony.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/time.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/time.svg new file mode 100644 index 0000000..d49851d --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/time.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/translation.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/translation.svg new file mode 100644 index 0000000..735bb92 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/translation.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/twig.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/twig.svg new file mode 100644 index 0000000..4a6ef7a --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/twig.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/validator.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/validator.svg new file mode 100644 index 0000000..6a81d92 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/validator.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Icon/yes.svg b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/yes.svg new file mode 100644 index 0000000..dbbff93 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Icon/yes.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/ajax_layout.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/ajax_layout.html.twig new file mode 100644 index 0000000..3e2f6f0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/ajax_layout.html.twig @@ -0,0 +1 @@ +{% block panel '' %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/bag.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/bag.html.twig new file mode 100644 index 0000000..4df5ccf --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/bag.html.twig @@ -0,0 +1,20 @@ + + + + + + + + + {% for key in bag.keys|sort %} + + + + + {% else %} + + + + {% endfor %} + +
    {{ labels is defined ? labels[0] : 'Key' }}{{ labels is defined ? labels[1] : 'Value' }}
    {{ key }}{{ profiler_dump(bag.get(key), maxDepth=maxDepth|default(0)) }}
    (no data)
    diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base.html.twig new file mode 100644 index 0000000..1a74431 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base.html.twig @@ -0,0 +1,34 @@ + + + + + + + {% block title %}Symfony Profiler{% endblock %} + + + {% block head %} + + {{ include('@WebProfiler/Profiler/profiler.css.twig') }} + + {% endblock %} + + + + if (null === localStorage.getItem('symfony/profiler/theme') || 'theme-auto' === localStorage.getItem('symfony/profiler/theme')) { + document.body.classList.add((matchMedia('(prefers-color-scheme: dark)').matches ? 'theme-dark' : 'theme-light')); + // needed to respond dynamically to OS changes without having to refresh the page + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => { + document.body.classList.remove('theme-light', 'theme-dark'); + document.body.classList.add(e.matches ? 'theme-dark' : 'theme-light'); + }); + } else { + document.body.classList.add(localStorage.getItem('symfony/profiler/theme')); + } + + document.body.classList.add(localStorage.getItem('symfony/profiler/width') || 'width-normal'); + + + {% block body '' %} + + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base_js.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base_js.html.twig new file mode 100644 index 0000000..af36bc0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/base_js.html.twig @@ -0,0 +1,874 @@ +{# This file is partially duplicated in src/Symfony/Component/ErrorHandler/Resources/assets/js/exception.js. + If you make any change in this file, verify the same change is needed in the other file. #} +/* 0) { + addClass(ajaxToolbarPanel, 'sf-ajax-request-loading'); + } else if (successStreak < 4) { + addClass(ajaxToolbarPanel, 'sf-toolbar-status-red'); + removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading'); + } else { + removeClass(ajaxToolbarPanel, 'sf-ajax-request-loading'); + removeClass(ajaxToolbarPanel, 'sf-toolbar-status-red'); + } + }; + + var startAjaxRequest = function(index) { + var tbody = document.querySelector('.sf-toolbar-ajax-request-list'); + if (!tbody) { + return; + } + + var nbOfAjaxRequest = tbody.rows.length; + if (nbOfAjaxRequest >= 100) { + tbody.deleteRow(0); + } + + var request = requestStack[index]; + pendingRequests++; + var row = document.createElement('tr'); + request.DOMNode = row; + + var requestNumberCell = document.createElement('td'); + requestNumberCell.textContent = index + 1; + row.appendChild(requestNumberCell); + + var profilerCell = document.createElement('td'); + profilerCell.textContent = 'n/a'; + row.appendChild(profilerCell); + + var methodCell = document.createElement('td'); + methodCell.textContent = request.method; + row.appendChild(methodCell); + + var typeCell = document.createElement('td'); + typeCell.textContent = request.type; + row.appendChild(typeCell); + + var statusCodeCell = document.createElement('td'); + var statusCode = document.createElement('span'); + statusCode.textContent = 'n/a'; + statusCodeCell.appendChild(statusCode); + row.appendChild(statusCodeCell); + + var pathCell = document.createElement('td'); + pathCell.className = 'sf-ajax-request-url'; + if ('GET' === request.method) { + var pathLink = document.createElement('a'); + pathLink.setAttribute('href', request.url); + pathLink.textContent = request.url; + pathCell.appendChild(pathLink); + } else { + pathCell.textContent = request.url; + } + pathCell.setAttribute('title', request.url); + row.appendChild(pathCell); + + var durationCell = document.createElement('td'); + durationCell.className = 'sf-ajax-request-duration'; + durationCell.textContent = 'n/a'; + row.appendChild(durationCell); + + request.liveDurationHandle = setInterval(function() { + durationCell.textContent = (new Date() - request.start) + ' ms'; + }, 100); + + row.className = 'sf-ajax-request sf-ajax-request-loading'; + tbody.insertBefore(row, null); + + var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info'); + toolbarInfo.scrollTop = toolbarInfo.scrollHeight; + + renderAjaxRequests(); + }; + + var finishAjaxRequest = function(index) { + var request = requestStack[index]; + clearInterval(request.liveDurationHandle); + + if (!request.DOMNode) { + return; + } + + if (request.toolbarReplace && !request.toolbarReplaceFinished && request.profile) { + /* Flag as complete because finishAjaxRequest can be called multiple times. */ + request.toolbarReplaceFinished = true; + /* Search up through the DOM to find the toolbar's container ID. */ + for (var elem = request.DOMNode; elem && elem !== document; elem = elem.parentNode) { + if (elem.id.match(/^sfwdt/)) { + Sfjs.loadToolbar(elem.id.replace(/^sfwdt/, ''), request.profile); + break; + } + } + } + + pendingRequests--; + var row = request.DOMNode; + /* Unpack the children from the row */ + var profilerCell = row.children[1]; + var methodCell = row.children[2]; + var statusCodeCell = row.children[4]; + var statusCodeElem = statusCodeCell.children[0]; + var durationCell = row.children[6]; + + if (request.error) { + row.className = 'sf-ajax-request sf-ajax-request-error'; + methodCell.className = 'sf-ajax-request-error'; + successStreak = 0; + } else { + row.className = 'sf-ajax-request sf-ajax-request-ok'; + successStreak++; + } + + if (request.statusCode) { + if (request.statusCode < 300) { + statusCodeElem.setAttribute('class', 'sf-toolbar-status'); + } else if (request.statusCode < 400) { + statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow'); + } else { + statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red'); + } + statusCodeElem.textContent = request.statusCode; + } else { + statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red'); + } + + if (request.duration) { + durationCell.textContent = request.duration + ' ms'; + } + + if (request.profilerUrl) { + profilerCell.textContent = ''; + var profilerLink = document.createElement('a'); + profilerLink.setAttribute('href', request.profilerUrl); + profilerLink.textContent = request.profile; + profilerCell.appendChild(profilerLink); + } + + renderAjaxRequests(); + }; + + {% if excluded_ajax_paths is defined %} + if (window.fetch && window.fetch.polyfill === undefined) { + var oldFetch = window.fetch; + window.fetch = function () { + var promise = oldFetch.apply(this, arguments); + var url = arguments[0]; + var params = arguments[1]; + var paramType = Object.prototype.toString.call(arguments[0]); + if (paramType === '[object Request]') { + url = arguments[0].url; + params = { + method: arguments[0].method, + credentials: arguments[0].credentials, + headers: arguments[0].headers, + mode: arguments[0].mode, + redirect: arguments[0].redirect + }; + } else { + url = String(url); + } + if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) { + var method = 'GET'; + if (params && params.method !== undefined) { + method = params.method; + } + + var stackElement = { + error: false, + url: url, + method: method, + type: 'fetch', + start: new Date() + }; + + var idx = requestStack.push(stackElement) - 1; + promise.then(function (r) { + stackElement.duration = new Date() - stackElement.start; + stackElement.error = r.status < 200 || r.status >= 400; + stackElement.statusCode = r.status; + stackElement.profile = r.headers.get('x-debug-token'); + stackElement.profilerUrl = r.headers.get('x-debug-token-link'); + stackElement.toolbarReplaceFinished = false; + stackElement.toolbarReplace = '1' === r.headers.get('Symfony-Debug-Toolbar-Replace'); + finishAjaxRequest(idx); + }, function (e){ + stackElement.error = true; + finishAjaxRequest(idx); + }); + startAjaxRequest(idx); + } + + return promise; + }; + } + if (window.XMLHttpRequest && XMLHttpRequest.prototype.addEventListener) { + var proxied = XMLHttpRequest.prototype.open; + + XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { + var self = this; + + /* prevent logging AJAX calls to static and inline files, like templates */ + var path = url; + if (url.slice(0, 1) === '/') { + if (0 === url.indexOf('{{ request.basePath|e('js') }}')) { + path = url.slice({{ request.basePath|length }}); + } + } + else if (0 === url.indexOf('{{ (request.schemeAndHttpHost ~ request.basePath)|e('js') }}')) { + path = url.slice({{ (request.schemeAndHttpHost ~ request.basePath)|length }}); + } + + if (!path.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) { + var stackElement = { + error: false, + url: url, + method: method, + type: 'xhr', + start: new Date() + }; + + var idx = requestStack.push(stackElement) - 1; + + this.addEventListener('readystatechange', function() { + if (self.readyState == 4) { + stackElement.duration = new Date() - stackElement.start; + stackElement.error = self.status < 200 || self.status >= 400; + stackElement.statusCode = self.status; + extractHeaders(self, stackElement); + + finishAjaxRequest(idx); + } + }, false); + + startAjaxRequest(idx); + } + + proxied.apply(this, Array.prototype.slice.call(arguments)); + }; + } + {% endif %} + + return { + hasClass: hasClass, + + removeClass: removeClass, + + addClass: addClass, + + toggleClass: toggleClass, + + getPreference: getPreference, + + setPreference: setPreference, + + addEventListener: addEventListener, + + request: request, + + renderAjaxRequests: renderAjaxRequests, + + getSfwdt: function(token) { + if (!this.sfwdt) { + this.sfwdt = document.getElementById('sfwdt' + token); + } + + return this.sfwdt; + }, + + load: function(selector, url, onSuccess, onError, options) { + var el = document.getElementById(selector); + + if (el && el.getAttribute('data-sfurl') !== url) { + request( + url, + function(xhr) { + el.innerHTML = xhr.responseText; + el.setAttribute('data-sfurl', url); + removeClass(el, 'loading'); + var pending = pendingRequests; + for (var i = 0; i < requestStack.length; i++) { + startAjaxRequest(i); + if (requestStack[i].duration) { + finishAjaxRequest(i); + } + } + /* Revert the pending state in case there was a start called without a finish above. */ + pendingRequests = pending; + (onSuccess || noop)(xhr, el); + }, + function(xhr) { (onError || noop)(xhr, el); }, + '', + options + ); + } + + return this; + }, + + showToolbar: function(token) { + var sfwdt = this.getSfwdt(token); + removeClass(sfwdt, 'sf-display-none'); + + if (getPreference('toolbar/displayState') == 'none') { + document.getElementById('sfToolbarMainContent-' + token).style.display = 'none'; + document.getElementById('sfToolbarClearer-' + token).style.display = 'none'; + document.getElementById('sfMiniToolbar-' + token).style.display = 'block'; + } else { + document.getElementById('sfToolbarMainContent-' + token).style.display = 'block'; + document.getElementById('sfToolbarClearer-' + token).style.display = 'block'; + document.getElementById('sfMiniToolbar-' + token).style.display = 'none'; + } + }, + + hideToolbar: function(token) { + var sfwdt = this.getSfwdt(token); + addClass(sfwdt, 'sf-display-none'); + }, + + initToolbar: function(token) { + this.showToolbar(token); + + var hideButton = document.getElementById('sfToolbarHideButton-' + token); + var hideButtonSvg = hideButton.querySelector('svg'); + hideButtonSvg.setAttribute('aria-hidden', 'true'); + hideButtonSvg.setAttribute('focusable', 'false'); + addEventListener(hideButton, 'click', function (event) { + event.preventDefault(); + + var p = this.parentNode; + p.style.display = 'none'; + (p.previousElementSibling || p.previousSibling).style.display = 'none'; + document.getElementById('sfMiniToolbar-' + token).style.display = 'block'; + setPreference('toolbar/displayState', 'none'); + }); + + var showButton = document.getElementById('sfToolbarMiniToggler-' + token); + var showButtonSvg = showButton.querySelector('svg'); + showButtonSvg.setAttribute('aria-hidden', 'true'); + showButtonSvg.setAttribute('focusable', 'false'); + addEventListener(showButton, 'click', function (event) { + event.preventDefault(); + + var elem = this.parentNode; + if (elem.style.display == 'none') { + document.getElementById('sfToolbarMainContent-' + token).style.display = 'none'; + document.getElementById('sfToolbarClearer-' + token).style.display = 'none'; + elem.style.display = 'block'; + } else { + document.getElementById('sfToolbarMainContent-' + token).style.display = 'block'; + document.getElementById('sfToolbarClearer-' + token).style.display = 'block'; + elem.style.display = 'none' + } + + setPreference('toolbar/displayState', 'block'); + }); + }, + + loadToolbar: function(token, newToken) { + var that = this; + var triesCounter = document.getElementById('sfLoadCounter-' + token); + + var options = { + retry: true, + onSend: function (count) { + if (count === 3) { + that.initToolbar(token); + } + + if (triesCounter) { + triesCounter.textContent = count; + } + }, + }; + + var cancelButton = document.getElementById('sfLoadCancel-' + token); + if (cancelButton) { + addEventListener(cancelButton, 'click', function (event) { + event.preventDefault(); + + options.stop = true; + that.hideToolbar(token); + }); + } + + newToken = (newToken || token); + + this.load( + 'sfwdt' + token, + '{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken), + function(xhr, el) { + /* Do nothing in the edge case where the toolbar has already been replaced with a new one */ + if (!document.getElementById('sfToolbarMainContent-' + newToken)) { + return; + } + + /* Evaluate in global scope scripts embedded inside the toolbar */ + var i, scripts = [].slice.call(el.querySelectorAll('script')); + for (i = 0; i < scripts.length; ++i) { + eval.call({}, scripts[i].firstChild.nodeValue); + } + + el.style.display = -1 !== xhr.responseText.indexOf('sf-toolbarreset') ? 'block' : 'none'; + + if (el.style.display == 'none') { + return; + } + + that.initToolbar(newToken); + + /* Handle toolbar-info position */ + var toolbarBlocks = [].slice.call(el.querySelectorAll('.sf-toolbar-block')); + for (i = 0; i < toolbarBlocks.length; ++i) { + toolbarBlocks[i].onmouseover = function () { + var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0]; + var pageWidth = document.body.clientWidth; + var elementWidth = toolbarInfo.offsetWidth; + var leftValue = (elementWidth + this.offsetLeft) - pageWidth; + var rightValue = (elementWidth + (pageWidth - this.offsetLeft)) - pageWidth; + + /* Reset right and left value, useful on window resize */ + toolbarInfo.style.right = ''; + toolbarInfo.style.left = ''; + + if (elementWidth > pageWidth) { + toolbarInfo.style.left = 0; + } + else if (leftValue > 0 && rightValue > 0) { + toolbarInfo.style.right = (rightValue * -1) + 'px'; + } else if (leftValue < 0) { + toolbarInfo.style.left = 0; + } else { + toolbarInfo.style.right = '0px'; + } + }; + } + + renderAjaxRequests(); + addEventListener(document.querySelector('.sf-toolbar-ajax-clear'), 'click', function() { + requestStack = []; + renderAjaxRequests(); + successStreak = 4; + document.querySelector('.sf-toolbar-ajax-request-list').innerHTML = ''; + }); + addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) { + var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info'); + elem.scrollTop = elem.scrollHeight; + }); + addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) { + event.preventDefault(); + + toggleClass(this.parentNode, 'hover'); + }); + + var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info'); + if (null !== dumpInfo) { + addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () { + dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px'; + }); + addEventListener(dumpInfo, 'mouseleave', function () { + dumpInfo.style.minHeight = ''; + }); + } + }, + function(xhr) { + if (xhr.status !== 0 && !options.stop) { + var sfwdt = that.getSfwdt(token); + sfwdt.innerHTML = '\ +
    \ +
    \ + An error occurred while loading the web debug toolbar. Open the web profiler.\ +
    \ + '; + sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); + } + }, + options + ); + + return this; + }, + + toggle: function(selector, elOn, elOff) { + var tmp = elOn.style.display, + el = document.getElementById(selector); + + elOn.style.display = elOff.style.display; + elOff.style.display = tmp; + + if (el) { + el.style.display = 'none' === tmp ? 'none' : 'block'; + } + + return this; + }, + + createTabs: function() { + var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])'); + + /* create the tab navigation for each group of tabs */ + for (var i = 0; i < tabGroups.length; i++) { + var tabs = tabGroups[i].querySelectorAll(':scope > .tab'); + var tabNavigation = document.createElement('ul'); + tabNavigation.className = 'tab-navigation'; + + var selectedTabId = 'tab-' + i + '-0'; /* select the first tab by default */ + for (var j = 0; j < tabs.length; j++) { + var tabId = 'tab-' + i + '-' + j; + var tabTitle = tabs[j].querySelector('.tab-title').innerHTML; + + var tabNavigationItem = document.createElement('li'); + tabNavigationItem.setAttribute('data-tab-id', tabId); + if (hasClass(tabs[j], 'active')) { selectedTabId = tabId; } + if (hasClass(tabs[j], 'disabled')) { addClass(tabNavigationItem, 'disabled'); } + tabNavigationItem.innerHTML = tabTitle; + tabNavigation.appendChild(tabNavigationItem); + + var tabContent = tabs[j].querySelector('.tab-content'); + tabContent.parentElement.setAttribute('id', tabId); + } + + tabGroups[i].insertBefore(tabNavigation, tabGroups[i].firstChild); + addClass(document.querySelector('[data-tab-id="' + selectedTabId + '"]'), 'active'); + } + + /* display the active tab and add the 'click' event listeners */ + for (i = 0; i < tabGroups.length; i++) { + tabNavigation = tabGroups[i].querySelectorAll(':scope > .tab-navigation li'); + + for (j = 0; j < tabNavigation.length; j++) { + tabId = tabNavigation[j].getAttribute('data-tab-id'); + document.getElementById(tabId).querySelector('.tab-title').className = 'hidden'; + + if (hasClass(tabNavigation[j], 'active')) { + document.getElementById(tabId).className = 'block'; + } else { + document.getElementById(tabId).className = 'hidden'; + } + + tabNavigation[j].addEventListener('click', function(e) { + var activeTab = e.target || e.srcElement; + + /* needed because when the tab contains HTML contents, user can click */ + /* on any of those elements instead of their parent '
  • ' element */ + while (activeTab.tagName.toLowerCase() !== 'li') { + activeTab = activeTab.parentNode; + } + + /* get the full list of tabs through the parent of the active tab element */ + var tabNavigation = activeTab.parentNode.children; + for (var k = 0; k < tabNavigation.length; k++) { + var tabId = tabNavigation[k].getAttribute('data-tab-id'); + document.getElementById(tabId).className = 'hidden'; + removeClass(tabNavigation[k], 'active'); + } + + addClass(activeTab, 'active'); + var activeTabId = activeTab.getAttribute('data-tab-id'); + document.getElementById(activeTabId).className = 'block'; + }); + } + + tabGroups[i].setAttribute('data-processed', 'true'); + } + }, + + createToggles: function() { + var toggles = document.querySelectorAll('.sf-toggle:not([data-processed=true])'); + + for (var i = 0; i < toggles.length; i++) { + var elementSelector = toggles[i].getAttribute('data-toggle-selector'); + var element = document.querySelector(elementSelector); + + addClass(element, 'sf-toggle-content'); + + if (toggles[i].hasAttribute('data-toggle-initial') && toggles[i].getAttribute('data-toggle-initial') == 'display') { + addClass(toggles[i], 'sf-toggle-on'); + addClass(element, 'sf-toggle-visible'); + } else { + addClass(toggles[i], 'sf-toggle-off'); + addClass(element, 'sf-toggle-hidden'); + } + + addEventListener(toggles[i], 'click', function(e) { + e.preventDefault(); + + if ('' !== window.getSelection().toString()) { + /* Don't do anything on text selection */ + return; + } + + var toggle = e.target || e.srcElement; + + /* needed because when the toggle contains HTML contents, user can click */ + /* on any of those elements instead of their parent '.sf-toggle' element */ + while (!hasClass(toggle, 'sf-toggle')) { + toggle = toggle.parentNode; + } + + var element = document.querySelector(toggle.getAttribute('data-toggle-selector')); + + toggleClass(toggle, 'sf-toggle-on'); + toggleClass(toggle, 'sf-toggle-off'); + toggleClass(element, 'sf-toggle-hidden'); + toggleClass(element, 'sf-toggle-visible'); + + /* the toggle doesn't change its contents when clicking on it */ + if (!toggle.hasAttribute('data-toggle-alt-content')) { + return; + } + + if (!toggle.hasAttribute('data-toggle-original-content')) { + toggle.setAttribute('data-toggle-original-content', toggle.innerHTML); + } + + var currentContent = toggle.innerHTML; + var originalContent = toggle.getAttribute('data-toggle-original-content'); + var altContent = toggle.getAttribute('data-toggle-alt-content'); + toggle.innerHTML = currentContent !== altContent ? altContent : originalContent; + }); + + /* Prevents from disallowing clicks on links inside toggles */ + var toggleLinks = toggles[i].querySelectorAll('a'); + for (var j = 0; j < toggleLinks.length; j++) { + addEventListener(toggleLinks[j], 'click', function(e) { + e.stopPropagation(); + }); + } + + /* Prevents from disallowing clicks on "copy to clipboard" elements inside toggles */ + var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]'); + for (var k = 0; k < copyToClipboardElements.length; k++) { + addEventListener(copyToClipboardElements[k], 'click', function(e) { + e.stopPropagation(); + }); + } + + toggles[i].setAttribute('data-processed', 'true'); + } + }, + + initializeLogsTable: function() { + Sfjs.updateLogsTable(); + + document.querySelectorAll('.log-filter input').forEach((input) => { + input.addEventListener('change', () => { Sfjs.updateLogsTable(); }); + }); + + document.querySelectorAll('.filter-select-all-or-none button').forEach((link) => { + link.addEventListener('click', () => { + const selectAll = link.classList.contains('select-all'); + link.closest('.log-filter-content').querySelectorAll('input').forEach((input) => { + input.checked = selectAll; + }); + + Sfjs.updateLogsTable(); + }); + }); + + document.body.addEventListener('click', (event) => { + document.querySelectorAll('details.log-filter').forEach((filterElement) => { + if (!filterElement.contains(event.target) && filterElement.open) { + filterElement.open = false; + } + }); + }); + }, + + updateLogsTable: function() { + const selectedType = document.querySelector('#log-filter-type input:checked').value; + const priorities = document.querySelectorAll('#log-filter-priority input'); + const allPriorities = Array.from(priorities).map((input) => input.value); + const selectedPriorities = Array.from(priorities).filter((input) => input.checked).map((input) => input.value); + const channels = document.querySelectorAll('#log-filter-channel input'); + const selectedChannels = Array.from(channels).filter((input) => input.checked).map((input) => input.value); + + const logs = document.querySelector('table.logs'); + if (null === logs) { + return; + } + + /* hide rows that don't match the current filters */ + let numVisibleRows = 0; + logs.querySelectorAll('tbody tr').forEach((row) => { + if ('all' !== selectedType && selectedType !== row.getAttribute('data-type')) { + row.style.display = 'none'; + return; + } + + const priority = row.getAttribute('data-priority'); + if (false === selectedPriorities.includes(priority) && true === allPriorities.includes(priority)) { + row.style.display = 'none'; + return; + } + + if ('' !== row.getAttribute('data-channel') && false === selectedChannels.includes(row.getAttribute('data-channel'))) { + row.style.display = 'none'; + return; + } + + row.style.display = 'table-row'; + numVisibleRows++; + }); + + document.querySelector('table.logs').style.display = 0 === numVisibleRows ? 'none' : 'table'; + document.querySelector('.no-logs-message').style.display = 0 === numVisibleRows ? 'block' : 'none'; + + /* update the selected totals of all filters */ + document.querySelector('#log-filter-priority .filter-active-num').innerText = (priorities.length === selectedPriorities.length) ? 'All' : selectedPriorities.length; + document.querySelector('#log-filter-channel .filter-active-num').innerText = (channels.length === selectedChannels.length) ? 'All' : selectedChannels.length; + + /* update the currently selected "log type" tab */ + document.querySelectorAll('#log-filter-type li').forEach((tab) => tab.classList.remove('active')); + document.querySelector(`#log-filter-type input[value="${selectedType}"]`).parentElement.classList.add('active'); + }, + }; + })(); + + Sfjs.addEventListener(document, 'DOMContentLoaded', function() { + Sfjs.createTabs(); + Sfjs.createToggles(); + }); +} +/*]]>*/ diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/cancel.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/cancel.html.twig new file mode 100644 index 0000000..6f1763d --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/cancel.html.twig @@ -0,0 +1,25 @@ +{% block toolbar %} + {% set icon %} + {{ include('@WebProfiler/Icon/symfony.svg') }} + + + Loading… + + {% endset %} + + {% set text %} +
    + Loading the web debug toolbar… +
    +
    + Attempt # +
    +
    + + + +
    + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/header.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/header.html.twig new file mode 100644 index 0000000..d04cf37 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/header.html.twig @@ -0,0 +1,14 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/info.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/info.html.twig new file mode 100644 index 0000000..4340439 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/info.html.twig @@ -0,0 +1,22 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% set messages = { + 'no_token' : { + status: 'error', + title: (token|default('') == 'latest') ? 'There are no profiles' : 'Token not found', + message: (token|default('') == 'latest') ? 'No profiles found.' : 'Token "' ~ token|default('') ~ '" not found.' + } +} %} + +{% block summary %} +
    +
    +

    {{ messages[about].status|title }}

    +
    +
    +{% endblock %} + +{% block panel %} +

    {{ messages[about].title }}

    +

    {{ messages[about].message }}

    +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/layout.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/layout.html.twig new file mode 100644 index 0000000..379653c --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/layout.html.twig @@ -0,0 +1,153 @@ +{% extends '@WebProfiler/Profiler/base.html.twig' %} + +{% block body %} + {{ include('@WebProfiler/Profiler/header.html.twig', with_context = false) }} + +
    + {% block summary %} + {% if profile is defined %} + {% set request_collector = profile.collectors.request|default(false) %} + {% set status_code = request_collector ? request_collector.statuscode|default(0) : 0 %} + {% set css_class = status_code > 399 ? 'status-error' : status_code > 299 ? 'status-warning' : 'status-success' %} + +
    +
    +

    + {% if profile.method|upper in ['GET', 'HEAD'] %} + {{ profile.url }} + {% else %} + {{ profile.url }} + {% set referer = request_collector ? request_collector.requestheaders.get('referer') : null %} + {% if referer %} + Return to referer URL + {% endif %} + {% endif %} +

    + + {% if request_collector and request_collector.redirect -%} + {%- set redirect = request_collector.redirect -%} + {%- set controller = redirect.controller -%} + {%- set redirect_route = '@' ~ redirect.route %} + + {%- endif %} + + {% if request_collector and request_collector.forwardtoken -%} + {% set forward_profile = profile.childByToken(request_collector.forwardtoken) %} + {% set controller = forward_profile ? forward_profile.collector('request').controller : 'n/a' %} + + {%- endif %} + + +
    +
    + {% endif %} + {% endblock %} +
    + +
    +
    + + +
    +
    + {{ include('@WebProfiler/Profiler/base_js.html.twig') }} + {% block panel '' %} +
    +
    +
    +
    + +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.css.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.css.twig new file mode 100644 index 0000000..747d73f --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.css.twig @@ -0,0 +1,79 @@ +{# Mixins + ========================================================================= #} +{% set mixins = { + 'break_long_words': '-ms-word-break: break-all; word-break: break-all; word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto;', + 'monospace_font': 'font-family: monospace; font-size: 13px; font-size-adjust: 0.5;', + 'sans_serif_font': 'font-family: Helvetica, Arial, sans-serif;', + 'subtle_border_and_shadow': 'background: #FFF; border: 1px solid #E0E0E0; box-shadow: 0px 0px 1px rgba(128, 128, 128, .2);' +} %} + +{# Normalization + (normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css) + ========================================================================= #} +html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0} + +{# Basic styles + ========================================================================= #} +html, body { + height: 100%; + width: 100%; +} +body { + background-color: #F9F9F9; + color: #aaa; + display: flex; + flex-direction: column; + {{ mixins.sans_serif_font|raw }} + font-size: 14px; + line-height: 1.4; +} +.header { + background-color: #222; + position: fixed; + top: 0; + display: flex; + width: 100%; +} +.header h1 { + color: #FFF; + font-weight: normal; + font-size: 21px; + margin: 0; + padding: 10px 10px 8px; + word-break: break-all; +} + +a.doc { + color: #FFF; + text-decoration: none; + margin: auto; + margin-right: 10px; +} + +a.doc:hover { + text-decoration: underline; +} + +.empty { + padding: 10px; + color: #555; +} + +.source { + margin-top: 41px; +} + +.source li code { + color: #555; +} + +.source li.selected { + background: rgba(255, 255, 153, 0.5); +} + +.anchor { + position: relative; + display: inline-block; + top: -7em; + visibility: hidden; +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.html.twig new file mode 100644 index 0000000..ba94bc0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/open.html.twig @@ -0,0 +1,22 @@ +{% extends '@WebProfiler/Profiler/base.html.twig' %} + +{% block head %} + +{% endblock %} + +{% block body %} + {% set source = filename|file_excerpt(line, -1) %} +
    +

    {{ file }}{% if 0 < line %} line {{ line }}{% endif %}

    + Open in your IDE? +
    +
    + {% if source is null %} +

    The file is not readable.

    + {% else %} + {{ source|raw }} + {% endif %} +
    +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/profiler.css.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/profiler.css.twig new file mode 100644 index 0000000..67e38ab --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/profiler.css.twig @@ -0,0 +1,1477 @@ +{# This file is partially duplicated in TwigBundle/Resources/views/exceotion.css.twig. + If you make any change in this file, verify the same change is needed in the other file. #} +{# Normalization + (normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css) + ========================================================================= #} +*{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0} + +:root { + --font-sans-serif: Helvetica, Arial, sans-serif; + --page-background: #f9f9f9; + --color-text: #222; + --color-muted: #999; + --color-link: #218BC3; + /* when updating any of these colors, do the same in toolbar.css.twig */ + --color-success: #4f805d; + --color-warning: #a46a1f; + --color-error: #b0413e; + --badge-background: #f5f5f5; + --badge-color: #666; + --badge-warning-background: #FEF3C7; + --badge-warning-color: #B45309; + --badge-danger-background: #FEE2E2; + --badge-danger-color: #B91C1C; + --tab-background: #fff; + --tab-color: #444; + --tab-active-background: #666; + --tab-active-color: #fafafa; + --tab-disabled-background: #f5f5f5; + --tab-disabled-color: #999; + --log-filter-button-background: #fff; + --log-filter-button-border: #999; + --log-filter-button-color: #555; + --log-filter-active-num-color: #2563EB; + --log-timestamp-color: #555; + --metric-value-background: #fff; + --metric-value-color: inherit; + --metric-unit-color: #999; + --metric-label-background: #e0e0e0; + --metric-label-color: inherit; + --trace-selected-background: #F7E5A1; + --table-border: #e0e0e0; + --table-background: #fff; + --table-header: #e0e0e0; + --info-background: #ddf; + --tree-active-background: #F7E5A1; + --exception-title-color: var(--base-2); + --shadow: 0px 0px 1px rgba(128, 128, 128, .2); + --border: 1px solid #e0e0e0; + --background-error: var(--color-error); + --highlight-comment: #969896; + --highlight-default: #222222; + --highlight-keyword: #a71d5d; + --highlight-string: #183691; + --base-0: #fff; + --base-1: #f5f5f5; + --base-2: #e0e0e0; + --base-3: #ccc; + --base-4: #666; + --base-5: #444; + --base-6: #222; + --card-label-background: #eee; + --card-label-color: var(--base-6); +} + +.theme-dark { + --page-background: #36393e; + --color-text: #e0e0e0; + --color-muted: #777; + --color-link: #93C5FD; + --color-error: #d43934; + --badge-background: #555; + --badge-color: #ddd; + --badge-warning-background: #B45309; + --badge-warning-color: #FEF3C7; + --badge-danger-background: #B91C1C; + --badge-danger-color: #FEE2E2; + --tab-background: #555; + --tab-color: #ccc; + --tab-active-background: #888; + --tab-active-color: #fafafa; + --tab-disabled-background: var(--page-background); + --tab-disabled-color: #777; + --log-filter-button-background: #555; + --log-filter-button-border: #999; + --log-filter-button-color: #ccc; + --log-filter-active-num-color: #93C5FD; + --log-timestamp-color: #ccc; + --metric-value-background: #555; + --metric-value-color: inherit; + --metric-unit-color: #999; + --metric-label-background: #777; + --metric-label-color: #e0e0e0; + --trace-selected-background: #71663acc; + --table-border: #444; + --table-background: #333; + --table-header: #555; + --info-background: rgba(79, 148, 195, 0.5); + --tree-active-background: var(--metric-label-background); + --exception-title-color: var(--base-2); + --shadow: 0px 0px 1px rgba(32, 32, 32, .2); + --border: 1px solid #666; + --background-error: #b0413e; + --highlight-comment: #dedede; + --highlight-default: var(--base-6); + --highlight-keyword: #ff413c; + --highlight-string: #70a6fd; + --base-0: #2e3136; + --base-1: #444; + --base-2: #666; + --base-3: #666; + --base-4: #666; + --base-5: #e0e0e0; + --base-6: #f5f5f5; + --card-label-background: var(--tab-active-background); + --card-label-color: var(--tab-active-color); +} + +{# Basic styles + ========================================================================= #} +html, body { + height: 100%; + width: 100%; +} +body { + background-color: var(--page-background); + color: var(--base-6); + display: flex; + flex-direction: column; + font-family: var(--font-sans-serif); + font-size: 14px; + line-height: 1.4; +} + +h2, h3, h4 { + font-weight: 500; + margin: 1.5em 0 .5em; +} +h2 + h3, +h3 + h4 { + margin-top: 1em; +} +h2 { + font-size: 24px; +} +h3 { + font-size: 21px; +} +h4 { + font-size: 18px; +} +h2 span, h3 span, h4 span, +h2 small, h3 small, h4 small { + color: var(--color-muted); +} + +li { + margin-bottom: 10px; +} + +p { + font-size: 16px; + margin-bottom: 1em; +} + +a { + color: var(--color-link); + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +a.link-inverse { + text-decoration: underline; +} +a.link-inverse:hover { + text-decoration: none; +} +a:active, +a:hover { + outline: 0; +} +h2 a, +h3 a, +h4 a { + text-decoration: underline; +} +h2 a:hover, +h3 a:hover, +h4 a:hover { + text-decoration: none; +} + +abbr { + border-bottom: 1px dotted var(--base-5); + cursor: help; +} + +code, pre { + font-family: monospace; + font-size: 13px; +} + +{# Buttons (the colors of this element don't change based on the selected theme) + ------------------------------------------------------------------------- #} +button { + font-family: var(--font-sans-serif); +} +.btn { + background: #777; + border-radius: 2px; + border: 0; + color: #f5f5f5; + display: inline-block; + padding: .5em .75em; +} +.btn:hover { + cursor: pointer; + opacity: 0.8; + text-decoration: none; +} +.btn-sm { + font-size: 12px; +} +.btn-sm svg { + height: 16px; + width: 16px; + vertical-align: middle; +} +.btn-link { + border-color: transparent; + color: var(--color-link); + text-decoration: none; + background-color: transparent; + outline: none; + border: 0; + padding: 0; + cursor: pointer; +} +.btn-link:hover { + text-decoration: underline; +} +{# Tables + ------------------------------------------------------------------------- #} +table, tr, th, td { + background: var(--table-background); + border-collapse: collapse; + line-height: 1.5; + vertical-align: top; +} +table { + background: var(--base-0); + border: var(--border); + box-shadow: var(--shadow); + margin: 1em 0; + width: 100%; +} + +table th, table td { + padding: 8px 10px; +} + +table th { + font-weight: bold; + text-align: left; +} +table thead th { + background-color: var(--table-header); +} +table thead th.key { + width: 19%; +} +table thead.small th { + font-size: 12px; + padding: 4px 10px; +} + +table tbody th, +table tbody td { + border: 1px solid var(--base-2); + border-width: 1px 0; + font-family: monospace; + font-size: 13px; +} + +table tbody div { + margin: .25em 0; +} +table tbody ul { + margin: 0; + padding: 0 0 0 1em; +} + +table thead th.num-col, +table tbody td.num-col { + text-align: center; +} + +{# Utility classes + ========================================================================= #} +.block { + display: block; +} +.full-width { + width: 100%; +} +.hidden { + display: none; +} +.nowrap { + white-space: pre; +} +.prewrap { + white-space: pre-wrap; +} +.newline { + display: block; +} +.break-long-words { + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; +} +.text-small { + font-size: 12px !important; +} +.text-muted { + color: var(--color-muted); +} +.text-danger { + color: var(--color-error); +} +.text-bold { + font-weight: bold; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.font-normal { + font-family: var(--font-sans-serif); + font-size: 14px; +} +.help { + color: var(--color-muted); + font-size: 14px; + margin-bottom: .5em; +} +.empty { + border: 4px dashed var(--base-2); + color: var(--color-muted); + margin: 1em 0; + padding: .5em 2em; +} + +.label { + background-color: var(--base-4); + color: #FAFAFA; + display: inline-block; + font-size: 12px; + font-weight: bold; + padding: 3px 7px; + white-space: nowrap; +} +.label.same-width { + min-width: 70px; + text-align: center; +} +.label.status-success { background: var(--color-success); color: #FFF; } +.label.status-warning { background: var(--color-warning); color: #FFF; } +.label.status-error { background: var(--background-error); color: #FFF; } + +{# Metrics + ------------------------------------------------------------------------- #} +.metrics { + margin: 1em 0 0; + overflow: auto; +} +.metrics .metric { + float: left; + margin: 0 1em 1em 0; +} + +.metric { + background: var(--metric-value-background); + border: 1px solid var(--table-border); + box-shadow: var(--shadow); + color: var(--metric-value-color); + min-width: 100px; + min-height: 70px; +} +.metric .value { + display: block; + font-size: 28px; + padding: 8px 15px 4px; + text-align: center; +} +.metric .value svg { + margin: 5px 0 -5px; +} +.metric .unit { + color: var(--metric-unit-color); + font-size: 18px; + margin-left: -4px; +} +.metric .label { + background: var(--metric-label-background); + color: var(--metric-label-color); + display: block; + font-size: 12px; + padding: 5px; + text-align: center; +} + +.metrics-horizontal .metric { + min-height: 0; + min-width: 0; +} +.metrics-horizontal .metric .value, +.metrics-horizontal .metric .label { + display: inline; + padding: 2px 6px; +} +.metrics-horizontal .metric .label { + display: inline-block; + padding: 6px; +} +.metrics-horizontal .metric .value { + font-size: 16px; +} +.metrics-horizontal .metric .value svg { + max-height: 14px; + line-height: 10px; + margin: 0; + padding-left: 4px; + vertical-align: middle; +} + +.metric-divider { + float: left; + margin: 0 1em; + min-height: 1px; {# required to apply 'margin' to an empty 'div' #} +} + +{# Cards + ------------------------------------------------------------------------- #} +.card { + background: var(--base-0); + border: var(--border); + box-shadow: var(--shadow); + margin: 1em 0; + padding: 10px; +} +.card-block + .card-block { + border-top: 1px solid var(--base-2); + padding-top: 10px; +} +.card *:first-child, +.card-block *:first-child { + margin-top: 0; +} +.card .label { + background-color: var(--card-label-background); + color: var(--card-label-color); +} + +{# Status + ------------------------------------------------------------------------- #} +.status-success { + background: rgba(94, 151, 110, 0.3); +} +.status-warning { + background: rgba(240, 181, 24, 0.3); +} +.status-error { + background: rgba(176, 65, 62, 0.2); +} +.status-success td, +.status-warning td, +.status-error td { + background: transparent; +} +tr.status-error td, +tr.status-warning td { + border-bottom: 1px solid var(--base-2); + border-top: 1px solid var(--base-2); +} + +.status-warning .colored { + color: var(--color-warning); +} +.status-error .colored { + color: var(--color-error); +} + +{# Syntax highlighting + ========================================================================= #} +.highlight pre { + margin: 0; + white-space: pre-wrap; +} + +.highlight .keyword { color: #8959A8; font-weight: bold; } +.highlight .word { color: var(--color-text); } +.highlight .variable { color: #916319; } +.highlight .symbol { color: var(--color-text); } +.highlight .comment { color: #999999; } +.highlight .backtick { color: #718C00; } +.highlight .string { color: #718C00; } +.highlight .number { color: #F5871F; font-weight: bold; } +.highlight .error { color: #C82829; } + +{# Icons + ========================================================================= #} +.sf-icon { + vertical-align: middle; + background-repeat: no-repeat; + background-size: contain; + width: 16px; + height: 16px; + display: inline-block; +} +.sf-icon svg { + width: 16px; + height: 16px; +} +.sf-icon.sf-medium, +.sf-icon.sf-medium svg { + width: 24px; + height: 24px; +} +.sf-icon.sf-large, +.sf-icon.sf-large svg { + width: 32px; + height: 32px; +} + + +{# Layout + ========================================================================= #} +.container { + max-width: 1300px; + padding-right: 15px; +} +#header { + flex: 0 0 auto; +} +#header .container { + display: flex; + flex-direction: row; + justify-content: space-between; +} +#summary { + flex: 0 0 auto; +} +#content { + height: 100%; +} +#main { + display: flex; + flex-direction: row; + min-height: 100%; +} +#sidebar { + flex: 0 0 220px; +} +#collector-wrapper { + flex: 0 1 100%; + min-width: 0; +} +#collector-content { + margin: 0 0 30px 0; + padding: 14px 0 14px 20px; +} + +#main h2:first-of-type { + margin-top: 0; +} + +{# Header (the colors of this element don't change based on the selected theme) + ========================================================================= #} +#header { + background-color: #222; + overflow: hidden; +} +#header h1 { + color: #fff; + flex: 1; + font-weight: normal; + font-size: 21px; + margin: 0; + padding: 10px 10px 8px; +} +#header h1 span { + color: #ccc; +} +#header h1 svg { + height: 40px; + width: 40px; + margin-top: -4px; + vertical-align: middle; +} +#header h1 svg path, +#header h1 svg .sf-svg-path { + fill: #fff; +} +#header .search { + padding-top: 11px; +} +#header .search input { + border: 1px solid #ddd; + margin-right: 4px; + padding: 7px 8px; + width: 200px; +} + +{# Summary + ========================================================================= #} +#summary .status { + background: var(--base-2); + border: solid rgba(0, 0, 0, 0.1); + border-width: 2px 0; + padding: 10px; +} +#summary h2, +#summary h2 a { + color: var(--base-6); + font-size: 21px; + margin: 0; + text-decoration: none; + vertical-align: middle; +} +#summary h2 a:hover { + text-decoration: underline; +} +#summary h2 a.referer { + margin-left: .5em; + font-size: 75%; + color: rgba(255, 255, 255, 0.5); +} +#summary h2 a.referer:before { + content: '\1F503\00a0'; +} + +#summary .status-success { background: var(--color-success); } +#summary .status-warning { background: var(--color-warning); } +#summary .status-error { background: var(--background-error); } + +#summary .status-success h2, +#summary .status-success a, +#summary .status-warning h2, +#summary .status-warning a, +#summary .status-error h2, +#summary .status-error a { + color: #FFF; +} + +#summary dl.metadata, +#summary dl.metadata a { + margin: 5px 0 0; + color: rgba(255, 255, 255, 0.75); +} +#summary dl.metadata dt, +#summary dl.metadata dd { + display: inline-block; + font-size: 13px; +} +#summary dl.metadata dt { + font-weight: bold; +} +#summary dl.metadata dt:after { + content: ':'; +} +#summary dl.metadata dd { + margin: 0 1.5em 0 0; +} + +#summary dl.metadata .label { + background: rgba(255, 255, 255, 0.2); +} + +{# Sidebar + ========================================================================= #} +#sidebar { + background: #444; + color: #ccc; + padding-bottom: 30px; + position: relative; + width: 220px; + z-index: 9999; +} +#sidebar .module { + padding: 10px; + width: 220px; +} + +{# Sidebar Shortcuts + ------------------------------------------------------------------------- #} +#sidebar #sidebar-shortcuts { + background: #333; + width: 220px; +} +#sidebar #sidebar-shortcuts .shortcuts { + position: relative; + padding: 16px 10px; +} +#sidebar-shortcuts .icon { + display: block; + float: left; + width: 50px; + margin: 2px 0 0 -10px; + text-align: center; +} +#sidebar #sidebar-shortcuts .btn { + color: #f5f5f5; +} +#sidebar #sidebar-shortcuts .btn + .btn { + margin-left: 5px; +} +#sidebar #sidebar-shortcuts .btn { + padding: .5em; +} + +{# Sidebar Search (the colors of this element don't change based on the selected theme) + ------------------------------------------------------------------------- #} +#sidebar-search .form-group:first-of-type { + padding-top: 20px; +} +#sidebar-search .form-group { + clear: both; + overflow: hidden; + padding-bottom: 10px; +} +#sidebar-search .form-group label { + float: left; + font-size: 13px; + line-height: 24px; + width: 60px; +} +#sidebar-search .form-group input, +#sidebar-search .form-group select { + float: left; + font-size: 13px; + padding: 3px 6px; +} +#sidebar-search .form-group input { + background: #ccc; + border: 1px solid var(--color-muted); + color: #222; + width: 120px; +} +#sidebar-search .form-group select { + color: #222; +} +#sidebar-search .form-group .btn { + float: right; + margin-right: 10px; +} + +{# Sidebar Menu (the colors of this element don't change based on the selected theme) + ------------------------------------------------------------------------- #} +#menu-profiler { + margin: 0; + padding: 0; + list-style-type: none; +} +#menu-profiler li { + position: relative; + margin-bottom: 0; +} +#menu-profiler li a { + border: solid transparent; + border-width: 2px 0; + color: var(--base-3); + display: block; +} +#menu-profiler li a:hover { + text-decoration: none; +} +#menu-profiler li a .label { + background: transparent; + color: #EEE; + display: block; + padding: 8px 10px 8px 50px; + overflow: hidden; + white-space: nowrap; +} +#menu-profiler li a .label .icon { + display: block; + position: absolute; + left: 0; + top: 8px; + width: 50px; + text-align: center; +} +#menu-profiler .label .icon img, +#menu-profiler .label .icon svg { + height: 24px; + max-width: 24px; +} +#menu-profiler li a .label .icon svg path, +#menu-profiler li a .label .icon svg .sf-svg-path { + fill: #DDD; +} +#menu-profiler li a .label strong { + font-size: 16px; + font-weight: normal; +} +#menu-profiler li a .label.disabled { + opacity: .25; +} +#menu-profiler li a:hover .label.disabled, +#menu-profiler li.selected a .label.disabled { + opacity: 1; +} + +#menu-profiler li.selected a, +#menu-profiler:hover li.selected a:hover, +#menu-profiler li a:hover { + background: #666; + border: solid #555; + border-width: 2px 0; +} +#menu-profiler li.selected a .label, +#menu-profiler li a:hover .label { + color: #FFF; +} +#menu-profiler li.selected a .icon svg path, +#menu-profiler li.selected a .icon svg .sf-svg-path, +#menu-profiler li a:hover .icon svg path, +#menu-profiler li a:hover .icon svg .sf-svg-path { + fill: #fff; +} + +#menu-profiler li a .count { + background-color: #666; + color: #fff; + display: inline-block; + font-weight: bold; + min-width: 10px; + padding: 2px 6px; + position: absolute; + right: 10px; + text-align: center; + vertical-align: baseline; + white-space: nowrap; +} +#menu-profiler li a span.count span { + font-size: 12px; + +} +#menu-profiler li a span.count span + span::before { + content: " / "; + color: #AAA; +} + +#menu-profiler .label-status-warning .count { + background: var(--color-warning); +} +#menu-profiler .label-status-error .count { + background: var(--background-error); +} + +{# Timeline panel + ========================================================================= #} +#timeline-control { + background: var(--table-background); + box-shadow: var(--shadow); + margin: 1em 0; + padding: 10px; +} +#timeline-control label { + font-weight: bold; + margin-right: 1em; +} +#timeline-control input { + background: var(--metric-value-background); + border: 1px solid var(--table-border); + font-size: 16px; + padding: 4px; + text-align: right; + width: 5em; +} +#timeline-control .help { + margin-left: 1em; +} + +.sf-profiler-timeline .legends { + font-size: 12px; + line-height: 1.5em; +} +.sf-profiler-timeline + p.help { + margin-top: 0; +} + +{# Tabbed navigation + ========================================================================= #} +.tab-navigation { + margin: 0 0 1em 0; + padding: 0; +} +.tab-navigation li { + background: var(--tab-background); + border: 1px solid var(--table-border); + color: var(--tab-color); + cursor: pointer; + display: inline-block; + font-size: 16px; + margin: 0 0 0 -1px; + padding: .5em .75em; + z-index: 1; +} +.tab-navigation li .badge { + background-color: var(--base-1); + color: var(--base-4); + display: inline-block; + font-size: 14px; + font-weight: bold; + margin-left: 8px; + min-width: 10px; + padding: 1px 6px; + text-align: center; + white-space: nowrap; +} +.tab-navigation li.disabled { + background: var(--tab-disabled-background); + color: var(--tab-disabled-color); +} +.tab-navigation li.active { + background: var(--tab-active-background); + color: var(--tab-active-color); + z-index: 1100; +} +.tab-navigation li.active .badge { + background-color: var(--base-5); + color: var(--base-2); +} +.tab-content > *:first-child { + margin-top: 0; +} +.tab-navigation li .badge.status-warning { background: var(--color-warning); color: #FFF; } +.tab-navigation li .badge.status-error { background: var(--background-error); color: #FFF; } + +.sf-tabs .tab:not(:first-child) { display: none; } + +{# Toggles + ========================================================================= #} +.sf-toggle-content { + -moz-transition: display .25s ease; + -webkit-transition: display .25s ease; + transition: display .25s ease; +} +.sf-toggle-content.sf-toggle-hidden { + display: none; +} +.sf-toggle-content.sf-toggle-visible { + display: block; +} + +{# Filters + ========================================================================= #} +[data-filters] { position: relative; } +[data-filtered] { cursor: pointer; } +[data-filtered]:after { content: '\00a0\25BE'; } +[data-filtered]:hover .filter-list li { display: inline-flex; } +[class*="filter-hidden-"] { display: none; } +.filter-list { position: absolute; border: var(--border); box-shadow: var(--shadow); margin: 0; padding: 0; display: flex; flex-direction: column; } +.filter-list :after { content: ''; } +.filter-list li { + background: var(--tab-disabled-background); + border-bottom: var(--border); + color: var(--tab-disabled-color); + display: none; + list-style: none; + margin: 0; + padding: 5px 10px; + text-align: left; + font-weight: normal; +} +.filter-list li.active { + background: var(--tab-background); + color: var(--tab-color); +} +.filter-list li.last-active { + background: var(--tab-active-background); + color: var(--tab-active-color); +} + +.filter-list-level li { cursor: s-resize; } +.filter-list-level li.active { cursor: n-resize; } +.filter-list-level li.last-active { cursor: default; } +.filter-list-level li.last-active:before { content: '\2714\00a0'; } +.filter-list-choice li:before { content: '\2714\00a0'; color: transparent; } +.filter-list-choice li.active:before { color: unset; } + +{# Twig panel + ========================================================================= #} +#twig-dump pre { + font-size: 12px; + line-height: 1.7; + background-color: var(--base-0); + border: var(--border); + padding: 15px; + box-shadow: 0 0 1px rgba(128, 128, 128, .2); +} +#twig-dump span { + border-radius: 2px; + padding: 1px 2px; +} +#twig-dump .status-error { background: transparent; color: var(--color-error); } +#twig-dump .status-warning { background: rgba(240, 181, 24, 0.3); } +#twig-dump .status-success { background: rgba(100, 189, 99, 0.2); } +#twig-dump .status-info { background: var(--info-background); } + +#twig-table tbody td { + vertical-align: middle; +} +#twig-table tbody td > a { + margin-left: -5px; +} +#twig-table tbody td div { + margin: 0; +} + +.icon-twig { + vertical-align: text-bottom; +} +.icon-twig svg path { + fill: #7eea12; +} + +{# Logger panel + ========================================================================= #} +.badge { + background: var(--badge-background); + border-radius: 4px; + color: var(--badge-color); + font-size: 12px; + font-weight: bold; + padding: 1px 4px; +} +.badge-warning { + background: var(--badge-warning-background); + color: var(--badge-warning-color); +} + +.log-filters { + display: flex; +} +.log-filters .log-filter { + position: relative; +} +.log-filters .log-filter + .log-filter { + margin-left: 15px; +} +.log-filters .log-filter summary { + align-items: center; + background: var(--log-filter-button-background); + border-radius: 2px; + border: 1px solid var(--log-filter-button-border); + color: var(--log-filter-button-color); + cursor: pointer; + display: flex; + padding: 5px 8px; +} +.log-filters .log-filter summary .icon { + height: 18px; + width: 18px; + margin: 0 7px 0 0; +} +.log-filters .log-filter summary svg { + height: 18px; + width: 18px; + opacity: 0.7; +} +.log-filters .log-filter summary .filter-active-num { + color: var(--log-filter-active-num-color); + font-weight: bold; + padding: 0 1px; +} +.log-filter .tab-navigation { + margin-bottom: 0; +} +.log-filter .tab-navigation li:first-child { + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; +} +.log-filter .tab-navigation li:last-child { + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; +} +.log-filter .tab-navigation li { + border-color: var(--log-filter-button-border); + padding: 0; +} +.log-filter .tab-navigation li + li { + margin-left: -5px; +} +.log-filter .tab-navigation li .badge { + font-size: 13px; + padding: 0 6px; +} +.log-filter .tab-navigation li input { + display: none; +} +.log-filter .tab-navigation li label { + align-items: center; + cursor: pointer; + padding: 5px 10px; + display: inline-flex; + font-size: 14px; +} + +.log-filters .log-filter .log-filter-content { + background: var(--base-0); + border: 1px solid var(--table-border); + border-radius: 2px; + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); + padding: 15px; + position: absolute; + left: 0; + top: 36px; + max-width: 400px; + min-width: 200px; + z-index: 9999; +} +.log-filters .log-filter .log-filter-content .log-filter-option { + align-items: center; + display: flex; +} +.log-filter .filter-select-all-or-none { + margin-bottom: 10px; +} +.log-filter .filter-select-all-or-none button + button { + margin-left: 15px; +} +.log-filters .log-filter .log-filter-content .log-filter-option + .log-filter-option { + margin: 7px 0 0; +} +.log-filters .log-filter .log-filter-content .log-filter-option label { + cursor: pointer; + flex: 1; + padding-left: 10px; +} + +table.logs .metadata { + display: block; + font-size: 12px; +} +.theme-dark tr.status-error td, +.theme-dark tr.status-warning td { border-bottom: unset; border-top: unset; } + +table.logs .log-timestamp { + color: var(--log-timestamp-color); +} +table.logs .log-metadata { + margin: 8px 0 0; +} +table.logs .log-metadata > span { + display: inline-block; +} +table.logs .log-metadata > span + span { + margin-left: 10px; +} +table.logs .log-metadata .log-channel { + color: var(--base-1); + font-size: 13px; + font-weight: bold; +} +table.logs .log-metadata .log-num-occurrences { + color: var(--color-muted); + font-size: 13px; +} +.log-type-badge { + display: inline-block; + font-family: var(--font-sans-serif); + margin-top: 5px; +} +.log-type-badge.badge-deprecation { + background: var(--badge-warning-background); + color: var(--badge-warning-color); +} +.log-type-badge.badge-error { + background: var(--badge-danger-background); + color: var(--badge-danger-color); +} +.log-type-badge.badge-silenced { + background: #EDE9FE; + color: #6D28D9; +} +.theme-dark .log-type-badge.badge-silenced { + background: #5B21B6; + color: #EDE9FE; +} + +tr.log-status-warning { + border-left: 4px solid #F59E0B; +} +tr.log-status-error { + border-left: 4px solid #EF4444; +} +tr.log-status-silenced { + border-left: 4px solid #A78BFA; +} + +.container-compilation-logs { + background: var(--table-background); + border: 1px solid var(--base-2); + margin-top: 30px; + padding: 15px; +} +.container-compilation-logs summary { + cursor: pointer; +} +.container-compilation-logs summary h4 { + margin: 0 0 5px; +} +.container-compilation-logs summary p { + margin: 0; +} + +{# Doctrine panel + ========================================================================= #} +.sql-runnable { + background: var(--base-1); + margin: .5em 0; + padding: 1em; +} +.sql-explain { + overflow-x: auto; + max-width: 920px; +} +.sql-explain table td, .sql-explain table tr { + word-break: normal; +} +.queries-table pre { + margin: 0; + white-space: pre-wrap; + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; +} + +{# Security panel + ========================================================================= #} +#collector-content .decision-log .voter_result td { + border-top-width: 1px; + border-bottom-width: 0; + padding-bottom: 0; +} + +#collector-content .decision-log .voter_details td { + border-top-width: 0; + border-bottom-width: 1px; + padding-bottom: 0; +} + +#collector-content .decision-log .voter_details table { + border: 0; + margin: 0; + box-shadow: unset; +} + +#collector-content .decision-log .voter_details table td { + border: 0; + padding: 0 0 8px 0; +} + +{# Validator panel + ========================================================================= #} + +#collector-content .sf-validator { + margin-bottom: 2em; +} + +#collector-content .sf-validator .sf-validator-context, +#collector-content .sf-validator .trace { + border: var(--border); + background: var(--base-0); + padding: 10px; + margin: 0.5em 0; + overflow: auto; +} +#collector-content .sf-validator .trace { + font-size: 12px; +} +#collector-content .sf-validator .trace li { + margin-bottom: 0; + padding: 0; +} +#collector-content .sf-validator .trace li.selected { + background: rgba(255, 255, 153, 0.5); +} + +{# Messenger panel + ========================================================================= #} + +#collector-content .message-bus .trace { + border: 1px solid #DDD; + background: #FFF; + padding: 10px; + margin: 0.5em 0; + overflow: auto; +} +#collector-content .message-bus .trace { + font-size: 12px; +} +#collector-content .message-bus .trace li { + margin-bottom: 0; + padding: 0; +} +#collector-content .message-bus .trace li.selected { + background: rgba(255, 255, 153, 0.5); +} + +{# Dump panel + ========================================================================= #} +pre.sf-dump, pre.sf-dump .sf-dump-default { + z-index: 1000 !important; +} + +#collector-content .sf-dump { + margin-bottom: 2em; +} +#collector-content pre.sf-dump, +#collector-content .sf-dump code, +#collector-content .sf-dump samp { + font-family: monospace; + font-size: 13px; +} +#collector-content .sf-dump a { + cursor: pointer; +} +#collector-content .sf-dump pre.sf-dump, +#collector-content .sf-dump .trace { + border: var(--border); + padding: 10px; + margin: 0.5em 0; + overflow: auto; +} + +#collector-content pre.sf-dump, +#collector-content .sf-dump-default { + background: none; +} +#collector-content .sf-dump-ellipsis { max-width: 100em; } + +#collector-content .sf-dump { + margin: 0; + padding: 0; + line-height: 1.4; +} + +#collector-content .dump-inline .sf-dump { + display: inline; + white-space: normal; + font-size: inherit; + line-height: inherit; +} +#collector-content .dump-inline .sf-dump:after { + display: none; +} + +#collector-content .sf-dump .trace { + font-size: 12px; +} +#collector-content .sf-dump .trace li { + margin-bottom: 0; + padding: 0; +} + +{# Search Results page + ========================================================================= #} +#search-results td { + font-family: var(--font-sans-serif); + vertical-align: middle; +} + +#search-results .sf-search { + visibility: hidden; + margin-left: 2px; +} +#search-results tr:hover .sf-search { + visibility: visible; +} + +{# Small screens + ========================================================================= #} + +.visible-small { + display: none; +} +.hidden-small { + display: inherit; +} + +@media (max-width: 768px) { + #sidebar { + flex-basis: 50px; + overflow-x: hidden; + transition: flex-basis 200ms ease-out; + } + #sidebar:hover, #sidebar.expanded { + flex-basis: 220px; + } + + #sidebar-search { + display: none; + } + #sidebar:hover #sidebar-search.sf-toggle-visible, #sidebar.expanded #sidebar-search.sf-toggle-visible { + display: block; + } + + #sidebar .module { + display: none; + } + #sidebar:hover .module, #sidebar.expanded .module { + display: block; + } + + #sidebar:not(:hover):not(.expanded) .label .count { + border-radius: 50%; + border: 1px solid #eee; + height: 8px; + min-width: 0; + padding: 0; + right: 4px; + text-indent: -9999px; + top: 50%; + width: 8px; + } + + .visible-small { + display: inherit; + } + .hidden-small { + display: none; + } + + .btn-sm svg { + margin-left: 2px; + } +} + +{# Config Options + ========================================================================= #} +body.width-full .container { + max-width: 100%; +} + +body.theme-light #collector-content .sf-dump pre.sf-dump, +body.theme-light #collector-content .sf-dump .trace { + background: #FFF; +} +body.theme-light #collector-content pre.sf-dump, +body.theme-light #collector-content .sf-dump-default { + color: #CC7832; +} +body.theme-light #collector-content .sf-dump-str { color: #629755; } +body.theme-light #collector-content .sf-dump-private, +body.theme-light #collector-content .sf-dump-protected, +body.theme-light #collector-content .sf-dump-public { color: #262626; } +body.theme-light #collector-content .sf-dump-note { color: #6897BB; } +body.theme-light #collector-content .sf-dump-key { color: #789339; } +body.theme-light #collector-content .sf-dump-ref { color: #6E6E6E; } +body.theme-light #collector-content .sf-dump-ellipsis { color: #CC7832; max-width: 100em; } +body.theme-light #collector-content .sf-dump-ellipsis-path { max-width: 5em; } +body.theme-light #collector-content .sf-dump .trace li.selected { + background: rgba(255, 255, 153, 0.5); +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/results.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/results.html.twig new file mode 100644 index 0000000..7ddbf9c --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/results.html.twig @@ -0,0 +1,67 @@ +{% extends '@WebProfiler/Profiler/layout.html.twig' %} + +{% macro profile_search_filter(request, result, property) %} + {%- if request.hasSession -%} + {{ include('@WebProfiler/Icon/search.svg') }} + {%- endif -%} +{% endmacro %} + +{% import _self as helper %} + +{% block summary %} +
    +
    +

    Profile Search

    +
    +
    +{% endblock %} + +{% block panel %} +

    {{ tokens ? tokens|length : 'No' }} results found

    + + {% if tokens %} + + + + + + + + + + + + + {% for result in tokens %} + {% set css_class = result.status_code|default(0) > 399 ? 'status-error' : result.status_code|default(0) > 299 ? 'status-warning' : 'status-success' %} + + + + + + + + + + {% endfor %} + +
    StatusIPMethodURLTimeToken
    + {{ result.status_code|default('n/a') }} + + {{ result.ip }} {{ helper.profile_search_filter(request, result, 'ip') }} + + {{ result.method }} {{ helper.profile_search_filter(request, result, 'method') }} + + {{ result.url }} + {{ helper.profile_search_filter(request, result, 'url') }} + + {{ result.time|date('d-M-Y') }} + {{ result.time|date('H:i:s') }} + {{ result.token }}
    + {% else %} +
    +

    The query returned no result.

    +
    + {% endif %} + +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/search.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/search.html.twig new file mode 100644 index 0000000..7494b4e --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/search.html.twig @@ -0,0 +1,56 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/settings.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/settings.html.twig new file mode 100644 index 0000000..4b23946 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/settings.html.twig @@ -0,0 +1,193 @@ + + +Settings + + + + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/table.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/table.html.twig new file mode 100644 index 0000000..cb9986b --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/table.html.twig @@ -0,0 +1,16 @@ + + + + + + + + + {% for key in data|keys|sort %} + + + + + {% endfor %} + +
    {{ labels is defined ? labels[0] : 'Key' }}{{ labels is defined ? labels[1] : 'Value' }}
    {{ key }}{{ profiler_dump(data[key]) }}
    diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.css.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.css.twig new file mode 100644 index 0000000..920e41e --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.css.twig @@ -0,0 +1,562 @@ +{# when updating any of these colors, do the same in profiler.css.twig #} +{% set colors = { 'success': '#4F805D', 'warning': '#A46A1F', 'error': '#B0413E' } %} + +.sf-minitoolbar { + background-color: #222; + border-top-left-radius: 4px; + bottom: 0; + box-sizing: border-box; + display: none; + height: 36px; + padding: 6px; + position: fixed; + right: 0; + z-index: 99999; +} + +.sf-minitoolbar button { + background-color: transparent; + padding: 0; + border: none; +} +.sf-minitoolbar svg, +.sf-minitoolbar img { + max-height: 24px; + max-width: 24px; + display: inline; +} + +.sf-toolbar-clearer { + clear: both; + height: 36px; +} + +.sf-display-none { + display: none; +} + +.sf-toolbarreset * { + box-sizing: content-box; + vertical-align: baseline; + letter-spacing: normal; + width: auto; +} + +.sf-toolbarreset { + background-color: #222; + bottom: 0; + box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); + color: #EEE; + font: 11px Arial, sans-serif; + left: 0; + margin: 0; + padding: 0 36px 0 0; + position: fixed; + right: 0; + text-align: left; + text-transform: none; + z-index: 99999; + direction: ltr; + + /* neutralize the aliasing defined by external CSS styles */ + -webkit-font-smoothing: subpixel-antialiased; + -moz-osx-font-smoothing: auto; +} +.sf-toolbarreset abbr { + border: dashed #777; + border-width: 0 0 1px; +} +.sf-toolbarreset svg, +.sf-toolbarreset img { + height: 20px; + width: 20px; + display: inline-block; +} + +.sf-toolbarreset .sf-cancel-button { + color: #444; +} + +.sf-toolbarreset .hide-button { + background: #444; + display: block; + position: absolute; + top: 0; + right: 0; + width: 36px; + height: 36px; + cursor: pointer; + text-align: center; + border: none; + margin: 0; + padding: 0; +} +.sf-toolbarreset .hide-button svg { + max-height: 18px; + margin-top: 1px; +} + +.sf-toolbar-block { + cursor: default; + display: block; + float: left; + height: 36px; + margin-right: 0; + white-space: nowrap; + max-width: 15%; +} +.sf-toolbar-block > a, +.sf-toolbar-block > a:hover { + display: block; + text-decoration: none; + background-color: transparent; + color: inherit; +} + +.sf-toolbar-block span { + display: inline-block; +} +.sf-toolbar-block .sf-toolbar-value { + color: #F5F5F5; + font-size: 13px; + line-height: 36px; + padding: 0; +} +.sf-toolbar-block .sf-toolbar-label, +.sf-toolbar-block .sf-toolbar-class-separator { + color: #AAA; + font-size: 12px; +} + +.sf-toolbar-block .sf-toolbar-info { + border-collapse: collapse; + display: table; + z-index: 100000; +} +.sf-toolbar-block hr { + border-top: 1px solid #777; + margin: 4px 0; + padding-top: 4px; +} +.sf-toolbar-block .sf-toolbar-info-piece { + /* this 'border-bottom' trick is needed because 'margin-bottom' doesn't work for table rows */ + border-bottom: solid transparent 3px; + display: table-row; +} +.sf-toolbar-block .sf-toolbar-info-piece-additional, +.sf-toolbar-block .sf-toolbar-info-piece-additional-detail { + display: none; +} +.sf-toolbar-block .sf-toolbar-info-group { + margin-bottom: 4px; + padding-bottom: 2px; + border-bottom: 1px solid #333333; +} +.sf-toolbar-block .sf-toolbar-info-group:last-child { + margin-bottom: 0; + padding-bottom: 0; + border-bottom: none; +} + +.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status { + padding: 2px 5px; + margin-bottom: 0; +} +.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status + .sf-toolbar-status { + margin-left: 4px; +} + +.sf-toolbar-block .sf-toolbar-info-piece:last-child { + margin-bottom: 0; +} + +div.sf-toolbar .sf-toolbar-block .sf-toolbar-info-piece a { + color: #99CDD8; + text-decoration: underline; +} +div.sf-toolbar .sf-toolbar-block a:hover { + text-decoration: none; +} + +.sf-toolbar-block .sf-toolbar-info-piece b { + color: #AAA; + display: table-cell; + font-size: 11px; + padding: 4px 8px 4px 0; +} +.sf-toolbar-block:not(.sf-toolbar-block-dump) .sf-toolbar-info-piece span { + color: #F5F5F5; +} +.sf-toolbar-block .sf-toolbar-info-piece span { + font-size: 12px; +} + +.sf-toolbar-block .sf-toolbar-info { + background-color: #444; + bottom: 36px; + color: #F5F5F5; + display: none; + padding: 9px 0; + position: absolute; +} + +.sf-toolbar-block .sf-toolbar-info:empty { + visibility: hidden; +} + +.sf-toolbar-block .sf-toolbar-status { + display: inline-block; + color: #FFF; + background-color: #666; + padding: 3px 6px; + margin-bottom: 2px; + vertical-align: middle; + min-width: 15px; + min-height: 13px; + text-align: center; +} + +.sf-toolbar-block .sf-toolbar-status-green { + background-color: {{ colors.success|raw }}; +} +.sf-toolbar-block .sf-toolbar-status-red { + background-color: {{ colors.error|raw }}; +} +.sf-toolbar-block .sf-toolbar-status-yellow { + background-color: {{ colors.warning|raw }}; +} + +.sf-toolbar-block.sf-toolbar-status-green { + background-color: {{ colors.success|raw }}; + color: #FFF; +} +.sf-toolbar-block.sf-toolbar-status-red { + background-color: {{ colors.error|raw }}; + color: #FFF; +} +.sf-toolbar-block.sf-toolbar-status-yellow { + background-color: {{ colors.warning|raw }}; + color: #FFF; +} + +.sf-toolbar-block-request .sf-toolbar-status { + color: #FFF; + display: inline-block; + font-size: 14px; + height: 36px; + line-height: 36px; + padding: 0 10px; +} +.sf-toolbar-block-request .sf-toolbar-info-piece a { + background-color: transparent; + text-decoration: none; +} +.sf-toolbar-block-request .sf-toolbar-info-piece a:hover { + text-decoration: underline; +} +.sf-toolbar-block-request .sf-toolbar-redirection-status { + font-weight: normal; + padding: 2px 4px; + line-height: 18px; +} +.sf-toolbar-block-request .sf-toolbar-info-piece span.sf-toolbar-redirection-method { + font-size: 12px; + height: 17px; + line-height: 17px; + margin-right: 5px; +} + +.sf-toolbar-block-ajax .sf-toolbar-icon { + cursor: pointer; +} + +.sf-toolbar-status-green .sf-toolbar-label, +.sf-toolbar-status-yellow .sf-toolbar-label, +.sf-toolbar-status-red .sf-toolbar-label { + color: #FFF; +} +.sf-toolbar-status-green svg path, +.sf-toolbar-status-green svg .sf-svg-path, +.sf-toolbar-status-red svg path, +.sf-toolbar-status-red svg .sf-svg-path, +.sf-toolbar-status-yellow svg path, +.sf-toolbar-status-yellow svg .sf-svg-path { + fill: #FFF; +} +.sf-toolbar-block-config svg path, +.sf-toolbar-block-config svg .sf-svg-path { + fill: #FFF; +} + +.sf-toolbar-block .sf-toolbar-icon { + display: block; + height: 36px; + padding: 0 7px; + overflow: hidden; + text-overflow: ellipsis; +} +.sf-toolbar-block-request .sf-toolbar-icon { + padding-left: 0; + padding-right: 0; +} + +.sf-toolbar-block .sf-toolbar-icon img, +.sf-toolbar-block .sf-toolbar-icon svg { + border-width: 0; + position: relative; + top: 8px; + vertical-align: baseline; +} + +.sf-toolbar-block .sf-toolbar-icon img + span, +.sf-toolbar-block .sf-toolbar-icon svg + span { + margin-left: 4px; +} +.sf-toolbar-block-config .sf-toolbar-icon .sf-toolbar-value { + margin-left: 4px; +} + +.sf-toolbar-block:hover, +.sf-toolbar-block.hover { + position: relative; +} +.sf-toolbar-block:hover .sf-toolbar-icon, +.sf-toolbar-block.hover .sf-toolbar-icon { + background-color: #444; + position: relative; + z-index: 10002; +} +.sf-toolbar-block-ajax.hover .sf-toolbar-info { + z-index: 10001; +} +.sf-toolbar-block:hover .sf-toolbar-info, +.sf-toolbar-block.hover .sf-toolbar-info { + display: block; + padding: 10px; + max-width: 480px; + max-height: 480px; + word-wrap: break-word; + overflow: hidden; + overflow-y: auto; +} +.sf-toolbar-info-piece b.sf-toolbar-ajax-info { + color: #F5F5F5; +} +.sf-toolbar-ajax-requests { + table-layout: auto; + width: 100%; +} +.sf-toolbar-ajax-requests td { + background-color: #444; + border-bottom: 1px solid #777; + color: #F5F5F5; + font-size: 12px; + padding: 4px; +} +.sf-toolbar-ajax-requests tr:last-child td { + border-bottom: 0; +} +.sf-toolbar-ajax-requests th { + background-color: #222; + border-bottom: 0; + color: #AAA; + font-size: 11px; + padding: 4px; +} +.sf-ajax-request-url { + max-width: 250px; + line-height: 9px; + overflow: hidden; + text-overflow: ellipsis; +} +.sf-toolbar-ajax-requests .sf-ajax-request-url a { + text-decoration: none; +} +.sf-toolbar-ajax-requests .sf-ajax-request-url a:hover { + text-decoration: underline; +} +.sf-ajax-request-duration { + text-align: right; +} +.sf-ajax-request-loading { + animation: sf-blink .5s ease-in-out infinite; +} +@keyframes sf-blink { + 0% { background: #222; } + 50% { background: #444; } + 100% { background: #222; } +} + +.sf-toolbar-block.sf-toolbar-block-dump .sf-toolbar-info { + max-width: none; + width: 100%; + position: fixed; + box-sizing: border-box; + left: 0; +} + +.sf-toolbar-block-dump pre.sf-dump { + background-color: #222; + border-color: #777; + border-radius: 0; + margin: 6px 0 12px 0; +} +.sf-toolbar-block-dump pre.sf-dump:last-child { + margin-bottom: 0; +} +.sf-toolbar-block-dump pre.sf-dump .sf-dump-search-wrapper { + margin-bottom: 5px; +} +.sf-toolbar-block-dump pre.sf-dump span.sf-dump-search-count { + color: #333; + font-size: 12px; +} +.sf-toolbar-block-dump .sf-toolbar-info-piece { + display: block; +} +.sf-toolbar-block-dump .sf-toolbar-info-piece .sf-toolbar-file-line { + color: #AAA; + margin-left: 4px; +} +.sf-toolbar-block-dump .sf-toolbar-info img { + display: none; +} + +/* Responsive Design */ +.sf-toolbar-icon .sf-toolbar-label, +.sf-toolbar-icon .sf-toolbar-value { + display: none; +} +.sf-toolbar-block-config .sf-toolbar-icon .sf-toolbar-label { + display: inline-block; +} + +/* Legacy Design - these styles are maintained to make old panels look + a bit better on the new toolbar */ +.sf-toolbar-block .sf-toolbar-info-piece-additional-detail { + color: #AAA; + font-size: 12px; +} +.sf-toolbar-status-green .sf-toolbar-info-piece-additional-detail, +.sf-toolbar-status-yellow .sf-toolbar-info-piece-additional-detail, +.sf-toolbar-status-red .sf-toolbar-info-piece-additional-detail { + color: #FFF; +} + +@media (min-width: 768px) { + + .sf-toolbar-icon .sf-toolbar-label, + .sf-toolbar-icon .sf-toolbar-value { + display: inline; + } + + .sf-toolbar-block .sf-toolbar-icon img, + .sf-toolbar-block .sf-toolbar-icon svg { + top: 6px; + } + .sf-toolbar-block-time .sf-toolbar-icon svg, + .sf-toolbar-block-memory .sf-toolbar-icon svg { + display: none; + } + .sf-toolbar-block-time .sf-toolbar-icon svg + span, + .sf-toolbar-block-memory .sf-toolbar-icon svg + span { + margin-left: 0; + } + + .sf-toolbar-block .sf-toolbar-icon { + padding: 0 10px; + } + .sf-toolbar-block-time .sf-toolbar-icon { + padding-right: 5px; + } + .sf-toolbar-block-memory .sf-toolbar-icon { + padding-left: 5px; + } + .sf-toolbar-block-request .sf-toolbar-icon { + padding-left: 0; + padding-right: 0; + } + .sf-toolbar-block-request .sf-toolbar-label { + margin-left: 5px; + } + .sf-toolbar-block-request .sf-toolbar-status + svg { + margin-left: 5px; + } + .sf-toolbar-block-request .sf-toolbar-icon svg + .sf-toolbar-label { + margin-left: 0; + } + .sf-toolbar-block-request .sf-toolbar-label + .sf-toolbar-value { + margin-right: 10px; + } + + .sf-toolbar-block-request:hover .sf-toolbar-info { + max-width: none; + } + + .sf-toolbar-block .sf-toolbar-info-piece b { + font-size: 12px; + } + .sf-toolbar-block .sf-toolbar-info-piece span { + font-size: 13px; + } + + .sf-toolbar-block-right { + float: right; + margin-left: 0; + margin-right: 0; + } +} + +@media (min-width: 1024px) { + .sf-toolbar-block .sf-toolbar-info-piece-additional, + .sf-toolbar-block .sf-toolbar-info-piece-additional-detail { + display: inline; + } + + .sf-toolbar-block .sf-toolbar-info-piece-additional:empty, + .sf-toolbar-block .sf-toolbar-info-piece-additional-detail:empty { + display: none; + } +} + +/***** Error Toolbar *****/ +.sf-error-toolbar .sf-toolbarreset { + background: #222; + color: #f5f5f5; + font: 13px/36px Arial, sans-serif; + height: 36px; + padding: 0 15px; + text-align: left; +} + +.sf-error-toolbar .sf-toolbarreset svg { + height: auto; +} + +.sf-error-toolbar .sf-toolbarreset a { + color: #99cdd8; + margin-left: 5px; + text-decoration: underline; +} + +.sf-error-toolbar .sf-toolbarreset a:hover { + text-decoration: none; +} + +.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon { + float: left; + padding: 5px 0; + margin-right: 10px; +} + +.sf-full-stack { + left: 0px; + font-size: 12px; +} + +/***** Media query print: Do not print the Toolbar. *****/ +@media print { + .sf-toolbar { + display: none !important; + } +} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.html.twig new file mode 100644 index 0000000..236fc70 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar.html.twig @@ -0,0 +1,46 @@ + +
    + +
    +
    + +
    + {% for name, template in templates %} + {% if block('toolbar', template) is defined %} + {% with { + collector: profile ? profile.getcollector(name) : null, + profiler_url: profiler_url, + token: token ?? (profile ? profile.token : null), + name: name, + profiler_markup_version: profiler_markup_version, + csp_script_nonce: csp_script_nonce, + csp_style_nonce: csp_style_nonce + } %} + {{ block('toolbar', template) }} + {% endwith %} + {% endif %} + {% endfor %} + {% if full_stack %} +
    +
    + Using symfony/symfony is NOT supported +
    +
    +

    This project is using Symfony via the "symfony/symfony" package.

    +

    This is NOT supported anymore since Symfony 4.0.

    +

    Even if it seems to work well, it has some important limitations with no workarounds.

    +

    Using this package also makes your project slower.

    + + Please, stop using this package and replace it with individual packages instead. +
    +
    +
    + {% endif %} + + +
    + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_item.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_item.html.twig new file mode 100644 index 0000000..d81e877 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_item.html.twig @@ -0,0 +1,6 @@ +
    + {% if link is not defined or link %}{% endif %} +
    {{ icon|default('') }}
    + {% if link|default(false) %}
    {% endif %} +
    {{ text|default('') }}
    +
    diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_js.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_js.html.twig new file mode 100644 index 0000000..352fbb0 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_js.html.twig @@ -0,0 +1,21 @@ +
    + {% include('@WebProfiler/Profiler/toolbar.html.twig') with { + templates: { + 'request': '@WebProfiler/Profiler/cancel.html.twig' + }, + profile: null, + profiler_url: url('_profiler', {token: token}), + profiler_markup_version: 2, + } %} +
    + +{{ include('@WebProfiler/Profiler/base_js.html.twig') }} + + + {{ include('@WebProfiler/Profiler/toolbar.css.twig') }} + +/**/ diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_redirect.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_redirect.html.twig new file mode 100644 index 0000000..18d43b2 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Profiler/toolbar_redirect.html.twig @@ -0,0 +1,18 @@ +{% extends '@WebProfiler/Profiler/base.html.twig' %} + +{% block title 'Redirection Intercepted' %} + +{% block body %} +
    +
    +

    This request redirects to {{ location }}.

    + +

    + + The redirect was intercepted by the web debug toolbar to help debugging. + For more information, see the "intercept-redirects" option of the Profiler. + +

    +
    +
    +{% endblock %} diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/Router/panel.html.twig b/vendor/symfony/web-profiler-bundle/Resources/views/Router/panel.html.twig new file mode 100644 index 0000000..41636d1 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/Router/panel.html.twig @@ -0,0 +1,71 @@ +

    Routing

    + +
    +
    + {{ request.route ?: '(none)' }} + Matched route +
    +
    + +{% if request.route %} +

    Route Parameters

    + + {% if request.routeParams is empty %} +
    +

    No parameters.

    +
    + {% else %} + {{ include('@WebProfiler/Profiler/table.html.twig', { data: request.routeParams, labels: ['Name', 'Value'] }, with_context = false) }} + {% endif %} +{% endif %} + +{% if router.redirect %} +

    Route Redirection

    + +

    This page redirects to:

    +
    + {{ router.targetUrl }} + {% if router.targetRoute %}(route: "{{ router.targetRoute }}"){% endif %} +
    +{% endif %} + +

    Route Matching Logs

    + +
    + Path to match: {{ request.pathinfo }} +
    + + + + + + + + + + + + {% for trace in traces %} + + + + + + + {% endfor %} + +
    #Route namePathLog
    {{ loop.index }}{{ trace.name }}{{ trace.path }} + {% if trace.level == 1 %} + Path almost matches, but + {{ trace.log }} + {% elseif trace.level == 2 %} + {{ trace.log }} + {% else %} + Path does not match + {% endif %} +
    + +

    + Note: These matching logs are based on the current router configuration, + which might differ from the configuration used when profiling this request. +

    diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-minus-square.svg b/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-minus-square.svg new file mode 100644 index 0000000..471c274 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-minus-square.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-plus-square.svg b/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-plus-square.svg new file mode 100644 index 0000000..2f5c3b3 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Resources/views/images/icon-plus-square.svg @@ -0,0 +1 @@ + diff --git a/vendor/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php b/vendor/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php new file mode 100644 index 0000000..8a8721a --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/Twig/WebProfilerExtension.php @@ -0,0 +1,113 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle\Twig; + +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Twig\Environment; +use Twig\Extension\ProfilerExtension; +use Twig\Profiler\Profile; +use Twig\TwigFunction; + +/** + * Twig extension for the profiler. + * + * @author Fabien Potencier + * + * @internal + */ +class WebProfilerExtension extends ProfilerExtension +{ + /** + * @var HtmlDumper + */ + private $dumper; + + /** + * @var resource + */ + private $output; + + /** + * @var int + */ + private $stackLevel = 0; + + public function __construct(HtmlDumper $dumper = null) + { + $this->dumper = $dumper ?? new HtmlDumper(); + $this->dumper->setOutput($this->output = fopen('php://memory', 'r+')); + } + + public function enter(Profile $profile): void + { + ++$this->stackLevel; + } + + public function leave(Profile $profile): void + { + if (0 === --$this->stackLevel) { + $this->dumper->setOutput($this->output = fopen('php://memory', 'r+')); + } + } + + /** + * {@inheritdoc} + */ + public function getFunctions(): array + { + return [ + new TwigFunction('profiler_dump', [$this, 'dumpData'], ['is_safe' => ['html'], 'needs_environment' => true]), + new TwigFunction('profiler_dump_log', [$this, 'dumpLog'], ['is_safe' => ['html'], 'needs_environment' => true]), + ]; + } + + public function dumpData(Environment $env, Data $data, int $maxDepth = 0) + { + $this->dumper->setCharset($env->getCharset()); + $this->dumper->dump($data, null, [ + 'maxDepth' => $maxDepth, + ]); + + $dump = stream_get_contents($this->output, -1, 0); + rewind($this->output); + ftruncate($this->output, 0); + + return str_replace("\n$1"', $message); + + if (null === $context || !str_contains($message, '{')) { + return ''.$message.''; + } + + $replacements = []; + foreach ($context as $k => $v) { + $k = '{'.twig_escape_filter($env, $k).'}'; + $replacements['"'.$k.'"'] = $replacements['"'.$k.'"'] = $replacements[$k] = $this->dumpData($env, $v); + } + + return ''.strtr($message, $replacements).''; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'profiler'; + } +} diff --git a/vendor/symfony/web-profiler-bundle/WebProfilerBundle.php b/vendor/symfony/web-profiler-bundle/WebProfilerBundle.php new file mode 100644 index 0000000..7fcc4ec --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/WebProfilerBundle.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\WebProfilerBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +/** + * @author Fabien Potencier + */ +class WebProfilerBundle extends Bundle +{ + public function boot() + { + if ('prod' === $this->container->getParameter('kernel.environment')) { + @trigger_error('Using WebProfilerBundle in production is not supported and puts your project at risk, disable it.', \E_USER_WARNING); + } + } +} diff --git a/vendor/symfony/web-profiler-bundle/composer.json b/vendor/symfony/web-profiler-bundle/composer.json new file mode 100644 index 0000000..3f67bb6 --- /dev/null +++ b/vendor/symfony/web-profiler-bundle/composer.json @@ -0,0 +1,47 @@ +{ + "name": "symfony/web-profiler-bundle", + "type": "symfony-bundle", + "description": "Provides a development tool that gives detailed information about the execution of any request", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0", + "symfony/polyfill-php80": "^1.16", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "require-dev": { + "symfony/browser-kit": "^4.4|^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "conflict": { + "symfony/form": "<4.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<4.4", + "symfony/dependency-injection": "<5.2" + }, + "autoload": { + "psr-4": { "Symfony\\Bundle\\WebProfilerBundle\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev" +} diff --git a/vendor/twig/twig/.editorconfig b/vendor/twig/twig/.editorconfig new file mode 100644 index 0000000..270f1d1 --- /dev/null +++ b/vendor/twig/twig/.editorconfig @@ -0,0 +1,18 @@ +; top-most EditorConfig file +root = true + +; Unix-style newlines +[*] +end_of_line = LF + +[*.php] +indent_style = space +indent_size = 4 + +[*.test] +indent_style = space +indent_size = 4 + +[*.rst] +indent_style = space +indent_size = 4 diff --git a/vendor/twig/twig/.gitattributes b/vendor/twig/twig/.gitattributes new file mode 100644 index 0000000..1ce832b --- /dev/null +++ b/vendor/twig/twig/.gitattributes @@ -0,0 +1,4 @@ +/doc/** export-ignore +/extra/** export-ignore +/tests export-ignore +/phpunit.xml.dist export-ignore diff --git a/vendor/twig/twig/.github/workflows/ci.yml b/vendor/twig/twig/.github/workflows/ci.yml new file mode 100644 index 0000000..140483c --- /dev/null +++ b/vendor/twig/twig/.github/workflows/ci.yml @@ -0,0 +1,175 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - '3.x' + +env: + SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1 + +jobs: + tests: + name: "PHP ${{ matrix.php-version }}" + + runs-on: 'ubuntu-latest' + + continue-on-error: ${{ matrix.experimental }} + + strategy: + matrix: + php-version: + - '7.2.5' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + composer-options: [''] + experimental: [false] + + steps: + - name: "Checkout code" + uses: actions/checkout@v2.3.3 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@2.7.0 + with: + coverage: "none" + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + tools: composer:v2 + + - name: "Add PHPUnit matcher" + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: "Set composer cache directory" + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache composer" + uses: actions/cache@v2.1.2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer- + + - run: composer install ${{ matrix.composer-options }} + + - name: "Install PHPUnit" + run: vendor/bin/simple-phpunit install + + - name: "PHPUnit version" + run: vendor/bin/simple-phpunit --version + + - name: "Run tests" + run: vendor/bin/simple-phpunit + + extension-tests: + needs: + - 'tests' + + name: "${{ matrix.extension }} with PHP ${{ matrix.php-version }}" + + runs-on: 'ubuntu-latest' + + continue-on-error: true + + strategy: + matrix: + php-version: + - '7.2.5' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + extension: + - 'extra/cache-extra' + - 'extra/cssinliner-extra' + - 'extra/html-extra' + - 'extra/inky-extra' + - 'extra/intl-extra' + - 'extra/markdown-extra' + - 'extra/string-extra' + - 'extra/twig-extra-bundle' + composer-options: [''] + experimental: [false] + + steps: + - name: "Checkout code" + uses: actions/checkout@v2.3.3 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@2.7.0 + with: + coverage: "none" + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + tools: composer:v2 + + - name: "Add PHPUnit matcher" + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: "Set composer cache directory" + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache composer" + uses: actions/cache@v2.1.2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}- + + - run: composer install + + - name: "Install PHPUnit" + run: vendor/bin/simple-phpunit install + + - name: "PHPUnit version" + run: vendor/bin/simple-phpunit --version + + - if: matrix.extension == 'extra/markdown-extra' && matrix.php-version == '8.0' + working-directory: ${{ matrix.extension}} + run: composer config platform.php 7.4.99 + + - name: "Composer install" + working-directory: ${{ matrix.extension}} + run: composer install + + - name: "Run tests" + working-directory: ${{ matrix.extension}} + run: ../../vendor/bin/simple-phpunit +# +# Drupal does not support Twig 3 now! +# +# integration-tests: +# needs: +# - 'tests' +# +# name: "Integration tests with PHP ${{ matrix.php-version }}" +# +# runs-on: 'ubuntu-20.04' +# +# continue-on-error: true +# +# strategy: +# matrix: +# php-version: +# - '7.3' +# +# steps: +# - name: "Checkout code" +# uses: actions/checkout@v2.3.3 +# +# - name: "Install PHP with extensions" +# uses: shivammathur/setup-php@2.7.0 +# with: +# coverage: "none" +# extensions: "gd, pdo_sqlite" +# php-version: ${{ matrix.php-version }} +# ini-values: memory_limit=-1 +# tools: composer:v2 +# +# - run: bash ./tests/drupal_test.sh +# shell: "bash" diff --git a/vendor/twig/twig/.github/workflows/documentation.yml b/vendor/twig/twig/.github/workflows/documentation.yml new file mode 100644 index 0000000..0b3ca71 --- /dev/null +++ b/vendor/twig/twig/.github/workflows/documentation.yml @@ -0,0 +1,60 @@ +name: "Documentation" + +on: + pull_request: + push: + branches: + - '3.x' + +jobs: + build: + name: "Build" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Set up Python 3.7" + uses: actions/setup-python@v1 + with: + python-version: '3.7' # Semantic version range syntax or exact version of a Python version + + - name: "Display Python version" + run: python -c "import sys; print(sys.version)" + + - name: "Install Sphinx dependencies" + run: sudo apt-get install python-dev build-essential + + - name: "Cache pip" + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('_build/.requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: "Install Sphinx + requirements via pip" + working-directory: "doc" + run: pip install -r _build/.requirements.txt + + - name: "Build documentation" + working-directory: "doc" + run: make -C _build SPHINXOPTS="-nqW -j auto" html + + doctor-rst: + name: "DOCtor-RST" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Run DOCtor-RST" + uses: docker://oskarstark/doctor-rst + with: + args: --short + env: + DOCS_DIR: 'doc/' diff --git a/vendor/twig/twig/.gitignore b/vendor/twig/twig/.gitignore new file mode 100644 index 0000000..cd52aea --- /dev/null +++ b/vendor/twig/twig/.gitignore @@ -0,0 +1,4 @@ +/composer.lock +/phpunit.xml +/vendor +.phpunit.result.cache diff --git a/vendor/twig/twig/.php-cs-fixer.dist.php b/vendor/twig/twig/.php-cs-fixer.dist.php new file mode 100644 index 0000000..b07ac7f --- /dev/null +++ b/vendor/twig/twig/.php-cs-fixer.dist.php @@ -0,0 +1,20 @@ +setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + '@PHPUnit75Migration:risky' => true, + 'php_unit_dedicate_assert' => ['target' => '5.6'], + 'array_syntax' => ['syntax' => 'short'], + 'php_unit_fqcn_annotation' => true, + 'no_unreachable_default_argument_value' => false, + 'braces' => ['allow_single_line_closure' => true], + 'heredoc_to_nowdoc' => false, + 'ordered_imports' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'], + ]) + ->setRiskyAllowed(true) + ->setFinder((new PhpCsFixer\Finder())->in(__DIR__)) +; diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG new file mode 100644 index 0000000..d276df8 --- /dev/null +++ b/vendor/twig/twig/CHANGELOG @@ -0,0 +1,132 @@ +# 3.3.10 (2022-04-06) + + * Enable bytecode invalidation when auto_reload is enabled + +# 3.3.9 (2022-03-25) + + * Fix custom escapers when using multiple Twig environments + * Add support for "constant('class', object)" + * Do not reuse internally generated variable names during parsing + +# 3.3.8 (2022-02-04) + + * Fix a security issue when in a sandbox: the `sort` filter must require a Closure for the `arrow` parameter + * Fix deprecation notice on `round` + * Fix call to deprecated `convertToHtml` method + +# 3.3.7 (2022-01-03) + +* Allow more null support when Twig expects a string (for better 8.1 support) +* Only use Commonmark extensions if markdown enabled + +# 3.3.6 (2022-01-03) + +* Only use Commonmark extensions if markdown enabled + +# 3.3.5 (2022-01-03) + +* Allow CommonMark extensions to easily be added +* Allow null when Twig expects a string (for better 8.1 support) +* Make some performance optimizations +* Allow Symfony translation contract v3+ + +# 3.3.4 (2021-11-25) + + * Bump minimum supported Symfony component versions + * Fix a deprecated message + +# 3.3.3 (2021-09-17) + + * Allow Symfony 6 + * Improve compatibility with PHP 8.1 + * Explicitly specify the encoding for mb_ord in JS escaper + +# 3.3.2 (2021-05-16) + + * Revert "Throw a proper exception when a template name is an absolute path (as it has never been supported)" + +# 3.3.1 (2021-05-12) + + * Fix PHP 8.1 compatibility + * Throw a proper exception when a template name is an absolute path (as it has never been supported) + +# 3.3.0 (2021-02-08) + + * Fix macro calls in a "cache" tag + * Add the slug filter + * Allow extra bundle to be compatible with Twig 2 + +# 3.2.1 (2021-01-05) + + * Fix extra bundle compat with older versions of Symfony + +# 3.2.0 (2021-01-05) + + * Add the Cache extension in the "extra" repositories: "cache" tag + * Add "registerUndefinedTokenParserCallback" + * Mark built-in node visitors as @internal + * Fix "odd" not working for negative numbers + +# 3.1.1 (2020-10-27) + + * Fix "include(template_from_string())" + +# 3.1.0 (2020-10-21) + + * Fix sandbox support when using "include(template_from_string())" + * Make round brackets optional for one argument tests like "same as" or "divisible by" + * Add support for ES2015 style object initialisation shortcut { a } is the same as { 'a': a } + +# 3.0.5 (2020-08-05) + + * Fix twig_compare w.r.t. whitespace trimming + * Fix sandbox not disabled if syntax error occurs within {% sandbox %} tag + * Fix a regression when not using a space before an operator + * Restrict callables to closures in filters + * Allow trailing commas in argument lists (in calls as well as definitions) + +# 3.0.4 (2020-07-05) + + * Fix comparison operators + * Fix options not taken into account when using "Michelf\MarkdownExtra" + * Fix "Twig\Extra\Intl\IntlExtension::getCountryName()" to accept "null" as a first argument + * Throw exception in case non-Traversable data is passed to "filter" + * Fix context optimization on PHP 7.4 + * Fix PHP 8 compatibility + * Fix ambiguous syntax parsing + +# 3.0.3 (2020-02-11) + + * Add a check to ensure that iconv() is defined + +# 3.0.2 (2020-02-11) + + * Avoid exceptions when an intl resource is not found + * Fix implementation of case-insensitivity for method names + +# 3.0.1 (2019-12-28) + + * fixed Symfony 5.0 support for the HTML extra extension + +# 3.0.0 (2019-11-15) + + * fixed number formatter in Intl extra extension when using a formatter prototype + +# 3.0.0-BETA1 (2019-11-11) + + * removed the "if" condition support on the "for" tag + * made the in, <, >, <=, >=, ==, and != operators more strict when comparing strings and integers/floats + * removed the "filter" tag + * added type hints everywhere + * changed Environment::resolveTemplate() to always return a TemplateWrapper instance + * removed Template::__toString() + * removed Parser::isReservedMacroName() + * removed SanboxedPrintNode + * removed Node::setTemplateName() + * made classes maked as "@final" final + * removed InitRuntimeInterface, ExistsLoaderInterface, and SourceContextLoaderInterface + * removed the "spaceless" tag + * removed Twig\Environment::getBaseTemplateClass() and Twig\Environment::setBaseTemplateClass() + * removed the "base_template_class" option on Twig\Environment + * bumped minimum PHP version to 7.2 + * removed PSR-0 classes diff --git a/vendor/twig/twig/LICENSE b/vendor/twig/twig/LICENSE new file mode 100644 index 0000000..8711927 --- /dev/null +++ b/vendor/twig/twig/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009-2022 by the Twig Team. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Twig nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/twig/twig/README.rst b/vendor/twig/twig/README.rst new file mode 100644 index 0000000..fbe7e9a --- /dev/null +++ b/vendor/twig/twig/README.rst @@ -0,0 +1,23 @@ +Twig, the flexible, fast, and secure template language for PHP +============================================================== + +Twig is a template language for PHP. + +Twig uses a syntax similar to the Django and Jinja template languages which +inspired the Twig runtime environment. + +Sponsors +-------- + +.. raw:: html + + + Blackfire.io + + +More Information +---------------- + +Read the `documentation`_ for more information. + +.. _documentation: https://twig.symfony.com/documentation diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json new file mode 100644 index 0000000..91ff912 --- /dev/null +++ b/vendor/twig/twig/composer.json @@ -0,0 +1,50 @@ +{ + "name": "twig/twig", + "type": "library", + "description": "Twig, the flexible, fast, and secure template language for PHP", + "keywords": ["templating"], + "homepage": "https://twig.symfony.com", + "license": "BSD-3-Clause", + "minimum-stability": "dev", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0", + "psr/container": "^1.0" + }, + "autoload": { + "psr-4" : { + "Twig\\" : "src/" + } + }, + "autoload-dev": { + "psr-4" : { + "Twig\\Tests\\" : "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + } +} diff --git a/vendor/twig/twig/src/Cache/CacheInterface.php b/vendor/twig/twig/src/Cache/CacheInterface.php new file mode 100644 index 0000000..6e8c409 --- /dev/null +++ b/vendor/twig/twig/src/Cache/CacheInterface.php @@ -0,0 +1,46 @@ + + */ +interface CacheInterface +{ + /** + * Generates a cache key for the given template class name. + */ + public function generateKey(string $name, string $className): string; + + /** + * Writes the compiled template to cache. + * + * @param string $content The template representation as a PHP class + */ + public function write(string $key, string $content): void; + + /** + * Loads a template from the cache. + */ + public function load(string $key): void; + + /** + * Returns the modification timestamp of a key. + */ + public function getTimestamp(string $key): int; +} diff --git a/vendor/twig/twig/src/Cache/FilesystemCache.php b/vendor/twig/twig/src/Cache/FilesystemCache.php new file mode 100644 index 0000000..e075563 --- /dev/null +++ b/vendor/twig/twig/src/Cache/FilesystemCache.php @@ -0,0 +1,87 @@ + + */ +class FilesystemCache implements CacheInterface +{ + public const FORCE_BYTECODE_INVALIDATION = 1; + + private $directory; + private $options; + + public function __construct(string $directory, int $options = 0) + { + $this->directory = rtrim($directory, '\/').'/'; + $this->options = $options; + } + + public function generateKey(string $name, string $className): string + { + $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $className); + + return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; + } + + public function load(string $key): void + { + if (is_file($key)) { + @include_once $key; + } + } + + public function write(string $key, string $content): void + { + $dir = \dirname($key); + if (!is_dir($dir)) { + if (false === @mkdir($dir, 0777, true)) { + clearstatcache(true, $dir); + if (!is_dir($dir)) { + throw new \RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); + } + } + } elseif (!is_writable($dir)) { + throw new \RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); + } + + $tmpFile = tempnam($dir, basename($key)); + if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { + @chmod($key, 0666 & ~umask()); + + if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { + // Compile cached file into bytecode cache + if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) { + @opcache_invalidate($key, true); + } elseif (\function_exists('apc_compile_file')) { + apc_compile_file($key); + } + } + + return; + } + + throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $key)); + } + + public function getTimestamp(string $key): int + { + if (!is_file($key)) { + return 0; + } + + return (int) @filemtime($key); + } +} diff --git a/vendor/twig/twig/src/Cache/NullCache.php b/vendor/twig/twig/src/Cache/NullCache.php new file mode 100644 index 0000000..8d20d59 --- /dev/null +++ b/vendor/twig/twig/src/Cache/NullCache.php @@ -0,0 +1,38 @@ + + */ +final class NullCache implements CacheInterface +{ + public function generateKey(string $name, string $className): string + { + return ''; + } + + public function write(string $key, string $content): void + { + } + + public function load(string $key): void + { + } + + public function getTimestamp(string $key): int + { + return 0; + } +} diff --git a/vendor/twig/twig/src/Compiler.php b/vendor/twig/twig/src/Compiler.php new file mode 100644 index 0000000..95e1f18 --- /dev/null +++ b/vendor/twig/twig/src/Compiler.php @@ -0,0 +1,214 @@ + + */ +class Compiler +{ + private $lastLine; + private $source; + private $indentation; + private $env; + private $debugInfo = []; + private $sourceOffset; + private $sourceLine; + private $varNameSalt = 0; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + public function getEnvironment(): Environment + { + return $this->env; + } + + public function getSource(): string + { + return $this->source; + } + + /** + * @return $this + */ + public function compile(Node $node, int $indentation = 0) + { + $this->lastLine = null; + $this->source = ''; + $this->debugInfo = []; + $this->sourceOffset = 0; + // source code starts at 1 (as we then increment it when we encounter new lines) + $this->sourceLine = 1; + $this->indentation = $indentation; + $this->varNameSalt = 0; + + $node->compile($this); + + return $this; + } + + /** + * @return $this + */ + public function subcompile(Node $node, bool $raw = true) + { + if (false === $raw) { + $this->source .= str_repeat(' ', $this->indentation * 4); + } + + $node->compile($this); + + return $this; + } + + /** + * Adds a raw string to the compiled code. + * + * @return $this + */ + public function raw(string $string) + { + $this->source .= $string; + + return $this; + } + + /** + * Writes a string to the compiled code by adding indentation. + * + * @return $this + */ + public function write(...$strings) + { + foreach ($strings as $string) { + $this->source .= str_repeat(' ', $this->indentation * 4).$string; + } + + return $this; + } + + /** + * Adds a quoted string to the compiled code. + * + * @return $this + */ + public function string(string $value) + { + $this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\")); + + return $this; + } + + /** + * Returns a PHP representation of a given value. + * + * @return $this + */ + public function repr($value) + { + if (\is_int($value) || \is_float($value)) { + if (false !== $locale = setlocale(\LC_NUMERIC, '0')) { + setlocale(\LC_NUMERIC, 'C'); + } + + $this->raw(var_export($value, true)); + + if (false !== $locale) { + setlocale(\LC_NUMERIC, $locale); + } + } elseif (null === $value) { + $this->raw('null'); + } elseif (\is_bool($value)) { + $this->raw($value ? 'true' : 'false'); + } elseif (\is_array($value)) { + $this->raw('array('); + $first = true; + foreach ($value as $key => $v) { + if (!$first) { + $this->raw(', '); + } + $first = false; + $this->repr($key); + $this->raw(' => '); + $this->repr($v); + } + $this->raw(')'); + } else { + $this->string($value); + } + + return $this; + } + + /** + * @return $this + */ + public function addDebugInfo(Node $node) + { + if ($node->getTemplateLine() != $this->lastLine) { + $this->write(sprintf("// line %d\n", $node->getTemplateLine())); + + $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); + $this->sourceOffset = \strlen($this->source); + $this->debugInfo[$this->sourceLine] = $node->getTemplateLine(); + + $this->lastLine = $node->getTemplateLine(); + } + + return $this; + } + + public function getDebugInfo(): array + { + ksort($this->debugInfo); + + return $this->debugInfo; + } + + /** + * @return $this + */ + public function indent(int $step = 1) + { + $this->indentation += $step; + + return $this; + } + + /** + * @return $this + * + * @throws \LogicException When trying to outdent too much so the indentation would become negative + */ + public function outdent(int $step = 1) + { + // can't outdent by more steps than the current indentation level + if ($this->indentation < $step) { + throw new \LogicException('Unable to call outdent() as the indentation would become negative.'); + } + + $this->indentation -= $step; + + return $this; + } + + public function getVarName(): string + { + return sprintf('__internal_compile_%d', $this->varNameSalt++); + } +} diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php new file mode 100644 index 0000000..4ff095c --- /dev/null +++ b/vendor/twig/twig/src/Environment.php @@ -0,0 +1,832 @@ + + */ +class Environment +{ + public const VERSION = '3.3.10'; + public const VERSION_ID = 30310; + public const MAJOR_VERSION = 3; + public const MINOR_VERSION = 3; + public const RELEASE_VERSION = 10; + public const EXTRA_VERSION = ''; + + private $charset; + private $loader; + private $debug; + private $autoReload; + private $cache; + private $lexer; + private $parser; + private $compiler; + private $globals = []; + private $resolvedGlobals; + private $loadedTemplates; + private $strictVariables; + private $templateClassPrefix = '__TwigTemplate_'; + private $originalCache; + private $extensionSet; + private $runtimeLoaders = []; + private $runtimes = []; + private $optionsHash; + + /** + * Constructor. + * + * Available options: + * + * * debug: When set to true, it automatically set "auto_reload" to true as + * well (default to false). + * + * * charset: The charset used by the templates (default to UTF-8). + * + * * cache: An absolute path where to store the compiled templates, + * a \Twig\Cache\CacheInterface implementation, + * or false to disable compilation cache (default). + * + * * auto_reload: Whether to reload the template if the original source changed. + * If you don't provide the auto_reload option, it will be + * determined automatically based on the debug value. + * + * * strict_variables: Whether to ignore invalid variables in templates + * (default to false). + * + * * autoescape: Whether to enable auto-escaping (default to html): + * * false: disable auto-escaping + * * html, js: set the autoescaping to one of the supported strategies + * * name: set the autoescaping strategy based on the template name extension + * * PHP callback: a PHP callback that returns an escaping strategy based on the template "name" + * + * * optimizations: A flag that indicates which optimizations to apply + * (default to -1 which means that all optimizations are enabled; + * set it to 0 to disable). + */ + public function __construct(LoaderInterface $loader, $options = []) + { + $this->setLoader($loader); + + $options = array_merge([ + 'debug' => false, + 'charset' => 'UTF-8', + 'strict_variables' => false, + 'autoescape' => 'html', + 'cache' => false, + 'auto_reload' => null, + 'optimizations' => -1, + ], $options); + + $this->debug = (bool) $options['debug']; + $this->setCharset($options['charset'] ?? 'UTF-8'); + $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; + $this->strictVariables = (bool) $options['strict_variables']; + $this->setCache($options['cache']); + $this->extensionSet = new ExtensionSet(); + + $this->addExtension(new CoreExtension()); + $this->addExtension(new EscaperExtension($options['autoescape'])); + $this->addExtension(new OptimizerExtension($options['optimizations'])); + } + + /** + * Enables debugging mode. + */ + public function enableDebug() + { + $this->debug = true; + $this->updateOptionsHash(); + } + + /** + * Disables debugging mode. + */ + public function disableDebug() + { + $this->debug = false; + $this->updateOptionsHash(); + } + + /** + * Checks if debug mode is enabled. + * + * @return bool true if debug mode is enabled, false otherwise + */ + public function isDebug() + { + return $this->debug; + } + + /** + * Enables the auto_reload option. + */ + public function enableAutoReload() + { + $this->autoReload = true; + } + + /** + * Disables the auto_reload option. + */ + public function disableAutoReload() + { + $this->autoReload = false; + } + + /** + * Checks if the auto_reload option is enabled. + * + * @return bool true if auto_reload is enabled, false otherwise + */ + public function isAutoReload() + { + return $this->autoReload; + } + + /** + * Enables the strict_variables option. + */ + public function enableStrictVariables() + { + $this->strictVariables = true; + $this->updateOptionsHash(); + } + + /** + * Disables the strict_variables option. + */ + public function disableStrictVariables() + { + $this->strictVariables = false; + $this->updateOptionsHash(); + } + + /** + * Checks if the strict_variables option is enabled. + * + * @return bool true if strict_variables is enabled, false otherwise + */ + public function isStrictVariables() + { + return $this->strictVariables; + } + + /** + * Gets the current cache implementation. + * + * @param bool $original Whether to return the original cache option or the real cache instance + * + * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function getCache($original = true) + { + return $original ? $this->originalCache : $this->cache; + } + + /** + * Sets the current cache implementation. + * + * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation, + * an absolute path to the compiled templates, + * or false to disable cache + */ + public function setCache($cache) + { + if (\is_string($cache)) { + $this->originalCache = $cache; + $this->cache = new FilesystemCache($cache, $this->autoReload ? FilesystemCache::FORCE_BYTECODE_INVALIDATION : 0); + } elseif (false === $cache) { + $this->originalCache = $cache; + $this->cache = new NullCache(); + } elseif ($cache instanceof CacheInterface) { + $this->originalCache = $this->cache = $cache; + } else { + throw new \LogicException('Cache can only be a string, false, or a \Twig\Cache\CacheInterface implementation.'); + } + } + + /** + * Gets the template class associated with the given string. + * + * The generated template class is based on the following parameters: + * + * * The cache key for the given template; + * * The currently enabled extensions; + * * Whether the Twig C extension is available or not; + * * PHP version; + * * Twig version; + * * Options with what environment was created. + * + * @param string $name The name for which to calculate the template class name + * @param int|null $index The index if it is an embedded template + * + * @internal + */ + public function getTemplateClass(string $name, int $index = null): string + { + $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; + + return $this->templateClassPrefix.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $key).(null === $index ? '' : '___'.$index); + } + + /** + * Renders a template. + * + * @param string|TemplateWrapper $name The template name + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function render($name, array $context = []): string + { + return $this->load($name)->render($context); + } + + /** + * Displays a template. + * + * @param string|TemplateWrapper $name The template name + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + * @throws RuntimeError When an error occurred during rendering + */ + public function display($name, array $context = []): void + { + $this->load($name)->display($context); + } + + /** + * Loads a template. + * + * @param string|TemplateWrapper $name The template name + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + */ + public function load($name): TemplateWrapper + { + if ($name instanceof TemplateWrapper) { + return $name; + } + + return new TemplateWrapper($this, $this->loadTemplate($this->getTemplateClass($name), $name)); + } + + /** + * Loads a template internal representation. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The template name + * @param int $index The index if it is an embedded template + * + * @throws LoaderError When the template cannot be found + * @throws RuntimeError When a previously generated cache is corrupted + * @throws SyntaxError When an error occurred during compilation + * + * @internal + */ + public function loadTemplate(string $cls, string $name, int $index = null): Template + { + $mainCls = $cls; + if (null !== $index) { + $cls .= '___'.$index; + } + + if (isset($this->loadedTemplates[$cls])) { + return $this->loadedTemplates[$cls]; + } + + if (!class_exists($cls, false)) { + $key = $this->cache->generateKey($name, $mainCls); + + if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) { + $this->cache->load($key); + } + + $source = null; + if (!class_exists($cls, false)) { + $source = $this->getLoader()->getSourceContext($name); + $content = $this->compileSource($source); + $this->cache->write($key, $content); + $this->cache->load($key); + + if (!class_exists($mainCls, false)) { + /* Last line of defense if either $this->bcWriteCacheFile was used, + * $this->cache is implemented as a no-op or we have a race condition + * where the cache was cleared between the above calls to write to and load from + * the cache. + */ + eval('?>'.$content); + } + + if (!class_exists($cls, false)) { + throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source); + } + } + } + + $this->extensionSet->initRuntime(); + + return $this->loadedTemplates[$cls] = new $cls($this); + } + + /** + * Creates a template from source. + * + * This method should not be used as a generic way to load templates. + * + * @param string $template The template source + * @param string $name An optional name of the template to be used in error messages + * + * @throws LoaderError When the template cannot be found + * @throws SyntaxError When an error occurred during compilation + */ + public function createTemplate(string $template, string $name = null): TemplateWrapper + { + $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $template, false); + if (null !== $name) { + $name = sprintf('%s (string template %s)', $name, $hash); + } else { + $name = sprintf('__string_template__%s', $hash); + } + + $loader = new ChainLoader([ + new ArrayLoader([$name => $template]), + $current = $this->getLoader(), + ]); + + $this->setLoader($loader); + try { + return new TemplateWrapper($this, $this->loadTemplate($this->getTemplateClass($name), $name)); + } finally { + $this->setLoader($current); + } + } + + /** + * Returns true if the template is still fresh. + * + * Besides checking the loader for freshness information, + * this method also checks if the enabled extensions have + * not changed. + * + * @param int $time The last modification time of the cached template + */ + public function isTemplateFresh(string $name, int $time): bool + { + return $this->extensionSet->getLastModified() <= $time && $this->getLoader()->isFresh($name, $time); + } + + /** + * Tries to load a template consecutively from an array. + * + * Similar to load() but it also accepts instances of \Twig\Template and + * \Twig\TemplateWrapper, and an array of templates where each is tried to be loaded. + * + * @param string|TemplateWrapper|array $names A template or an array of templates to try consecutively + * + * @throws LoaderError When none of the templates can be found + * @throws SyntaxError When an error occurred during compilation + */ + public function resolveTemplate($names): TemplateWrapper + { + if (!\is_array($names)) { + return $this->load($names); + } + + $count = \count($names); + foreach ($names as $name) { + if ($name instanceof Template) { + return $name; + } + if ($name instanceof TemplateWrapper) { + return $name; + } + + if (1 !== $count && !$this->getLoader()->exists($name)) { + continue; + } + + return $this->load($name); + } + + throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); + } + + public function setLexer(Lexer $lexer) + { + $this->lexer = $lexer; + } + + /** + * @throws SyntaxError When the code is syntactically wrong + */ + public function tokenize(Source $source): TokenStream + { + if (null === $this->lexer) { + $this->lexer = new Lexer($this); + } + + return $this->lexer->tokenize($source); + } + + public function setParser(Parser $parser) + { + $this->parser = $parser; + } + + /** + * Converts a token stream to a node tree. + * + * @throws SyntaxError When the token stream is syntactically or semantically wrong + */ + public function parse(TokenStream $stream): ModuleNode + { + if (null === $this->parser) { + $this->parser = new Parser($this); + } + + return $this->parser->parse($stream); + } + + public function setCompiler(Compiler $compiler) + { + $this->compiler = $compiler; + } + + /** + * Compiles a node and returns the PHP code. + */ + public function compile(Node $node): string + { + if (null === $this->compiler) { + $this->compiler = new Compiler($this); + } + + return $this->compiler->compile($node)->getSource(); + } + + /** + * Compiles a template source code. + * + * @throws SyntaxError When there was an error during tokenizing, parsing or compiling + */ + public function compileSource(Source $source): string + { + try { + return $this->compile($this->parse($this->tokenize($source))); + } catch (Error $e) { + $e->setSourceContext($source); + throw $e; + } catch (\Exception $e) { + throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); + } + } + + public function setLoader(LoaderInterface $loader) + { + $this->loader = $loader; + } + + public function getLoader(): LoaderInterface + { + return $this->loader; + } + + public function setCharset(string $charset) + { + if ('UTF8' === $charset = null === $charset ? null : strtoupper($charset)) { + // iconv on Windows requires "UTF-8" instead of "UTF8" + $charset = 'UTF-8'; + } + + $this->charset = $charset; + } + + public function getCharset(): string + { + return $this->charset; + } + + public function hasExtension(string $class): bool + { + return $this->extensionSet->hasExtension($class); + } + + public function addRuntimeLoader(RuntimeLoaderInterface $loader) + { + $this->runtimeLoaders[] = $loader; + } + + /** + * @template TExtension of ExtensionInterface + * + * @param class-string $class + * + * @return TExtension + */ + public function getExtension(string $class): ExtensionInterface + { + return $this->extensionSet->getExtension($class); + } + + /** + * Returns the runtime implementation of a Twig element (filter/function/tag/test). + * + * @template TRuntime of object + * + * @param class-string $class A runtime class name + * + * @return TRuntime The runtime implementation + * + * @throws RuntimeError When the template cannot be found + */ + public function getRuntime(string $class) + { + if (isset($this->runtimes[$class])) { + return $this->runtimes[$class]; + } + + foreach ($this->runtimeLoaders as $loader) { + if (null !== $runtime = $loader->load($class)) { + return $this->runtimes[$class] = $runtime; + } + } + + throw new RuntimeError(sprintf('Unable to load the "%s" runtime.', $class)); + } + + public function addExtension(ExtensionInterface $extension) + { + $this->extensionSet->addExtension($extension); + $this->updateOptionsHash(); + } + + /** + * @param ExtensionInterface[] $extensions An array of extensions + */ + public function setExtensions(array $extensions) + { + $this->extensionSet->setExtensions($extensions); + $this->updateOptionsHash(); + } + + /** + * @return ExtensionInterface[] An array of extensions (keys are for internal usage only and should not be relied on) + */ + public function getExtensions(): array + { + return $this->extensionSet->getExtensions(); + } + + public function addTokenParser(TokenParserInterface $parser) + { + $this->extensionSet->addTokenParser($parser); + } + + /** + * @return TokenParserInterface[] + * + * @internal + */ + public function getTokenParsers(): array + { + return $this->extensionSet->getTokenParsers(); + } + + /** + * @internal + */ + public function getTokenParser(string $name): ?TokenParserInterface + { + return $this->extensionSet->getTokenParser($name); + } + + public function registerUndefinedTokenParserCallback(callable $callable): void + { + $this->extensionSet->registerUndefinedTokenParserCallback($callable); + } + + public function addNodeVisitor(NodeVisitorInterface $visitor) + { + $this->extensionSet->addNodeVisitor($visitor); + } + + /** + * @return NodeVisitorInterface[] + * + * @internal + */ + public function getNodeVisitors(): array + { + return $this->extensionSet->getNodeVisitors(); + } + + public function addFilter(TwigFilter $filter) + { + $this->extensionSet->addFilter($filter); + } + + /** + * @internal + */ + public function getFilter(string $name): ?TwigFilter + { + return $this->extensionSet->getFilter($name); + } + + public function registerUndefinedFilterCallback(callable $callable): void + { + $this->extensionSet->registerUndefinedFilterCallback($callable); + } + + /** + * Gets the registered Filters. + * + * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback. + * + * @return TwigFilter[] + * + * @see registerUndefinedFilterCallback + * + * @internal + */ + public function getFilters(): array + { + return $this->extensionSet->getFilters(); + } + + public function addTest(TwigTest $test) + { + $this->extensionSet->addTest($test); + } + + /** + * @return TwigTest[] + * + * @internal + */ + public function getTests(): array + { + return $this->extensionSet->getTests(); + } + + /** + * @internal + */ + public function getTest(string $name): ?TwigTest + { + return $this->extensionSet->getTest($name); + } + + public function addFunction(TwigFunction $function) + { + $this->extensionSet->addFunction($function); + } + + /** + * @internal + */ + public function getFunction(string $name): ?TwigFunction + { + return $this->extensionSet->getFunction($name); + } + + public function registerUndefinedFunctionCallback(callable $callable): void + { + $this->extensionSet->registerUndefinedFunctionCallback($callable); + } + + /** + * Gets registered functions. + * + * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. + * + * @return TwigFunction[] + * + * @see registerUndefinedFunctionCallback + * + * @internal + */ + public function getFunctions(): array + { + return $this->extensionSet->getFunctions(); + } + + /** + * Registers a Global. + * + * New globals can be added before compiling or rendering a template; + * but after, you can only update existing globals. + * + * @param mixed $value The global value + */ + public function addGlobal(string $name, $value) + { + if ($this->extensionSet->isInitialized() && !\array_key_exists($name, $this->getGlobals())) { + throw new \LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); + } + + if (null !== $this->resolvedGlobals) { + $this->resolvedGlobals[$name] = $value; + } else { + $this->globals[$name] = $value; + } + } + + /** + * @internal + */ + public function getGlobals(): array + { + if ($this->extensionSet->isInitialized()) { + if (null === $this->resolvedGlobals) { + $this->resolvedGlobals = array_merge($this->extensionSet->getGlobals(), $this->globals); + } + + return $this->resolvedGlobals; + } + + return array_merge($this->extensionSet->getGlobals(), $this->globals); + } + + public function mergeGlobals(array $context): array + { + // we don't use array_merge as the context being generally + // bigger than globals, this code is faster. + foreach ($this->getGlobals() as $key => $value) { + if (!\array_key_exists($key, $context)) { + $context[$key] = $value; + } + } + + return $context; + } + + /** + * @internal + */ + public function getUnaryOperators(): array + { + return $this->extensionSet->getUnaryOperators(); + } + + /** + * @internal + */ + public function getBinaryOperators(): array + { + return $this->extensionSet->getBinaryOperators(); + } + + private function updateOptionsHash(): void + { + $this->optionsHash = implode(':', [ + $this->extensionSet->getSignature(), + \PHP_MAJOR_VERSION, + \PHP_MINOR_VERSION, + self::VERSION, + (int) $this->debug, + (int) $this->strictVariables, + ]); + } +} diff --git a/vendor/twig/twig/src/Error/Error.php b/vendor/twig/twig/src/Error/Error.php new file mode 100644 index 0000000..a68be65 --- /dev/null +++ b/vendor/twig/twig/src/Error/Error.php @@ -0,0 +1,227 @@ + + */ +class Error extends \Exception +{ + private $lineno; + private $name; + private $rawMessage; + private $sourcePath; + private $sourceCode; + + /** + * Constructor. + * + * By default, automatic guessing is enabled. + * + * @param string $message The error message + * @param int $lineno The template line where the error occurred + * @param Source|null $source The source context where the error occurred + */ + public function __construct(string $message, int $lineno = -1, Source $source = null, \Exception $previous = null) + { + parent::__construct('', 0, $previous); + + if (null === $source) { + $name = null; + } else { + $name = $source->getName(); + $this->sourceCode = $source->getCode(); + $this->sourcePath = $source->getPath(); + } + + $this->lineno = $lineno; + $this->name = $name; + $this->rawMessage = $message; + $this->updateRepr(); + } + + public function getRawMessage(): string + { + return $this->rawMessage; + } + + public function getTemplateLine(): int + { + return $this->lineno; + } + + public function setTemplateLine(int $lineno): void + { + $this->lineno = $lineno; + + $this->updateRepr(); + } + + public function getSourceContext(): ?Source + { + return $this->name ? new Source($this->sourceCode, $this->name, $this->sourcePath) : null; + } + + public function setSourceContext(Source $source = null): void + { + if (null === $source) { + $this->sourceCode = $this->name = $this->sourcePath = null; + } else { + $this->sourceCode = $source->getCode(); + $this->name = $source->getName(); + $this->sourcePath = $source->getPath(); + } + + $this->updateRepr(); + } + + public function guess(): void + { + $this->guessTemplateInfo(); + $this->updateRepr(); + } + + public function appendMessage($rawMessage): void + { + $this->rawMessage .= $rawMessage; + $this->updateRepr(); + } + + private function updateRepr(): void + { + $this->message = $this->rawMessage; + + if ($this->sourcePath && $this->lineno > 0) { + $this->file = $this->sourcePath; + $this->line = $this->lineno; + + return; + } + + $dot = false; + if ('.' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $dot = true; + } + + $questionMark = false; + if ('?' === substr($this->message, -1)) { + $this->message = substr($this->message, 0, -1); + $questionMark = true; + } + + if ($this->name) { + if (\is_string($this->name) || (\is_object($this->name) && method_exists($this->name, '__toString'))) { + $name = sprintf('"%s"', $this->name); + } else { + $name = json_encode($this->name); + } + $this->message .= sprintf(' in %s', $name); + } + + if ($this->lineno && $this->lineno >= 0) { + $this->message .= sprintf(' at line %d', $this->lineno); + } + + if ($dot) { + $this->message .= '.'; + } + + if ($questionMark) { + $this->message .= '?'; + } + } + + private function guessTemplateInfo(): void + { + $template = null; + $templateClass = null; + + $backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT); + foreach ($backtrace as $trace) { + if (isset($trace['object']) && $trace['object'] instanceof Template) { + $currentClass = \get_class($trace['object']); + $isEmbedContainer = null === $templateClass ? false : 0 === strpos($templateClass, $currentClass); + if (null === $this->name || ($this->name == $trace['object']->getTemplateName() && !$isEmbedContainer)) { + $template = $trace['object']; + $templateClass = \get_class($trace['object']); + } + } + } + + // update template name + if (null !== $template && null === $this->name) { + $this->name = $template->getTemplateName(); + } + + // update template path if any + if (null !== $template && null === $this->sourcePath) { + $src = $template->getSourceContext(); + $this->sourceCode = $src->getCode(); + $this->sourcePath = $src->getPath(); + } + + if (null === $template || $this->lineno > -1) { + return; + } + + $r = new \ReflectionObject($template); + $file = $r->getFileName(); + + $exceptions = [$e = $this]; + while ($e = $e->getPrevious()) { + $exceptions[] = $e; + } + + while ($e = array_pop($exceptions)) { + $traces = $e->getTrace(); + array_unshift($traces, ['file' => $e->getFile(), 'line' => $e->getLine()]); + + while ($trace = array_shift($traces)) { + if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { + continue; + } + + foreach ($template->getDebugInfo() as $codeLine => $templateLine) { + if ($codeLine <= $trace['line']) { + // update template line + $this->lineno = $templateLine; + + return; + } + } + } + } + } +} diff --git a/vendor/twig/twig/src/Error/LoaderError.php b/vendor/twig/twig/src/Error/LoaderError.php new file mode 100644 index 0000000..7c8c23c --- /dev/null +++ b/vendor/twig/twig/src/Error/LoaderError.php @@ -0,0 +1,21 @@ + + */ +class LoaderError extends Error +{ +} diff --git a/vendor/twig/twig/src/Error/RuntimeError.php b/vendor/twig/twig/src/Error/RuntimeError.php new file mode 100644 index 0000000..f6b8476 --- /dev/null +++ b/vendor/twig/twig/src/Error/RuntimeError.php @@ -0,0 +1,22 @@ + + */ +class RuntimeError extends Error +{ +} diff --git a/vendor/twig/twig/src/Error/SyntaxError.php b/vendor/twig/twig/src/Error/SyntaxError.php new file mode 100644 index 0000000..726b330 --- /dev/null +++ b/vendor/twig/twig/src/Error/SyntaxError.php @@ -0,0 +1,46 @@ + + */ +class SyntaxError extends Error +{ + /** + * Tweaks the error message to include suggestions. + * + * @param string $name The original name of the item that does not exist + * @param array $items An array of possible items + */ + public function addSuggestions(string $name, array $items): void + { + $alternatives = []; + foreach ($items as $item) { + $lev = levenshtein($name, $item); + if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = $lev; + } + } + + if (!$alternatives) { + return; + } + + asort($alternatives); + + $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', array_keys($alternatives)))); + } +} diff --git a/vendor/twig/twig/src/ExpressionParser.php b/vendor/twig/twig/src/ExpressionParser.php new file mode 100644 index 0000000..70b6eb0 --- /dev/null +++ b/vendor/twig/twig/src/ExpressionParser.php @@ -0,0 +1,825 @@ + + * + * @internal + */ +class ExpressionParser +{ + public const OPERATOR_LEFT = 1; + public const OPERATOR_RIGHT = 2; + + private $parser; + private $env; + private $unaryOperators; + private $binaryOperators; + + public function __construct(Parser $parser, Environment $env) + { + $this->parser = $parser; + $this->env = $env; + $this->unaryOperators = $env->getUnaryOperators(); + $this->binaryOperators = $env->getBinaryOperators(); + } + + public function parseExpression($precedence = 0, $allowArrow = false) + { + if ($allowArrow && $arrow = $this->parseArrow()) { + return $arrow; + } + + $expr = $this->getPrimary(); + $token = $this->parser->getCurrentToken(); + while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) { + $op = $this->binaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + + if ('is not' === $token->getValue()) { + $expr = $this->parseNotTestExpression($expr); + } elseif ('is' === $token->getValue()) { + $expr = $this->parseTestExpression($expr); + } elseif (isset($op['callable'])) { + $expr = $op['callable']($this->parser, $expr); + } else { + $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']); + $class = $op['class']; + $expr = new $class($expr, $expr1, $token->getLine()); + } + + $token = $this->parser->getCurrentToken(); + } + + if (0 === $precedence) { + return $this->parseConditionalExpression($expr); + } + + return $expr; + } + + /** + * @return ArrowFunctionExpression|null + */ + private function parseArrow() + { + $stream = $this->parser->getStream(); + + // short array syntax (one argument, no parentheses)? + if ($stream->look(1)->test(/* Token::ARROW_TYPE */ 12)) { + $line = $stream->getCurrent()->getLine(); + $token = $stream->expect(/* Token::NAME_TYPE */ 5); + $names = [new AssignNameExpression($token->getValue(), $token->getLine())]; + $stream->expect(/* Token::ARROW_TYPE */ 12); + + return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); + } + + // first, determine if we are parsing an arrow function by finding => (long form) + $i = 0; + if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + return null; + } + ++$i; + while (true) { + // variable name + ++$i; + if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + ++$i; + } + if (!$stream->look($i)->test(/* Token::PUNCTUATION_TYPE */ 9, ')')) { + return null; + } + ++$i; + if (!$stream->look($i)->test(/* Token::ARROW_TYPE */ 12)) { + return null; + } + + // yes, let's parse it properly + $token = $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '('); + $line = $token->getLine(); + + $names = []; + while (true) { + $token = $stream->expect(/* Token::NAME_TYPE */ 5); + $names[] = new AssignNameExpression($token->getValue(), $token->getLine()); + + if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + } + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ')'); + $stream->expect(/* Token::ARROW_TYPE */ 12); + + return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line); + } + + private function getPrimary(): AbstractExpression + { + $token = $this->parser->getCurrentToken(); + + if ($this->isUnary($token)) { + $operator = $this->unaryOperators[$token->getValue()]; + $this->parser->getStream()->next(); + $expr = $this->parseExpression($operator['precedence']); + $class = $operator['class']; + + return $this->parsePostfixExpression(new $class($expr, $token->getLine())); + } elseif ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + $this->parser->getStream()->next(); + $expr = $this->parseExpression(); + $this->parser->getStream()->expect(/* Token::PUNCTUATION_TYPE */ 9, ')', 'An opened parenthesis is not properly closed'); + + return $this->parsePostfixExpression($expr); + } + + return $this->parsePrimaryExpression(); + } + + private function parseConditionalExpression($expr): AbstractExpression + { + while ($this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, '?')) { + if (!$this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { + $expr2 = $this->parseExpression(); + if ($this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { + $expr3 = $this->parseExpression(); + } else { + $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine()); + } + } else { + $expr2 = $expr; + $expr3 = $this->parseExpression(); + } + + $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); + } + + return $expr; + } + + private function isUnary(Token $token): bool + { + return $token->test(/* Token::OPERATOR_TYPE */ 8) && isset($this->unaryOperators[$token->getValue()]); + } + + private function isBinary(Token $token): bool + { + return $token->test(/* Token::OPERATOR_TYPE */ 8) && isset($this->binaryOperators[$token->getValue()]); + } + + public function parsePrimaryExpression() + { + $token = $this->parser->getCurrentToken(); + switch ($token->getType()) { + case /* Token::NAME_TYPE */ 5: + $this->parser->getStream()->next(); + switch ($token->getValue()) { + case 'true': + case 'TRUE': + $node = new ConstantExpression(true, $token->getLine()); + break; + + case 'false': + case 'FALSE': + $node = new ConstantExpression(false, $token->getLine()); + break; + + case 'none': + case 'NONE': + case 'null': + case 'NULL': + $node = new ConstantExpression(null, $token->getLine()); + break; + + default: + if ('(' === $this->parser->getCurrentToken()->getValue()) { + $node = $this->getFunctionNode($token->getValue(), $token->getLine()); + } else { + $node = new NameExpression($token->getValue(), $token->getLine()); + } + } + break; + + case /* Token::NUMBER_TYPE */ 6: + $this->parser->getStream()->next(); + $node = new ConstantExpression($token->getValue(), $token->getLine()); + break; + + case /* Token::STRING_TYPE */ 7: + case /* Token::INTERPOLATION_START_TYPE */ 10: + $node = $this->parseStringExpression(); + break; + + case /* Token::OPERATOR_TYPE */ 8: + if (preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) { + // in this context, string operators are variable names + $this->parser->getStream()->next(); + $node = new NameExpression($token->getValue(), $token->getLine()); + break; + } + + if (isset($this->unaryOperators[$token->getValue()])) { + $class = $this->unaryOperators[$token->getValue()]['class']; + if (!\in_array($class, [NegUnary::class, PosUnary::class])) { + throw new SyntaxError(sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + + $this->parser->getStream()->next(); + $expr = $this->parsePrimaryExpression(); + + $node = new $class($expr, $token->getLine()); + break; + } + + // no break + default: + if ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '[')) { + $node = $this->parseArrayExpression(); + } elseif ($token->test(/* Token::PUNCTUATION_TYPE */ 9, '{')) { + $node = $this->parseHashExpression(); + } elseif ($token->test(/* Token::OPERATOR_TYPE */ 8, '=') && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) { + throw new SyntaxError(sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } else { + throw new SyntaxError(sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext()); + } + } + + return $this->parsePostfixExpression($node); + } + + public function parseStringExpression() + { + $stream = $this->parser->getStream(); + + $nodes = []; + // a string cannot be followed by another string in a single expression + $nextCanBeString = true; + while (true) { + if ($nextCanBeString && $token = $stream->nextIf(/* Token::STRING_TYPE */ 7)) { + $nodes[] = new ConstantExpression($token->getValue(), $token->getLine()); + $nextCanBeString = false; + } elseif ($stream->nextIf(/* Token::INTERPOLATION_START_TYPE */ 10)) { + $nodes[] = $this->parseExpression(); + $stream->expect(/* Token::INTERPOLATION_END_TYPE */ 11); + $nextCanBeString = true; + } else { + break; + } + } + + $expr = array_shift($nodes); + foreach ($nodes as $node) { + $expr = new ConcatBinary($expr, $node, $node->getTemplateLine()); + } + + return $expr; + } + + public function parseArrayExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '[', 'An array element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { + if (!$first) { + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'An array element must be followed by a comma'); + + // trailing ,? + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { + break; + } + } + $first = false; + + $node->addElement($this->parseExpression()); + } + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']', 'An opened array is not properly closed'); + + return $node; + } + + public function parseHashExpression() + { + $stream = $this->parser->getStream(); + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '{', 'A hash element was expected'); + + $node = new ArrayExpression([], $stream->getCurrent()->getLine()); + $first = true; + while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, '}')) { + if (!$first) { + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'A hash value must be followed by a comma'); + + // trailing ,? + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '}')) { + break; + } + } + $first = false; + + // a hash key can be: + // + // * a number -- 12 + // * a string -- 'a' + // * a name, which is equivalent to a string -- a + // * an expression, which must be enclosed in parentheses -- (1 + 2) + if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) { + $key = new ConstantExpression($token->getValue(), $token->getLine()); + + // {a} is a shortcut for {a:a} + if ($stream->test(Token::PUNCTUATION_TYPE, [',', '}'])) { + $value = new NameExpression($key->getAttribute('value'), $key->getTemplateLine()); + $node->addElement($value, $key); + continue; + } + } elseif (($token = $stream->nextIf(/* Token::STRING_TYPE */ 7)) || $token = $stream->nextIf(/* Token::NUMBER_TYPE */ 6)) { + $key = new ConstantExpression($token->getValue(), $token->getLine()); + } elseif ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + $key = $this->parseExpression(); + } else { + $current = $stream->getCurrent(); + + throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext()); + } + + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ':', 'A hash key must be followed by a colon (:)'); + $value = $this->parseExpression(); + + $node->addElement($value, $key); + } + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '}', 'An opened hash is not properly closed'); + + return $node; + } + + public function parsePostfixExpression($node) + { + while (true) { + $token = $this->parser->getCurrentToken(); + if (/* Token::PUNCTUATION_TYPE */ 9 == $token->getType()) { + if ('.' == $token->getValue() || '[' == $token->getValue()) { + $node = $this->parseSubscriptExpression($node); + } elseif ('|' == $token->getValue()) { + $node = $this->parseFilterExpression($node); + } else { + break; + } + } else { + break; + } + } + + return $node; + } + + public function getFunctionNode($name, $line) + { + switch ($name) { + case 'parent': + $this->parseArguments(); + if (!\count($this->parser->getBlockStack())) { + throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + if (!$this->parser->getParent() && !$this->parser->hasTraits()) { + throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext()); + } + + return new ParentExpression($this->parser->peekBlockStack(), $line); + case 'block': + $args = $this->parseArguments(); + if (\count($args) < 1) { + throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new BlockReferenceExpression($args->getNode(0), \count($args) > 1 ? $args->getNode(1) : null, $line); + case 'attribute': + $args = $this->parseArguments(); + if (\count($args) < 2) { + throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext()); + } + + return new GetAttrExpression($args->getNode(0), $args->getNode(1), \count($args) > 2 ? $args->getNode(2) : null, Template::ANY_CALL, $line); + default: + if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { + $arguments = new ArrayExpression([], $line); + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + + $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line); + $node->setAttribute('safe', true); + + return $node; + } + + $args = $this->parseArguments(true); + $class = $this->getFunctionNodeClass($name, $line); + + return new $class($name, $args, $line); + } + } + + public function parseSubscriptExpression($node) + { + $stream = $this->parser->getStream(); + $token = $stream->next(); + $lineno = $token->getLine(); + $arguments = new ArrayExpression([], $lineno); + $type = Template::ANY_CALL; + if ('.' == $token->getValue()) { + $token = $stream->next(); + if ( + /* Token::NAME_TYPE */ 5 == $token->getType() + || + /* Token::NUMBER_TYPE */ 6 == $token->getType() + || + (/* Token::OPERATOR_TYPE */ 8 == $token->getType() && preg_match(Lexer::REGEX_NAME, $token->getValue())) + ) { + $arg = new ConstantExpression($token->getValue(), $lineno); + + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + $type = Template::METHOD_CALL; + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + } + } else { + throw new SyntaxError(sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $lineno, $stream->getSourceContext()); + } + + if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { + if (!$arg instanceof ConstantExpression) { + throw new SyntaxError(sprintf('Dynamic macro names are not supported (called on "%s").', $node->getAttribute('name')), $token->getLine(), $stream->getSourceContext()); + } + + $name = $arg->getAttribute('value'); + + $node = new MethodCallExpression($node, 'macro_'.$name, $arguments, $lineno); + $node->setAttribute('safe', true); + + return $node; + } + } else { + $type = Template::ARRAY_CALL; + + // slice? + $slice = false; + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ':')) { + $slice = true; + $arg = new ConstantExpression(0, $token->getLine()); + } else { + $arg = $this->parseExpression(); + } + + if ($stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ':')) { + $slice = true; + } + + if ($slice) { + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ']')) { + $length = new ConstantExpression(null, $token->getLine()); + } else { + $length = $this->parseExpression(); + } + + $class = $this->getFilterNodeClass('slice', $token->getLine()); + $arguments = new Node([$arg, $length]); + $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine()); + + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']'); + + return $filter; + } + + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']'); + } + + return new GetAttrExpression($node, $arg, $arguments, $type, $lineno); + } + + public function parseFilterExpression($node) + { + $this->parser->getStream()->next(); + + return $this->parseFilterExpressionRaw($node); + } + + public function parseFilterExpressionRaw($node, $tag = null) + { + while (true) { + $token = $this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5); + + $name = new ConstantExpression($token->getValue(), $token->getLine()); + if (!$this->parser->getStream()->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + $arguments = new Node(); + } else { + $arguments = $this->parseArguments(true, false, true); + } + + $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); + + $node = new $class($node, $name, $arguments, $token->getLine(), $tag); + + if (!$this->parser->getStream()->test(/* Token::PUNCTUATION_TYPE */ 9, '|')) { + break; + } + + $this->parser->getStream()->next(); + } + + return $node; + } + + /** + * Parses arguments. + * + * @param bool $namedArguments Whether to allow named arguments or not + * @param bool $definition Whether we are parsing arguments for a function definition + * + * @return Node + * + * @throws SyntaxError + */ + public function parseArguments($namedArguments = false, $definition = false, $allowArrow = false) + { + $args = []; + $stream = $this->parser->getStream(); + + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, '(', 'A list of arguments must begin with an opening parenthesis'); + while (!$stream->test(/* Token::PUNCTUATION_TYPE */ 9, ')')) { + if (!empty($args)) { + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ',', 'Arguments must be separated by a comma'); + + // if the comma above was a trailing comma, early exit the argument parse loop + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, ')')) { + break; + } + } + + if ($definition) { + $token = $stream->expect(/* Token::NAME_TYPE */ 5, null, 'An argument must be a name'); + $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine()); + } else { + $value = $this->parseExpression(0, $allowArrow); + } + + $name = null; + if ($namedArguments && $token = $stream->nextIf(/* Token::OPERATOR_TYPE */ 8, '=')) { + if (!$value instanceof NameExpression) { + throw new SyntaxError(sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext()); + } + $name = $value->getAttribute('name'); + + if ($definition) { + $value = $this->parsePrimaryExpression(); + + if (!$this->checkConstantExpression($value)) { + throw new SyntaxError('A default value for an argument must be a constant (a boolean, a string, a number, or an array).', $token->getLine(), $stream->getSourceContext()); + } + } else { + $value = $this->parseExpression(0, $allowArrow); + } + } + + if ($definition) { + if (null === $name) { + $name = $value->getAttribute('name'); + $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine()); + } + $args[$name] = $value; + } else { + if (null === $name) { + $args[] = $value; + } else { + $args[$name] = $value; + } + } + } + $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ')', 'A list of arguments must be closed by a parenthesis'); + + return new Node($args); + } + + public function parseAssignmentExpression() + { + $stream = $this->parser->getStream(); + $targets = []; + while (true) { + $token = $this->parser->getCurrentToken(); + if ($stream->test(/* Token::OPERATOR_TYPE */ 8) && preg_match(Lexer::REGEX_NAME, $token->getValue())) { + // in this context, string operators are variable names + $this->parser->getStream()->next(); + } else { + $stream->expect(/* Token::NAME_TYPE */ 5, null, 'Only variables can be assigned to'); + } + $value = $token->getValue(); + if (\in_array(strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) { + throw new SyntaxError(sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext()); + } + $targets[] = new AssignNameExpression($value, $token->getLine()); + + if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + } + + return new Node($targets); + } + + public function parseMultitargetExpression() + { + $targets = []; + while (true) { + $targets[] = $this->parseExpression(); + if (!$this->parser->getStream()->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + } + + return new Node($targets); + } + + private function parseNotTestExpression(Node $node): NotUnary + { + return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine()); + } + + private function parseTestExpression(Node $node): TestExpression + { + $stream = $this->parser->getStream(); + list($name, $test) = $this->getTest($node->getTemplateLine()); + + $class = $this->getTestNodeClass($test); + $arguments = null; + if ($stream->test(/* Token::PUNCTUATION_TYPE */ 9, '(')) { + $arguments = $this->parseArguments(true); + } elseif ($test->hasOneMandatoryArgument()) { + $arguments = new Node([0 => $this->parsePrimaryExpression()]); + } + + if ('defined' === $name && $node instanceof NameExpression && null !== $alias = $this->parser->getImportedSymbol('function', $node->getAttribute('name'))) { + $node = new MethodCallExpression($alias['node'], $alias['name'], new ArrayExpression([], $node->getTemplateLine()), $node->getTemplateLine()); + $node->setAttribute('safe', true); + } + + return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine()); + } + + private function getTest(int $line): array + { + $stream = $this->parser->getStream(); + $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + + if ($test = $this->env->getTest($name)) { + return [$name, $test]; + } + + if ($stream->test(/* Token::NAME_TYPE */ 5)) { + // try 2-words tests + $name = $name.' '.$this->parser->getCurrentToken()->getValue(); + + if ($test = $this->env->getTest($name)) { + $stream->next(); + + return [$name, $test]; + } + } + + $e = new SyntaxError(sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getTests())); + + throw $e; + } + + private function getTestNodeClass(TwigTest $test): string + { + if ($test->isDeprecated()) { + $stream = $this->parser->getStream(); + $message = sprintf('Twig Test "%s" is deprecated', $test->getName()); + + if ($test->getDeprecatedVersion()) { + $message .= sprintf(' since version %s', $test->getDeprecatedVersion()); + } + if ($test->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $test->getAlternative()); + } + $src = $stream->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine()); + + @trigger_error($message, \E_USER_DEPRECATED); + } + + return $test->getNodeClass(); + } + + private function getFunctionNodeClass(string $name, int $line): string + { + if (!$function = $this->env->getFunction($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFunctions())); + + throw $e; + } + + if ($function->isDeprecated()) { + $message = sprintf('Twig Function "%s" is deprecated', $function->getName()); + if ($function->getDeprecatedVersion()) { + $message .= sprintf(' since version %s', $function->getDeprecatedVersion()); + } + if ($function->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $function->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); + + @trigger_error($message, \E_USER_DEPRECATED); + } + + return $function->getNodeClass(); + } + + private function getFilterNodeClass(string $name, int $line): string + { + if (!$filter = $this->env->getFilter($name)) { + $e = new SyntaxError(sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext()); + $e->addSuggestions($name, array_keys($this->env->getFilters())); + + throw $e; + } + + if ($filter->isDeprecated()) { + $message = sprintf('Twig Filter "%s" is deprecated', $filter->getName()); + if ($filter->getDeprecatedVersion()) { + $message .= sprintf(' since version %s', $filter->getDeprecatedVersion()); + } + if ($filter->getAlternative()) { + $message .= sprintf('. Use "%s" instead', $filter->getAlternative()); + } + $src = $this->parser->getStream()->getSourceContext(); + $message .= sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line); + + @trigger_error($message, \E_USER_DEPRECATED); + } + + return $filter->getNodeClass(); + } + + // checks that the node only contains "constant" elements + private function checkConstantExpression(Node $node): bool + { + if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression + || $node instanceof NegUnary || $node instanceof PosUnary + )) { + return false; + } + + foreach ($node as $n) { + if (!$this->checkConstantExpression($n)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/twig/twig/src/Extension/AbstractExtension.php b/vendor/twig/twig/src/Extension/AbstractExtension.php new file mode 100644 index 0000000..422925f --- /dev/null +++ b/vendor/twig/twig/src/Extension/AbstractExtension.php @@ -0,0 +1,45 @@ +dateFormats[0] = $format; + } + + if (null !== $dateIntervalFormat) { + $this->dateFormats[1] = $dateIntervalFormat; + } + } + + /** + * Gets the default format to be used by the date filter. + * + * @return array The default date format string and the default date interval format string + */ + public function getDateFormat() + { + return $this->dateFormats; + } + + /** + * Sets the default timezone to be used by the date filter. + * + * @param \DateTimeZone|string $timezone The default timezone string or a \DateTimeZone object + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone instanceof \DateTimeZone ? $timezone : new \DateTimeZone($timezone); + } + + /** + * Gets the default timezone to be used by the date filter. + * + * @return \DateTimeZone The default timezone currently in use + */ + public function getTimezone() + { + if (null === $this->timezone) { + $this->timezone = new \DateTimeZone(date_default_timezone_get()); + } + + return $this->timezone; + } + + /** + * Sets the default format to be used by the number_format filter. + * + * @param int $decimal the number of decimal places to use + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + */ + public function setNumberFormat($decimal, $decimalPoint, $thousandSep) + { + $this->numberFormat = [$decimal, $decimalPoint, $thousandSep]; + } + + /** + * Get the default format used by the number_format filter. + * + * @return array The arguments for number_format() + */ + public function getNumberFormat() + { + return $this->numberFormat; + } + + public function getTokenParsers(): array + { + return [ + new ApplyTokenParser(), + new ForTokenParser(), + new IfTokenParser(), + new ExtendsTokenParser(), + new IncludeTokenParser(), + new BlockTokenParser(), + new UseTokenParser(), + new MacroTokenParser(), + new ImportTokenParser(), + new FromTokenParser(), + new SetTokenParser(), + new FlushTokenParser(), + new DoTokenParser(), + new EmbedTokenParser(), + new WithTokenParser(), + new DeprecatedTokenParser(), + ]; + } + + public function getFilters(): array + { + return [ + // formatting filters + new TwigFilter('date', 'twig_date_format_filter', ['needs_environment' => true]), + new TwigFilter('date_modify', 'twig_date_modify_filter', ['needs_environment' => true]), + new TwigFilter('format', 'twig_sprintf'), + new TwigFilter('replace', 'twig_replace_filter'), + new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), + new TwigFilter('abs', 'abs'), + new TwigFilter('round', 'twig_round'), + + // encoding + new TwigFilter('url_encode', 'twig_urlencode_filter'), + new TwigFilter('json_encode', 'json_encode'), + new TwigFilter('convert_encoding', 'twig_convert_encoding'), + + // string filters + new TwigFilter('title', 'twig_title_string_filter', ['needs_environment' => true]), + new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), + new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]), + new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]), + new TwigFilter('striptags', 'twig_striptags'), + new TwigFilter('trim', 'twig_trim_filter'), + new TwigFilter('nl2br', 'twig_nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('spaceless', 'twig_spaceless', ['is_safe' => ['html']]), + + // array helpers + new TwigFilter('join', 'twig_join_filter'), + new TwigFilter('split', 'twig_split_filter', ['needs_environment' => true]), + new TwigFilter('sort', 'twig_sort_filter', ['needs_environment' => true]), + new TwigFilter('merge', 'twig_array_merge'), + new TwigFilter('batch', 'twig_array_batch'), + new TwigFilter('column', 'twig_array_column'), + new TwigFilter('filter', 'twig_array_filter', ['needs_environment' => true]), + new TwigFilter('map', 'twig_array_map', ['needs_environment' => true]), + new TwigFilter('reduce', 'twig_array_reduce', ['needs_environment' => true]), + + // string/array filters + new TwigFilter('reverse', 'twig_reverse_filter', ['needs_environment' => true]), + new TwigFilter('length', 'twig_length_filter', ['needs_environment' => true]), + new TwigFilter('slice', 'twig_slice', ['needs_environment' => true]), + new TwigFilter('first', 'twig_first', ['needs_environment' => true]), + new TwigFilter('last', 'twig_last', ['needs_environment' => true]), + + // iteration and runtime + new TwigFilter('default', '_twig_default_filter', ['node_class' => DefaultFilter::class]), + new TwigFilter('keys', 'twig_get_array_keys_filter'), + ]; + } + + public function getFunctions(): array + { + return [ + new TwigFunction('max', 'max'), + new TwigFunction('min', 'min'), + new TwigFunction('range', 'range'), + new TwigFunction('constant', 'twig_constant'), + new TwigFunction('cycle', 'twig_cycle'), + new TwigFunction('random', 'twig_random', ['needs_environment' => true]), + new TwigFunction('date', 'twig_date_converter', ['needs_environment' => true]), + new TwigFunction('include', 'twig_include', ['needs_environment' => true, 'needs_context' => true, 'is_safe' => ['all']]), + new TwigFunction('source', 'twig_source', ['needs_environment' => true, 'is_safe' => ['all']]), + ]; + } + + public function getTests(): array + { + return [ + new TwigTest('even', null, ['node_class' => EvenTest::class]), + new TwigTest('odd', null, ['node_class' => OddTest::class]), + new TwigTest('defined', null, ['node_class' => DefinedTest::class]), + new TwigTest('same as', null, ['node_class' => SameasTest::class, 'one_mandatory_argument' => true]), + new TwigTest('none', null, ['node_class' => NullTest::class]), + new TwigTest('null', null, ['node_class' => NullTest::class]), + new TwigTest('divisible by', null, ['node_class' => DivisiblebyTest::class, 'one_mandatory_argument' => true]), + new TwigTest('constant', null, ['node_class' => ConstantTest::class]), + new TwigTest('empty', 'twig_test_empty'), + new TwigTest('iterable', 'twig_test_iterable'), + ]; + } + + public function getNodeVisitors(): array + { + return [new MacroAutoImportNodeVisitor()]; + } + + public function getOperators(): array + { + return [ + [ + 'not' => ['precedence' => 50, 'class' => NotUnary::class], + '-' => ['precedence' => 500, 'class' => NegUnary::class], + '+' => ['precedence' => 500, 'class' => PosUnary::class], + ], + [ + 'or' => ['precedence' => 10, 'class' => OrBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'and' => ['precedence' => 15, 'class' => AndBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-or' => ['precedence' => 16, 'class' => BitwiseOrBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-xor' => ['precedence' => 17, 'class' => BitwiseXorBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'b-and' => ['precedence' => 18, 'class' => BitwiseAndBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '==' => ['precedence' => 20, 'class' => EqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '!=' => ['precedence' => 20, 'class' => NotEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<=>' => ['precedence' => 20, 'class' => SpaceshipBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<' => ['precedence' => 20, 'class' => LessBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>' => ['precedence' => 20, 'class' => GreaterBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '>=' => ['precedence' => 20, 'class' => GreaterEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '<=' => ['precedence' => 20, 'class' => LessEqualBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'not in' => ['precedence' => 20, 'class' => NotInBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'in' => ['precedence' => 20, 'class' => InBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'matches' => ['precedence' => 20, 'class' => MatchesBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'starts with' => ['precedence' => 20, 'class' => StartsWithBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'ends with' => ['precedence' => 20, 'class' => EndsWithBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '..' => ['precedence' => 25, 'class' => RangeBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '+' => ['precedence' => 30, 'class' => AddBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '-' => ['precedence' => 30, 'class' => SubBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '~' => ['precedence' => 40, 'class' => ConcatBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '*' => ['precedence' => 60, 'class' => MulBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '/' => ['precedence' => 60, 'class' => DivBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '//' => ['precedence' => 60, 'class' => FloorDivBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '%' => ['precedence' => 60, 'class' => ModBinary::class, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + 'is not' => ['precedence' => 100, 'associativity' => ExpressionParser::OPERATOR_LEFT], + '**' => ['precedence' => 200, 'class' => PowerBinary::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT], + '??' => ['precedence' => 300, 'class' => NullCoalesceExpression::class, 'associativity' => ExpressionParser::OPERATOR_RIGHT], + ], + ]; + } +} +} + +namespace { + use Twig\Environment; + use Twig\Error\LoaderError; + use Twig\Error\RuntimeError; + use Twig\Extension\CoreExtension; + use Twig\Extension\SandboxExtension; + use Twig\Markup; + use Twig\Source; + use Twig\Template; + use Twig\TemplateWrapper; + +/** + * Cycles over a value. + * + * @param \ArrayAccess|array $values + * @param int $position The cycle position + * + * @return string The next value in the cycle + */ +function twig_cycle($values, $position) +{ + if (!\is_array($values) && !$values instanceof \ArrayAccess) { + return $values; + } + + return $values[$position % \count($values)]; +} + +/** + * Returns a random value depending on the supplied parameter type: + * - a random item from a \Traversable or array + * - a random character from a string + * - a random integer between 0 and the integer parameter. + * + * @param \Traversable|array|int|float|string $values The values to pick a random item from + * @param int|null $max Maximum value used when $values is an int + * + * @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is) + * + * @return mixed A random value from the given sequence + */ +function twig_random(Environment $env, $values = null, $max = null) +{ + if (null === $values) { + return null === $max ? mt_rand() : mt_rand(0, (int) $max); + } + + if (\is_int($values) || \is_float($values)) { + if (null === $max) { + if ($values < 0) { + $max = 0; + $min = $values; + } else { + $max = $values; + $min = 0; + } + } else { + $min = $values; + $max = $max; + } + + return mt_rand((int) $min, (int) $max); + } + + if (\is_string($values)) { + if ('' === $values) { + return ''; + } + + $charset = $env->getCharset(); + + if ('UTF-8' !== $charset) { + $values = twig_convert_encoding($values, 'UTF-8', $charset); + } + + // unicode version of str_split() + // split at all positions, but not after the start and not before the end + $values = preg_split('/(? $value) { + $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); + } + } + } + + if (!twig_test_iterable($values)) { + return $values; + } + + $values = twig_to_array($values); + + if (0 === \count($values)) { + throw new RuntimeError('The random function cannot pick from an empty array.'); + } + + return $values[array_rand($values, 1)]; +} + +/** + * Converts a date to the given format. + * + * {{ post.published_at|date("m/d/Y") }} + * + * @param \DateTimeInterface|\DateInterval|string $date A date + * @param string|null $format The target format, null to use the default + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return string The formatted date + */ +function twig_date_format_filter(Environment $env, $date, $format = null, $timezone = null) +{ + if (null === $format) { + $formats = $env->getExtension(CoreExtension::class)->getDateFormat(); + $format = $date instanceof \DateInterval ? $formats[1] : $formats[0]; + } + + if ($date instanceof \DateInterval) { + return $date->format($format); + } + + return twig_date_converter($env, $date, $timezone)->format($format); +} + +/** + * Returns a new date object modified. + * + * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }} + * + * @param \DateTimeInterface|string $date A date + * @param string $modifier A modifier string + * + * @return \DateTimeInterface + */ +function twig_date_modify_filter(Environment $env, $date, $modifier) +{ + $date = twig_date_converter($env, $date, false); + + return $date->modify($modifier); +} + +/** + * Returns a formatted string. + * + * @param string|null $format + * @param ...$values + * + * @return string + */ +function twig_sprintf($format, ...$values) +{ + return sprintf($format ?? '', ...$values); +} + +/** + * Converts an input to a \DateTime instance. + * + * {% if date(user.created_at) < date('+2days') %} + * {# do something #} + * {% endif %} + * + * @param \DateTimeInterface|string|null $date A date or null to use the current time + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + * + * @return \DateTimeInterface + */ +function twig_date_converter(Environment $env, $date = null, $timezone = null) +{ + // determine the timezone + if (false !== $timezone) { + if (null === $timezone) { + $timezone = $env->getExtension(CoreExtension::class)->getTimezone(); + } elseif (!$timezone instanceof \DateTimeZone) { + $timezone = new \DateTimeZone($timezone); + } + } + + // immutable dates + if ($date instanceof \DateTimeImmutable) { + return false !== $timezone ? $date->setTimezone($timezone) : $date; + } + + if ($date instanceof \DateTimeInterface) { + $date = clone $date; + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; + } + + if (null === $date || 'now' === $date) { + if (null === $date) { + $date = 'now'; + } + + return new \DateTime($date, false !== $timezone ? $timezone : $env->getExtension(CoreExtension::class)->getTimezone()); + } + + $asString = (string) $date; + if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { + $date = new \DateTime('@'.$date); + } else { + $date = new \DateTime($date, $env->getExtension(CoreExtension::class)->getTimezone()); + } + + if (false !== $timezone) { + $date->setTimezone($timezone); + } + + return $date; +} + +/** + * Replaces strings within a string. + * + * @param string|null $str String to replace in + * @param array|\Traversable $from Replace values + * + * @return string + */ +function twig_replace_filter($str, $from) +{ + if (!twig_test_iterable($from)) { + throw new RuntimeError(sprintf('The "replace" filter expects an array or "Traversable" as replace values, got "%s".', \is_object($from) ? \get_class($from) : \gettype($from))); + } + + return strtr($str ?? '', twig_to_array($from)); +} + +/** + * Rounds a number. + * + * @param int|float|string|null $value The value to round + * @param int|float $precision The rounding precision + * @param string $method The method to use for rounding + * + * @return int|float The rounded number + */ +function twig_round($value, $precision = 0, $method = 'common') +{ + $value = (float) $value; + + if ('common' === $method) { + return round($value, $precision); + } + + if ('ceil' !== $method && 'floor' !== $method) { + throw new RuntimeError('The round filter only supports the "common", "ceil", and "floor" methods.'); + } + + return $method($value * 10 ** $precision) / 10 ** $precision; +} + +/** + * Number format filter. + * + * All of the formatting options can be left null, in that case the defaults will + * be used. Supplying any of the parameters will override the defaults set in the + * environment object. + * + * @param mixed $number A float/int/string of the number to format + * @param int $decimal the number of decimal points to display + * @param string $decimalPoint the character(s) to use for the decimal point + * @param string $thousandSep the character(s) to use for the thousands separator + * + * @return string The formatted number + */ +function twig_number_format_filter(Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) +{ + $defaults = $env->getExtension(CoreExtension::class)->getNumberFormat(); + if (null === $decimal) { + $decimal = $defaults[0]; + } + + if (null === $decimalPoint) { + $decimalPoint = $defaults[1]; + } + + if (null === $thousandSep) { + $thousandSep = $defaults[2]; + } + + return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); +} + +/** + * URL encodes (RFC 3986) a string as a path segment or an array as a query string. + * + * @param string|array|null $url A URL or an array of query parameters + * + * @return string The URL encoded value + */ +function twig_urlencode_filter($url) +{ + if (\is_array($url)) { + return http_build_query($url, '', '&', \PHP_QUERY_RFC3986); + } + + return rawurlencode($url ?? ''); +} + +/** + * Merges an array with another one. + * + * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + * + * {% set items = items|merge({ 'peugeot': 'car' }) %} + * + * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} + * + * @param array|\Traversable $arr1 An array + * @param array|\Traversable $arr2 An array + * + * @return array The merged array + */ +function twig_array_merge($arr1, $arr2) +{ + if (!twig_test_iterable($arr1)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); + } + + if (!twig_test_iterable($arr2)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); + } + + return array_merge(twig_to_array($arr1), twig_to_array($arr2)); +} + +/** + * Slices a variable. + * + * @param mixed $item A variable + * @param int $start Start of the slice + * @param int $length Size of the slice + * @param bool $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ +function twig_slice(Environment $env, $item, $start, $length = null, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + while ($item instanceof \IteratorAggregate) { + $item = $item->getIterator(); + } + + if ($start >= 0 && $length >= 0 && $item instanceof \Iterator) { + try { + return iterator_to_array(new \LimitIterator($item, $start, null === $length ? -1 : $length), $preserveKeys); + } catch (\OutOfBoundsException $e) { + return []; + } + } + + $item = iterator_to_array($item, $preserveKeys); + } + + if (\is_array($item)) { + return \array_slice($item, $start, $length, $preserveKeys); + } + + return (string) mb_substr((string) $item, $start, $length, $env->getCharset()); +} + +/** + * Returns the first element of the item. + * + * @param mixed $item A variable + * + * @return mixed The first element of the item + */ +function twig_first(Environment $env, $item) +{ + $elements = twig_slice($env, $item, 0, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Returns the last element of the item. + * + * @param mixed $item A variable + * + * @return mixed The last element of the item + */ +function twig_last(Environment $env, $item) +{ + $elements = twig_slice($env, $item, -1, 1, false); + + return \is_string($elements) ? $elements : current($elements); +} + +/** + * Joins the values to a string. + * + * The separators between elements are empty strings per default, you can define them with the optional parameters. + * + * {{ [1, 2, 3]|join(', ', ' and ') }} + * {# returns 1, 2 and 3 #} + * + * {{ [1, 2, 3]|join('|') }} + * {# returns 1|2|3 #} + * + * {{ [1, 2, 3]|join }} + * {# returns 123 #} + * + * @param array $value An array + * @param string $glue The separator + * @param string|null $and The separator for the last pair + * + * @return string The concatenated string + */ +function twig_join_filter($value, $glue = '', $and = null) +{ + if (!twig_test_iterable($value)) { + $value = (array) $value; + } + + $value = twig_to_array($value, false); + + if (0 === \count($value)) { + return ''; + } + + if (null === $and || $and === $glue) { + return implode($glue, $value); + } + + if (1 === \count($value)) { + return $value[0]; + } + + return implode($glue, \array_slice($value, 0, -1)).$and.$value[\count($value) - 1]; +} + +/** + * Splits the string into an array. + * + * {{ "one,two,three"|split(',') }} + * {# returns [one, two, three] #} + * + * {{ "one,two,three,four,five"|split(',', 3) }} + * {# returns [one, two, "three,four,five"] #} + * + * {{ "123"|split('') }} + * {# returns [1, 2, 3] #} + * + * {{ "aabbcc"|split('', 2) }} + * {# returns [aa, bb, cc] #} + * + * @param string|null $value A string + * @param string $delimiter The delimiter + * @param int $limit The limit + * + * @return array The split string as an array + */ +function twig_split_filter(Environment $env, $value, $delimiter, $limit = null) +{ + $value = $value ?? ''; + + if (\strlen($delimiter) > 0) { + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); + } + + if ($limit <= 1) { + return preg_split('/(?getCharset()); + if ($length < $limit) { + return [$value]; + } + + $r = []; + for ($i = 0; $i < $length; $i += $limit) { + $r[] = mb_substr($value, $i, $limit, $env->getCharset()); + } + + return $r; +} + +// The '_default' filter is used internally to avoid using the ternary operator +// which costs a lot for big contexts (before PHP 5.4). So, on average, +// a function call is cheaper. +/** + * @internal + */ +function _twig_default_filter($value, $default = '') +{ + if (twig_test_empty($value)) { + return $default; + } + + return $value; +} + +/** + * Returns the keys for the given array. + * + * It is useful when you want to iterate over the keys of an array: + * + * {% for key in array|keys %} + * {# ... #} + * {% endfor %} + * + * @param array $array An array + * + * @return array The keys + */ +function twig_get_array_keys_filter($array) +{ + if ($array instanceof \Traversable) { + while ($array instanceof \IteratorAggregate) { + $array = $array->getIterator(); + } + + $keys = []; + if ($array instanceof \Iterator) { + $array->rewind(); + while ($array->valid()) { + $keys[] = $array->key(); + $array->next(); + } + + return $keys; + } + + foreach ($array as $key => $item) { + $keys[] = $key; + } + + return $keys; + } + + if (!\is_array($array)) { + return []; + } + + return array_keys($array); +} + +/** + * Reverses a variable. + * + * @param array|\Traversable|string|null $item An array, a \Traversable instance, or a string + * @param bool $preserveKeys Whether to preserve key or not + * + * @return mixed The reversed input + */ +function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) +{ + if ($item instanceof \Traversable) { + return array_reverse(iterator_to_array($item), $preserveKeys); + } + + if (\is_array($item)) { + return array_reverse($item, $preserveKeys); + } + + $string = (string) $item; + + $charset = $env->getCharset(); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + preg_match_all('/./us', $string, $matches); + + $string = implode('', array_reverse($matches[0])); + + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; +} + +/** + * Sorts an array. + * + * @param array|\Traversable $array + * + * @return array + */ +function twig_sort_filter(Environment $env, $array, $arrow = null) +{ + if ($array instanceof \Traversable) { + $array = iterator_to_array($array); + } elseif (!\is_array($array)) { + throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array))); + } + + if (null !== $arrow) { + twig_check_arrow_in_sandbox($env, $arrow, 'sort', 'filter'); + + uasort($array, $arrow); + } else { + asort($array); + } + + return $array; +} + +/** + * @internal + */ +function twig_in_filter($value, $compare) +{ + if ($value instanceof Markup) { + $value = (string) $value; + } + if ($compare instanceof Markup) { + $compare = (string) $compare; + } + + if (\is_string($compare)) { + if (\is_string($value) || \is_int($value) || \is_float($value)) { + return '' === $value || false !== strpos($compare, (string) $value); + } + + return false; + } + + if (!is_iterable($compare)) { + return false; + } + + if (\is_object($value) || \is_resource($value)) { + if (!\is_array($compare)) { + foreach ($compare as $item) { + if ($item === $value) { + return true; + } + } + + return false; + } + + return \in_array($value, $compare, true); + } + + foreach ($compare as $item) { + if (0 === twig_compare($value, $item)) { + return true; + } + } + + return false; +} + +/** + * Compares two values using a more strict version of the PHP non-strict comparison operator. + * + * @see https://wiki.php.net/rfc/string_to_number_comparison + * @see https://wiki.php.net/rfc/trailing_whitespace_numerics + * + * @internal + */ +function twig_compare($a, $b) +{ + // int <=> string + if (\is_int($a) && \is_string($b)) { + $bTrim = trim($b, " \t\n\r\v\f"); + if (!is_numeric($bTrim)) { + return (string) $a <=> $b; + } + if ((int) $bTrim == $bTrim) { + return $a <=> (int) $bTrim; + } else { + return (float) $a <=> (float) $bTrim; + } + } + if (\is_string($a) && \is_int($b)) { + $aTrim = trim($a, " \t\n\r\v\f"); + if (!is_numeric($aTrim)) { + return $a <=> (string) $b; + } + if ((int) $aTrim == $aTrim) { + return (int) $aTrim <=> $b; + } else { + return (float) $aTrim <=> (float) $b; + } + } + + // float <=> string + if (\is_float($a) && \is_string($b)) { + if (is_nan($a)) { + return 1; + } + $bTrim = trim($b, " \t\n\r\v\f"); + if (!is_numeric($bTrim)) { + return (string) $a <=> $b; + } + + return $a <=> (float) $bTrim; + } + if (\is_string($a) && \is_float($b)) { + if (is_nan($b)) { + return 1; + } + $aTrim = trim($a, " \t\n\r\v\f"); + if (!is_numeric($aTrim)) { + return $a <=> (string) $b; + } + + return (float) $aTrim <=> $b; + } + + // fallback to <=> + return $a <=> $b; +} + +/** + * Returns a trimmed string. + * + * @param string|null $string + * @param string|null $characterMask + * @param string $side + * + * @return string + * + * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') + */ +function twig_trim_filter($string, $characterMask = null, $side = 'both') +{ + if (null === $characterMask) { + $characterMask = " \t\n\r\0\x0B"; + } + + switch ($side) { + case 'both': + return trim($string ?? '', $characterMask); + case 'left': + return ltrim($string ?? '', $characterMask); + case 'right': + return rtrim($string ?? '', $characterMask); + default: + throw new RuntimeError('Trimming side must be "left", "right" or "both".'); + } +} + +/** + * Inserts HTML line breaks before all newlines in a string. + * + * @param string|null $string + * + * @return string + */ +function twig_nl2br($string) +{ + return nl2br($string ?? ''); +} + +/** + * Removes whitespaces between HTML tags. + * + * @param string|null $string + * + * @return string + */ +function twig_spaceless($content) +{ + return trim(preg_replace('/>\s+<', $content ?? '')); +} + +/** + * @param string|null $string + * @param string $to + * @param string $from + * + * @return string + */ +function twig_convert_encoding($string, $to, $from) +{ + if (!\function_exists('iconv')) { + throw new RuntimeError('Unable to convert encoding: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); + } + + return iconv($from, $to, $string ?? ''); +} + +/** + * Returns the length of a variable. + * + * @param mixed $thing A variable + * + * @return int The length of the value + */ +function twig_length_filter(Environment $env, $thing) +{ + if (null === $thing) { + return 0; + } + + if (is_scalar($thing)) { + return mb_strlen($thing, $env->getCharset()); + } + + if ($thing instanceof \Countable || \is_array($thing) || $thing instanceof \SimpleXMLElement) { + return \count($thing); + } + + if ($thing instanceof \Traversable) { + return iterator_count($thing); + } + + if (method_exists($thing, '__toString') && !$thing instanceof \Countable) { + return mb_strlen((string) $thing, $env->getCharset()); + } + + return 1; +} + +/** + * Converts a string to uppercase. + * + * @param string|null $string A string + * + * @return string The uppercased string + */ +function twig_upper_filter(Environment $env, $string) +{ + return mb_strtoupper($string ?? '', $env->getCharset()); +} + +/** + * Converts a string to lowercase. + * + * @param string|null $string A string + * + * @return string The lowercased string + */ +function twig_lower_filter(Environment $env, $string) +{ + return mb_strtolower($string ?? '', $env->getCharset()); +} + +/** + * Strips HTML and PHP tags from a string. + * + * @param string|null $string + * @param string[]|string|null $string + * + * @return string + */ +function twig_striptags($string, $allowable_tags = null) +{ + return strip_tags($string ?? '', $allowable_tags); +} + +/** + * Returns a titlecased string. + * + * @param string|null $string A string + * + * @return string The titlecased string + */ +function twig_title_string_filter(Environment $env, $string) +{ + if (null !== $charset = $env->getCharset()) { + return mb_convert_case($string ?? '', \MB_CASE_TITLE, $charset); + } + + return ucwords(strtolower($string ?? '')); +} + +/** + * Returns a capitalized string. + * + * @param string|null $string A string + * + * @return string The capitalized string + */ +function twig_capitalize_string_filter(Environment $env, $string) +{ + $charset = $env->getCharset(); + + return mb_strtoupper(mb_substr($string ?? '', 0, 1, $charset), $charset).mb_strtolower(mb_substr($string ?? '', 1, null, $charset), $charset); +} + +/** + * @internal + */ +function twig_call_macro(Template $template, string $method, array $args, int $lineno, array $context, Source $source) +{ + if (!method_exists($template, $method)) { + $parent = $template; + while ($parent = $parent->getParent($context)) { + if (method_exists($parent, $method)) { + return $parent->$method(...$args); + } + } + + throw new RuntimeError(sprintf('Macro "%s" is not defined in template "%s".', substr($method, \strlen('macro_')), $template->getTemplateName()), $lineno, $source); + } + + return $template->$method(...$args); +} + +/** + * @internal + */ +function twig_ensure_traversable($seq) +{ + if ($seq instanceof \Traversable || \is_array($seq)) { + return $seq; + } + + return []; +} + +/** + * @internal + */ +function twig_to_array($seq, $preserveKeys = true) +{ + if ($seq instanceof \Traversable) { + return iterator_to_array($seq, $preserveKeys); + } + + if (!\is_array($seq)) { + return $seq; + } + + return $preserveKeys ? $seq : array_values($seq); +} + +/** + * Checks if a variable is empty. + * + * {# evaluates to true if the foo variable is null, false, or the empty string #} + * {% if foo is empty %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is empty, false otherwise + */ +function twig_test_empty($value) +{ + if ($value instanceof \Countable) { + return 0 === \count($value); + } + + if ($value instanceof \Traversable) { + return !iterator_count($value); + } + + if (\is_object($value) && method_exists($value, '__toString')) { + return '' === (string) $value; + } + + return '' === $value || false === $value || null === $value || [] === $value; +} + +/** + * Checks if a variable is traversable. + * + * {# evaluates to true if the foo variable is an array or a traversable object #} + * {% if foo is iterable %} + * {# ... #} + * {% endif %} + * + * @param mixed $value A variable + * + * @return bool true if the value is traversable + */ +function twig_test_iterable($value) +{ + return $value instanceof \Traversable || \is_array($value); +} + +/** + * Renders a template. + * + * @param array $context + * @param string|array $template The template to render or an array of templates to try consecutively + * @param array $variables The variables to pass to the template + * @param bool $withContext + * @param bool $ignoreMissing Whether to ignore missing templates or not + * @param bool $sandboxed Whether to sandbox the template or not + * + * @return string The rendered template + */ +function twig_include(Environment $env, $context, $template, $variables = [], $withContext = true, $ignoreMissing = false, $sandboxed = false) +{ + $alreadySandboxed = false; + $sandbox = null; + if ($withContext) { + $variables = array_merge($context, $variables); + } + + if ($isSandboxed = $sandboxed && $env->hasExtension(SandboxExtension::class)) { + $sandbox = $env->getExtension(SandboxExtension::class); + if (!$alreadySandboxed = $sandbox->isSandboxed()) { + $sandbox->enableSandbox(); + } + + foreach ((\is_array($template) ? $template : [$template]) as $name) { + // if a Template instance is passed, it might have been instantiated outside of a sandbox, check security + if ($name instanceof TemplateWrapper || $name instanceof Template) { + $name->unwrap()->checkSecurity(); + } + } + } + + try { + $loaded = null; + try { + $loaded = $env->resolveTemplate($template); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + } + + return $loaded ? $loaded->render($variables) : ''; + } finally { + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } + } +} + +/** + * Returns a template content without rendering it. + * + * @param string $name The template name + * @param bool $ignoreMissing Whether to ignore missing templates or not + * + * @return string The template source + */ +function twig_source(Environment $env, $name, $ignoreMissing = false) +{ + $loader = $env->getLoader(); + try { + return $loader->getSourceContext($name)->getCode(); + } catch (LoaderError $e) { + if (!$ignoreMissing) { + throw $e; + } + } +} + +/** + * Provides the ability to get constants from instances as well as class/global constants. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return string + */ +function twig_constant($constant, $object = null) +{ + if (null !== $object) { + if ('class' === $constant) { + return \get_class($object); + } + + $constant = \get_class($object).'::'.$constant; + } + + return \constant($constant); +} + +/** + * Checks if a constant exists. + * + * @param string $constant The name of the constant + * @param object|null $object The object to get the constant from + * + * @return bool + */ +function twig_constant_is_defined($constant, $object = null) +{ + if (null !== $object) { + if ('class' === $constant) { + return true; + } + + $constant = \get_class($object).'::'.$constant; + } + + return \defined($constant); +} + +/** + * Batches item. + * + * @param array $items An array of items + * @param int $size The size of the batch + * @param mixed $fill A value used to fill missing items + * + * @return array + */ +function twig_array_batch($items, $size, $fill = null, $preserveKeys = true) +{ + if (!twig_test_iterable($items)) { + throw new RuntimeError(sprintf('The "batch" filter expects an array or "Traversable", got "%s".', \is_object($items) ? \get_class($items) : \gettype($items))); + } + + $size = ceil($size); + + $result = array_chunk(twig_to_array($items, $preserveKeys), $size, $preserveKeys); + + if (null !== $fill && $result) { + $last = \count($result) - 1; + if ($fillCount = $size - \count($result[$last])) { + for ($i = 0; $i < $fillCount; ++$i) { + $result[$last][] = $fill; + } + } + } + + return $result; +} + +/** + * Returns the attribute value for a given array/object. + * + * @param mixed $object The object or array from where to get the item + * @param mixed $item The item to get from the array or object + * @param array $arguments An array of arguments to pass if the item is an object method + * @param string $type The type of attribute (@see \Twig\Template constants) + * @param bool $isDefinedTest Whether this is only a defined check + * @param bool $ignoreStrictCheck Whether to ignore the strict attribute check or not + * @param int $lineno The template line where the attribute was called + * + * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true + * + * @throws RuntimeError if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false + * + * @internal + */ +function twig_get_attribute(Environment $env, Source $source, $object, $item, array $arguments = [], $type = /* Template::ANY_CALL */ 'any', $isDefinedTest = false, $ignoreStrictCheck = false, $sandboxed = false, int $lineno = -1) +{ + // array + if (/* Template::METHOD_CALL */ 'method' !== $type) { + $arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item; + + if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object))) + || ($object instanceof ArrayAccess && isset($object[$arrayItem])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$arrayItem]; + } + + if (/* Template::ARRAY_CALL */ 'array' === $type || !\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$env->isStrictVariables()) { + return; + } + + if ($object instanceof ArrayAccess) { + $message = sprintf('Key "%s" in object with ArrayAccess of class "%s" does not exist.', $arrayItem, \get_class($object)); + } elseif (\is_object($object)) { + $message = sprintf('Impossible to access a key "%s" on an object of class "%s" that does not implement ArrayAccess interface.', $item, \get_class($object)); + } elseif (\is_array($object)) { + if (empty($object)) { + $message = sprintf('Key "%s" does not exist as the array is empty.', $arrayItem); + } else { + $message = sprintf('Key "%s" for array with keys "%s" does not exist.', $arrayItem, implode(', ', array_keys($object))); + } + } elseif (/* Template::ARRAY_CALL */ 'array' === $type) { + if (null === $object) { + $message = sprintf('Impossible to access a key ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access a key ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + } elseif (null === $object) { + $message = sprintf('Impossible to access an attribute ("%s") on a null variable.', $item); + } else { + $message = sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, $lineno, $source); + } + } + + if (!\is_object($object)) { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$env->isStrictVariables()) { + return; + } + + if (null === $object) { + $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item); + } elseif (\is_array($object)) { + $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item); + } else { + $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object); + } + + throw new RuntimeError($message, $lineno, $source); + } + + if ($object instanceof Template) { + throw new RuntimeError('Accessing \Twig\Template attributes is forbidden.', $lineno, $source); + } + + // object property + if (/* Template::METHOD_CALL */ 'method' !== $type) { + if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) { + if ($isDefinedTest) { + return true; + } + + if ($sandboxed) { + $env->getExtension(SandboxExtension::class)->checkPropertyAllowed($object, $item, $lineno, $source); + } + + return $object->$item; + } + } + + static $cache = []; + + $class = \get_class($object); + + // object method + // precedence: getXxx() > isXxx() > hasXxx() + if (!isset($cache[$class])) { + $methods = get_class_methods($object); + sort($methods); + $lcMethods = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, $methods); + $classCache = []; + foreach ($methods as $i => $method) { + $classCache[$method] = $method; + $classCache[$lcName = $lcMethods[$i]] = $method; + + if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) { + $name = substr($method, 3); + $lcName = substr($lcName, 3); + } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) { + $name = substr($method, 2); + $lcName = substr($lcName, 2); + } elseif ('h' === $lcName[0] && 0 === strpos($lcName, 'has')) { + $name = substr($method, 3); + $lcName = substr($lcName, 3); + if (\in_array('is'.$lcName, $lcMethods)) { + continue; + } + } else { + continue; + } + + // skip get() and is() methods (in which case, $name is empty) + if ($name) { + if (!isset($classCache[$name])) { + $classCache[$name] = $method; + } + + if (!isset($classCache[$lcName])) { + $classCache[$lcName] = $method; + } + } + } + $cache[$class] = $classCache; + } + + $call = false; + if (isset($cache[$class][$item])) { + $method = $cache[$class][$item]; + } elseif (isset($cache[$class][$lcItem = strtr($item, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')])) { + $method = $cache[$class][$lcItem]; + } elseif (isset($cache[$class]['__call'])) { + $method = $item; + $call = true; + } else { + if ($isDefinedTest) { + return false; + } + + if ($ignoreStrictCheck || !$env->isStrictVariables()) { + return; + } + + throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), $lineno, $source); + } + + if ($isDefinedTest) { + return true; + } + + if ($sandboxed) { + $env->getExtension(SandboxExtension::class)->checkMethodAllowed($object, $method, $lineno, $source); + } + + // Some objects throw exceptions when they have __call, and the method we try + // to call is not supported. If ignoreStrictCheck is true, we should return null. + try { + $ret = $object->$method(...$arguments); + } catch (\BadMethodCallException $e) { + if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) { + return; + } + throw $e; + } + + return $ret; +} + +/** + * Returns the values from a single column in the input array. + * + *
    + *  {% set items = [{ 'fruit' : 'apple'}, {'fruit' : 'orange' }] %}
    + *
    + *  {% set fruits = items|column('fruit') %}
    + *
    + *  {# fruits now contains ['apple', 'orange'] #}
    + * 
    + * + * @param array|Traversable $array An array + * @param mixed $name The column name + * @param mixed $index The column to use as the index/keys for the returned array + * + * @return array The array of values + */ +function twig_array_column($array, $name, $index = null): array +{ + if ($array instanceof Traversable) { + $array = iterator_to_array($array); + } elseif (!\is_array($array)) { + throw new RuntimeError(sprintf('The column filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($array))); + } + + return array_column($array, $name, $index); +} + +function twig_array_filter(Environment $env, $array, $arrow) +{ + if (!twig_test_iterable($array)) { + throw new RuntimeError(sprintf('The "filter" filter expects an array or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); + } + + twig_check_arrow_in_sandbox($env, $arrow, 'filter', 'filter'); + + if (\is_array($array)) { + return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); + } + + // the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator + return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow); +} + +function twig_array_map(Environment $env, $array, $arrow) +{ + twig_check_arrow_in_sandbox($env, $arrow, 'map', 'filter'); + + $r = []; + foreach ($array as $k => $v) { + $r[$k] = $arrow($v, $k); + } + + return $r; +} + +function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) +{ + twig_check_arrow_in_sandbox($env, $arrow, 'reduce', 'filter'); + + if (!\is_array($array)) { + if (!$array instanceof \Traversable) { + throw new RuntimeError(sprintf('The "reduce" filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($array))); + } + + $array = iterator_to_array($array); + } + + return array_reduce($array, $arrow, $initial); +} + +function twig_check_arrow_in_sandbox(Environment $env, $arrow, $thing, $type) +{ + if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { + throw new RuntimeError(sprintf('The callable passed to the "%s" %s must be a Closure in sandbox mode.', $thing, $type)); + } +} +} diff --git a/vendor/twig/twig/src/Extension/DebugExtension.php b/vendor/twig/twig/src/Extension/DebugExtension.php new file mode 100644 index 0000000..bfb23d7 --- /dev/null +++ b/vendor/twig/twig/src/Extension/DebugExtension.php @@ -0,0 +1,64 @@ + $isDumpOutputHtmlSafe ? ['html'] : [], 'needs_context' => true, 'needs_environment' => true, 'is_variadic' => true]), + ]; + } +} +} + +namespace { +use Twig\Environment; +use Twig\Template; +use Twig\TemplateWrapper; + +function twig_var_dump(Environment $env, $context, ...$vars) +{ + if (!$env->isDebug()) { + return; + } + + ob_start(); + + if (!$vars) { + $vars = []; + foreach ($context as $key => $value) { + if (!$value instanceof Template && !$value instanceof TemplateWrapper) { + $vars[$key] = $value; + } + } + + var_dump($vars); + } else { + var_dump(...$vars); + } + + return ob_get_clean(); +} +} diff --git a/vendor/twig/twig/src/Extension/EscaperExtension.php b/vendor/twig/twig/src/Extension/EscaperExtension.php new file mode 100644 index 0000000..9d2251d --- /dev/null +++ b/vendor/twig/twig/src/Extension/EscaperExtension.php @@ -0,0 +1,416 @@ +setDefaultStrategy($defaultStrategy); + } + + public function getTokenParsers(): array + { + return [new AutoEscapeTokenParser()]; + } + + public function getNodeVisitors(): array + { + return [new EscaperNodeVisitor()]; + } + + public function getFilters(): array + { + return [ + new TwigFilter('escape', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + new TwigFilter('e', 'twig_escape_filter', ['needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe']), + new TwigFilter('raw', 'twig_raw_filter', ['is_safe' => ['all']]), + ]; + } + + /** + * Sets the default strategy to use when not defined by the user. + * + * The strategy can be a valid PHP callback that takes the template + * name as an argument and returns the strategy to use. + * + * @param string|false|callable $defaultStrategy An escaping strategy + */ + public function setDefaultStrategy($defaultStrategy): void + { + if ('name' === $defaultStrategy) { + $defaultStrategy = [FileExtensionEscapingStrategy::class, 'guess']; + } + + $this->defaultStrategy = $defaultStrategy; + } + + /** + * Gets the default strategy to use when not defined by the user. + * + * @param string $name The template name + * + * @return string|false The default strategy to use for the template + */ + public function getDefaultStrategy(string $name) + { + // disable string callables to avoid calling a function named html or js, + // or any other upcoming escaping strategy + if (!\is_string($this->defaultStrategy) && false !== $this->defaultStrategy) { + return \call_user_func($this->defaultStrategy, $name); + } + + return $this->defaultStrategy; + } + + /** + * Defines a new escaper to be used via the escape filter. + * + * @param string $strategy The strategy name that should be used as a strategy in the escape call + * @param callable $callable A valid PHP callable + */ + public function setEscaper($strategy, callable $callable) + { + $this->escapers[$strategy] = $callable; + } + + /** + * Gets all defined escapers. + * + * @return callable[] An array of escapers + */ + public function getEscapers() + { + return $this->escapers; + } + + public function setSafeClasses(array $safeClasses = []) + { + $this->safeClasses = []; + $this->safeLookup = []; + foreach ($safeClasses as $class => $strategies) { + $this->addSafeClass($class, $strategies); + } + } + + public function addSafeClass(string $class, array $strategies) + { + $class = ltrim($class, '\\'); + if (!isset($this->safeClasses[$class])) { + $this->safeClasses[$class] = []; + } + $this->safeClasses[$class] = array_merge($this->safeClasses[$class], $strategies); + + foreach ($strategies as $strategy) { + $this->safeLookup[$strategy][$class] = true; + } + } +} +} + +namespace { +use Twig\Environment; +use Twig\Error\RuntimeError; +use Twig\Extension\EscaperExtension; +use Twig\Markup; +use Twig\Node\Expression\ConstantExpression; +use Twig\Node\Node; + +/** + * Marks a variable as being safe. + * + * @param string $string A PHP variable + */ +function twig_raw_filter($string) +{ + return $string; +} + +/** + * Escapes a string. + * + * @param mixed $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string $charset The charset + * @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) + * + * @return string + */ +function twig_escape_filter(Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) +{ + if ($autoescape && $string instanceof Markup) { + return $string; + } + + if (!\is_string($string)) { + if (\is_object($string) && method_exists($string, '__toString')) { + if ($autoescape) { + $c = \get_class($string); + $ext = $env->getExtension(EscaperExtension::class); + if (!isset($ext->safeClasses[$c])) { + $ext->safeClasses[$c] = []; + foreach (class_parents($string) + class_implements($string) as $class) { + if (isset($ext->safeClasses[$class])) { + $ext->safeClasses[$c] = array_unique(array_merge($ext->safeClasses[$c], $ext->safeClasses[$class])); + foreach ($ext->safeClasses[$class] as $s) { + $ext->safeLookup[$s][$c] = true; + } + } + } + } + if (isset($ext->safeLookup[$strategy][$c]) || isset($ext->safeLookup['all'][$c])) { + return (string) $string; + } + } + + $string = (string) $string; + } elseif (\in_array($strategy, ['html', 'js', 'css', 'html_attr', 'url'])) { + return $string; + } + } + + if ('' === $string) { + return ''; + } + + if (null === $charset) { + $charset = $env->getCharset(); + } + + switch ($strategy) { + case 'html': + // see https://www.php.net/htmlspecialchars + + // Using a static variable to avoid initializing the array + // each time the function is called. Moving the declaration on the + // top of the function slow downs other escaping strategies. + static $htmlspecialcharsCharsets = [ + 'ISO-8859-1' => true, 'ISO8859-1' => true, + 'ISO-8859-15' => true, 'ISO8859-15' => true, + 'utf-8' => true, 'UTF-8' => true, + 'CP866' => true, 'IBM866' => true, '866' => true, + 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, + '1251' => true, + 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, + 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, + 'BIG5' => true, '950' => true, + 'GB2312' => true, '936' => true, + 'BIG5-HKSCS' => true, + 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, + 'EUC-JP' => true, 'EUCJP' => true, + 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, + ]; + + if (isset($htmlspecialcharsCharsets[$charset])) { + return htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset); + } + + if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { + // cache the lowercase variant for future iterations + $htmlspecialcharsCharsets[$charset] = true; + + return htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, $charset); + } + + $string = twig_convert_encoding($string, 'UTF-8', $charset); + $string = htmlspecialchars($string, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8'); + + return iconv('UTF-8', $charset, $string); + + case 'js': + // escape all non-alphanumeric characters + // into their \x or \uHHHH representations + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', function ($matches) { + $char = $matches[0]; + + /* + * A few characters have short escape sequences in JSON and JavaScript. + * Escape sequences supported only by JavaScript, not JSON, are omitted. + * \" is also supported but omitted, because the resulting string is not HTML safe. + */ + static $shortMap = [ + '\\' => '\\\\', + '/' => '\\/', + "\x08" => '\b', + "\x0C" => '\f', + "\x0A" => '\n', + "\x0D" => '\r', + "\x09" => '\t', + ]; + + if (isset($shortMap[$char])) { + return $shortMap[$char]; + } + + $codepoint = mb_ord($char, 'UTF-8'); + if (0x10000 > $codepoint) { + return sprintf('\u%04X', $codepoint); + } + + // Split characters outside the BMP into surrogate pairs + // https://tools.ietf.org/html/rfc2781.html#section-2.1 + $u = $codepoint - 0x10000; + $high = 0xD800 | ($u >> 10); + $low = 0xDC00 | ($u & 0x3FF); + + return sprintf('\u%04X\u%04X', $high, $low); + }, $string); + + if ('UTF-8' !== $charset) { + $string = iconv('UTF-8', $charset, $string); + } + + return $string; + + case 'css': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) { + $char = $matches[0]; + + return sprintf('\\%X ', 1 === \strlen($char) ? \ord($char) : mb_ord($char, 'UTF-8')); + }, $string); + + if ('UTF-8' !== $charset) { + $string = iconv('UTF-8', $charset, $string); + } + + return $string; + + case 'html_attr': + if ('UTF-8' !== $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (!preg_match('//u', $string)) { + throw new RuntimeError('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', function ($matches) { + /** + * This function is adapted from code coming from Zend Framework. + * + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (https://www.zend.com) + * @license https://framework.zend.com/license/new-bsd New BSD License + */ + $chr = $matches[0]; + $ord = \ord($chr); + + /* + * The following replaces characters undefined in HTML with the + * hex entity for the Unicode replacement character. + */ + if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) { + return '�'; + } + + /* + * Check if the current character to escape has a name entity we should + * replace it with while grabbing the hex value of the character. + */ + if (1 === \strlen($chr)) { + /* + * While HTML supports far more named entities, the lowest common denominator + * has become HTML5's XML Serialisation which is restricted to the those named + * entities that XML supports. Using HTML entities would result in this error: + * XML Parsing Error: undefined entity + */ + static $entityMap = [ + 34 => '"', /* quotation mark */ + 38 => '&', /* ampersand */ + 60 => '<', /* less-than sign */ + 62 => '>', /* greater-than sign */ + ]; + + if (isset($entityMap[$ord])) { + return $entityMap[$ord]; + } + + return sprintf('&#x%02X;', $ord); + } + + /* + * Per OWASP recommendations, we'll use hex entities for any other + * characters where a named entity does not exist. + */ + return sprintf('&#x%04X;', mb_ord($chr, 'UTF-8')); + }, $string); + + if ('UTF-8' !== $charset) { + $string = iconv('UTF-8', $charset, $string); + } + + return $string; + + case 'url': + return rawurlencode($string); + + default: + $escapers = $env->getExtension(EscaperExtension::class)->getEscapers(); + if (array_key_exists($strategy, $escapers)) { + return $escapers[$strategy]($env, $string, $charset); + } + + $validStrategies = implode(', ', array_merge(['html', 'js', 'url', 'css', 'html_attr'], array_keys($escapers))); + + throw new RuntimeError(sprintf('Invalid escaping strategy "%s" (valid ones: %s).', $strategy, $validStrategies)); + } +} + +/** + * @internal + */ +function twig_escape_filter_is_safe(Node $filterArgs) +{ + foreach ($filterArgs as $arg) { + if ($arg instanceof ConstantExpression) { + return [$arg->getAttribute('value')]; + } + + return []; + } + + return ['html']; +} +} diff --git a/vendor/twig/twig/src/Extension/ExtensionInterface.php b/vendor/twig/twig/src/Extension/ExtensionInterface.php new file mode 100644 index 0000000..75fa237 --- /dev/null +++ b/vendor/twig/twig/src/Extension/ExtensionInterface.php @@ -0,0 +1,68 @@ + + */ +interface ExtensionInterface +{ + /** + * Returns the token parser instances to add to the existing list. + * + * @return TokenParserInterface[] + */ + public function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return NodeVisitorInterface[] + */ + public function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return TwigFilter[] + */ + public function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return TwigTest[] + */ + public function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return TwigFunction[] + */ + public function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array First array of unary operators, second array of binary operators + */ + public function getOperators(); +} diff --git a/vendor/twig/twig/src/Extension/GlobalsInterface.php b/vendor/twig/twig/src/Extension/GlobalsInterface.php new file mode 100644 index 0000000..ec0c682 --- /dev/null +++ b/vendor/twig/twig/src/Extension/GlobalsInterface.php @@ -0,0 +1,25 @@ + + */ +interface GlobalsInterface +{ + public function getGlobals(): array; +} diff --git a/vendor/twig/twig/src/Extension/OptimizerExtension.php b/vendor/twig/twig/src/Extension/OptimizerExtension.php new file mode 100644 index 0000000..965bfdb --- /dev/null +++ b/vendor/twig/twig/src/Extension/OptimizerExtension.php @@ -0,0 +1,29 @@ +optimizers = $optimizers; + } + + public function getNodeVisitors(): array + { + return [new OptimizerNodeVisitor($this->optimizers)]; + } +} diff --git a/vendor/twig/twig/src/Extension/ProfilerExtension.php b/vendor/twig/twig/src/Extension/ProfilerExtension.php new file mode 100644 index 0000000..43e4a44 --- /dev/null +++ b/vendor/twig/twig/src/Extension/ProfilerExtension.php @@ -0,0 +1,52 @@ +actives[] = $profile; + } + + /** + * @return void + */ + public function enter(Profile $profile) + { + $this->actives[0]->addProfile($profile); + array_unshift($this->actives, $profile); + } + + /** + * @return void + */ + public function leave(Profile $profile) + { + $profile->leave(); + array_shift($this->actives); + + if (1 === \count($this->actives)) { + $this->actives[0]->leave(); + } + } + + public function getNodeVisitors(): array + { + return [new ProfilerNodeVisitor(static::class)]; + } +} diff --git a/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php b/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php new file mode 100644 index 0000000..63bc3b1 --- /dev/null +++ b/vendor/twig/twig/src/Extension/RuntimeExtensionInterface.php @@ -0,0 +1,19 @@ + + */ +interface RuntimeExtensionInterface +{ +} diff --git a/vendor/twig/twig/src/Extension/SandboxExtension.php b/vendor/twig/twig/src/Extension/SandboxExtension.php new file mode 100644 index 0000000..c861159 --- /dev/null +++ b/vendor/twig/twig/src/Extension/SandboxExtension.php @@ -0,0 +1,123 @@ +policy = $policy; + $this->sandboxedGlobally = $sandboxed; + } + + public function getTokenParsers(): array + { + return [new SandboxTokenParser()]; + } + + public function getNodeVisitors(): array + { + return [new SandboxNodeVisitor()]; + } + + public function enableSandbox(): void + { + $this->sandboxed = true; + } + + public function disableSandbox(): void + { + $this->sandboxed = false; + } + + public function isSandboxed(): bool + { + return $this->sandboxedGlobally || $this->sandboxed; + } + + public function isSandboxedGlobally(): bool + { + return $this->sandboxedGlobally; + } + + public function setSecurityPolicy(SecurityPolicyInterface $policy) + { + $this->policy = $policy; + } + + public function getSecurityPolicy(): SecurityPolicyInterface + { + return $this->policy; + } + + public function checkSecurity($tags, $filters, $functions): void + { + if ($this->isSandboxed()) { + $this->policy->checkSecurity($tags, $filters, $functions); + } + } + + public function checkMethodAllowed($obj, $method, int $lineno = -1, Source $source = null): void + { + if ($this->isSandboxed()) { + try { + $this->policy->checkMethodAllowed($obj, $method); + } catch (SecurityNotAllowedMethodError $e) { + $e->setSourceContext($source); + $e->setTemplateLine($lineno); + + throw $e; + } + } + } + + public function checkPropertyAllowed($obj, $property, int $lineno = -1, Source $source = null): void + { + if ($this->isSandboxed()) { + try { + $this->policy->checkPropertyAllowed($obj, $property); + } catch (SecurityNotAllowedPropertyError $e) { + $e->setSourceContext($source); + $e->setTemplateLine($lineno); + + throw $e; + } + } + } + + public function ensureToStringAllowed($obj, int $lineno = -1, Source $source = null) + { + if ($this->isSandboxed() && \is_object($obj) && method_exists($obj, '__toString')) { + try { + $this->policy->checkMethodAllowed($obj, '__toString'); + } catch (SecurityNotAllowedMethodError $e) { + $e->setSourceContext($source); + $e->setTemplateLine($lineno); + + throw $e; + } + } + + return $obj; + } +} diff --git a/vendor/twig/twig/src/Extension/StagingExtension.php b/vendor/twig/twig/src/Extension/StagingExtension.php new file mode 100644 index 0000000..0ea47f9 --- /dev/null +++ b/vendor/twig/twig/src/Extension/StagingExtension.php @@ -0,0 +1,100 @@ + + * + * @internal + */ +final class StagingExtension extends AbstractExtension +{ + private $functions = []; + private $filters = []; + private $visitors = []; + private $tokenParsers = []; + private $tests = []; + + public function addFunction(TwigFunction $function): void + { + if (isset($this->functions[$function->getName()])) { + throw new \LogicException(sprintf('Function "%s" is already registered.', $function->getName())); + } + + $this->functions[$function->getName()] = $function; + } + + public function getFunctions(): array + { + return $this->functions; + } + + public function addFilter(TwigFilter $filter): void + { + if (isset($this->filters[$filter->getName()])) { + throw new \LogicException(sprintf('Filter "%s" is already registered.', $filter->getName())); + } + + $this->filters[$filter->getName()] = $filter; + } + + public function getFilters(): array + { + return $this->filters; + } + + public function addNodeVisitor(NodeVisitorInterface $visitor): void + { + $this->visitors[] = $visitor; + } + + public function getNodeVisitors(): array + { + return $this->visitors; + } + + public function addTokenParser(TokenParserInterface $parser): void + { + if (isset($this->tokenParsers[$parser->getTag()])) { + throw new \LogicException(sprintf('Tag "%s" is already registered.', $parser->getTag())); + } + + $this->tokenParsers[$parser->getTag()] = $parser; + } + + public function getTokenParsers(): array + { + return $this->tokenParsers; + } + + public function addTest(TwigTest $test): void + { + if (isset($this->tests[$test->getName()])) { + throw new \LogicException(sprintf('Test "%s" is already registered.', $test->getName())); + } + + $this->tests[$test->getName()] = $test; + } + + public function getTests(): array + { + return $this->tests; + } +} diff --git a/vendor/twig/twig/src/Extension/StringLoaderExtension.php b/vendor/twig/twig/src/Extension/StringLoaderExtension.php new file mode 100644 index 0000000..7b45147 --- /dev/null +++ b/vendor/twig/twig/src/Extension/StringLoaderExtension.php @@ -0,0 +1,42 @@ + true]), + ]; + } +} +} + +namespace { +use Twig\Environment; +use Twig\TemplateWrapper; + +/** + * Loads a template from a string. + * + * {{ include(template_from_string("Hello {{ name }}")) }} + * + * @param string $template A template as a string or object implementing __toString() + * @param string $name An optional name of the template to be used in error messages + */ +function twig_template_from_string(Environment $env, $template, string $name = null): TemplateWrapper +{ + return $env->createTemplate((string) $template, $name); +} +} diff --git a/vendor/twig/twig/src/ExtensionSet.php b/vendor/twig/twig/src/ExtensionSet.php new file mode 100644 index 0000000..36e5bbc --- /dev/null +++ b/vendor/twig/twig/src/ExtensionSet.php @@ -0,0 +1,463 @@ + + * + * @internal + */ +final class ExtensionSet +{ + private $extensions; + private $initialized = false; + private $runtimeInitialized = false; + private $staging; + private $parsers; + private $visitors; + private $filters; + private $tests; + private $functions; + private $unaryOperators; + private $binaryOperators; + private $globals; + private $functionCallbacks = []; + private $filterCallbacks = []; + private $parserCallbacks = []; + private $lastModified = 0; + + public function __construct() + { + $this->staging = new StagingExtension(); + } + + public function initRuntime() + { + $this->runtimeInitialized = true; + } + + public function hasExtension(string $class): bool + { + return isset($this->extensions[ltrim($class, '\\')]); + } + + public function getExtension(string $class): ExtensionInterface + { + $class = ltrim($class, '\\'); + + if (!isset($this->extensions[$class])) { + throw new RuntimeError(sprintf('The "%s" extension is not enabled.', $class)); + } + + return $this->extensions[$class]; + } + + /** + * @param ExtensionInterface[] $extensions + */ + public function setExtensions(array $extensions): void + { + foreach ($extensions as $extension) { + $this->addExtension($extension); + } + } + + /** + * @return ExtensionInterface[] + */ + public function getExtensions(): array + { + return $this->extensions; + } + + public function getSignature(): string + { + return json_encode(array_keys($this->extensions)); + } + + public function isInitialized(): bool + { + return $this->initialized || $this->runtimeInitialized; + } + + public function getLastModified(): int + { + if (0 !== $this->lastModified) { + return $this->lastModified; + } + + foreach ($this->extensions as $extension) { + $r = new \ReflectionObject($extension); + if (is_file($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) { + $this->lastModified = $extensionTime; + } + } + + return $this->lastModified; + } + + public function addExtension(ExtensionInterface $extension): void + { + $class = \get_class($extension); + + if ($this->initialized) { + throw new \LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $class)); + } + + if (isset($this->extensions[$class])) { + throw new \LogicException(sprintf('Unable to register extension "%s" as it is already registered.', $class)); + } + + $this->extensions[$class] = $extension; + } + + public function addFunction(TwigFunction $function): void + { + if ($this->initialized) { + throw new \LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $function->getName())); + } + + $this->staging->addFunction($function); + } + + /** + * @return TwigFunction[] + */ + public function getFunctions(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->functions; + } + + public function getFunction(string $name): ?TwigFunction + { + if (!$this->initialized) { + $this->initExtensions(); + } + + if (isset($this->functions[$name])) { + return $this->functions[$name]; + } + + foreach ($this->functions as $pattern => $function) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $function->setArguments($matches); + + return $function; + } + } + + foreach ($this->functionCallbacks as $callback) { + if (false !== $function = $callback($name)) { + return $function; + } + } + + return null; + } + + public function registerUndefinedFunctionCallback(callable $callable): void + { + $this->functionCallbacks[] = $callable; + } + + public function addFilter(TwigFilter $filter): void + { + if ($this->initialized) { + throw new \LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $filter->getName())); + } + + $this->staging->addFilter($filter); + } + + /** + * @return TwigFilter[] + */ + public function getFilters(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->filters; + } + + public function getFilter(string $name): ?TwigFilter + { + if (!$this->initialized) { + $this->initExtensions(); + } + + if (isset($this->filters[$name])) { + return $this->filters[$name]; + } + + foreach ($this->filters as $pattern => $filter) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count && preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $filter->setArguments($matches); + + return $filter; + } + } + + foreach ($this->filterCallbacks as $callback) { + if (false !== $filter = $callback($name)) { + return $filter; + } + } + + return null; + } + + public function registerUndefinedFilterCallback(callable $callable): void + { + $this->filterCallbacks[] = $callable; + } + + public function addNodeVisitor(NodeVisitorInterface $visitor): void + { + if ($this->initialized) { + throw new \LogicException('Unable to add a node visitor as extensions have already been initialized.'); + } + + $this->staging->addNodeVisitor($visitor); + } + + /** + * @return NodeVisitorInterface[] + */ + public function getNodeVisitors(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->visitors; + } + + public function addTokenParser(TokenParserInterface $parser): void + { + if ($this->initialized) { + throw new \LogicException('Unable to add a token parser as extensions have already been initialized.'); + } + + $this->staging->addTokenParser($parser); + } + + /** + * @return TokenParserInterface[] + */ + public function getTokenParsers(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->parsers; + } + + public function getTokenParser(string $name): ?TokenParserInterface + { + if (!$this->initialized) { + $this->initExtensions(); + } + + if (isset($this->parsers[$name])) { + return $this->parsers[$name]; + } + + foreach ($this->parserCallbacks as $callback) { + if (false !== $parser = $callback($name)) { + return $parser; + } + } + + return null; + } + + public function registerUndefinedTokenParserCallback(callable $callable): void + { + $this->parserCallbacks[] = $callable; + } + + public function getGlobals(): array + { + if (null !== $this->globals) { + return $this->globals; + } + + $globals = []; + foreach ($this->extensions as $extension) { + if (!$extension instanceof GlobalsInterface) { + continue; + } + + $extGlobals = $extension->getGlobals(); + if (!\is_array($extGlobals)) { + throw new \UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', \get_class($extension))); + } + + $globals = array_merge($globals, $extGlobals); + } + + if ($this->initialized) { + $this->globals = $globals; + } + + return $globals; + } + + public function addTest(TwigTest $test): void + { + if ($this->initialized) { + throw new \LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $test->getName())); + } + + $this->staging->addTest($test); + } + + /** + * @return TwigTest[] + */ + public function getTests(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->tests; + } + + public function getTest(string $name): ?TwigTest + { + if (!$this->initialized) { + $this->initExtensions(); + } + + if (isset($this->tests[$name])) { + return $this->tests[$name]; + } + + foreach ($this->tests as $pattern => $test) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $test->setArguments($matches); + + return $test; + } + } + } + + return null; + } + + public function getUnaryOperators(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->unaryOperators; + } + + public function getBinaryOperators(): array + { + if (!$this->initialized) { + $this->initExtensions(); + } + + return $this->binaryOperators; + } + + private function initExtensions(): void + { + $this->parsers = []; + $this->filters = []; + $this->functions = []; + $this->tests = []; + $this->visitors = []; + $this->unaryOperators = []; + $this->binaryOperators = []; + + foreach ($this->extensions as $extension) { + $this->initExtension($extension); + } + $this->initExtension($this->staging); + // Done at the end only, so that an exception during initialization does not mark the environment as initialized when catching the exception + $this->initialized = true; + } + + private function initExtension(ExtensionInterface $extension): void + { + // filters + foreach ($extension->getFilters() as $filter) { + $this->filters[$filter->getName()] = $filter; + } + + // functions + foreach ($extension->getFunctions() as $function) { + $this->functions[$function->getName()] = $function; + } + + // tests + foreach ($extension->getTests() as $test) { + $this->tests[$test->getName()] = $test; + } + + // token parsers + foreach ($extension->getTokenParsers() as $parser) { + if (!$parser instanceof TokenParserInterface) { + throw new \LogicException('getTokenParsers() must return an array of \Twig\TokenParser\TokenParserInterface.'); + } + + $this->parsers[$parser->getTag()] = $parser; + } + + // node visitors + foreach ($extension->getNodeVisitors() as $visitor) { + $this->visitors[] = $visitor; + } + + // operators + if ($operators = $extension->getOperators()) { + if (!\is_array($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array with operators, got "%s".', \get_class($extension), \is_object($operators) ? \get_class($operators) : \gettype($operators).(\is_resource($operators) ? '' : '#'.$operators))); + } + + if (2 !== \count($operators)) { + throw new \InvalidArgumentException(sprintf('"%s::getOperators()" must return an array of 2 elements, got %d.', \get_class($extension), \count($operators))); + } + + $this->unaryOperators = array_merge($this->unaryOperators, $operators[0]); + $this->binaryOperators = array_merge($this->binaryOperators, $operators[1]); + } + } +} diff --git a/vendor/twig/twig/src/FileExtensionEscapingStrategy.php b/vendor/twig/twig/src/FileExtensionEscapingStrategy.php new file mode 100644 index 0000000..65198bb --- /dev/null +++ b/vendor/twig/twig/src/FileExtensionEscapingStrategy.php @@ -0,0 +1,60 @@ + + */ +class FileExtensionEscapingStrategy +{ + /** + * Guesses the best autoescaping strategy based on the file name. + * + * @param string $name The template name + * + * @return string|false The escaping strategy name to use or false to disable + */ + public static function guess(string $name) + { + if (\in_array(substr($name, -1), ['/', '\\'])) { + return 'html'; // return html for directories + } + + if ('.twig' === substr($name, -5)) { + $name = substr($name, 0, -5); + } + + $extension = pathinfo($name, \PATHINFO_EXTENSION); + + switch ($extension) { + case 'js': + return 'js'; + + case 'css': + return 'css'; + + case 'txt': + return false; + + default: + return 'html'; + } + } +} diff --git a/vendor/twig/twig/src/Lexer.php b/vendor/twig/twig/src/Lexer.php new file mode 100644 index 0000000..9ff028c --- /dev/null +++ b/vendor/twig/twig/src/Lexer.php @@ -0,0 +1,501 @@ + + */ +class Lexer +{ + private $tokens; + private $code; + private $cursor; + private $lineno; + private $end; + private $state; + private $states; + private $brackets; + private $env; + private $source; + private $options; + private $regexes; + private $position; + private $positions; + private $currentVarBlockLine; + + public const STATE_DATA = 0; + public const STATE_BLOCK = 1; + public const STATE_VAR = 2; + public const STATE_STRING = 3; + public const STATE_INTERPOLATION = 4; + + public const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; + public const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?([Ee][\+\-][0-9]+)?/A'; + public const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; + public const REGEX_DQ_STRING_DELIM = '/"/A'; + public const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; + public const PUNCTUATION = '()[]{}?:.,|'; + + public function __construct(Environment $env, array $options = []) + { + $this->env = $env; + + $this->options = array_merge([ + 'tag_comment' => ['{#', '#}'], + 'tag_block' => ['{%', '%}'], + 'tag_variable' => ['{{', '}}'], + 'whitespace_trim' => '-', + 'whitespace_line_trim' => '~', + 'whitespace_line_chars' => ' \t\0\x0B', + 'interpolation' => ['#{', '}'], + ], $options); + + // when PHP 7.3 is the min version, we will be able to remove the '#' part in preg_quote as it's part of the default + $this->regexes = [ + // }} + 'lex_var' => '{ + \s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '#').'\s*'. // -}}\s* + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_variable'][1], '#'). // }} + ') + }Ax', + + // %} + 'lex_block' => '{ + \s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*\n?'. // -%}\s*\n? + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#').'\n?'. // %}\n? + ') + }Ax', + + // {% endverbatim %} + 'lex_raw_data' => '{'. + preg_quote($this->options['tag_block'][0], '#'). // {% + '('. + $this->options['whitespace_trim']. // - + '|'. + $this->options['whitespace_line_trim']. // ~ + ')?\s*endverbatim\s*'. + '(?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%} + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#'). // %} + ') + }sx', + + 'operator' => $this->getOperatorRegex(), + + // #} + 'lex_comment' => '{ + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_comment'][1], '#').'\s*\n?'. // -#}\s*\n? + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_comment'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~#}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_comment'][1], '#').'\n?'. // #}\n? + ') + }sx', + + // verbatim %} + 'lex_block_raw' => '{ + \s*verbatim\s* + (?:'. + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%}\s* + '|'. + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + '|'. + preg_quote($this->options['tag_block'][1], '#'). // %} + ') + }Asx', + + 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '#').'}As', + + // {{ or {% or {# + 'lex_tokens_start' => '{ + ('. + preg_quote($this->options['tag_variable'][0], '#'). // {{ + '|'. + preg_quote($this->options['tag_block'][0], '#'). // {% + '|'. + preg_quote($this->options['tag_comment'][0], '#'). // {# + ')('. + preg_quote($this->options['whitespace_trim'], '#'). // - + '|'. + preg_quote($this->options['whitespace_line_trim'], '#'). // ~ + ')? + }sx', + 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0], '#').'\s*}A', + 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1], '#').'}A', + ]; + } + + public function tokenize(Source $source): TokenStream + { + $this->source = $source; + $this->code = str_replace(["\r\n", "\r"], "\n", $source->getCode()); + $this->cursor = 0; + $this->lineno = 1; + $this->end = \strlen($this->code); + $this->tokens = []; + $this->state = self::STATE_DATA; + $this->states = []; + $this->brackets = []; + $this->position = -1; + + // find all token starts in one go + preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, \PREG_OFFSET_CAPTURE); + $this->positions = $matches; + + while ($this->cursor < $this->end) { + // dispatch to the lexing functions depending + // on the current state + switch ($this->state) { + case self::STATE_DATA: + $this->lexData(); + break; + + case self::STATE_BLOCK: + $this->lexBlock(); + break; + + case self::STATE_VAR: + $this->lexVar(); + break; + + case self::STATE_STRING: + $this->lexString(); + break; + + case self::STATE_INTERPOLATION: + $this->lexInterpolation(); + break; + } + } + + $this->pushToken(/* Token::EOF_TYPE */ -1); + + if (!empty($this->brackets)) { + list($expect, $lineno) = array_pop($this->brackets); + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + return new TokenStream($this->tokens, $this->source); + } + + private function lexData(): void + { + // if no matches are left we return the rest of the template as simple text token + if ($this->position == \count($this->positions[0]) - 1) { + $this->pushToken(/* Token::TEXT_TYPE */ 0, substr($this->code, $this->cursor)); + $this->cursor = $this->end; + + return; + } + + // Find the first token after the current cursor + $position = $this->positions[0][++$this->position]; + while ($position[1] < $this->cursor) { + if ($this->position == \count($this->positions[0]) - 1) { + return; + } + $position = $this->positions[0][++$this->position]; + } + + // push the template text first + $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); + + // trim? + if (isset($this->positions[2][$this->position][0])) { + if ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0]) { + // whitespace_trim detected ({%-, {{- or {#-) + $text = rtrim($text); + } elseif ($this->options['whitespace_line_trim'] === $this->positions[2][$this->position][0]) { + // whitespace_line_trim detected ({%~, {{~ or {#~) + // don't trim \r and \n + $text = rtrim($text, " \t\0\x0B"); + } + } + $this->pushToken(/* Token::TEXT_TYPE */ 0, $text); + $this->moveCursor($textContent.$position[0]); + + switch ($this->positions[1][$this->position][0]) { + case $this->options['tag_comment'][0]: + $this->lexComment(); + break; + + case $this->options['tag_block'][0]: + // raw data? + if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lexRawData(); + // {% line \d+ %} + } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + $this->lineno = (int) $match[1]; + } else { + $this->pushToken(/* Token::BLOCK_START_TYPE */ 1); + $this->pushState(self::STATE_BLOCK); + $this->currentVarBlockLine = $this->lineno; + } + break; + + case $this->options['tag_variable'][0]: + $this->pushToken(/* Token::VAR_START_TYPE */ 2); + $this->pushState(self::STATE_VAR); + $this->currentVarBlockLine = $this->lineno; + break; + } + } + + private function lexBlock(): void + { + if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(/* Token::BLOCK_END_TYPE */ 3); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + private function lexVar(): void + { + if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(/* Token::VAR_END_TYPE */ 4); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + private function lexExpression(): void + { + // whitespace + if (preg_match('/\s+/A', $this->code, $match, 0, $this->cursor)) { + $this->moveCursor($match[0]); + + if ($this->cursor >= $this->end) { + throw new SyntaxError(sprintf('Unclosed "%s".', self::STATE_BLOCK === $this->state ? 'block' : 'variable'), $this->currentVarBlockLine, $this->source); + } + } + + // arrow function + if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { + $this->pushToken(Token::ARROW_TYPE, '=>'); + $this->moveCursor('=>'); + } + // operators + elseif (preg_match($this->regexes['operator'], $this->code, $match, 0, $this->cursor)) { + $this->pushToken(/* Token::OPERATOR_TYPE */ 8, preg_replace('/\s+/', ' ', $match[0])); + $this->moveCursor($match[0]); + } + // names + elseif (preg_match(self::REGEX_NAME, $this->code, $match, 0, $this->cursor)) { + $this->pushToken(/* Token::NAME_TYPE */ 5, $match[0]); + $this->moveCursor($match[0]); + } + // numbers + elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, 0, $this->cursor)) { + $number = (float) $match[0]; // floats + if (ctype_digit($match[0]) && $number <= \PHP_INT_MAX) { + $number = (int) $match[0]; // integers lower than the maximum + } + $this->pushToken(/* Token::NUMBER_TYPE */ 6, $number); + $this->moveCursor($match[0]); + } + // punctuation + elseif (false !== strpos(self::PUNCTUATION, $this->code[$this->cursor])) { + // opening bracket + if (false !== strpos('([{', $this->code[$this->cursor])) { + $this->brackets[] = [$this->code[$this->cursor], $this->lineno]; + } + // closing bracket + elseif (false !== strpos(')]}', $this->code[$this->cursor])) { + if (empty($this->brackets)) { + throw new SyntaxError(sprintf('Unexpected "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + + list($expect, $lineno) = array_pop($this->brackets); + if ($this->code[$this->cursor] != strtr($expect, '([{', ')]}')) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + } + + $this->pushToken(/* Token::PUNCTUATION_TYPE */ 9, $this->code[$this->cursor]); + ++$this->cursor; + } + // strings + elseif (preg_match(self::REGEX_STRING, $this->code, $match, 0, $this->cursor)) { + $this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes(substr($match[0], 1, -1))); + $this->moveCursor($match[0]); + } + // opening double quoted string + elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { + $this->brackets[] = ['"', $this->lineno]; + $this->pushState(self::STATE_STRING); + $this->moveCursor($match[0]); + } + // unlexable + else { + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + private function lexRawData(): void + { + if (!preg_match($this->regexes['lex_raw_data'], $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError('Unexpected end of file: Unclosed "verbatim" block.', $this->lineno, $this->source); + } + + $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); + $this->moveCursor($text.$match[0][0]); + + // trim? + if (isset($match[1][0])) { + if ($this->options['whitespace_trim'] === $match[1][0]) { + // whitespace_trim detected ({%-, {{- or {#-) + $text = rtrim($text); + } else { + // whitespace_line_trim detected ({%~, {{~ or {#~) + // don't trim \r and \n + $text = rtrim($text, " \t\0\x0B"); + } + } + + $this->pushToken(/* Token::TEXT_TYPE */ 0, $text); + } + + private function lexComment(): void + { + if (!preg_match($this->regexes['lex_comment'], $this->code, $match, \PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new SyntaxError('Unclosed comment.', $this->lineno, $this->source); + } + + $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); + } + + private function lexString(): void + { + if (preg_match($this->regexes['interpolation_start'], $this->code, $match, 0, $this->cursor)) { + $this->brackets[] = [$this->options['interpolation'][0], $this->lineno]; + $this->pushToken(/* Token::INTERPOLATION_START_TYPE */ 10); + $this->moveCursor($match[0]); + $this->pushState(self::STATE_INTERPOLATION); + } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) { + $this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes($match[0])); + $this->moveCursor($match[0]); + } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) { + list($expect, $lineno) = array_pop($this->brackets); + if ('"' != $this->code[$this->cursor]) { + throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $lineno, $this->source); + } + + $this->popState(); + ++$this->cursor; + } else { + // unlexable + throw new SyntaxError(sprintf('Unexpected character "%s".', $this->code[$this->cursor]), $this->lineno, $this->source); + } + } + + private function lexInterpolation(): void + { + $bracket = end($this->brackets); + if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, 0, $this->cursor)) { + array_pop($this->brackets); + $this->pushToken(/* Token::INTERPOLATION_END_TYPE */ 11); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + + private function pushToken($type, $value = ''): void + { + // do not push empty text tokens + if (/* Token::TEXT_TYPE */ 0 === $type && '' === $value) { + return; + } + + $this->tokens[] = new Token($type, $value, $this->lineno); + } + + private function moveCursor($text): void + { + $this->cursor += \strlen($text); + $this->lineno += substr_count($text, "\n"); + } + + private function getOperatorRegex(): string + { + $operators = array_merge( + ['='], + array_keys($this->env->getUnaryOperators()), + array_keys($this->env->getBinaryOperators()) + ); + + $operators = array_combine($operators, array_map('strlen', $operators)); + arsort($operators); + + $regex = []; + foreach ($operators as $operator => $length) { + // an operator that ends with a character must be followed by + // a whitespace, a parenthesis, an opening map [ or sequence { + $r = preg_quote($operator, '/'); + if (ctype_alpha($operator[$length - 1])) { + $r .= '(?=[\s()\[{])'; + } + + // an operator that begins with a character must not have a dot or pipe before + if (ctype_alpha($operator[0])) { + $r = '(?states[] = $this->state; + $this->state = $state; + } + + private function popState(): void + { + if (0 === \count($this->states)) { + throw new \LogicException('Cannot pop state without a previous state.'); + } + + $this->state = array_pop($this->states); + } +} diff --git a/vendor/twig/twig/src/Loader/ArrayLoader.php b/vendor/twig/twig/src/Loader/ArrayLoader.php new file mode 100644 index 0000000..5d726c3 --- /dev/null +++ b/vendor/twig/twig/src/Loader/ArrayLoader.php @@ -0,0 +1,77 @@ + + */ +final class ArrayLoader implements LoaderInterface +{ + private $templates = []; + + /** + * @param array $templates An array of templates (keys are the names, and values are the source code) + */ + public function __construct(array $templates = []) + { + $this->templates = $templates; + } + + public function setTemplate(string $name, string $template): void + { + $this->templates[$name] = $template; + } + + public function getSourceContext(string $name): Source + { + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return new Source($this->templates[$name], $name); + } + + public function exists(string $name): bool + { + return isset($this->templates[$name]); + } + + public function getCacheKey(string $name): string + { + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return $name.':'.$this->templates[$name]; + } + + public function isFresh(string $name, int $time): bool + { + if (!isset($this->templates[$name])) { + throw new LoaderError(sprintf('Template "%s" is not defined.', $name)); + } + + return true; + } +} diff --git a/vendor/twig/twig/src/Loader/ChainLoader.php b/vendor/twig/twig/src/Loader/ChainLoader.php new file mode 100644 index 0000000..fbf4f3a --- /dev/null +++ b/vendor/twig/twig/src/Loader/ChainLoader.php @@ -0,0 +1,119 @@ + + */ +final class ChainLoader implements LoaderInterface +{ + private $hasSourceCache = []; + private $loaders = []; + + /** + * @param LoaderInterface[] $loaders + */ + public function __construct(array $loaders = []) + { + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + public function addLoader(LoaderInterface $loader): void + { + $this->loaders[] = $loader; + $this->hasSourceCache = []; + } + + /** + * @return LoaderInterface[] + */ + public function getLoaders(): array + { + return $this->loaders; + } + + public function getSourceContext(string $name): Source + { + $exceptions = []; + foreach ($this->loaders as $loader) { + if (!$loader->exists($name)) { + continue; + } + + try { + return $loader->getSourceContext($name); + } catch (LoaderError $e) { + $exceptions[] = $e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } + + public function exists(string $name): bool + { + if (isset($this->hasSourceCache[$name])) { + return $this->hasSourceCache[$name]; + } + + foreach ($this->loaders as $loader) { + if ($loader->exists($name)) { + return $this->hasSourceCache[$name] = true; + } + } + + return $this->hasSourceCache[$name] = false; + } + + public function getCacheKey(string $name): string + { + $exceptions = []; + foreach ($this->loaders as $loader) { + if (!$loader->exists($name)) { + continue; + } + + try { + return $loader->getCacheKey($name); + } catch (LoaderError $e) { + $exceptions[] = \get_class($loader).': '.$e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } + + public function isFresh(string $name, int $time): bool + { + $exceptions = []; + foreach ($this->loaders as $loader) { + if (!$loader->exists($name)) { + continue; + } + + try { + return $loader->isFresh($name, $time); + } catch (LoaderError $e) { + $exceptions[] = \get_class($loader).': '.$e->getMessage(); + } + } + + throw new LoaderError(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : '')); + } +} diff --git a/vendor/twig/twig/src/Loader/FilesystemLoader.php b/vendor/twig/twig/src/Loader/FilesystemLoader.php new file mode 100644 index 0000000..859a898 --- /dev/null +++ b/vendor/twig/twig/src/Loader/FilesystemLoader.php @@ -0,0 +1,283 @@ + + */ +class FilesystemLoader implements LoaderInterface +{ + /** Identifier of the main namespace. */ + public const MAIN_NAMESPACE = '__main__'; + + protected $paths = []; + protected $cache = []; + protected $errorCache = []; + + private $rootPath; + + /** + * @param string|array $paths A path or an array of paths where to look for templates + * @param string|null $rootPath The root path common to all relative paths (null for getcwd()) + */ + public function __construct($paths = [], string $rootPath = null) + { + $this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR; + if (null !== $rootPath && false !== ($realPath = realpath($rootPath))) { + $this->rootPath = $realPath.\DIRECTORY_SEPARATOR; + } + + if ($paths) { + $this->setPaths($paths); + } + } + + /** + * Returns the paths to the templates. + */ + public function getPaths(string $namespace = self::MAIN_NAMESPACE): array + { + return $this->paths[$namespace] ?? []; + } + + /** + * Returns the path namespaces. + * + * The main namespace is always defined. + */ + public function getNamespaces(): array + { + return array_keys($this->paths); + } + + /** + * @param string|array $paths A path or an array of paths where to look for templates + */ + public function setPaths($paths, string $namespace = self::MAIN_NAMESPACE): void + { + if (!\is_array($paths)) { + $paths = [$paths]; + } + + $this->paths[$namespace] = []; + foreach ($paths as $path) { + $this->addPath($path, $namespace); + } + } + + /** + * @throws LoaderError + */ + public function addPath(string $path, string $namespace = self::MAIN_NAMESPACE): void + { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } + + $this->paths[$namespace][] = rtrim($path, '/\\'); + } + + /** + * @throws LoaderError + */ + public function prependPath(string $path, string $namespace = self::MAIN_NAMESPACE): void + { + // invalidate the cache + $this->cache = $this->errorCache = []; + + $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path; + if (!is_dir($checkPath)) { + throw new LoaderError(sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath)); + } + + $path = rtrim($path, '/\\'); + + if (!isset($this->paths[$namespace])) { + $this->paths[$namespace][] = $path; + } else { + array_unshift($this->paths[$namespace], $path); + } + } + + public function getSourceContext(string $name): Source + { + if (null === $path = $this->findTemplate($name)) { + return new Source('', $name, ''); + } + + return new Source(file_get_contents($path), $name, $path); + } + + public function getCacheKey(string $name): string + { + if (null === $path = $this->findTemplate($name)) { + return ''; + } + $len = \strlen($this->rootPath); + if (0 === strncmp($this->rootPath, $path, $len)) { + return substr($path, $len); + } + + return $path; + } + + /** + * @return bool + */ + public function exists(string $name) + { + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return true; + } + + return null !== $this->findTemplate($name, false); + } + + public function isFresh(string $name, int $time): bool + { + // false support to be removed in 3.0 + if (null === $path = $this->findTemplate($name)) { + return false; + } + + return filemtime($path) < $time; + } + + /** + * @return string|null + */ + protected function findTemplate(string $name, bool $throw = true) + { + $name = $this->normalizeName($name); + + if (isset($this->cache[$name])) { + return $this->cache[$name]; + } + + if (isset($this->errorCache[$name])) { + if (!$throw) { + return null; + } + + throw new LoaderError($this->errorCache[$name]); + } + + try { + $this->validateName($name); + + list($namespace, $shortname) = $this->parseName($name); + } catch (LoaderError $e) { + if (!$throw) { + return null; + } + + throw $e; + } + + if (!isset($this->paths[$namespace])) { + $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace); + + if (!$throw) { + return null; + } + + throw new LoaderError($this->errorCache[$name]); + } + + foreach ($this->paths[$namespace] as $path) { + if (!$this->isAbsolutePath($path)) { + $path = $this->rootPath.$path; + } + + if (is_file($path.'/'.$shortname)) { + if (false !== $realpath = realpath($path.'/'.$shortname)) { + return $this->cache[$name] = $realpath; + } + + return $this->cache[$name] = $path.'/'.$shortname; + } + } + + $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace])); + + if (!$throw) { + return null; + } + + throw new LoaderError($this->errorCache[$name]); + } + + private function normalizeName(string $name): string + { + return preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name)); + } + + private function parseName(string $name, string $default = self::MAIN_NAMESPACE): array + { + if (isset($name[0]) && '@' == $name[0]) { + if (false === $pos = strpos($name, '/')) { + throw new LoaderError(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); + } + + $namespace = substr($name, 1, $pos - 1); + $shortname = substr($name, $pos + 1); + + return [$namespace, $shortname]; + } + + return [$default, $name]; + } + + private function validateName(string $name): void + { + if (false !== strpos($name, "\0")) { + throw new LoaderError('A template name cannot contain NUL bytes.'); + } + + $name = ltrim($name, '/'); + $parts = explode('/', $name); + $level = 0; + foreach ($parts as $part) { + if ('..' === $part) { + --$level; + } elseif ('.' !== $part) { + ++$level; + } + + if ($level < 0) { + throw new LoaderError(sprintf('Looks like you try to load a template outside configured directories (%s).', $name)); + } + } + } + + private function isAbsolutePath(string $file): bool + { + return strspn($file, '/\\', 0, 1) + || (\strlen($file) > 3 && ctype_alpha($file[0]) + && ':' === $file[1] + && strspn($file, '/\\', 2, 1) + ) + || null !== parse_url($file, \PHP_URL_SCHEME) + ; + } +} diff --git a/vendor/twig/twig/src/Loader/LoaderInterface.php b/vendor/twig/twig/src/Loader/LoaderInterface.php new file mode 100644 index 0000000..fec7e85 --- /dev/null +++ b/vendor/twig/twig/src/Loader/LoaderInterface.php @@ -0,0 +1,49 @@ + + */ +interface LoaderInterface +{ + /** + * Returns the source context for a given template logical name. + * + * @throws LoaderError When $name is not found + */ + public function getSourceContext(string $name): Source; + + /** + * Gets the cache key to use for the cache for a given template name. + * + * @throws LoaderError When $name is not found + */ + public function getCacheKey(string $name): string; + + /** + * @param int $time Timestamp of the last modification time of the cached template + * + * @throws LoaderError When $name is not found + */ + public function isFresh(string $name, int $time): bool; + + /** + * @return bool + */ + public function exists(string $name); +} diff --git a/vendor/twig/twig/src/Markup.php b/vendor/twig/twig/src/Markup.php new file mode 100644 index 0000000..1788acc --- /dev/null +++ b/vendor/twig/twig/src/Markup.php @@ -0,0 +1,52 @@ + + */ +class Markup implements \Countable, \JsonSerializable +{ + private $content; + private $charset; + + public function __construct($content, $charset) + { + $this->content = (string) $content; + $this->charset = $charset; + } + + public function __toString() + { + return $this->content; + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return mb_strlen($this->content, $this->charset); + } + + /** + * @return mixed + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->content; + } +} diff --git a/vendor/twig/twig/src/Node/AutoEscapeNode.php b/vendor/twig/twig/src/Node/AutoEscapeNode.php new file mode 100644 index 0000000..cd97041 --- /dev/null +++ b/vendor/twig/twig/src/Node/AutoEscapeNode.php @@ -0,0 +1,38 @@ + + */ +class AutoEscapeNode extends Node +{ + public function __construct($value, Node $body, int $lineno, string $tag = 'autoescape') + { + parent::__construct(['body' => $body], ['value' => $value], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->subcompile($this->getNode('body')); + } +} diff --git a/vendor/twig/twig/src/Node/BlockNode.php b/vendor/twig/twig/src/Node/BlockNode.php new file mode 100644 index 0000000..0632ba7 --- /dev/null +++ b/vendor/twig/twig/src/Node/BlockNode.php @@ -0,0 +1,44 @@ + + */ +class BlockNode extends Node +{ + public function __construct(string $name, Node $body, int $lineno, string $tag = null) + { + parent::__construct(['body' => $body], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write(sprintf("public function block_%s(\$context, array \$blocks = [])\n", $this->getAttribute('name')), "{\n") + ->indent() + ->write("\$macros = \$this->macros;\n") + ; + + $compiler + ->subcompile($this->getNode('body')) + ->outdent() + ->write("}\n\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/BlockReferenceNode.php b/vendor/twig/twig/src/Node/BlockReferenceNode.php new file mode 100644 index 0000000..cc8af5b --- /dev/null +++ b/vendor/twig/twig/src/Node/BlockReferenceNode.php @@ -0,0 +1,36 @@ + + */ +class BlockReferenceNode extends Node implements NodeOutputInterface +{ + public function __construct(string $name, int $lineno, string $tag = null) + { + parent::__construct([], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) + ; + } +} diff --git a/vendor/twig/twig/src/Node/BodyNode.php b/vendor/twig/twig/src/Node/BodyNode.php new file mode 100644 index 0000000..041cbf6 --- /dev/null +++ b/vendor/twig/twig/src/Node/BodyNode.php @@ -0,0 +1,21 @@ + + */ +class BodyNode extends Node +{ +} diff --git a/vendor/twig/twig/src/Node/CheckSecurityCallNode.php b/vendor/twig/twig/src/Node/CheckSecurityCallNode.php new file mode 100644 index 0000000..a78a38d --- /dev/null +++ b/vendor/twig/twig/src/Node/CheckSecurityCallNode.php @@ -0,0 +1,28 @@ + + */ +class CheckSecurityCallNode extends Node +{ + public function compile(Compiler $compiler) + { + $compiler + ->write("\$this->sandbox = \$this->env->getExtension('\Twig\Extension\SandboxExtension');\n") + ->write("\$this->checkSecurity();\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/CheckSecurityNode.php b/vendor/twig/twig/src/Node/CheckSecurityNode.php new file mode 100644 index 0000000..4727327 --- /dev/null +++ b/vendor/twig/twig/src/Node/CheckSecurityNode.php @@ -0,0 +1,88 @@ + + */ +class CheckSecurityNode extends Node +{ + private $usedFilters; + private $usedTags; + private $usedFunctions; + + public function __construct(array $usedFilters, array $usedTags, array $usedFunctions) + { + $this->usedFilters = $usedFilters; + $this->usedTags = $usedTags; + $this->usedFunctions = $usedFunctions; + + parent::__construct(); + } + + public function compile(Compiler $compiler): void + { + $tags = $filters = $functions = []; + foreach (['tags', 'filters', 'functions'] as $type) { + foreach ($this->{'used'.ucfirst($type)} as $name => $node) { + if ($node instanceof Node) { + ${$type}[$name] = $node->getTemplateLine(); + } else { + ${$type}[$node] = null; + } + } + } + + $compiler + ->write("\n") + ->write("public function checkSecurity()\n") + ->write("{\n") + ->indent() + ->write('static $tags = ')->repr(array_filter($tags))->raw(";\n") + ->write('static $filters = ')->repr(array_filter($filters))->raw(";\n") + ->write('static $functions = ')->repr(array_filter($functions))->raw(";\n\n") + ->write("try {\n") + ->indent() + ->write("\$this->sandbox->checkSecurity(\n") + ->indent() + ->write(!$tags ? "[],\n" : "['".implode("', '", array_keys($tags))."'],\n") + ->write(!$filters ? "[],\n" : "['".implode("', '", array_keys($filters))."'],\n") + ->write(!$functions ? "[]\n" : "['".implode("', '", array_keys($functions))."']\n") + ->outdent() + ->write(");\n") + ->outdent() + ->write("} catch (SecurityError \$e) {\n") + ->indent() + ->write("\$e->setSourceContext(\$this->source);\n\n") + ->write("if (\$e instanceof SecurityNotAllowedTagError && isset(\$tags[\$e->getTagName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$tags[\$e->getTagName()]);\n") + ->outdent() + ->write("} elseif (\$e instanceof SecurityNotAllowedFilterError && isset(\$filters[\$e->getFilterName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$filters[\$e->getFilterName()]);\n") + ->outdent() + ->write("} elseif (\$e instanceof SecurityNotAllowedFunctionError && isset(\$functions[\$e->getFunctionName()])) {\n") + ->indent() + ->write("\$e->setTemplateLine(\$functions[\$e->getFunctionName()]);\n") + ->outdent() + ->write("}\n\n") + ->write("throw \$e;\n") + ->outdent() + ->write("}\n\n") + ->outdent() + ->write("}\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/CheckToStringNode.php b/vendor/twig/twig/src/Node/CheckToStringNode.php new file mode 100644 index 0000000..c7a9d69 --- /dev/null +++ b/vendor/twig/twig/src/Node/CheckToStringNode.php @@ -0,0 +1,45 @@ + + */ +class CheckToStringNode extends AbstractExpression +{ + public function __construct(AbstractExpression $expr) + { + parent::__construct(['expr' => $expr], [], $expr->getTemplateLine(), $expr->getNodeTag()); + } + + public function compile(Compiler $compiler): void + { + $expr = $this->getNode('expr'); + $compiler + ->raw('$this->sandbox->ensureToStringAllowed(') + ->subcompile($expr) + ->raw(', ') + ->repr($expr->getTemplateLine()) + ->raw(', $this->source)') + ; + } +} diff --git a/vendor/twig/twig/src/Node/DeprecatedNode.php b/vendor/twig/twig/src/Node/DeprecatedNode.php new file mode 100644 index 0000000..5ff4430 --- /dev/null +++ b/vendor/twig/twig/src/Node/DeprecatedNode.php @@ -0,0 +1,53 @@ + + */ +class DeprecatedNode extends Node +{ + public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) + { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + $expr = $this->getNode('expr'); + + if ($expr instanceof ConstantExpression) { + $compiler->write('@trigger_error(') + ->subcompile($expr); + } else { + $varName = $compiler->getVarName(); + $compiler->write(sprintf('$%s = ', $varName)) + ->subcompile($expr) + ->raw(";\n") + ->write(sprintf('@trigger_error($%s', $varName)); + } + + $compiler + ->raw('.') + ->string(sprintf(' ("%s" at line %d).', $this->getTemplateName(), $this->getTemplateLine())) + ->raw(", E_USER_DEPRECATED);\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/DoNode.php b/vendor/twig/twig/src/Node/DoNode.php new file mode 100644 index 0000000..f7783d1 --- /dev/null +++ b/vendor/twig/twig/src/Node/DoNode.php @@ -0,0 +1,38 @@ + + */ +class DoNode extends Node +{ + public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) + { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('') + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/EmbedNode.php b/vendor/twig/twig/src/Node/EmbedNode.php new file mode 100644 index 0000000..903c3f6 --- /dev/null +++ b/vendor/twig/twig/src/Node/EmbedNode.php @@ -0,0 +1,48 @@ + + */ +class EmbedNode extends IncludeNode +{ + // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) + public function __construct(string $name, int $index, ?AbstractExpression $variables, bool $only, bool $ignoreMissing, int $lineno, string $tag = null) + { + parent::__construct(new ConstantExpression('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); + + $this->setAttribute('name', $name); + $this->setAttribute('index', $index); + } + + protected function addGetTemplate(Compiler $compiler): void + { + $compiler + ->write('$this->loadTemplate(') + ->string($this->getAttribute('name')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(', ') + ->string($this->getAttribute('index')) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/AbstractExpression.php b/vendor/twig/twig/src/Node/Expression/AbstractExpression.php new file mode 100644 index 0000000..42da055 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/AbstractExpression.php @@ -0,0 +1,24 @@ + + */ +abstract class AbstractExpression extends Node +{ +} diff --git a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php new file mode 100644 index 0000000..0e25fe4 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php @@ -0,0 +1,85 @@ +index = -1; + foreach ($this->getKeyValuePairs() as $pair) { + if ($pair['key'] instanceof ConstantExpression && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { + $this->index = $pair['key']->getAttribute('value'); + } + } + } + + public function getKeyValuePairs(): array + { + $pairs = []; + foreach (array_chunk($this->nodes, 2) as $pair) { + $pairs[] = [ + 'key' => $pair[0], + 'value' => $pair[1], + ]; + } + + return $pairs; + } + + public function hasElement(AbstractExpression $key): bool + { + foreach ($this->getKeyValuePairs() as $pair) { + // we compare the string representation of the keys + // to avoid comparing the line numbers which are not relevant here. + if ((string) $key === (string) $pair['key']) { + return true; + } + } + + return false; + } + + public function addElement(AbstractExpression $value, AbstractExpression $key = null): void + { + if (null === $key) { + $key = new ConstantExpression(++$this->index, $value->getTemplateLine()); + } + + array_push($this->nodes, $key, $value); + } + + public function compile(Compiler $compiler): void + { + $compiler->raw('['); + $first = true; + foreach ($this->getKeyValuePairs() as $pair) { + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + $compiler + ->subcompile($pair['key']) + ->raw(' => ') + ->subcompile($pair['value']) + ; + } + $compiler->raw(']'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php b/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php new file mode 100644 index 0000000..eaad03c --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php @@ -0,0 +1,64 @@ + + */ +class ArrowFunctionExpression extends AbstractExpression +{ + public function __construct(AbstractExpression $expr, Node $names, $lineno, $tag = null) + { + parent::__construct(['expr' => $expr, 'names' => $names], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->raw('function (') + ; + foreach ($this->getNode('names') as $i => $name) { + if ($i) { + $compiler->raw(', '); + } + + $compiler + ->raw('$__') + ->raw($name->getAttribute('name')) + ->raw('__') + ; + } + $compiler + ->raw(') use ($context, $macros) { ') + ; + foreach ($this->getNode('names') as $name) { + $compiler + ->raw('$context["') + ->raw($name->getAttribute('name')) + ->raw('"] = $__') + ->raw($name->getAttribute('name')) + ->raw('__; ') + ; + } + $compiler + ->raw('return ') + ->subcompile($this->getNode('expr')) + ->raw('; }') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php b/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php new file mode 100644 index 0000000..7dd1bc4 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/AssignNameExpression.php @@ -0,0 +1,27 @@ +raw('$context[') + ->string($this->getAttribute('name')) + ->raw(']') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php new file mode 100644 index 0000000..c424e5c --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/AbstractBinary.php @@ -0,0 +1,42 @@ + $left, 'right' => $right], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(') + ->subcompile($this->getNode('left')) + ->raw(' ') + ; + $this->operator($compiler); + $compiler + ->raw(' ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + abstract public function operator(Compiler $compiler): Compiler; +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php new file mode 100644 index 0000000..ee4307e --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/AddBinary.php @@ -0,0 +1,23 @@ +raw('+'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php new file mode 100644 index 0000000..5f2380d --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/AndBinary.php @@ -0,0 +1,23 @@ +raw('&&'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php new file mode 100644 index 0000000..db7d6d6 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseAndBinary.php @@ -0,0 +1,23 @@ +raw('&'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php new file mode 100644 index 0000000..ce803dd --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php @@ -0,0 +1,23 @@ +raw('|'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php new file mode 100644 index 0000000..5c29785 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/BitwiseXorBinary.php @@ -0,0 +1,23 @@ +raw('^'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php new file mode 100644 index 0000000..f825ab8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/ConcatBinary.php @@ -0,0 +1,23 @@ +raw('.'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php new file mode 100644 index 0000000..e3817d1 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/DivBinary.php @@ -0,0 +1,23 @@ +raw('/'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php new file mode 100644 index 0000000..c3516b8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/EndsWithBinary.php @@ -0,0 +1,35 @@ +getVarName(); + $right = $compiler->getVarName(); + $compiler + ->raw(sprintf('(is_string($%s = ', $left)) + ->subcompile($this->getNode('left')) + ->raw(sprintf(') && is_string($%s = ', $right)) + ->subcompile($this->getNode('right')) + ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw(''); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php new file mode 100644 index 0000000..6b48549 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/EqualBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 === twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('=='); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php new file mode 100644 index 0000000..d7e7980 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/FloorDivBinary.php @@ -0,0 +1,29 @@ +raw('(int) floor('); + parent::compile($compiler); + $compiler->raw(')'); + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('/'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php new file mode 100644 index 0000000..e1dd067 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(1 === twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('>'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php new file mode 100644 index 0000000..df9bfcf --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/GreaterEqualBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 <= twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('>='); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php new file mode 100644 index 0000000..6dbfa97 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php @@ -0,0 +1,33 @@ +raw('twig_in_filter(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('in'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php new file mode 100644 index 0000000..598e629 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(-1 === twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('<'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php new file mode 100644 index 0000000..e3c4af5 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/LessEqualBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 >= twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('<='); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php new file mode 100644 index 0000000..bc97292 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/MatchesBinary.php @@ -0,0 +1,33 @@ +raw('preg_match(') + ->subcompile($this->getNode('right')) + ->raw(', ') + ->subcompile($this->getNode('left')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw(''); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php new file mode 100644 index 0000000..271b45c --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php @@ -0,0 +1,23 @@ +raw('%'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php new file mode 100644 index 0000000..6d4c1e0 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/MulBinary.php @@ -0,0 +1,23 @@ +raw('*'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php new file mode 100644 index 0000000..db47a28 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotEqualBinary.php @@ -0,0 +1,39 @@ += 80000) { + parent::compile($compiler); + + return; + } + + $compiler + ->raw('(0 !== twig_compare(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw('))') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('!='); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php new file mode 100644 index 0000000..fcba6cc --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/NotInBinary.php @@ -0,0 +1,33 @@ +raw('!twig_in_filter(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('not in'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php new file mode 100644 index 0000000..21f87c9 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/OrBinary.php @@ -0,0 +1,23 @@ +raw('||'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php new file mode 100644 index 0000000..c9f4c66 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/PowerBinary.php @@ -0,0 +1,22 @@ +raw('**'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php new file mode 100644 index 0000000..55982c8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/RangeBinary.php @@ -0,0 +1,33 @@ +raw('range(') + ->subcompile($this->getNode('left')) + ->raw(', ') + ->subcompile($this->getNode('right')) + ->raw(')') + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw('..'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php new file mode 100644 index 0000000..ae5a4a4 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php @@ -0,0 +1,22 @@ +raw('<=>'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php new file mode 100644 index 0000000..d0df1c4 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php @@ -0,0 +1,35 @@ +getVarName(); + $right = $compiler->getVarName(); + $compiler + ->raw(sprintf('(is_string($%s = ', $left)) + ->subcompile($this->getNode('left')) + ->raw(sprintf(') && is_string($%s = ', $right)) + ->subcompile($this->getNode('right')) + ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) + ; + } + + public function operator(Compiler $compiler): Compiler + { + return $compiler->raw(''); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php b/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php new file mode 100644 index 0000000..eeb87fa --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Binary/SubBinary.php @@ -0,0 +1,23 @@ +raw('-'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php new file mode 100644 index 0000000..b1e2a8f --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/BlockReferenceExpression.php @@ -0,0 +1,86 @@ + + */ +class BlockReferenceExpression extends AbstractExpression +{ + public function __construct(Node $name, ?Node $template, int $lineno, string $tag = null) + { + $nodes = ['name' => $name]; + if (null !== $template) { + $nodes['template'] = $template; + } + + parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('is_defined_test')) { + $this->compileTemplateCall($compiler, 'hasBlock'); + } else { + if ($this->getAttribute('output')) { + $compiler->addDebugInfo($this); + + $this + ->compileTemplateCall($compiler, 'displayBlock') + ->raw(";\n"); + } else { + $this->compileTemplateCall($compiler, 'renderBlock'); + } + } + } + + private function compileTemplateCall(Compiler $compiler, string $method): Compiler + { + if (!$this->hasNode('template')) { + $compiler->write('$this'); + } else { + $compiler + ->write('$this->loadTemplate(') + ->subcompile($this->getNode('template')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')') + ; + } + + $compiler->raw(sprintf('->%s', $method)); + + return $this->compileBlockArguments($compiler); + } + + private function compileBlockArguments(Compiler $compiler): Compiler + { + $compiler + ->raw('(') + ->subcompile($this->getNode('name')) + ->raw(', $context'); + + if (!$this->hasNode('template')) { + $compiler->raw(', $blocks'); + } + + return $compiler->raw(')'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/CallExpression.php b/vendor/twig/twig/src/Node/Expression/CallExpression.php new file mode 100644 index 0000000..fdf92a8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/CallExpression.php @@ -0,0 +1,320 @@ +getAttribute('callable'); + + $closingParenthesis = false; + $isArray = false; + if (\is_string($callable) && false === strpos($callable, '::')) { + $compiler->raw($callable); + } else { + list($r, $callable) = $this->reflectCallable($callable); + if ($r instanceof \ReflectionMethod && \is_string($callable[0])) { + if ($r->isStatic()) { + $compiler->raw(sprintf('%s::%s', $callable[0], $callable[1])); + } else { + $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); + } + } elseif ($r instanceof \ReflectionMethod && $callable[0] instanceof ExtensionInterface) { + $class = \get_class($callable[0]); + if (!$compiler->getEnvironment()->hasExtension($class)) { + // Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error + $compiler->raw(sprintf('$this->env->getExtension(\'%s\')', $class)); + } else { + $compiler->raw(sprintf('$this->extensions[\'%s\']', ltrim($class, '\\'))); + } + + $compiler->raw(sprintf('->%s', $callable[1])); + } else { + $closingParenthesis = true; + $isArray = true; + $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); + } + } + + $this->compileArguments($compiler, $isArray); + + if ($closingParenthesis) { + $compiler->raw(')'); + } + } + + protected function compileArguments(Compiler $compiler, $isArray = false): void + { + $compiler->raw($isArray ? '[' : '('); + + $first = true; + + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + $compiler->raw('$this->env'); + $first = false; + } + + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->raw('$context'); + $first = false; + } + + if ($this->hasAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->string($argument); + $first = false; + } + } + + if ($this->hasNode('node')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($this->getNode('node')); + $first = false; + } + + if ($this->hasNode('arguments')) { + $callable = $this->getAttribute('callable'); + $arguments = $this->getArguments($callable, $this->getNode('arguments')); + foreach ($arguments as $node) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($node); + $first = false; + } + } + + $compiler->raw($isArray ? ']' : ')'); + } + + protected function getArguments($callable, $arguments) + { + $callType = $this->getAttribute('type'); + $callName = $this->getAttribute('name'); + + $parameters = []; + $named = false; + foreach ($arguments as $name => $node) { + if (!\is_int($name)) { + $named = true; + $name = $this->normalizeName($name); + } elseif ($named) { + throw new SyntaxError(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); + } + + $parameters[$name] = $node; + } + + $isVariadic = $this->hasAttribute('is_variadic') && $this->getAttribute('is_variadic'); + if (!$named && !$isVariadic) { + return $parameters; + } + + if (!$callable) { + if ($named) { + $message = sprintf('Named arguments are not supported for %s "%s".', $callType, $callName); + } else { + $message = sprintf('Arbitrary positional arguments are not supported for %s "%s".', $callType, $callName); + } + + throw new \LogicException($message); + } + + list($callableParameters, $isPhpVariadic) = $this->getCallableParameters($callable, $isVariadic); + $arguments = []; + $names = []; + $missingArguments = []; + $optionalArguments = []; + $pos = 0; + foreach ($callableParameters as $callableParameter) { + $name = $this->normalizeName($callableParameter->name); + if (\PHP_VERSION_ID >= 80000 && 'range' === $callable) { + if ('start' === $name) { + $name = 'low'; + } elseif ('end' === $name) { + $name = 'high'; + } + } + + $names[] = $name; + + if (\array_key_exists($name, $parameters)) { + if (\array_key_exists($pos, $parameters)) { + throw new SyntaxError(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); + } + + if (\count($missingArguments)) { + throw new SyntaxError(sprintf( + 'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".', + $name, $callType, $callName, implode(', ', $names), \count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments) + ), $this->getTemplateLine(), $this->getSourceContext()); + } + + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $parameters[$name]; + unset($parameters[$name]); + $optionalArguments = []; + } elseif (\array_key_exists($pos, $parameters)) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $parameters[$pos]; + unset($parameters[$pos]); + $optionalArguments = []; + ++$pos; + } elseif ($callableParameter->isDefaultValueAvailable()) { + $optionalArguments[] = new ConstantExpression($callableParameter->getDefaultValue(), -1); + } elseif ($callableParameter->isOptional()) { + if (empty($parameters)) { + break; + } else { + $missingArguments[] = $name; + } + } else { + throw new SyntaxError(sprintf('Value for argument "%s" is required for %s "%s".', $name, $callType, $callName), $this->getTemplateLine(), $this->getSourceContext()); + } + } + + if ($isVariadic) { + $arbitraryArguments = $isPhpVariadic ? new VariadicExpression([], -1) : new ArrayExpression([], -1); + foreach ($parameters as $key => $value) { + if (\is_int($key)) { + $arbitraryArguments->addElement($value); + } else { + $arbitraryArguments->addElement($value, new ConstantExpression($key, -1)); + } + unset($parameters[$key]); + } + + if ($arbitraryArguments->count()) { + $arguments = array_merge($arguments, $optionalArguments); + $arguments[] = $arbitraryArguments; + } + } + + if (!empty($parameters)) { + $unknownParameter = null; + foreach ($parameters as $parameter) { + if ($parameter instanceof Node) { + $unknownParameter = $parameter; + break; + } + } + + throw new SyntaxError( + sprintf( + 'Unknown argument%s "%s" for %s "%s(%s)".', + \count($parameters) > 1 ? 's' : '', implode('", "', array_keys($parameters)), $callType, $callName, implode(', ', $names) + ), + $unknownParameter ? $unknownParameter->getTemplateLine() : $this->getTemplateLine(), + $unknownParameter ? $unknownParameter->getSourceContext() : $this->getSourceContext() + ); + } + + return $arguments; + } + + protected function normalizeName(string $name): string + { + return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $name)); + } + + private function getCallableParameters($callable, bool $isVariadic): array + { + list($r) = $this->reflectCallable($callable); + if (null === $r) { + return [[], false]; + } + + $parameters = $r->getParameters(); + if ($this->hasNode('node')) { + array_shift($parameters); + } + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + array_shift($parameters); + } + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + array_shift($parameters); + } + if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + array_shift($parameters); + } + } + $isPhpVariadic = false; + if ($isVariadic) { + $argument = end($parameters); + $isArray = $argument && $argument->hasType() && 'array' === $argument->getType()->getName(); + if ($isArray && $argument->isDefaultValueAvailable() && [] === $argument->getDefaultValue()) { + array_pop($parameters); + } elseif ($argument && $argument->isVariadic()) { + array_pop($parameters); + $isPhpVariadic = true; + } else { + $callableName = $r->name; + if ($r instanceof \ReflectionMethod) { + $callableName = $r->getDeclaringClass()->name.'::'.$callableName; + } + + throw new \LogicException(sprintf('The last parameter of "%s" for %s "%s" must be an array with default value, eg. "array $arg = []".', $callableName, $this->getAttribute('type'), $this->getAttribute('name'))); + } + } + + return [$parameters, $isPhpVariadic]; + } + + private function reflectCallable($callable) + { + if (null !== $this->reflector) { + return $this->reflector; + } + + if (\is_array($callable)) { + if (!method_exists($callable[0], $callable[1])) { + // __call() + return [null, []]; + } + $r = new \ReflectionMethod($callable[0], $callable[1]); + } elseif (\is_object($callable) && !$callable instanceof \Closure) { + $r = new \ReflectionObject($callable); + $r = $r->getMethod('__invoke'); + $callable = [$callable, '__invoke']; + } elseif (\is_string($callable) && false !== $pos = strpos($callable, '::')) { + $class = substr($callable, 0, $pos); + $method = substr($callable, $pos + 2); + if (!method_exists($class, $method)) { + // __staticCall() + return [null, []]; + } + $r = new \ReflectionMethod($callable); + $callable = [$class, $method]; + } else { + $r = new \ReflectionFunction($callable); + } + + return $this->reflector = [$r, $callable]; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php new file mode 100644 index 0000000..2c7bd0a --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/ConditionalExpression.php @@ -0,0 +1,36 @@ + $expr1, 'expr2' => $expr2, 'expr3' => $expr3], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->raw('((') + ->subcompile($this->getNode('expr1')) + ->raw(') ? (') + ->subcompile($this->getNode('expr2')) + ->raw(') : (') + ->subcompile($this->getNode('expr3')) + ->raw('))') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ConstantExpression.php b/vendor/twig/twig/src/Node/Expression/ConstantExpression.php new file mode 100644 index 0000000..7ddbcc6 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/ConstantExpression.php @@ -0,0 +1,28 @@ + $value], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->repr($this->getAttribute('value')); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php b/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php new file mode 100644 index 0000000..6a572d4 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Filter/DefaultFilter.php @@ -0,0 +1,52 @@ + + */ +class DefaultFilter extends FilterExpression +{ + public function __construct(Node $node, ConstantExpression $filterName, Node $arguments, int $lineno, string $tag = null) + { + $default = new FilterExpression($node, new ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine()); + + if ('default' === $filterName->getAttribute('value') && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) { + $test = new DefinedTest(clone $node, 'defined', new Node(), $node->getTemplateLine()); + $false = \count($arguments) ? $arguments->getNode(0) : new ConstantExpression('', $node->getTemplateLine()); + + $node = new ConditionalExpression($test, $default, $false, $node->getTemplateLine()); + } else { + $node = $default; + } + + parent::__construct($node, $filterName, $arguments, $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->subcompile($this->getNode('node')); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/FilterExpression.php b/vendor/twig/twig/src/Node/Expression/FilterExpression.php new file mode 100644 index 0000000..0fc1588 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/FilterExpression.php @@ -0,0 +1,40 @@ + $node, 'filter' => $filterName, 'arguments' => $arguments], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $name = $this->getNode('filter')->getAttribute('value'); + $filter = $compiler->getEnvironment()->getFilter($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'filter'); + $this->setAttribute('needs_environment', $filter->needsEnvironment()); + $this->setAttribute('needs_context', $filter->needsContext()); + $this->setAttribute('arguments', $filter->getArguments()); + $this->setAttribute('callable', $filter->getCallable()); + $this->setAttribute('is_variadic', $filter->isVariadic()); + + $this->compileCallable($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/FunctionExpression.php b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php new file mode 100644 index 0000000..7126977 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/FunctionExpression.php @@ -0,0 +1,43 @@ + $arguments], ['name' => $name, 'is_defined_test' => false], $lineno); + } + + public function compile(Compiler $compiler) + { + $name = $this->getAttribute('name'); + $function = $compiler->getEnvironment()->getFunction($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'function'); + $this->setAttribute('needs_environment', $function->needsEnvironment()); + $this->setAttribute('needs_context', $function->needsContext()); + $this->setAttribute('arguments', $function->getArguments()); + $callable = $function->getCallable(); + if ('constant' === $name && $this->getAttribute('is_defined_test')) { + $callable = 'twig_constant_is_defined'; + } + $this->setAttribute('callable', $callable); + $this->setAttribute('is_variadic', $function->isVariadic()); + + $this->compileCallable($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php new file mode 100644 index 0000000..e6a75ce --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/GetAttrExpression.php @@ -0,0 +1,87 @@ + $node, 'attribute' => $attribute]; + if (null !== $arguments) { + $nodes['arguments'] = $arguments; + } + + parent::__construct($nodes, ['type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'optimizable' => true], $lineno); + } + + public function compile(Compiler $compiler): void + { + $env = $compiler->getEnvironment(); + + // optimize array calls + if ( + $this->getAttribute('optimizable') + && (!$env->isStrictVariables() || $this->getAttribute('ignore_strict_check')) + && !$this->getAttribute('is_defined_test') + && Template::ARRAY_CALL === $this->getAttribute('type') + ) { + $var = '$'.$compiler->getVarName(); + $compiler + ->raw('(('.$var.' = ') + ->subcompile($this->getNode('node')) + ->raw(') && is_array(') + ->raw($var) + ->raw(') || ') + ->raw($var) + ->raw(' instanceof ArrayAccess ? (') + ->raw($var) + ->raw('[') + ->subcompile($this->getNode('attribute')) + ->raw('] ?? null) : null)') + ; + + return; + } + + $compiler->raw('twig_get_attribute($this->env, $this->source, '); + + if ($this->getAttribute('ignore_strict_check')) { + $this->getNode('node')->setAttribute('ignore_strict_check', true); + } + + $compiler + ->subcompile($this->getNode('node')) + ->raw(', ') + ->subcompile($this->getNode('attribute')) + ; + + if ($this->hasNode('arguments')) { + $compiler->raw(', ')->subcompile($this->getNode('arguments')); + } else { + $compiler->raw(', []'); + } + + $compiler->raw(', ') + ->repr($this->getAttribute('type')) + ->raw(', ')->repr($this->getAttribute('is_defined_test')) + ->raw(', ')->repr($this->getAttribute('ignore_strict_check')) + ->raw(', ')->repr($env->hasExtension(SandboxExtension::class)) + ->raw(', ')->repr($this->getNode('node')->getTemplateLine()) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/InlinePrint.php b/vendor/twig/twig/src/Node/Expression/InlinePrint.php new file mode 100644 index 0000000..1ad4751 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/InlinePrint.php @@ -0,0 +1,35 @@ + $node], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->raw('print (') + ->subcompile($this->getNode('node')) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php new file mode 100644 index 0000000..d5ec0b6 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/MethodCallExpression.php @@ -0,0 +1,62 @@ + $node, 'arguments' => $arguments], ['method' => $method, 'safe' => false, 'is_defined_test' => false], $lineno); + + if ($node instanceof NameExpression) { + $node->setAttribute('always_defined', true); + } + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('is_defined_test')) { + $compiler + ->raw('method_exists($macros[') + ->repr($this->getNode('node')->getAttribute('name')) + ->raw('], ') + ->repr($this->getAttribute('method')) + ->raw(')') + ; + + return; + } + + $compiler + ->raw('twig_call_macro($macros[') + ->repr($this->getNode('node')->getAttribute('name')) + ->raw('], ') + ->repr($this->getAttribute('method')) + ->raw(', [') + ; + $first = true; + foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + $compiler->subcompile($pair['value']); + } + $compiler + ->raw('], ') + ->repr($this->getTemplateLine()) + ->raw(', $context, $this->getSourceContext())'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/NameExpression.php b/vendor/twig/twig/src/Node/Expression/NameExpression.php new file mode 100644 index 0000000..c3563f0 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/NameExpression.php @@ -0,0 +1,97 @@ + '$this->getTemplateName()', + '_context' => '$context', + '_charset' => '$this->env->getCharset()', + ]; + + public function __construct(string $name, int $lineno) + { + parent::__construct([], ['name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false], $lineno); + } + + public function compile(Compiler $compiler): void + { + $name = $this->getAttribute('name'); + + $compiler->addDebugInfo($this); + + if ($this->getAttribute('is_defined_test')) { + if ($this->isSpecial()) { + $compiler->repr(true); + } elseif (\PHP_VERSION_ID >= 70400) { + $compiler + ->raw('array_key_exists(') + ->string($name) + ->raw(', $context)') + ; + } else { + $compiler + ->raw('(isset($context[') + ->string($name) + ->raw(']) || array_key_exists(') + ->string($name) + ->raw(', $context))') + ; + } + } elseif ($this->isSpecial()) { + $compiler->raw($this->specialVars[$name]); + } elseif ($this->getAttribute('always_defined')) { + $compiler + ->raw('$context[') + ->string($name) + ->raw(']') + ; + } else { + if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { + $compiler + ->raw('($context[') + ->string($name) + ->raw('] ?? null)') + ; + } else { + $compiler + ->raw('(isset($context[') + ->string($name) + ->raw(']) || array_key_exists(') + ->string($name) + ->raw(', $context) ? $context[') + ->string($name) + ->raw('] : (function () { throw new RuntimeError(\'Variable ') + ->string($name) + ->raw(' does not exist.\', ') + ->repr($this->lineno) + ->raw(', $this->source); })()') + ->raw(')') + ; + } + } + } + + public function isSpecial() + { + return isset($this->specialVars[$this->getAttribute('name')]); + } + + public function isSimple() + { + return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php b/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php new file mode 100644 index 0000000..a72bc4f --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php @@ -0,0 +1,60 @@ +getTemplateLine()); + // for "block()", we don't need the null test as the return value is always a string + if (!$left instanceof BlockReferenceExpression) { + $test = new AndBinary( + $test, + new NotUnary(new NullTest($left, 'null', new Node(), $left->getTemplateLine()), $left->getTemplateLine()), + $left->getTemplateLine() + ); + } + + parent::__construct($test, $left, $right, $lineno); + } + + public function compile(Compiler $compiler): void + { + /* + * This optimizes only one case. PHP 7 also supports more complex expressions + * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works, + * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced + * cases might be implemented as an optimizer node visitor, but has not been done + * as benefits are probably not worth the added complexity. + */ + if ($this->getNode('expr2') instanceof NameExpression) { + $this->getNode('expr2')->setAttribute('always_defined', true); + $compiler + ->raw('((') + ->subcompile($this->getNode('expr2')) + ->raw(') ?? (') + ->subcompile($this->getNode('expr3')) + ->raw('))') + ; + } else { + parent::compile($compiler); + } + } +} diff --git a/vendor/twig/twig/src/Node/Expression/ParentExpression.php b/vendor/twig/twig/src/Node/Expression/ParentExpression.php new file mode 100644 index 0000000..2549197 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/ParentExpression.php @@ -0,0 +1,46 @@ + + */ +class ParentExpression extends AbstractExpression +{ + public function __construct(string $name, int $lineno, string $tag = null) + { + parent::__construct([], ['output' => false, 'name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('output')) { + $compiler + ->addDebugInfo($this) + ->write('$this->displayParentBlock(') + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks);\n") + ; + } else { + $compiler + ->raw('$this->renderParentBlock(') + ->string($this->getAttribute('name')) + ->raw(', $context, $blocks)') + ; + } + } +} diff --git a/vendor/twig/twig/src/Node/Expression/TempNameExpression.php b/vendor/twig/twig/src/Node/Expression/TempNameExpression.php new file mode 100644 index 0000000..004c704 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/TempNameExpression.php @@ -0,0 +1,31 @@ + $name], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->raw('$_') + ->raw($this->getAttribute('name')) + ->raw('_') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php b/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php new file mode 100644 index 0000000..57e9319 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/ConstantTest.php @@ -0,0 +1,49 @@ + + */ +class ConstantTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === constant(') + ; + + if ($this->getNode('arguments')->hasNode(1)) { + $compiler + ->raw('get_class(') + ->subcompile($this->getNode('arguments')->getNode(1)) + ->raw(')."::".') + ; + } + + $compiler + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw('))') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php b/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php new file mode 100644 index 0000000..3953bbb --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php @@ -0,0 +1,74 @@ + + */ +class DefinedTest extends TestExpression +{ + public function __construct(Node $node, string $name, ?Node $arguments, int $lineno) + { + if ($node instanceof NameExpression) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof GetAttrExpression) { + $node->setAttribute('is_defined_test', true); + $this->changeIgnoreStrictCheck($node); + } elseif ($node instanceof BlockReferenceExpression) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof FunctionExpression && 'constant' === $node->getAttribute('name')) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof ConstantExpression || $node instanceof ArrayExpression) { + $node = new ConstantExpression(true, $node->getTemplateLine()); + } elseif ($node instanceof MethodCallExpression) { + $node->setAttribute('is_defined_test', true); + } else { + throw new SyntaxError('The "defined" test only works with simple variables.', $lineno); + } + + parent::__construct($node, $name, $arguments, $lineno); + } + + private function changeIgnoreStrictCheck(GetAttrExpression $node) + { + $node->setAttribute('optimizable', false); + $node->setAttribute('ignore_strict_check', true); + + if ($node->getNode('node') instanceof GetAttrExpression) { + $this->changeIgnoreStrictCheck($node->getNode('node')); + } + } + + public function compile(Compiler $compiler): void + { + $compiler->subcompile($this->getNode('node')); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php b/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php new file mode 100644 index 0000000..4cb3ee0 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/DivisiblebyTest.php @@ -0,0 +1,36 @@ + + */ +class DivisiblebyTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(0 == ') + ->subcompile($this->getNode('node')) + ->raw(' % ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php b/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php new file mode 100644 index 0000000..a0e3ed6 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php @@ -0,0 +1,35 @@ + + */ +class EvenTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 0') + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/NullTest.php b/vendor/twig/twig/src/Node/Expression/Test/NullTest.php new file mode 100644 index 0000000..45b54ae --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/NullTest.php @@ -0,0 +1,34 @@ + + */ +class NullTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(null === ') + ->subcompile($this->getNode('node')) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/OddTest.php b/vendor/twig/twig/src/Node/Expression/Test/OddTest.php new file mode 100644 index 0000000..d56c711 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/OddTest.php @@ -0,0 +1,35 @@ + + */ +class OddTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 != 0') + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php b/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php new file mode 100644 index 0000000..c96d2bc --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Test/SameasTest.php @@ -0,0 +1,34 @@ + + */ +class SameasTest extends TestExpression +{ + public function compile(Compiler $compiler): void + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; + } +} diff --git a/vendor/twig/twig/src/Node/Expression/TestExpression.php b/vendor/twig/twig/src/Node/Expression/TestExpression.php new file mode 100644 index 0000000..e518bd8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/TestExpression.php @@ -0,0 +1,42 @@ + $node]; + if (null !== $arguments) { + $nodes['arguments'] = $arguments; + } + + parent::__construct($nodes, ['name' => $name], $lineno); + } + + public function compile(Compiler $compiler): void + { + $name = $this->getAttribute('name'); + $test = $compiler->getEnvironment()->getTest($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'test'); + $this->setAttribute('arguments', $test->getArguments()); + $this->setAttribute('callable', $test->getCallable()); + $this->setAttribute('is_variadic', $test->isVariadic()); + + $this->compileCallable($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php new file mode 100644 index 0000000..e31e3f8 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Unary/AbstractUnary.php @@ -0,0 +1,34 @@ + $node], [], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler->raw(' '); + $this->operator($compiler); + $compiler->subcompile($this->getNode('node')); + } + + abstract public function operator(Compiler $compiler): Compiler; +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php new file mode 100644 index 0000000..dc2f235 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Unary/NegUnary.php @@ -0,0 +1,23 @@ +raw('-'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php new file mode 100644 index 0000000..55c11ba --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Unary/NotUnary.php @@ -0,0 +1,23 @@ +raw('!'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php new file mode 100644 index 0000000..4b0a062 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/Unary/PosUnary.php @@ -0,0 +1,23 @@ +raw('+'); + } +} diff --git a/vendor/twig/twig/src/Node/Expression/VariadicExpression.php b/vendor/twig/twig/src/Node/Expression/VariadicExpression.php new file mode 100644 index 0000000..a1bdb48 --- /dev/null +++ b/vendor/twig/twig/src/Node/Expression/VariadicExpression.php @@ -0,0 +1,24 @@ +raw('...'); + + parent::compile($compiler); + } +} diff --git a/vendor/twig/twig/src/Node/FlushNode.php b/vendor/twig/twig/src/Node/FlushNode.php new file mode 100644 index 0000000..fa50a88 --- /dev/null +++ b/vendor/twig/twig/src/Node/FlushNode.php @@ -0,0 +1,35 @@ + + */ +class FlushNode extends Node +{ + public function __construct(int $lineno, string $tag) + { + parent::__construct([], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write("flush();\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/ForLoopNode.php b/vendor/twig/twig/src/Node/ForLoopNode.php new file mode 100644 index 0000000..d5ce845 --- /dev/null +++ b/vendor/twig/twig/src/Node/ForLoopNode.php @@ -0,0 +1,49 @@ + + */ +class ForLoopNode extends Node +{ + public function __construct(int $lineno, string $tag = null) + { + parent::__construct([], ['with_loop' => false, 'ifexpr' => false, 'else' => false], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + if ($this->getAttribute('else')) { + $compiler->write("\$context['_iterated'] = true;\n"); + } + + if ($this->getAttribute('with_loop')) { + $compiler + ->write("++\$context['loop']['index0'];\n") + ->write("++\$context['loop']['index'];\n") + ->write("\$context['loop']['first'] = false;\n") + ->write("if (isset(\$context['loop']['length'])) {\n") + ->indent() + ->write("--\$context['loop']['revindex0'];\n") + ->write("--\$context['loop']['revindex'];\n") + ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") + ->outdent() + ->write("}\n") + ; + } + } +} diff --git a/vendor/twig/twig/src/Node/ForNode.php b/vendor/twig/twig/src/Node/ForNode.php new file mode 100644 index 0000000..04addfb --- /dev/null +++ b/vendor/twig/twig/src/Node/ForNode.php @@ -0,0 +1,107 @@ + + */ +class ForNode extends Node +{ + private $loop; + + public function __construct(AssignNameExpression $keyTarget, AssignNameExpression $valueTarget, AbstractExpression $seq, ?Node $ifexpr, Node $body, ?Node $else, int $lineno, string $tag = null) + { + $body = new Node([$body, $this->loop = new ForLoopNode($lineno, $tag)]); + + $nodes = ['key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, ['with_loop' => true], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write("\$context['_parent'] = \$context;\n") + ->write("\$context['_seq'] = twig_ensure_traversable(") + ->subcompile($this->getNode('seq')) + ->raw(");\n") + ; + + if ($this->hasNode('else')) { + $compiler->write("\$context['_iterated'] = false;\n"); + } + + if ($this->getAttribute('with_loop')) { + $compiler + ->write("\$context['loop'] = [\n") + ->write(" 'parent' => \$context['_parent'],\n") + ->write(" 'index0' => 0,\n") + ->write(" 'index' => 1,\n") + ->write(" 'first' => true,\n") + ->write("];\n") + ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof \Countable)) {\n") + ->indent() + ->write("\$length = count(\$context['_seq']);\n") + ->write("\$context['loop']['revindex0'] = \$length - 1;\n") + ->write("\$context['loop']['revindex'] = \$length;\n") + ->write("\$context['loop']['length'] = \$length;\n") + ->write("\$context['loop']['last'] = 1 === \$length;\n") + ->outdent() + ->write("}\n") + ; + } + + $this->loop->setAttribute('else', $this->hasNode('else')); + $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); + + $compiler + ->write("foreach (\$context['_seq'] as ") + ->subcompile($this->getNode('key_target')) + ->raw(' => ') + ->subcompile($this->getNode('value_target')) + ->raw(") {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->outdent() + ->write("}\n") + ; + + if ($this->hasNode('else')) { + $compiler + ->write("if (!\$context['_iterated']) {\n") + ->indent() + ->subcompile($this->getNode('else')) + ->outdent() + ->write("}\n") + ; + } + + $compiler->write("\$_parent = \$context['_parent'];\n"); + + // remove some "private" loop variables (needed for nested loops) + $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); + + // keep the values set in the inner context for variables defined in the outer context + $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); + } +} diff --git a/vendor/twig/twig/src/Node/IfNode.php b/vendor/twig/twig/src/Node/IfNode.php new file mode 100644 index 0000000..5fa2008 --- /dev/null +++ b/vendor/twig/twig/src/Node/IfNode.php @@ -0,0 +1,70 @@ + + */ +class IfNode extends Node +{ + public function __construct(Node $tests, ?Node $else, int $lineno, string $tag = null) + { + $nodes = ['tests' => $tests]; + if (null !== $else) { + $nodes['else'] = $else; + } + + parent::__construct($nodes, [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + for ($i = 0, $count = \count($this->getNode('tests')); $i < $count; $i += 2) { + if ($i > 0) { + $compiler + ->outdent() + ->write('} elseif (') + ; + } else { + $compiler + ->write('if (') + ; + } + + $compiler + ->subcompile($this->getNode('tests')->getNode($i)) + ->raw(") {\n") + ->indent() + ->subcompile($this->getNode('tests')->getNode($i + 1)) + ; + } + + if ($this->hasNode('else')) { + $compiler + ->outdent() + ->write("} else {\n") + ->indent() + ->subcompile($this->getNode('else')) + ; + } + + $compiler + ->outdent() + ->write("}\n"); + } +} diff --git a/vendor/twig/twig/src/Node/ImportNode.php b/vendor/twig/twig/src/Node/ImportNode.php new file mode 100644 index 0000000..5378d79 --- /dev/null +++ b/vendor/twig/twig/src/Node/ImportNode.php @@ -0,0 +1,63 @@ + + */ +class ImportNode extends Node +{ + public function __construct(AbstractExpression $expr, AbstractExpression $var, int $lineno, string $tag = null, bool $global = true) + { + parent::__construct(['expr' => $expr, 'var' => $var], ['global' => $global], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('$macros[') + ->repr($this->getNode('var')->getAttribute('name')) + ->raw('] = ') + ; + + if ($this->getAttribute('global')) { + $compiler + ->raw('$this->macros[') + ->repr($this->getNode('var')->getAttribute('name')) + ->raw('] = ') + ; + } + + if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')->getAttribute('name')) { + $compiler->raw('$this'); + } else { + $compiler + ->raw('$this->loadTemplate(') + ->subcompile($this->getNode('expr')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')->unwrap()') + ; + } + + $compiler->raw(";\n"); + } +} diff --git a/vendor/twig/twig/src/Node/IncludeNode.php b/vendor/twig/twig/src/Node/IncludeNode.php new file mode 100644 index 0000000..d540d6b --- /dev/null +++ b/vendor/twig/twig/src/Node/IncludeNode.php @@ -0,0 +1,106 @@ + + */ +class IncludeNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, ?AbstractExpression $variables, bool $only, bool $ignoreMissing, int $lineno, string $tag = null) + { + $nodes = ['expr' => $expr]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => $only, 'ignore_missing' => $ignoreMissing], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + if ($this->getAttribute('ignore_missing')) { + $template = $compiler->getVarName(); + + $compiler + ->write(sprintf("$%s = null;\n", $template)) + ->write("try {\n") + ->indent() + ->write(sprintf('$%s = ', $template)) + ; + + $this->addGetTemplate($compiler); + + $compiler + ->raw(";\n") + ->outdent() + ->write("} catch (LoaderError \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n") + ->write(sprintf("if ($%s) {\n", $template)) + ->indent() + ->write(sprintf('$%s->display(', $template)) + ; + $this->addTemplateArguments($compiler); + $compiler + ->raw(");\n") + ->outdent() + ->write("}\n") + ; + } else { + $this->addGetTemplate($compiler); + $compiler->raw('->display('); + $this->addTemplateArguments($compiler); + $compiler->raw(");\n"); + } + } + + protected function addGetTemplate(Compiler $compiler) + { + $compiler + ->write('$this->loadTemplate(') + ->subcompile($this->getNode('expr')) + ->raw(', ') + ->repr($this->getTemplateName()) + ->raw(', ') + ->repr($this->getTemplateLine()) + ->raw(')') + ; + } + + protected function addTemplateArguments(Compiler $compiler) + { + if (!$this->hasNode('variables')) { + $compiler->raw(false === $this->getAttribute('only') ? '$context' : '[]'); + } elseif (false === $this->getAttribute('only')) { + $compiler + ->raw('twig_array_merge($context, ') + ->subcompile($this->getNode('variables')) + ->raw(')') + ; + } else { + $compiler->raw('twig_to_array('); + $compiler->subcompile($this->getNode('variables')); + $compiler->raw(')'); + } + } +} diff --git a/vendor/twig/twig/src/Node/MacroNode.php b/vendor/twig/twig/src/Node/MacroNode.php new file mode 100644 index 0000000..7f1b24d --- /dev/null +++ b/vendor/twig/twig/src/Node/MacroNode.php @@ -0,0 +1,113 @@ + + */ +class MacroNode extends Node +{ + public const VARARGS_NAME = 'varargs'; + + public function __construct(string $name, Node $body, Node $arguments, int $lineno, string $tag = null) + { + foreach ($arguments as $argumentName => $argument) { + if (self::VARARGS_NAME === $argumentName) { + throw new SyntaxError(sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine(), $argument->getSourceContext()); + } + } + + parent::__construct(['body' => $body, 'arguments' => $arguments], ['name' => $name], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write(sprintf('public function macro_%s(', $this->getAttribute('name'))) + ; + + $count = \count($this->getNode('arguments')); + $pos = 0; + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->raw('$__'.$name.'__ = ') + ->subcompile($default) + ; + + if (++$pos < $count) { + $compiler->raw(', '); + } + } + + if ($count) { + $compiler->raw(', '); + } + + $compiler + ->raw('...$__varargs__') + ->raw(")\n") + ->write("{\n") + ->indent() + ->write("\$macros = \$this->macros;\n") + ->write("\$context = \$this->env->mergeGlobals([\n") + ->indent() + ; + + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->write('') + ->string($name) + ->raw(' => $__'.$name.'__') + ->raw(",\n") + ; + } + + $compiler + ->write('') + ->string(self::VARARGS_NAME) + ->raw(' => ') + ; + + $compiler + ->raw("\$__varargs__,\n") + ->outdent() + ->write("]);\n\n") + ->write("\$blocks = [];\n\n") + ; + if ($compiler->getEnvironment()->isDebug()) { + $compiler->write("ob_start();\n"); + } else { + $compiler->write("ob_start(function () { return ''; });\n"); + } + $compiler + ->write("try {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->raw("\n") + ->write("return ('' === \$tmp = ob_get_contents()) ? '' : new Markup(\$tmp, \$this->env->getCharset());\n") + ->outdent() + ->write("} finally {\n") + ->indent() + ->write("ob_end_clean();\n") + ->outdent() + ->write("}\n") + ->outdent() + ->write("}\n\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/ModuleNode.php b/vendor/twig/twig/src/Node/ModuleNode.php new file mode 100644 index 0000000..e972b6b --- /dev/null +++ b/vendor/twig/twig/src/Node/ModuleNode.php @@ -0,0 +1,464 @@ + + */ +final class ModuleNode extends Node +{ + public function __construct(Node $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) + { + $nodes = [ + 'body' => $body, + 'blocks' => $blocks, + 'macros' => $macros, + 'traits' => $traits, + 'display_start' => new Node(), + 'display_end' => new Node(), + 'constructor_start' => new Node(), + 'constructor_end' => new Node(), + 'class_end' => new Node(), + ]; + if (null !== $parent) { + $nodes['parent'] = $parent; + } + + // embedded templates are set as attributes so that they are only visited once by the visitors + parent::__construct($nodes, [ + 'index' => null, + 'embedded_templates' => $embeddedTemplates, + ], 1); + + // populate the template name of all node children + $this->setSourceContext($source); + } + + public function setIndex($index) + { + $this->setAttribute('index', $index); + } + + public function compile(Compiler $compiler): void + { + $this->compileTemplate($compiler); + + foreach ($this->getAttribute('embedded_templates') as $template) { + $compiler->subcompile($template); + } + } + + protected function compileTemplate(Compiler $compiler) + { + if (!$this->getAttribute('index')) { + $compiler->write('compileClassHeader($compiler); + + $this->compileConstructor($compiler); + + $this->compileGetParent($compiler); + + $this->compileDisplay($compiler); + + $compiler->subcompile($this->getNode('blocks')); + + $this->compileMacros($compiler); + + $this->compileGetTemplateName($compiler); + + $this->compileIsTraitable($compiler); + + $this->compileDebugInfo($compiler); + + $this->compileGetSourceContext($compiler); + + $this->compileClassFooter($compiler); + } + + protected function compileGetParent(Compiler $compiler) + { + if (!$this->hasNode('parent')) { + return; + } + $parent = $this->getNode('parent'); + + $compiler + ->write("protected function doGetParent(array \$context)\n", "{\n") + ->indent() + ->addDebugInfo($parent) + ->write('return ') + ; + + if ($parent instanceof ConstantExpression) { + $compiler->subcompile($parent); + } else { + $compiler + ->raw('$this->loadTemplate(') + ->subcompile($parent) + ->raw(', ') + ->repr($this->getSourceContext()->getName()) + ->raw(', ') + ->repr($parent->getTemplateLine()) + ->raw(')') + ; + } + + $compiler + ->raw(";\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileClassHeader(Compiler $compiler) + { + $compiler + ->write("\n\n") + ; + if (!$this->getAttribute('index')) { + $compiler + ->write("use Twig\Environment;\n") + ->write("use Twig\Error\LoaderError;\n") + ->write("use Twig\Error\RuntimeError;\n") + ->write("use Twig\Extension\SandboxExtension;\n") + ->write("use Twig\Markup;\n") + ->write("use Twig\Sandbox\SecurityError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedTagError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedFilterError;\n") + ->write("use Twig\Sandbox\SecurityNotAllowedFunctionError;\n") + ->write("use Twig\Source;\n") + ->write("use Twig\Template;\n\n") + ; + } + $compiler + // if the template name contains */, add a blank to avoid a PHP parse error + ->write('/* '.str_replace('*/', '* /', $this->getSourceContext()->getName())." */\n") + ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getSourceContext()->getName(), $this->getAttribute('index'))) + ->raw(" extends Template\n") + ->write("{\n") + ->indent() + ->write("private \$source;\n") + ->write("private \$macros = [];\n\n") + ; + } + + protected function compileConstructor(Compiler $compiler) + { + $compiler + ->write("public function __construct(Environment \$env)\n", "{\n") + ->indent() + ->subcompile($this->getNode('constructor_start')) + ->write("parent::__construct(\$env);\n\n") + ->write("\$this->source = \$this->getSourceContext();\n\n") + ; + + // parent + if (!$this->hasNode('parent')) { + $compiler->write("\$this->parent = false;\n\n"); + } + + $countTraits = \count($this->getNode('traits')); + if ($countTraits) { + // traits + foreach ($this->getNode('traits') as $i => $trait) { + $node = $trait->getNode('template'); + + $compiler + ->addDebugInfo($node) + ->write(sprintf('$_trait_%s = $this->loadTemplate(', $i)) + ->subcompile($node) + ->raw(', ') + ->repr($node->getTemplateName()) + ->raw(', ') + ->repr($node->getTemplateLine()) + ->raw(");\n") + ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i)) + ->indent() + ->write("throw new RuntimeError('Template \"'.") + ->subcompile($trait->getNode('template')) + ->raw(".'\" cannot be used as a trait.', ") + ->repr($node->getTemplateLine()) + ->raw(", \$this->source);\n") + ->outdent() + ->write("}\n") + ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i)) + ; + + foreach ($trait->getNode('targets') as $key => $value) { + $compiler + ->write(sprintf('if (!isset($_trait_%s_blocks[', $i)) + ->string($key) + ->raw("])) {\n") + ->indent() + ->write("throw new RuntimeError('Block ") + ->string($key) + ->raw(' is not defined in trait ') + ->subcompile($trait->getNode('template')) + ->raw(".', ") + ->repr($node->getTemplateLine()) + ->raw(", \$this->source);\n") + ->outdent() + ->write("}\n\n") + + ->write(sprintf('$_trait_%s_blocks[', $i)) + ->subcompile($value) + ->raw(sprintf('] = $_trait_%s_blocks[', $i)) + ->string($key) + ->raw(sprintf(']; unset($_trait_%s_blocks[', $i)) + ->string($key) + ->raw("]);\n\n") + ; + } + } + + if ($countTraits > 1) { + $compiler + ->write("\$this->traits = array_merge(\n") + ->indent() + ; + + for ($i = 0; $i < $countTraits; ++$i) { + $compiler + ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i)) + ; + } + + $compiler + ->outdent() + ->write(");\n\n") + ; + } else { + $compiler + ->write("\$this->traits = \$_trait_0_blocks;\n\n") + ; + } + + $compiler + ->write("\$this->blocks = array_merge(\n") + ->indent() + ->write("\$this->traits,\n") + ->write("[\n") + ; + } else { + $compiler + ->write("\$this->blocks = [\n") + ; + } + + // blocks + $compiler + ->indent() + ; + + foreach ($this->getNode('blocks') as $name => $node) { + $compiler + ->write(sprintf("'%s' => [\$this, 'block_%s'],\n", $name, $name)) + ; + } + + if ($countTraits) { + $compiler + ->outdent() + ->write("]\n") + ->outdent() + ->write(");\n") + ; + } else { + $compiler + ->outdent() + ->write("];\n") + ; + } + + $compiler + ->subcompile($this->getNode('constructor_end')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDisplay(Compiler $compiler) + { + $compiler + ->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n") + ->indent() + ->write("\$macros = \$this->macros;\n") + ->subcompile($this->getNode('display_start')) + ->subcompile($this->getNode('body')) + ; + + if ($this->hasNode('parent')) { + $parent = $this->getNode('parent'); + + $compiler->addDebugInfo($parent); + if ($parent instanceof ConstantExpression) { + $compiler + ->write('$this->parent = $this->loadTemplate(') + ->subcompile($parent) + ->raw(', ') + ->repr($this->getSourceContext()->getName()) + ->raw(', ') + ->repr($parent->getTemplateLine()) + ->raw(");\n") + ; + $compiler->write('$this->parent'); + } else { + $compiler->write('$this->getParent($context)'); + } + $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); + } + + $compiler + ->subcompile($this->getNode('display_end')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileClassFooter(Compiler $compiler) + { + $compiler + ->subcompile($this->getNode('class_end')) + ->outdent() + ->write("}\n") + ; + } + + protected function compileMacros(Compiler $compiler) + { + $compiler->subcompile($this->getNode('macros')); + } + + protected function compileGetTemplateName(Compiler $compiler) + { + $compiler + ->write("public function getTemplateName()\n", "{\n") + ->indent() + ->write('return ') + ->repr($this->getSourceContext()->getName()) + ->raw(";\n") + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileIsTraitable(Compiler $compiler) + { + // A template can be used as a trait if: + // * it has no parent + // * it has no macros + // * it has no body + // + // Put another way, a template can be used as a trait if it + // only contains blocks and use statements. + $traitable = !$this->hasNode('parent') && 0 === \count($this->getNode('macros')); + if ($traitable) { + if ($this->getNode('body') instanceof BodyNode) { + $nodes = $this->getNode('body')->getNode(0); + } else { + $nodes = $this->getNode('body'); + } + + if (!\count($nodes)) { + $nodes = new Node([$nodes]); + } + + foreach ($nodes as $node) { + if (!\count($node)) { + continue; + } + + if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { + continue; + } + + if ($node instanceof BlockReferenceNode) { + continue; + } + + $traitable = false; + break; + } + } + + if ($traitable) { + return; + } + + $compiler + ->write("public function isTraitable()\n", "{\n") + ->indent() + ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDebugInfo(Compiler $compiler) + { + $compiler + ->write("public function getDebugInfo()\n", "{\n") + ->indent() + ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) + ->outdent() + ->write("}\n\n") + ; + } + + protected function compileGetSourceContext(Compiler $compiler) + { + $compiler + ->write("public function getSourceContext()\n", "{\n") + ->indent() + ->write('return new Source(') + ->string($compiler->getEnvironment()->isDebug() ? $this->getSourceContext()->getCode() : '') + ->raw(', ') + ->string($this->getSourceContext()->getName()) + ->raw(', ') + ->string($this->getSourceContext()->getPath()) + ->raw(");\n") + ->outdent() + ->write("}\n") + ; + } + + protected function compileLoadTemplate(Compiler $compiler, $node, $var) + { + if ($node instanceof ConstantExpression) { + $compiler + ->write(sprintf('%s = $this->loadTemplate(', $var)) + ->subcompile($node) + ->raw(', ') + ->repr($node->getTemplateName()) + ->raw(', ') + ->repr($node->getTemplateLine()) + ->raw(");\n") + ; + } else { + throw new \LogicException('Trait templates can only be constant nodes.'); + } + } +} diff --git a/vendor/twig/twig/src/Node/Node.php b/vendor/twig/twig/src/Node/Node.php new file mode 100644 index 0000000..c0558b9 --- /dev/null +++ b/vendor/twig/twig/src/Node/Node.php @@ -0,0 +1,179 @@ + + */ +class Node implements \Countable, \IteratorAggregate +{ + protected $nodes; + protected $attributes; + protected $lineno; + protected $tag; + + private $name; + private $sourceContext; + + /** + * @param array $nodes An array of named nodes + * @param array $attributes An array of attributes (should not be nodes) + * @param int $lineno The line number + * @param string $tag The tag name associated with the Node + */ + public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0, string $tag = null) + { + foreach ($nodes as $name => $node) { + if (!$node instanceof self) { + throw new \InvalidArgumentException(sprintf('Using "%s" for the value of node "%s" of "%s" is not supported. You must pass a \Twig\Node\Node instance.', \is_object($node) ? \get_class($node) : (null === $node ? 'null' : \gettype($node)), $name, static::class)); + } + } + $this->nodes = $nodes; + $this->attributes = $attributes; + $this->lineno = $lineno; + $this->tag = $tag; + } + + public function __toString() + { + $attributes = []; + foreach ($this->attributes as $name => $value) { + $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); + } + + $repr = [static::class.'('.implode(', ', $attributes)]; + + if (\count($this->nodes)) { + foreach ($this->nodes as $name => $node) { + $len = \strlen($name) + 4; + $noderepr = []; + foreach (explode("\n", (string) $node) as $line) { + $noderepr[] = str_repeat(' ', $len).$line; + } + + $repr[] = sprintf(' %s: %s', $name, ltrim(implode("\n", $noderepr))); + } + + $repr[] = ')'; + } else { + $repr[0] .= ')'; + } + + return implode("\n", $repr); + } + + /** + * @return void + */ + public function compile(Compiler $compiler) + { + foreach ($this->nodes as $node) { + $node->compile($compiler); + } + } + + public function getTemplateLine(): int + { + return $this->lineno; + } + + public function getNodeTag(): ?string + { + return $this->tag; + } + + public function hasAttribute(string $name): bool + { + return \array_key_exists($name, $this->attributes); + } + + public function getAttribute(string $name) + { + if (!\array_key_exists($name, $this->attributes)) { + throw new \LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, static::class)); + } + + return $this->attributes[$name]; + } + + public function setAttribute(string $name, $value): void + { + $this->attributes[$name] = $value; + } + + public function removeAttribute(string $name): void + { + unset($this->attributes[$name]); + } + + public function hasNode(string $name): bool + { + return isset($this->nodes[$name]); + } + + public function getNode(string $name): self + { + if (!isset($this->nodes[$name])) { + throw new \LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, static::class)); + } + + return $this->nodes[$name]; + } + + public function setNode(string $name, self $node): void + { + $this->nodes[$name] = $node; + } + + public function removeNode(string $name): void + { + unset($this->nodes[$name]); + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return \count($this->nodes); + } + + public function getIterator(): \Traversable + { + return new \ArrayIterator($this->nodes); + } + + public function getTemplateName(): ?string + { + return $this->sourceContext ? $this->sourceContext->getName() : null; + } + + public function setSourceContext(Source $source): void + { + $this->sourceContext = $source; + foreach ($this->nodes as $node) { + $node->setSourceContext($source); + } + } + + public function getSourceContext(): ?Source + { + return $this->sourceContext; + } +} diff --git a/vendor/twig/twig/src/Node/NodeCaptureInterface.php b/vendor/twig/twig/src/Node/NodeCaptureInterface.php new file mode 100644 index 0000000..9fb6a0c --- /dev/null +++ b/vendor/twig/twig/src/Node/NodeCaptureInterface.php @@ -0,0 +1,21 @@ + + */ +interface NodeCaptureInterface +{ +} diff --git a/vendor/twig/twig/src/Node/NodeOutputInterface.php b/vendor/twig/twig/src/Node/NodeOutputInterface.php new file mode 100644 index 0000000..5e35b40 --- /dev/null +++ b/vendor/twig/twig/src/Node/NodeOutputInterface.php @@ -0,0 +1,21 @@ + + */ +interface NodeOutputInterface +{ +} diff --git a/vendor/twig/twig/src/Node/PrintNode.php b/vendor/twig/twig/src/Node/PrintNode.php new file mode 100644 index 0000000..60386d2 --- /dev/null +++ b/vendor/twig/twig/src/Node/PrintNode.php @@ -0,0 +1,39 @@ + + */ +class PrintNode extends Node implements NodeOutputInterface +{ + public function __construct(AbstractExpression $expr, int $lineno, string $tag = null) + { + parent::__construct(['expr' => $expr], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('echo ') + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/SandboxNode.php b/vendor/twig/twig/src/Node/SandboxNode.php new file mode 100644 index 0000000..4d5666b --- /dev/null +++ b/vendor/twig/twig/src/Node/SandboxNode.php @@ -0,0 +1,52 @@ + + */ +class SandboxNode extends Node +{ + public function __construct(Node $body, int $lineno, string $tag = null) + { + parent::__construct(['body' => $body], [], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n") + ->indent() + ->write("\$this->sandbox->enableSandbox();\n") + ->outdent() + ->write("}\n") + ->write("try {\n") + ->indent() + ->subcompile($this->getNode('body')) + ->outdent() + ->write("} finally {\n") + ->indent() + ->write("if (!\$alreadySandboxed) {\n") + ->indent() + ->write("\$this->sandbox->disableSandbox();\n") + ->outdent() + ->write("}\n") + ->outdent() + ->write("}\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/SetNode.php b/vendor/twig/twig/src/Node/SetNode.php new file mode 100644 index 0000000..96b6bd8 --- /dev/null +++ b/vendor/twig/twig/src/Node/SetNode.php @@ -0,0 +1,105 @@ + + */ +class SetNode extends Node implements NodeCaptureInterface +{ + public function __construct(bool $capture, Node $names, Node $values, int $lineno, string $tag = null) + { + parent::__construct(['names' => $names, 'values' => $values], ['capture' => $capture, 'safe' => false], $lineno, $tag); + + /* + * Optimizes the node when capture is used for a large block of text. + * + * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new Twig\Markup("foo"); + */ + if ($this->getAttribute('capture')) { + $this->setAttribute('safe', true); + + $values = $this->getNode('values'); + if ($values instanceof TextNode) { + $this->setNode('values', new ConstantExpression($values->getAttribute('data'), $values->getTemplateLine())); + $this->setAttribute('capture', false); + } + } + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('list('); + foreach ($this->getNode('names') as $idx => $node) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($node); + } + $compiler->raw(')'); + } else { + if ($this->getAttribute('capture')) { + if ($compiler->getEnvironment()->isDebug()) { + $compiler->write("ob_start();\n"); + } else { + $compiler->write("ob_start(function () { return ''; });\n"); + } + $compiler + ->subcompile($this->getNode('values')) + ; + } + + $compiler->subcompile($this->getNode('names'), false); + + if ($this->getAttribute('capture')) { + $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Markup(\$tmp, \$this->env->getCharset())"); + } + } + + if (!$this->getAttribute('capture')) { + $compiler->raw(' = '); + + if (\count($this->getNode('names')) > 1) { + $compiler->write('['); + foreach ($this->getNode('values') as $idx => $value) { + if ($idx) { + $compiler->raw(', '); + } + + $compiler->subcompile($value); + } + $compiler->raw(']'); + } else { + if ($this->getAttribute('safe')) { + $compiler + ->raw("('' === \$tmp = ") + ->subcompile($this->getNode('values')) + ->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())") + ; + } else { + $compiler->subcompile($this->getNode('values')); + } + } + } + + $compiler->raw(";\n"); + } +} diff --git a/vendor/twig/twig/src/Node/TextNode.php b/vendor/twig/twig/src/Node/TextNode.php new file mode 100644 index 0000000..d74ebe6 --- /dev/null +++ b/vendor/twig/twig/src/Node/TextNode.php @@ -0,0 +1,38 @@ + + */ +class TextNode extends Node implements NodeOutputInterface +{ + public function __construct(string $data, int $lineno) + { + parent::__construct([], ['data' => $data], $lineno); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->addDebugInfo($this) + ->write('echo ') + ->string($this->getAttribute('data')) + ->raw(";\n") + ; + } +} diff --git a/vendor/twig/twig/src/Node/WithNode.php b/vendor/twig/twig/src/Node/WithNode.php new file mode 100644 index 0000000..56a3344 --- /dev/null +++ b/vendor/twig/twig/src/Node/WithNode.php @@ -0,0 +1,70 @@ + + */ +class WithNode extends Node +{ + public function __construct(Node $body, ?Node $variables, bool $only, int $lineno, string $tag = null) + { + $nodes = ['body' => $body]; + if (null !== $variables) { + $nodes['variables'] = $variables; + } + + parent::__construct($nodes, ['only' => $only], $lineno, $tag); + } + + public function compile(Compiler $compiler): void + { + $compiler->addDebugInfo($this); + + $parentContextName = $compiler->getVarName(); + + $compiler->write(sprintf("\$%s = \$context;\n", $parentContextName)); + + if ($this->hasNode('variables')) { + $node = $this->getNode('variables'); + $varsName = $compiler->getVarName(); + $compiler + ->write(sprintf('$%s = ', $varsName)) + ->subcompile($node) + ->raw(";\n") + ->write(sprintf("if (!twig_test_iterable(\$%s)) {\n", $varsName)) + ->indent() + ->write("throw new RuntimeError('Variables passed to the \"with\" tag must be a hash.', ") + ->repr($node->getTemplateLine()) + ->raw(", \$this->getSourceContext());\n") + ->outdent() + ->write("}\n") + ->write(sprintf("\$%s = twig_to_array(\$%s);\n", $varsName, $varsName)) + ; + + if ($this->getAttribute('only')) { + $compiler->write("\$context = [];\n"); + } + + $compiler->write(sprintf("\$context = \$this->env->mergeGlobals(array_merge(\$context, \$%s));\n", $varsName)); + } + + $compiler + ->subcompile($this->getNode('body')) + ->write(sprintf("\$context = \$%s;\n", $parentContextName)) + ; + } +} diff --git a/vendor/twig/twig/src/NodeTraverser.php b/vendor/twig/twig/src/NodeTraverser.php new file mode 100644 index 0000000..47a2d5c --- /dev/null +++ b/vendor/twig/twig/src/NodeTraverser.php @@ -0,0 +1,76 @@ + + */ +final class NodeTraverser +{ + private $env; + private $visitors = []; + + /** + * @param NodeVisitorInterface[] $visitors + */ + public function __construct(Environment $env, array $visitors = []) + { + $this->env = $env; + foreach ($visitors as $visitor) { + $this->addVisitor($visitor); + } + } + + public function addVisitor(NodeVisitorInterface $visitor): void + { + $this->visitors[$visitor->getPriority()][] = $visitor; + } + + /** + * Traverses a node and calls the registered visitors. + */ + public function traverse(Node $node): Node + { + ksort($this->visitors); + foreach ($this->visitors as $visitors) { + foreach ($visitors as $visitor) { + $node = $this->traverseForVisitor($visitor, $node); + } + } + + return $node; + } + + private function traverseForVisitor(NodeVisitorInterface $visitor, Node $node): ?Node + { + $node = $visitor->enterNode($node, $this->env); + + foreach ($node as $k => $n) { + if (null !== $m = $this->traverseForVisitor($visitor, $n)) { + if ($m !== $n) { + $node->setNode($k, $m); + } + } else { + $node->removeNode($k); + } + } + + return $visitor->leaveNode($node, $this->env); + } +} diff --git a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php new file mode 100644 index 0000000..d7036ae --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php @@ -0,0 +1,49 @@ + + */ +abstract class AbstractNodeVisitor implements NodeVisitorInterface +{ + final public function enterNode(Node $node, Environment $env): Node + { + return $this->doEnterNode($node, $env); + } + + final public function leaveNode(Node $node, Environment $env): ?Node + { + return $this->doLeaveNode($node, $env); + } + + /** + * Called before child nodes are visited. + * + * @return Node The modified node + */ + abstract protected function doEnterNode(Node $node, Environment $env); + + /** + * Called after child nodes are visited. + * + * @return Node|null The modified node or null if the node must be removed + */ + abstract protected function doLeaveNode(Node $node, Environment $env); +} diff --git a/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php new file mode 100644 index 0000000..fe56ea3 --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php @@ -0,0 +1,208 @@ + + * + * @internal + */ +final class EscaperNodeVisitor implements NodeVisitorInterface +{ + private $statusStack = []; + private $blocks = []; + private $safeAnalysis; + private $traverser; + private $defaultStrategy = false; + private $safeVars = []; + + public function __construct() + { + $this->safeAnalysis = new SafeAnalysisNodeVisitor(); + } + + public function enterNode(Node $node, Environment $env): Node + { + if ($node instanceof ModuleNode) { + if ($env->hasExtension(EscaperExtension::class) && $defaultStrategy = $env->getExtension(EscaperExtension::class)->getDefaultStrategy($node->getTemplateName())) { + $this->defaultStrategy = $defaultStrategy; + } + $this->safeVars = []; + $this->blocks = []; + } elseif ($node instanceof AutoEscapeNode) { + $this->statusStack[] = $node->getAttribute('value'); + } elseif ($node instanceof BlockNode) { + $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); + } elseif ($node instanceof ImportNode) { + $this->safeVars[] = $node->getNode('var')->getAttribute('name'); + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if ($node instanceof ModuleNode) { + $this->defaultStrategy = false; + $this->safeVars = []; + $this->blocks = []; + } elseif ($node instanceof FilterExpression) { + return $this->preEscapeFilterNode($node, $env); + } elseif ($node instanceof PrintNode && false !== $type = $this->needEscaping($env)) { + $expression = $node->getNode('expr'); + if ($expression instanceof ConditionalExpression && $this->shouldUnwrapConditional($expression, $env, $type)) { + return new DoNode($this->unwrapConditional($expression, $env, $type), $expression->getTemplateLine()); + } + + return $this->escapePrintNode($node, $env, $type); + } + + if ($node instanceof AutoEscapeNode || $node instanceof BlockNode) { + array_pop($this->statusStack); + } elseif ($node instanceof BlockReferenceNode) { + $this->blocks[$node->getAttribute('name')] = $this->needEscaping($env); + } + + return $node; + } + + private function shouldUnwrapConditional(ConditionalExpression $expression, Environment $env, string $type): bool + { + $expr2Safe = $this->isSafeFor($type, $expression->getNode('expr2'), $env); + $expr3Safe = $this->isSafeFor($type, $expression->getNode('expr3'), $env); + + return $expr2Safe !== $expr3Safe; + } + + private function unwrapConditional(ConditionalExpression $expression, Environment $env, string $type): ConditionalExpression + { + // convert "echo a ? b : c" to "a ? echo b : echo c" recursively + $expr2 = $expression->getNode('expr2'); + if ($expr2 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr2, $env, $type)) { + $expr2 = $this->unwrapConditional($expr2, $env, $type); + } else { + $expr2 = $this->escapeInlinePrintNode(new InlinePrint($expr2, $expr2->getTemplateLine()), $env, $type); + } + $expr3 = $expression->getNode('expr3'); + if ($expr3 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr3, $env, $type)) { + $expr3 = $this->unwrapConditional($expr3, $env, $type); + } else { + $expr3 = $this->escapeInlinePrintNode(new InlinePrint($expr3, $expr3->getTemplateLine()), $env, $type); + } + + return new ConditionalExpression($expression->getNode('expr1'), $expr2, $expr3, $expression->getTemplateLine()); + } + + private function escapeInlinePrintNode(InlinePrint $node, Environment $env, string $type): Node + { + $expression = $node->getNode('node'); + + if ($this->isSafeFor($type, $expression, $env)) { + return $node; + } + + return new InlinePrint($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); + } + + private function escapePrintNode(PrintNode $node, Environment $env, string $type): Node + { + if (false === $type) { + return $node; + } + + $expression = $node->getNode('expr'); + + if ($this->isSafeFor($type, $expression, $env)) { + return $node; + } + + $class = \get_class($node); + + return new $class($this->getEscaperFilter($type, $expression), $node->getTemplateLine()); + } + + private function preEscapeFilterNode(FilterExpression $filter, Environment $env): FilterExpression + { + $name = $filter->getNode('filter')->getAttribute('value'); + + $type = $env->getFilter($name)->getPreEscape(); + if (null === $type) { + return $filter; + } + + $node = $filter->getNode('node'); + if ($this->isSafeFor($type, $node, $env)) { + return $filter; + } + + $filter->setNode('node', $this->getEscaperFilter($type, $node)); + + return $filter; + } + + private function isSafeFor(string $type, Node $expression, Environment $env): bool + { + $safe = $this->safeAnalysis->getSafe($expression); + + if (null === $safe) { + if (null === $this->traverser) { + $this->traverser = new NodeTraverser($env, [$this->safeAnalysis]); + } + + $this->safeAnalysis->setSafeVars($this->safeVars); + + $this->traverser->traverse($expression); + $safe = $this->safeAnalysis->getSafe($expression); + } + + return \in_array($type, $safe) || \in_array('all', $safe); + } + + private function needEscaping(Environment $env) + { + if (\count($this->statusStack)) { + return $this->statusStack[\count($this->statusStack) - 1]; + } + + return $this->defaultStrategy ? $this->defaultStrategy : false; + } + + private function getEscaperFilter(string $type, Node $node): FilterExpression + { + $line = $node->getTemplateLine(); + $name = new ConstantExpression('escape', $line); + $args = new Node([new ConstantExpression($type, $line), new ConstantExpression(null, $line), new ConstantExpression(true, $line)]); + + return new FilterExpression($node, $name, $args, $line); + } + + public function getPriority(): int + { + return 0; + } +} diff --git a/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php new file mode 100644 index 0000000..af477e6 --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php @@ -0,0 +1,74 @@ + + * + * @internal + */ +final class MacroAutoImportNodeVisitor implements NodeVisitorInterface +{ + private $inAModule = false; + private $hasMacroCalls = false; + + public function enterNode(Node $node, Environment $env): Node + { + if ($node instanceof ModuleNode) { + $this->inAModule = true; + $this->hasMacroCalls = false; + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): Node + { + if ($node instanceof ModuleNode) { + $this->inAModule = false; + if ($this->hasMacroCalls) { + $node->getNode('constructor_end')->setNode('_auto_macro_import', new ImportNode(new NameExpression('_self', 0), new AssignNameExpression('_self', 0), 0, 'import', true)); + } + } elseif ($this->inAModule) { + if ( + $node instanceof GetAttrExpression && + $node->getNode('node') instanceof NameExpression && + '_self' === $node->getNode('node')->getAttribute('name') && + $node->getNode('attribute') instanceof ConstantExpression + ) { + $this->hasMacroCalls = true; + + $name = $node->getNode('attribute')->getAttribute('value'); + $node = new MethodCallExpression($node->getNode('node'), 'macro_'.$name, $node->getNode('arguments'), $node->getTemplateLine()); + $node->setAttribute('safe', true); + } + } + + return $node; + } + + public function getPriority(): int + { + // we must be ran before auto-escaping + return -10; + } +} diff --git a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php new file mode 100644 index 0000000..59e836d --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php @@ -0,0 +1,46 @@ + + */ +interface NodeVisitorInterface +{ + /** + * Called before child nodes are visited. + * + * @return Node The modified node + */ + public function enterNode(Node $node, Environment $env): Node; + + /** + * Called after child nodes are visited. + * + * @return Node|null The modified node or null if the node must be removed + */ + public function leaveNode(Node $node, Environment $env): ?Node; + + /** + * Returns the priority for this visitor. + * + * Priority should be between -10 and 10 (0 is the default). + * + * @return int The priority level + */ + public function getPriority(); +} diff --git a/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php new file mode 100644 index 0000000..7ac75e4 --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php @@ -0,0 +1,217 @@ + + * + * @internal + */ +final class OptimizerNodeVisitor implements NodeVisitorInterface +{ + public const OPTIMIZE_ALL = -1; + public const OPTIMIZE_NONE = 0; + public const OPTIMIZE_FOR = 2; + public const OPTIMIZE_RAW_FILTER = 4; + + private $loops = []; + private $loopsTargets = []; + private $optimizers; + + /** + * @param int $optimizers The optimizer mode + */ + public function __construct(int $optimizers = -1) + { + if ($optimizers > (self::OPTIMIZE_FOR | self::OPTIMIZE_RAW_FILTER)) { + throw new \InvalidArgumentException(sprintf('Optimizer mode "%s" is not valid.', $optimizers)); + } + + $this->optimizers = $optimizers; + } + + public function enterNode(Node $node, Environment $env): Node + { + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->enterOptimizeFor($node, $env); + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { + $this->leaveOptimizeFor($node, $env); + } + + if (self::OPTIMIZE_RAW_FILTER === (self::OPTIMIZE_RAW_FILTER & $this->optimizers)) { + $node = $this->optimizeRawFilter($node, $env); + } + + $node = $this->optimizePrintNode($node, $env); + + return $node; + } + + /** + * Optimizes print nodes. + * + * It replaces: + * + * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" + */ + private function optimizePrintNode(Node $node, Environment $env): Node + { + if (!$node instanceof PrintNode) { + return $node; + } + + $exprNode = $node->getNode('expr'); + if ( + $exprNode instanceof BlockReferenceExpression || + $exprNode instanceof ParentExpression + ) { + $exprNode->setAttribute('output', true); + + return $exprNode; + } + + return $node; + } + + /** + * Removes "raw" filters. + */ + private function optimizeRawFilter(Node $node, Environment $env): Node + { + if ($node instanceof FilterExpression && 'raw' == $node->getNode('filter')->getAttribute('value')) { + return $node->getNode('node'); + } + + return $node; + } + + /** + * Optimizes "for" tag by removing the "loop" variable creation whenever possible. + */ + private function enterOptimizeFor(Node $node, Environment $env): void + { + if ($node instanceof ForNode) { + // disable the loop variable by default + $node->setAttribute('with_loop', false); + array_unshift($this->loops, $node); + array_unshift($this->loopsTargets, $node->getNode('value_target')->getAttribute('name')); + array_unshift($this->loopsTargets, $node->getNode('key_target')->getAttribute('name')); + } elseif (!$this->loops) { + // we are outside a loop + return; + } + + // when do we need to add the loop variable back? + + // the loop variable is referenced for the current loop + elseif ($node instanceof NameExpression && 'loop' === $node->getAttribute('name')) { + $node->setAttribute('always_defined', true); + $this->addLoopToCurrent(); + } + + // optimize access to loop targets + elseif ($node instanceof NameExpression && \in_array($node->getAttribute('name'), $this->loopsTargets)) { + $node->setAttribute('always_defined', true); + } + + // block reference + elseif ($node instanceof BlockReferenceNode || $node instanceof BlockReferenceExpression) { + $this->addLoopToCurrent(); + } + + // include without the only attribute + elseif ($node instanceof IncludeNode && !$node->getAttribute('only')) { + $this->addLoopToAll(); + } + + // include function without the with_context=false parameter + elseif ($node instanceof FunctionExpression + && 'include' === $node->getAttribute('name') + && (!$node->getNode('arguments')->hasNode('with_context') + || false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value') + ) + ) { + $this->addLoopToAll(); + } + + // the loop variable is referenced via an attribute + elseif ($node instanceof GetAttrExpression + && (!$node->getNode('attribute') instanceof ConstantExpression + || 'parent' === $node->getNode('attribute')->getAttribute('value') + ) + && (true === $this->loops[0]->getAttribute('with_loop') + || ($node->getNode('node') instanceof NameExpression + && 'loop' === $node->getNode('node')->getAttribute('name') + ) + ) + ) { + $this->addLoopToAll(); + } + } + + /** + * Optimizes "for" tag by removing the "loop" variable creation whenever possible. + */ + private function leaveOptimizeFor(Node $node, Environment $env): void + { + if ($node instanceof ForNode) { + array_shift($this->loops); + array_shift($this->loopsTargets); + array_shift($this->loopsTargets); + } + } + + private function addLoopToCurrent(): void + { + $this->loops[0]->setAttribute('with_loop', true); + } + + private function addLoopToAll(): void + { + foreach ($this->loops as $loop) { + $loop->setAttribute('with_loop', true); + } + } + + public function getPriority(): int + { + return 255; + } +} diff --git a/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php new file mode 100644 index 0000000..90d6f2e --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php @@ -0,0 +1,160 @@ +safeVars = $safeVars; + } + + public function getSafe(Node $node) + { + $hash = spl_object_hash($node); + if (!isset($this->data[$hash])) { + return; + } + + foreach ($this->data[$hash] as $bucket) { + if ($bucket['key'] !== $node) { + continue; + } + + if (\in_array('html_attr', $bucket['value'])) { + $bucket['value'][] = 'html'; + } + + return $bucket['value']; + } + } + + private function setSafe(Node $node, array $safe): void + { + $hash = spl_object_hash($node); + if (isset($this->data[$hash])) { + foreach ($this->data[$hash] as &$bucket) { + if ($bucket['key'] === $node) { + $bucket['value'] = $safe; + + return; + } + } + } + $this->data[$hash][] = [ + 'key' => $node, + 'value' => $safe, + ]; + } + + public function enterNode(Node $node, Environment $env): Node + { + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if ($node instanceof ConstantExpression) { + // constants are marked safe for all + $this->setSafe($node, ['all']); + } elseif ($node instanceof BlockReferenceExpression) { + // blocks are safe by definition + $this->setSafe($node, ['all']); + } elseif ($node instanceof ParentExpression) { + // parent block is safe by definition + $this->setSafe($node, ['all']); + } elseif ($node instanceof ConditionalExpression) { + // intersect safeness of both operands + $safe = $this->intersectSafe($this->getSafe($node->getNode('expr2')), $this->getSafe($node->getNode('expr3'))); + $this->setSafe($node, $safe); + } elseif ($node instanceof FilterExpression) { + // filter expression is safe when the filter is safe + $name = $node->getNode('filter')->getAttribute('value'); + $args = $node->getNode('arguments'); + if ($filter = $env->getFilter($name)) { + $safe = $filter->getSafe($args); + if (null === $safe) { + $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); + } + $this->setSafe($node, $safe); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof FunctionExpression) { + // function expression is safe when the function is safe + $name = $node->getAttribute('name'); + $args = $node->getNode('arguments'); + if ($function = $env->getFunction($name)) { + $this->setSafe($node, $function->getSafe($args)); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof MethodCallExpression) { + if ($node->getAttribute('safe')) { + $this->setSafe($node, ['all']); + } else { + $this->setSafe($node, []); + } + } elseif ($node instanceof GetAttrExpression && $node->getNode('node') instanceof NameExpression) { + $name = $node->getNode('node')->getAttribute('name'); + if (\in_array($name, $this->safeVars)) { + $this->setSafe($node, ['all']); + } else { + $this->setSafe($node, []); + } + } else { + $this->setSafe($node, []); + } + + return $node; + } + + private function intersectSafe(array $a = null, array $b = null): array + { + if (null === $a || null === $b) { + return []; + } + + if (\in_array('all', $a)) { + return $b; + } + + if (\in_array('all', $b)) { + return $a; + } + + return array_intersect($a, $b); + } + + public function getPriority(): int + { + return 0; + } +} diff --git a/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php new file mode 100644 index 0000000..1446cee --- /dev/null +++ b/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php @@ -0,0 +1,136 @@ + + * + * @internal + */ +final class SandboxNodeVisitor implements NodeVisitorInterface +{ + private $inAModule = false; + private $tags; + private $filters; + private $functions; + private $needsToStringWrap = false; + + public function enterNode(Node $node, Environment $env): Node + { + if ($node instanceof ModuleNode) { + $this->inAModule = true; + $this->tags = []; + $this->filters = []; + $this->functions = []; + + return $node; + } elseif ($this->inAModule) { + // look for tags + if ($node->getNodeTag() && !isset($this->tags[$node->getNodeTag()])) { + $this->tags[$node->getNodeTag()] = $node; + } + + // look for filters + if ($node instanceof FilterExpression && !isset($this->filters[$node->getNode('filter')->getAttribute('value')])) { + $this->filters[$node->getNode('filter')->getAttribute('value')] = $node; + } + + // look for functions + if ($node instanceof FunctionExpression && !isset($this->functions[$node->getAttribute('name')])) { + $this->functions[$node->getAttribute('name')] = $node; + } + + // the .. operator is equivalent to the range() function + if ($node instanceof RangeBinary && !isset($this->functions['range'])) { + $this->functions['range'] = $node; + } + + if ($node instanceof PrintNode) { + $this->needsToStringWrap = true; + $this->wrapNode($node, 'expr'); + } + + if ($node instanceof SetNode && !$node->getAttribute('capture')) { + $this->needsToStringWrap = true; + } + + // wrap outer nodes that can implicitly call __toString() + if ($this->needsToStringWrap) { + if ($node instanceof ConcatBinary) { + $this->wrapNode($node, 'left'); + $this->wrapNode($node, 'right'); + } + if ($node instanceof FilterExpression) { + $this->wrapNode($node, 'node'); + $this->wrapArrayNode($node, 'arguments'); + } + if ($node instanceof FunctionExpression) { + $this->wrapArrayNode($node, 'arguments'); + } + } + } + + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if ($node instanceof ModuleNode) { + $this->inAModule = false; + + $node->setNode('constructor_end', new Node([new CheckSecurityCallNode(), $node->getNode('constructor_end')])); + $node->setNode('class_end', new Node([new CheckSecurityNode($this->filters, $this->tags, $this->functions), $node->getNode('class_end')])); + } elseif ($this->inAModule) { + if ($node instanceof PrintNode || $node instanceof SetNode) { + $this->needsToStringWrap = false; + } + } + + return $node; + } + + private function wrapNode(Node $node, string $name): void + { + $expr = $node->getNode($name); + if ($expr instanceof NameExpression || $expr instanceof GetAttrExpression) { + $node->setNode($name, new CheckToStringNode($expr)); + } + } + + private function wrapArrayNode(Node $node, string $name): void + { + $args = $node->getNode($name); + foreach ($args as $name => $_) { + $this->wrapNode($args, $name); + } + } + + public function getPriority(): int + { + return 0; + } +} diff --git a/vendor/twig/twig/src/Parser.php b/vendor/twig/twig/src/Parser.php new file mode 100644 index 0000000..4428208 --- /dev/null +++ b/vendor/twig/twig/src/Parser.php @@ -0,0 +1,348 @@ + + */ +class Parser +{ + private $stack = []; + private $stream; + private $parent; + private $visitors; + private $expressionParser; + private $blocks; + private $blockStack; + private $macros; + private $env; + private $importedSymbols; + private $traits; + private $embeddedTemplates = []; + private $varNameSalt = 0; + + public function __construct(Environment $env) + { + $this->env = $env; + } + + public function getVarName(): string + { + return sprintf('__internal_parse_%d', $this->varNameSalt++); + } + + public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode + { + $vars = get_object_vars($this); + unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames'], $vars['varNameSalt']); + $this->stack[] = $vars; + + // node visitors + if (null === $this->visitors) { + $this->visitors = $this->env->getNodeVisitors(); + } + + if (null === $this->expressionParser) { + $this->expressionParser = new ExpressionParser($this, $this->env); + } + + $this->stream = $stream; + $this->parent = null; + $this->blocks = []; + $this->macros = []; + $this->traits = []; + $this->blockStack = []; + $this->importedSymbols = [[]]; + $this->embeddedTemplates = []; + + try { + $body = $this->subparse($test, $dropNeedle); + + if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { + $body = new Node(); + } + } catch (SyntaxError $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->stream->getSourceContext()); + } + + if (!$e->getTemplateLine()) { + $e->setTemplateLine($this->stream->getCurrent()->getLine()); + } + + throw $e; + } + + $node = new ModuleNode(new BodyNode([$body]), $this->parent, new Node($this->blocks), new Node($this->macros), new Node($this->traits), $this->embeddedTemplates, $stream->getSourceContext()); + + $traverser = new NodeTraverser($this->env, $this->visitors); + + $node = $traverser->traverse($node); + + // restore previous stack so previous parse() call can resume working + foreach (array_pop($this->stack) as $key => $val) { + $this->$key = $val; + } + + return $node; + } + + public function subparse($test, bool $dropNeedle = false): Node + { + $lineno = $this->getCurrentToken()->getLine(); + $rv = []; + while (!$this->stream->isEOF()) { + switch ($this->getCurrentToken()->getType()) { + case /* Token::TEXT_TYPE */ 0: + $token = $this->stream->next(); + $rv[] = new TextNode($token->getValue(), $token->getLine()); + break; + + case /* Token::VAR_START_TYPE */ 2: + $token = $this->stream->next(); + $expr = $this->expressionParser->parseExpression(); + $this->stream->expect(/* Token::VAR_END_TYPE */ 4); + $rv[] = new PrintNode($expr, $token->getLine()); + break; + + case /* Token::BLOCK_START_TYPE */ 1: + $this->stream->next(); + $token = $this->getCurrentToken(); + + if (/* Token::NAME_TYPE */ 5 !== $token->getType()) { + throw new SyntaxError('A block must start with a tag name.', $token->getLine(), $this->stream->getSourceContext()); + } + + if (null !== $test && $test($token)) { + if ($dropNeedle) { + $this->stream->next(); + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + if (!$subparser = $this->env->getTokenParser($token->getValue())) { + if (null !== $test) { + $e = new SyntaxError(sprintf('Unexpected "%s" tag', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + + if (\is_array($test) && isset($test[0]) && $test[0] instanceof TokenParserInterface) { + $e->appendMessage(sprintf(' (expecting closing tag for the "%s" tag defined near line %s).', $test[0]->getTag(), $lineno)); + } + } else { + $e = new SyntaxError(sprintf('Unknown "%s" tag.', $token->getValue()), $token->getLine(), $this->stream->getSourceContext()); + $e->addSuggestions($token->getValue(), array_keys($this->env->getTokenParsers())); + } + + throw $e; + } + + $this->stream->next(); + + $subparser->setParser($this); + $node = $subparser->parse($token); + if (null !== $node) { + $rv[] = $node; + } + break; + + default: + throw new SyntaxError('Lexer or parser ended up in unsupported state.', $this->getCurrentToken()->getLine(), $this->stream->getSourceContext()); + } + } + + if (1 === \count($rv)) { + return $rv[0]; + } + + return new Node($rv, [], $lineno); + } + + public function getBlockStack(): array + { + return $this->blockStack; + } + + public function peekBlockStack() + { + return $this->blockStack[\count($this->blockStack) - 1] ?? null; + } + + public function popBlockStack(): void + { + array_pop($this->blockStack); + } + + public function pushBlockStack($name): void + { + $this->blockStack[] = $name; + } + + public function hasBlock(string $name): bool + { + return isset($this->blocks[$name]); + } + + public function getBlock(string $name): Node + { + return $this->blocks[$name]; + } + + public function setBlock(string $name, BlockNode $value): void + { + $this->blocks[$name] = new BodyNode([$value], [], $value->getTemplateLine()); + } + + public function hasMacro(string $name): bool + { + return isset($this->macros[$name]); + } + + public function setMacro(string $name, MacroNode $node): void + { + $this->macros[$name] = $node; + } + + public function addTrait($trait): void + { + $this->traits[] = $trait; + } + + public function hasTraits(): bool + { + return \count($this->traits) > 0; + } + + public function embedTemplate(ModuleNode $template) + { + $template->setIndex(mt_rand()); + + $this->embeddedTemplates[] = $template; + } + + public function addImportedSymbol(string $type, string $alias, string $name = null, AbstractExpression $node = null): void + { + $this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $node]; + } + + public function getImportedSymbol(string $type, string $alias) + { + // if the symbol does not exist in the current scope (0), try in the main/global scope (last index) + return $this->importedSymbols[0][$type][$alias] ?? ($this->importedSymbols[\count($this->importedSymbols) - 1][$type][$alias] ?? null); + } + + public function isMainScope(): bool + { + return 1 === \count($this->importedSymbols); + } + + public function pushLocalScope(): void + { + array_unshift($this->importedSymbols, []); + } + + public function popLocalScope(): void + { + array_shift($this->importedSymbols); + } + + public function getExpressionParser(): ExpressionParser + { + return $this->expressionParser; + } + + public function getParent(): ?Node + { + return $this->parent; + } + + public function setParent(?Node $parent): void + { + $this->parent = $parent; + } + + public function getStream(): TokenStream + { + return $this->stream; + } + + public function getCurrentToken(): Token + { + return $this->stream->getCurrent(); + } + + private function filterBodyNodes(Node $node, bool $nested = false): ?Node + { + // check that the body does not contain non-empty output nodes + if ( + ($node instanceof TextNode && !ctype_space($node->getAttribute('data'))) + || + (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface) + ) { + if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) { + $t = substr($node->getAttribute('data'), 3); + if ('' === $t || ctype_space($t)) { + // bypass empty nodes starting with a BOM + return null; + } + } + + throw new SyntaxError('A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag?', $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + // bypass nodes that "capture" the output + if ($node instanceof NodeCaptureInterface) { + // a "block" tag in such a node will serve as a block definition AND be displayed in place as well + return $node; + } + + // "block" tags that are not captured (see above) are only used for defining + // the content of the block. In such a case, nesting it does not work as + // expected as the definition is not part of the default template code flow. + if ($nested && $node instanceof BlockReferenceNode) { + throw new SyntaxError('A block definition cannot be nested under non-capturing nodes.', $node->getTemplateLine(), $this->stream->getSourceContext()); + } + + if ($node instanceof NodeOutputInterface) { + return null; + } + + // here, $nested means "being at the root level of a child template" + // we need to discard the wrapping "Node" for the "body" node + $nested = $nested || Node::class !== \get_class($node); + foreach ($node as $k => $n) { + if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { + $node->removeNode($k); + } + } + + return $node; + } +} diff --git a/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php b/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php new file mode 100644 index 0000000..4da43e4 --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Dumper/BaseDumper.php @@ -0,0 +1,63 @@ + + */ +abstract class BaseDumper +{ + private $root; + + public function dump(Profile $profile): string + { + return $this->dumpProfile($profile); + } + + abstract protected function formatTemplate(Profile $profile, $prefix): string; + + abstract protected function formatNonTemplate(Profile $profile, $prefix): string; + + abstract protected function formatTime(Profile $profile, $percent): string; + + private function dumpProfile(Profile $profile, $prefix = '', $sibling = false): string + { + if ($profile->isRoot()) { + $this->root = $profile->getDuration(); + $start = $profile->getName(); + } else { + if ($profile->isTemplate()) { + $start = $this->formatTemplate($profile, $prefix); + } else { + $start = $this->formatNonTemplate($profile, $prefix); + } + $prefix .= $sibling ? '│ ' : ' '; + } + + $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; + + if ($profile->getDuration() * 1000 < 1) { + $str = $start."\n"; + } else { + $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); + } + + $nCount = \count($profile->getProfiles()); + foreach ($profile as $i => $p) { + $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); + } + + return $str; + } +} diff --git a/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php b/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php new file mode 100644 index 0000000..03abe0f --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Dumper/BlackfireDumper.php @@ -0,0 +1,72 @@ + + */ +final class BlackfireDumper +{ + public function dump(Profile $profile): string + { + $data = []; + $this->dumpProfile('main()', $profile, $data); + $this->dumpChildren('main()', $profile, $data); + + $start = sprintf('%f', microtime(true)); + $str = << $values) { + $str .= "$name//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; + } + + return $str; + } + + private function dumpChildren(string $parent, Profile $profile, &$data) + { + foreach ($profile as $p) { + if ($p->isTemplate()) { + $name = $p->getTemplate(); + } else { + $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); + } + $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); + $this->dumpChildren($name, $p, $data); + } + } + + private function dumpProfile(string $edge, Profile $profile, &$data) + { + if (isset($data[$edge])) { + ++$data[$edge]['ct']; + $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); + $data[$edge]['mu'] += $profile->getMemoryUsage(); + $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); + } else { + $data[$edge] = [ + 'ct' => 1, + 'wt' => floor($profile->getDuration() * 1000000), + 'mu' => $profile->getMemoryUsage(), + 'pmu' => $profile->getPeakMemoryUsage(), + ]; + } + } +} diff --git a/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php b/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php new file mode 100644 index 0000000..1f2433b --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Dumper/HtmlDumper.php @@ -0,0 +1,47 @@ + + */ +final class HtmlDumper extends BaseDumper +{ + private static $colors = [ + 'block' => '#dfd', + 'macro' => '#ddf', + 'template' => '#ffd', + 'big' => '#d44', + ]; + + public function dump(Profile $profile): string + { + return '
    '.parent::dump($profile).'
    '; + } + + protected function formatTemplate(Profile $profile, $prefix): string + { + return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); + } + + protected function formatNonTemplate(Profile $profile, $prefix): string + { + return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); + } + + protected function formatTime(Profile $profile, $percent): string + { + return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); + } +} diff --git a/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php b/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php new file mode 100644 index 0000000..31561c4 --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Dumper/TextDumper.php @@ -0,0 +1,35 @@ + + */ +final class TextDumper extends BaseDumper +{ + protected function formatTemplate(Profile $profile, $prefix): string + { + return sprintf('%s└ %s', $prefix, $profile->getTemplate()); + } + + protected function formatNonTemplate(Profile $profile, $prefix): string + { + return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); + } + + protected function formatTime(Profile $profile, $percent): string + { + return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); + } +} diff --git a/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php b/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php new file mode 100644 index 0000000..1494baf --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php @@ -0,0 +1,42 @@ + + */ +class EnterProfileNode extends Node +{ + public function __construct(string $extensionName, string $type, string $name, string $varName) + { + parent::__construct([], ['extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName]); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->write(sprintf('$%s = $this->extensions[', $this->getAttribute('var_name'))) + ->repr($this->getAttribute('extension_name')) + ->raw("];\n") + ->write(sprintf('$%s->enter($%s = new \Twig\Profiler\Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) + ->repr($this->getAttribute('type')) + ->raw(', ') + ->repr($this->getAttribute('name')) + ->raw("));\n\n") + ; + } +} diff --git a/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php b/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php new file mode 100644 index 0000000..94cebba --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Node/LeaveProfileNode.php @@ -0,0 +1,36 @@ + + */ +class LeaveProfileNode extends Node +{ + public function __construct(string $varName) + { + parent::__construct([], ['var_name' => $varName]); + } + + public function compile(Compiler $compiler): void + { + $compiler + ->write("\n") + ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) + ; + } +} diff --git a/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php b/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php new file mode 100644 index 0000000..91abee8 --- /dev/null +++ b/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php @@ -0,0 +1,70 @@ + + */ +final class ProfilerNodeVisitor implements NodeVisitorInterface +{ + private $extensionName; + private $varName; + + public function __construct(string $extensionName) + { + $this->extensionName = $extensionName; + $this->varName = sprintf('__internal_%s', hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $extensionName)); + } + + public function enterNode(Node $node, Environment $env): Node + { + return $node; + } + + public function leaveNode(Node $node, Environment $env): ?Node + { + if ($node instanceof ModuleNode) { + $node->setNode('display_start', new Node([new EnterProfileNode($this->extensionName, Profile::TEMPLATE, $node->getTemplateName(), $this->varName), $node->getNode('display_start')])); + $node->setNode('display_end', new Node([new LeaveProfileNode($this->varName), $node->getNode('display_end')])); + } elseif ($node instanceof BlockNode) { + $node->setNode('body', new BodyNode([ + new EnterProfileNode($this->extensionName, Profile::BLOCK, $node->getAttribute('name'), $this->varName), + $node->getNode('body'), + new LeaveProfileNode($this->varName), + ])); + } elseif ($node instanceof MacroNode) { + $node->setNode('body', new BodyNode([ + new EnterProfileNode($this->extensionName, Profile::MACRO, $node->getAttribute('name'), $this->varName), + $node->getNode('body'), + new LeaveProfileNode($this->varName), + ])); + } + + return $node; + } + + public function getPriority(): int + { + return 0; + } +} diff --git a/vendor/twig/twig/src/Profiler/Profile.php b/vendor/twig/twig/src/Profiler/Profile.php new file mode 100644 index 0000000..252ca9b --- /dev/null +++ b/vendor/twig/twig/src/Profiler/Profile.php @@ -0,0 +1,181 @@ + + */ +final class Profile implements \IteratorAggregate, \Serializable +{ + public const ROOT = 'ROOT'; + public const BLOCK = 'block'; + public const TEMPLATE = 'template'; + public const MACRO = 'macro'; + + private $template; + private $name; + private $type; + private $starts = []; + private $ends = []; + private $profiles = []; + + public function __construct(string $template = 'main', string $type = self::ROOT, string $name = 'main') + { + $this->template = $template; + $this->type = $type; + $this->name = 0 === strpos($name, '__internal_') ? 'INTERNAL' : $name; + $this->enter(); + } + + public function getTemplate(): string + { + return $this->template; + } + + public function getType(): string + { + return $this->type; + } + + public function getName(): string + { + return $this->name; + } + + public function isRoot(): bool + { + return self::ROOT === $this->type; + } + + public function isTemplate(): bool + { + return self::TEMPLATE === $this->type; + } + + public function isBlock(): bool + { + return self::BLOCK === $this->type; + } + + public function isMacro(): bool + { + return self::MACRO === $this->type; + } + + /** + * @return Profile[] + */ + public function getProfiles(): array + { + return $this->profiles; + } + + public function addProfile(self $profile): void + { + $this->profiles[] = $profile; + } + + /** + * Returns the duration in microseconds. + */ + public function getDuration(): float + { + if ($this->isRoot() && $this->profiles) { + // for the root node with children, duration is the sum of all child durations + $duration = 0; + foreach ($this->profiles as $profile) { + $duration += $profile->getDuration(); + } + + return $duration; + } + + return isset($this->ends['wt']) && isset($this->starts['wt']) ? $this->ends['wt'] - $this->starts['wt'] : 0; + } + + /** + * Returns the memory usage in bytes. + */ + public function getMemoryUsage(): int + { + return isset($this->ends['mu']) && isset($this->starts['mu']) ? $this->ends['mu'] - $this->starts['mu'] : 0; + } + + /** + * Returns the peak memory usage in bytes. + */ + public function getPeakMemoryUsage(): int + { + return isset($this->ends['pmu']) && isset($this->starts['pmu']) ? $this->ends['pmu'] - $this->starts['pmu'] : 0; + } + + /** + * Starts the profiling. + */ + public function enter(): void + { + $this->starts = [ + 'wt' => microtime(true), + 'mu' => memory_get_usage(), + 'pmu' => memory_get_peak_usage(), + ]; + } + + /** + * Stops the profiling. + */ + public function leave(): void + { + $this->ends = [ + 'wt' => microtime(true), + 'mu' => memory_get_usage(), + 'pmu' => memory_get_peak_usage(), + ]; + } + + public function reset(): void + { + $this->starts = $this->ends = $this->profiles = []; + $this->enter(); + } + + public function getIterator(): \Traversable + { + return new \ArrayIterator($this->profiles); + } + + public function serialize(): string + { + return serialize($this->__serialize()); + } + + public function unserialize($data): void + { + $this->__unserialize(unserialize($data)); + } + + /** + * @internal + */ + public function __serialize(): array + { + return [$this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles]; + } + + /** + * @internal + */ + public function __unserialize(array $data): void + { + list($this->template, $this->name, $this->type, $this->starts, $this->ends, $this->profiles) = $data; + } +} diff --git a/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php new file mode 100644 index 0000000..b360d7b --- /dev/null +++ b/vendor/twig/twig/src/RuntimeLoader/ContainerRuntimeLoader.php @@ -0,0 +1,37 @@ + + * @author Robin Chalas + */ +class ContainerRuntimeLoader implements RuntimeLoaderInterface +{ + private $container; + + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + public function load(string $class) + { + return $this->container->has($class) ? $this->container->get($class) : null; + } +} diff --git a/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php b/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php new file mode 100644 index 0000000..1306483 --- /dev/null +++ b/vendor/twig/twig/src/RuntimeLoader/FactoryRuntimeLoader.php @@ -0,0 +1,41 @@ + + */ +class FactoryRuntimeLoader implements RuntimeLoaderInterface +{ + private $map; + + /** + * @param array $map An array where keys are class names and values factory callables + */ + public function __construct(array $map = []) + { + $this->map = $map; + } + + public function load(string $class) + { + if (!isset($this->map[$class])) { + return null; + } + + $runtimeFactory = $this->map[$class]; + + return $runtimeFactory(); + } +} diff --git a/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php b/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php new file mode 100644 index 0000000..9e5b204 --- /dev/null +++ b/vendor/twig/twig/src/RuntimeLoader/RuntimeLoaderInterface.php @@ -0,0 +1,27 @@ + + */ +interface RuntimeLoaderInterface +{ + /** + * Creates the runtime implementation of a Twig element (filter/function/test). + * + * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class + */ + public function load(string $class); +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityError.php b/vendor/twig/twig/src/Sandbox/SecurityError.php new file mode 100644 index 0000000..30a404f --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityError.php @@ -0,0 +1,23 @@ + + */ +class SecurityError extends Error +{ +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php new file mode 100644 index 0000000..02d3063 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFilterError.php @@ -0,0 +1,33 @@ + + */ +final class SecurityNotAllowedFilterError extends SecurityError +{ + private $filterName; + + public function __construct(string $message, string $functionName) + { + parent::__construct($message); + $this->filterName = $functionName; + } + + public function getFilterName(): string + { + return $this->filterName; + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php new file mode 100644 index 0000000..4f76dc6 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedFunctionError.php @@ -0,0 +1,33 @@ + + */ +final class SecurityNotAllowedFunctionError extends SecurityError +{ + private $functionName; + + public function __construct(string $message, string $functionName) + { + parent::__construct($message); + $this->functionName = $functionName; + } + + public function getFunctionName(): string + { + return $this->functionName; + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php new file mode 100644 index 0000000..8df9d0b --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedMethodError.php @@ -0,0 +1,40 @@ + + */ +final class SecurityNotAllowedMethodError extends SecurityError +{ + private $className; + private $methodName; + + public function __construct(string $message, string $className, string $methodName) + { + parent::__construct($message); + $this->className = $className; + $this->methodName = $methodName; + } + + public function getClassName(): string + { + return $this->className; + } + + public function getMethodName() + { + return $this->methodName; + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php new file mode 100644 index 0000000..42ec4f3 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedPropertyError.php @@ -0,0 +1,40 @@ + + */ +final class SecurityNotAllowedPropertyError extends SecurityError +{ + private $className; + private $propertyName; + + public function __construct(string $message, string $className, string $propertyName) + { + parent::__construct($message); + $this->className = $className; + $this->propertyName = $propertyName; + } + + public function getClassName(): string + { + return $this->className; + } + + public function getPropertyName() + { + return $this->propertyName; + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php new file mode 100644 index 0000000..4522150 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityNotAllowedTagError.php @@ -0,0 +1,33 @@ + + */ +final class SecurityNotAllowedTagError extends SecurityError +{ + private $tagName; + + public function __construct(string $message, string $tagName) + { + parent::__construct($message); + $this->tagName = $tagName; + } + + public function getTagName(): string + { + return $this->tagName; + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityPolicy.php b/vendor/twig/twig/src/Sandbox/SecurityPolicy.php new file mode 100644 index 0000000..2fc0d01 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicy.php @@ -0,0 +1,126 @@ + + */ +final class SecurityPolicy implements SecurityPolicyInterface +{ + private $allowedTags; + private $allowedFilters; + private $allowedMethods; + private $allowedProperties; + private $allowedFunctions; + + public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) + { + $this->allowedTags = $allowedTags; + $this->allowedFilters = $allowedFilters; + $this->setAllowedMethods($allowedMethods); + $this->allowedProperties = $allowedProperties; + $this->allowedFunctions = $allowedFunctions; + } + + public function setAllowedTags(array $tags): void + { + $this->allowedTags = $tags; + } + + public function setAllowedFilters(array $filters): void + { + $this->allowedFilters = $filters; + } + + public function setAllowedMethods(array $methods): void + { + $this->allowedMethods = []; + foreach ($methods as $class => $m) { + $this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]); + } + } + + public function setAllowedProperties(array $properties): void + { + $this->allowedProperties = $properties; + } + + public function setAllowedFunctions(array $functions): void + { + $this->allowedFunctions = $functions; + } + + public function checkSecurity($tags, $filters, $functions): void + { + foreach ($tags as $tag) { + if (!\in_array($tag, $this->allowedTags)) { + throw new SecurityNotAllowedTagError(sprintf('Tag "%s" is not allowed.', $tag), $tag); + } + } + + foreach ($filters as $filter) { + if (!\in_array($filter, $this->allowedFilters)) { + throw new SecurityNotAllowedFilterError(sprintf('Filter "%s" is not allowed.', $filter), $filter); + } + } + + foreach ($functions as $function) { + if (!\in_array($function, $this->allowedFunctions)) { + throw new SecurityNotAllowedFunctionError(sprintf('Function "%s" is not allowed.', $function), $function); + } + } + } + + public function checkMethodAllowed($obj, $method): void + { + if ($obj instanceof Template || $obj instanceof Markup) { + return; + } + + $allowed = false; + $method = strtr($method, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + foreach ($this->allowedMethods as $class => $methods) { + if ($obj instanceof $class) { + $allowed = \in_array($method, $methods); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); + } + } + + public function checkPropertyAllowed($obj, $property): void + { + $allowed = false; + foreach ($this->allowedProperties as $class => $properties) { + if ($obj instanceof $class) { + $allowed = \in_array($property, \is_array($properties) ? $properties : [$properties]); + + break; + } + } + + if (!$allowed) { + $class = \get_class($obj); + throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); + } + } +} diff --git a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php new file mode 100644 index 0000000..36471c5 --- /dev/null +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php @@ -0,0 +1,45 @@ + + */ +interface SecurityPolicyInterface +{ + /** + * @param string[] $tags + * @param string[] $filters + * @param string[] $functions + * + * @throws SecurityError + */ + public function checkSecurity($tags, $filters, $functions): void; + + /** + * @param object $obj + * @param string $method + * + * @throws SecurityNotAllowedMethodError + */ + public function checkMethodAllowed($obj, $method): void; + + /** + * @param object $obj + * @param string $property + * + * @throws SecurityNotAllowedPropertyError + */ + public function checkPropertyAllowed($obj, $property): void; +} diff --git a/vendor/twig/twig/src/Source.php b/vendor/twig/twig/src/Source.php new file mode 100644 index 0000000..3cb0240 --- /dev/null +++ b/vendor/twig/twig/src/Source.php @@ -0,0 +1,51 @@ + + */ +final class Source +{ + private $code; + private $name; + private $path; + + /** + * @param string $code The template source code + * @param string $name The template logical name + * @param string $path The filesystem path of the template if any + */ + public function __construct(string $code, string $name, string $path = '') + { + $this->code = $code; + $this->name = $name; + $this->path = $path; + } + + public function getCode(): string + { + return $this->code; + } + + public function getName(): string + { + return $this->name; + } + + public function getPath(): string + { + return $this->path; + } +} diff --git a/vendor/twig/twig/src/Template.php b/vendor/twig/twig/src/Template.php new file mode 100644 index 0000000..e04bd04 --- /dev/null +++ b/vendor/twig/twig/src/Template.php @@ -0,0 +1,422 @@ +load() + * instead, which returns an instance of \Twig\TemplateWrapper. + * + * @author Fabien Potencier + * + * @internal + */ +abstract class Template +{ + public const ANY_CALL = 'any'; + public const ARRAY_CALL = 'array'; + public const METHOD_CALL = 'method'; + + protected $parent; + protected $parents = []; + protected $env; + protected $blocks = []; + protected $traits = []; + protected $extensions = []; + protected $sandbox; + + public function __construct(Environment $env) + { + $this->env = $env; + $this->extensions = $env->getExtensions(); + } + + /** + * Returns the template name. + * + * @return string The template name + */ + abstract public function getTemplateName(); + + /** + * Returns debug information about the template. + * + * @return array Debug information + */ + abstract public function getDebugInfo(); + + /** + * Returns information about the original template source code. + * + * @return Source + */ + abstract public function getSourceContext(); + + /** + * Returns the parent template. + * + * This method is for internal use only and should never be called + * directly. + * + * @return Template|TemplateWrapper|false The parent template or false if there is no parent + */ + public function getParent(array $context) + { + if (null !== $this->parent) { + return $this->parent; + } + + try { + $parent = $this->doGetParent($context); + + if (false === $parent) { + return false; + } + + if ($parent instanceof self || $parent instanceof TemplateWrapper) { + return $this->parents[$parent->getSourceContext()->getName()] = $parent; + } + + if (!isset($this->parents[$parent])) { + $this->parents[$parent] = $this->loadTemplate($parent); + } + } catch (LoaderError $e) { + $e->setSourceContext(null); + $e->guess(); + + throw $e; + } + + return $this->parents[$parent]; + } + + protected function doGetParent(array $context) + { + return false; + } + + public function isTraitable() + { + return true; + } + + /** + * Displays a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + */ + public function displayParentBlock($name, array $context, array $blocks = []) + { + if (isset($this->traits[$name])) { + $this->traits[$name][0]->displayBlock($name, $context, $blocks, false); + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, $blocks, false); + } else { + throw new RuntimeError(sprintf('The template has no parent and no traits defining the "%s" block.', $name), -1, $this->getSourceContext()); + } + } + + /** + * Displays a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to display + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + */ + public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true, self $templateContext = null) + { + if ($useBlocks && isset($blocks[$name])) { + $template = $blocks[$name][0]; + $block = $blocks[$name][1]; + } elseif (isset($this->blocks[$name])) { + $template = $this->blocks[$name][0]; + $block = $this->blocks[$name][1]; + } else { + $template = null; + $block = null; + } + + // avoid RCEs when sandbox is enabled + if (null !== $template && !$template instanceof self) { + throw new \LogicException('A block must be a method on a \Twig\Template instance.'); + } + + if (null !== $template) { + try { + $template->$block($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($template->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e); + $e->guess(); + + throw $e; + } + } elseif (false !== $parent = $this->getParent($context)) { + $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false, $templateContext ?? $this); + } elseif (isset($blocks[$name])) { + throw new RuntimeError(sprintf('Block "%s" should not call parent() in "%s" as the block does not exist in the parent template "%s".', $name, $blocks[$name][0]->getTemplateName(), $this->getTemplateName()), -1, $blocks[$name][0]->getSourceContext()); + } else { + throw new RuntimeError(sprintf('Block "%s" on template "%s" does not exist.', $name, $this->getTemplateName()), -1, ($templateContext ?? $this)->getSourceContext()); + } + } + + /** + * Renders a parent block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render from the parent + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return string The rendered block + */ + public function renderParentBlock($name, array $context, array $blocks = []) + { + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + $this->displayParentBlock($name, $context, $blocks); + + return ob_get_clean(); + } + + /** + * Renders a block. + * + * This method is for internal use only and should never be called + * directly. + * + * @param string $name The block name to render + * @param array $context The context + * @param array $blocks The current set of blocks + * @param bool $useBlocks Whether to use the current set of blocks + * + * @return string The rendered block + */ + public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true) + { + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + $this->displayBlock($name, $context, $blocks, $useBlocks); + + return ob_get_clean(); + } + + /** + * Returns whether a block exists or not in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param string $name The block name + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return bool true if the block exists, false otherwise + */ + public function hasBlock($name, array $context, array $blocks = []) + { + if (isset($blocks[$name])) { + return $blocks[$name][0] instanceof self; + } + + if (isset($this->blocks[$name])) { + return true; + } + + if (false !== $parent = $this->getParent($context)) { + return $parent->hasBlock($name, $context); + } + + return false; + } + + /** + * Returns all block names in the current context of the template. + * + * This method checks blocks defined in the current template + * or defined in "used" traits or defined in parent templates. + * + * @param array $context The context + * @param array $blocks The current set of blocks + * + * @return array An array of block names + */ + public function getBlockNames(array $context, array $blocks = []) + { + $names = array_merge(array_keys($blocks), array_keys($this->blocks)); + + if (false !== $parent = $this->getParent($context)) { + $names = array_merge($names, $parent->getBlockNames($context)); + } + + return array_unique($names); + } + + /** + * @return Template|TemplateWrapper + */ + protected function loadTemplate($template, $templateName = null, $line = null, $index = null) + { + try { + if (\is_array($template)) { + return $this->env->resolveTemplate($template); + } + + if ($template instanceof self || $template instanceof TemplateWrapper) { + return $template; + } + + if ($template === $this->getTemplateName()) { + $class = static::class; + if (false !== $pos = strrpos($class, '___', -1)) { + $class = substr($class, 0, $pos); + } + } else { + $class = $this->env->getTemplateClass($template); + } + + return $this->env->loadTemplate($class, $template, $index); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); + } + + if ($e->getTemplateLine() > 0) { + throw $e; + } + + if (!$line) { + $e->guess(); + } else { + $e->setTemplateLine($line); + } + + throw $e; + } + } + + /** + * @internal + * + * @return Template + */ + public function unwrap() + { + return $this; + } + + /** + * Returns all blocks. + * + * This method is for internal use only and should never be called + * directly. + * + * @return array An array of blocks + */ + public function getBlocks() + { + return $this->blocks; + } + + public function display(array $context, array $blocks = []) + { + $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); + } + + public function render(array $context) + { + $level = ob_get_level(); + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + try { + $this->display($context); + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + protected function displayWithErrorHandling(array $context, array $blocks = []) + { + try { + $this->doDisplay($context, $blocks); + } catch (Error $e) { + if (!$e->getSourceContext()) { + $e->setSourceContext($this->getSourceContext()); + } + + // this is mostly useful for \Twig\Error\LoaderError exceptions + // see \Twig\Error\LoaderError + if (-1 === $e->getTemplateLine()) { + $e->guess(); + } + + throw $e; + } catch (\Exception $e) { + $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e); + $e->guess(); + + throw $e; + } + } + + /** + * Auto-generated method to display the template with the given context. + * + * @param array $context An array of parameters to pass to the template + * @param array $blocks An array of blocks to pass to the template + */ + abstract protected function doDisplay(array $context, array $blocks = []); +} diff --git a/vendor/twig/twig/src/TemplateWrapper.php b/vendor/twig/twig/src/TemplateWrapper.php new file mode 100644 index 0000000..c9c6b07 --- /dev/null +++ b/vendor/twig/twig/src/TemplateWrapper.php @@ -0,0 +1,109 @@ + + */ +final class TemplateWrapper +{ + private $env; + private $template; + + /** + * This method is for internal use only and should never be called + * directly (use Twig\Environment::load() instead). + * + * @internal + */ + public function __construct(Environment $env, Template $template) + { + $this->env = $env; + $this->template = $template; + } + + public function render(array $context = []): string + { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + return $this->template->render($context, \func_get_args()[1] ?? []); + } + + public function display(array $context = []) + { + // using func_get_args() allows to not expose the blocks argument + // as it should only be used by internal code + $this->template->display($context, \func_get_args()[1] ?? []); + } + + public function hasBlock(string $name, array $context = []): bool + { + return $this->template->hasBlock($name, $context); + } + + /** + * @return string[] An array of defined template block names + */ + public function getBlockNames(array $context = []): array + { + return $this->template->getBlockNames($context); + } + + public function renderBlock(string $name, array $context = []): string + { + $context = $this->env->mergeGlobals($context); + $level = ob_get_level(); + if ($this->env->isDebug()) { + ob_start(); + } else { + ob_start(function () { return ''; }); + } + try { + $this->template->displayBlock($name, $context); + } catch (\Throwable $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + + throw $e; + } + + return ob_get_clean(); + } + + public function displayBlock(string $name, array $context = []) + { + $this->template->displayBlock($name, $this->env->mergeGlobals($context)); + } + + public function getSourceContext(): Source + { + return $this->template->getSourceContext(); + } + + public function getTemplateName(): string + { + return $this->template->getTemplateName(); + } + + /** + * @internal + * + * @return Template + */ + public function unwrap() + { + return $this->template; + } +} diff --git a/vendor/twig/twig/src/Test/IntegrationTestCase.php b/vendor/twig/twig/src/Test/IntegrationTestCase.php new file mode 100644 index 0000000..307302b --- /dev/null +++ b/vendor/twig/twig/src/Test/IntegrationTestCase.php @@ -0,0 +1,265 @@ + + * @author Karma Dordrak + */ +abstract class IntegrationTestCase extends TestCase +{ + /** + * @return string + */ + abstract protected function getFixturesDir(); + + /** + * @return RuntimeLoaderInterface[] + */ + protected function getRuntimeLoaders() + { + return []; + } + + /** + * @return ExtensionInterface[] + */ + protected function getExtensions() + { + return []; + } + + /** + * @return TwigFilter[] + */ + protected function getTwigFilters() + { + return []; + } + + /** + * @return TwigFunction[] + */ + protected function getTwigFunctions() + { + return []; + } + + /** + * @return TwigTest[] + */ + protected function getTwigTests() + { + return []; + } + + /** + * @dataProvider getTests + */ + public function testIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') + { + $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); + } + + /** + * @dataProvider getLegacyTests + * @group legacy + */ + public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') + { + $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation); + } + + public function getTests($name, $legacyTests = false) + { + $fixturesDir = realpath($this->getFixturesDir()); + $tests = []; + + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fixturesDir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!preg_match('/\.test$/', $file)) { + continue; + } + + if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) { + continue; + } + + $test = file_get_contents($file->getRealpath()); + + if (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*(?:--DEPRECATION--\s*(.*?))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $deprecation = $match[3]; + $templates = self::parseTemplates($match[4]); + $exception = $match[6]; + $outputs = [[null, $match[5], null, '']]; + } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*(?:--DEPRECATION--\s*(.*?))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $deprecation = $match[3]; + $templates = self::parseTemplates($match[4]); + $exception = false; + preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, \PREG_SET_ORDER); + } else { + throw new \InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); + } + + $tests[] = [str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs, $deprecation]; + } + + if ($legacyTests && empty($tests)) { + // add a dummy test to avoid a PHPUnit message + return [['not', '-', '', [], '', []]]; + } + + return $tests; + } + + public function getLegacyTests() + { + return $this->getTests('testLegacyIntegration', true); + } + + protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '') + { + if (!$outputs) { + $this->markTestSkipped('no tests to run'); + } + + if ($condition) { + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + $loader = new ArrayLoader($templates); + + foreach ($outputs as $i => $match) { + $config = array_merge([ + 'cache' => false, + 'strict_variables' => true, + ], $match[2] ? eval($match[2].';') : []); + $twig = new Environment($loader, $config); + $twig->addGlobal('global', 'global'); + foreach ($this->getRuntimeLoaders() as $runtimeLoader) { + $twig->addRuntimeLoader($runtimeLoader); + } + + foreach ($this->getExtensions() as $extension) { + $twig->addExtension($extension); + } + + foreach ($this->getTwigFilters() as $filter) { + $twig->addFilter($filter); + } + + foreach ($this->getTwigTests() as $test) { + $twig->addTest($test); + } + + foreach ($this->getTwigFunctions() as $function) { + $twig->addFunction($function); + } + + // avoid using the same PHP class name for different cases + $p = new \ReflectionProperty($twig, 'templateClassPrefix'); + $p->setAccessible(true); + $p->setValue($twig, '__TwigTemplate_'.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', uniqid(mt_rand(), true), false).'_'); + + $deprecations = []; + try { + $prevHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$prevHandler) { + if (\E_USER_DEPRECATED === $type) { + $deprecations[] = $msg; + + return true; + } + + return $prevHandler ? $prevHandler($type, $msg, $file, $line, $context) : false; + }); + + $template = $twig->load('index.twig'); + } catch (\Exception $e) { + if (false !== $exception) { + $message = $e->getMessage(); + $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $message))); + $last = substr($message, \strlen($message) - 1); + $this->assertTrue('.' === $last || '?' === $last, 'Exception message must end with a dot or a question mark.'); + + return; + } + + throw new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); + } finally { + restore_error_handler(); + } + + $this->assertSame($deprecation, implode("\n", $deprecations)); + + try { + $output = trim($template->render(eval($match[1].';')), "\n "); + } catch (\Exception $e) { + if (false !== $exception) { + $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $e->getMessage()))); + + return; + } + + $e = new Error(sprintf('%s: %s', \get_class($e), $e->getMessage()), -1, null, $e); + + $output = trim(sprintf('%s: %s', \get_class($e), $e->getMessage())); + } + + if (false !== $exception) { + list($class) = explode(':', $exception); + $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; + $this->assertThat(null, new $constraintClass($class)); + } + + $expected = trim($match[3], "\n "); + + if ($expected !== $output) { + printf("Compiled templates that failed on case %d:\n", $i + 1); + + foreach (array_keys($templates) as $name) { + echo "Template: $name\n"; + echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); + } + } + $this->assertEquals($expected, $output, $message.' (in '.$file.')'); + } + } + + protected static function parseTemplates($test) + { + $templates = []; + preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, \PREG_SET_ORDER); + foreach ($matches as $match) { + $templates[($match[1] ?: 'index.twig')] = $match[2]; + } + + return $templates; + } +} diff --git a/vendor/twig/twig/src/Test/NodeTestCase.php b/vendor/twig/twig/src/Test/NodeTestCase.php new file mode 100644 index 0000000..3b8b2c8 --- /dev/null +++ b/vendor/twig/twig/src/Test/NodeTestCase.php @@ -0,0 +1,65 @@ +assertNodeCompilation($source, $node, $environment, $isPattern); + } + + public function assertNodeCompilation($source, Node $node, Environment $environment = null, $isPattern = false) + { + $compiler = $this->getCompiler($environment); + $compiler->compile($node); + + if ($isPattern) { + $this->assertStringMatchesFormat($source, trim($compiler->getSource())); + } else { + $this->assertEquals($source, trim($compiler->getSource())); + } + } + + protected function getCompiler(Environment $environment = null) + { + return new Compiler(null === $environment ? $this->getEnvironment() : $environment); + } + + protected function getEnvironment() + { + return new Environment(new ArrayLoader([])); + } + + protected function getVariableGetter($name, $line = false) + { + $line = $line > 0 ? "// line $line\n" : ''; + + return sprintf('%s($context["%s"] ?? null)', $line, $name); + } + + protected function getAttributeGetter() + { + return 'twig_get_attribute($this->env, $this->source, '; + } +} diff --git a/vendor/twig/twig/src/Token.php b/vendor/twig/twig/src/Token.php new file mode 100644 index 0000000..53a6caf --- /dev/null +++ b/vendor/twig/twig/src/Token.php @@ -0,0 +1,178 @@ + + */ +final class Token +{ + private $value; + private $type; + private $lineno; + + public const EOF_TYPE = -1; + public const TEXT_TYPE = 0; + public const BLOCK_START_TYPE = 1; + public const VAR_START_TYPE = 2; + public const BLOCK_END_TYPE = 3; + public const VAR_END_TYPE = 4; + public const NAME_TYPE = 5; + public const NUMBER_TYPE = 6; + public const STRING_TYPE = 7; + public const OPERATOR_TYPE = 8; + public const PUNCTUATION_TYPE = 9; + public const INTERPOLATION_START_TYPE = 10; + public const INTERPOLATION_END_TYPE = 11; + public const ARROW_TYPE = 12; + + public function __construct(int $type, $value, int $lineno) + { + $this->type = $type; + $this->value = $value; + $this->lineno = $lineno; + } + + public function __toString() + { + return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value); + } + + /** + * Tests the current token for a type and/or a value. + * + * Parameters may be: + * * just type + * * type and value (or array of possible values) + * * just value (or array of possible values) (NAME_TYPE is used as type) + * + * @param array|string|int $type The type to test + * @param array|string|null $values The token value + */ + public function test($type, $values = null): bool + { + if (null === $values && !\is_int($type)) { + $values = $type; + $type = self::NAME_TYPE; + } + + return ($this->type === $type) && ( + null === $values || + (\is_array($values) && \in_array($this->value, $values)) || + $this->value == $values + ); + } + + public function getLine(): int + { + return $this->lineno; + } + + public function getType(): int + { + return $this->type; + } + + public function getValue() + { + return $this->value; + } + + public static function typeToString(int $type, bool $short = false): string + { + switch ($type) { + case self::EOF_TYPE: + $name = 'EOF_TYPE'; + break; + case self::TEXT_TYPE: + $name = 'TEXT_TYPE'; + break; + case self::BLOCK_START_TYPE: + $name = 'BLOCK_START_TYPE'; + break; + case self::VAR_START_TYPE: + $name = 'VAR_START_TYPE'; + break; + case self::BLOCK_END_TYPE: + $name = 'BLOCK_END_TYPE'; + break; + case self::VAR_END_TYPE: + $name = 'VAR_END_TYPE'; + break; + case self::NAME_TYPE: + $name = 'NAME_TYPE'; + break; + case self::NUMBER_TYPE: + $name = 'NUMBER_TYPE'; + break; + case self::STRING_TYPE: + $name = 'STRING_TYPE'; + break; + case self::OPERATOR_TYPE: + $name = 'OPERATOR_TYPE'; + break; + case self::PUNCTUATION_TYPE: + $name = 'PUNCTUATION_TYPE'; + break; + case self::INTERPOLATION_START_TYPE: + $name = 'INTERPOLATION_START_TYPE'; + break; + case self::INTERPOLATION_END_TYPE: + $name = 'INTERPOLATION_END_TYPE'; + break; + case self::ARROW_TYPE: + $name = 'ARROW_TYPE'; + break; + default: + throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); + } + + return $short ? $name : 'Twig\Token::'.$name; + } + + public static function typeToEnglish(int $type): string + { + switch ($type) { + case self::EOF_TYPE: + return 'end of template'; + case self::TEXT_TYPE: + return 'text'; + case self::BLOCK_START_TYPE: + return 'begin of statement block'; + case self::VAR_START_TYPE: + return 'begin of print statement'; + case self::BLOCK_END_TYPE: + return 'end of statement block'; + case self::VAR_END_TYPE: + return 'end of print statement'; + case self::NAME_TYPE: + return 'name'; + case self::NUMBER_TYPE: + return 'number'; + case self::STRING_TYPE: + return 'string'; + case self::OPERATOR_TYPE: + return 'operator'; + case self::PUNCTUATION_TYPE: + return 'punctuation'; + case self::INTERPOLATION_START_TYPE: + return 'begin of string interpolation'; + case self::INTERPOLATION_END_TYPE: + return 'end of string interpolation'; + case self::ARROW_TYPE: + return 'arrow function'; + default: + throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); + } + } +} diff --git a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php new file mode 100644 index 0000000..720ea67 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php @@ -0,0 +1,32 @@ + + */ +abstract class AbstractTokenParser implements TokenParserInterface +{ + /** + * @var Parser + */ + protected $parser; + + public function setParser(Parser $parser): void + { + $this->parser = $parser; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php b/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php new file mode 100644 index 0000000..4dbf304 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php @@ -0,0 +1,60 @@ +getLine(); + $name = $this->parser->getVarName(); + + $ref = new TempNameExpression($name, $lineno); + $ref->setAttribute('always_defined', true); + + $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideApplyEnd'], true); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new Node([ + new SetNode(true, $ref, $body, $lineno, $this->getTag()), + new PrintNode($filter, $lineno, $this->getTag()), + ]); + } + + public function decideApplyEnd(Token $token): bool + { + return $token->test('endapply'); + } + + public function getTag(): string + { + return 'apply'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php b/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php new file mode 100644 index 0000000..b674bea --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php @@ -0,0 +1,58 @@ +getLine(); + $stream = $this->parser->getStream(); + + if ($stream->test(/* Token::BLOCK_END_TYPE */ 3)) { + $value = 'html'; + } else { + $expr = $this->parser->getExpressionParser()->parseExpression(); + if (!$expr instanceof ConstantExpression) { + throw new SyntaxError('An escaping strategy must be a string or false.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + $value = $expr->getAttribute('value'); + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new AutoEscapeNode($value, $body, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endautoescape'); + } + + public function getTag(): string + { + return 'autoescape'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/BlockTokenParser.php b/vendor/twig/twig/src/TokenParser/BlockTokenParser.php new file mode 100644 index 0000000..5878131 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/BlockTokenParser.php @@ -0,0 +1,78 @@ + + * {% block title %}{% endblock %} - My Webpage + * {% endblock %} + * + * @internal + */ +final class BlockTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + if ($this->parser->hasBlock($name)) { + throw new SyntaxError(sprintf("The block '%s' has already been defined line %d.", $name, $this->parser->getBlock($name)->getTemplateLine()), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + $this->parser->setBlock($name, $block = new BlockNode($name, new Node([]), $lineno)); + $this->parser->pushLocalScope(); + $this->parser->pushBlockStack($name); + + if ($stream->nextIf(/* Token::BLOCK_END_TYPE */ 3)) { + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) { + $value = $token->getValue(); + + if ($value != $name) { + throw new SyntaxError(sprintf('Expected endblock for block "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + } else { + $body = new Node([ + new PrintNode($this->parser->getExpressionParser()->parseExpression(), $lineno), + ]); + } + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $block->setNode('body', $body); + $this->parser->popBlockStack(); + $this->parser->popLocalScope(); + + return new BlockReferenceNode($name, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endblock'); + } + + public function getTag(): string + { + return 'block'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php b/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php new file mode 100644 index 0000000..31416c7 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/DeprecatedTokenParser.php @@ -0,0 +1,43 @@ + + * + * @internal + */ +final class DeprecatedTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new DeprecatedNode($expr, $token->getLine(), $this->getTag()); + } + + public function getTag(): string + { + return 'deprecated'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/DoTokenParser.php b/vendor/twig/twig/src/TokenParser/DoTokenParser.php new file mode 100644 index 0000000..32c8f12 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/DoTokenParser.php @@ -0,0 +1,38 @@ +parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new DoNode($expr, $token->getLine(), $this->getTag()); + } + + public function getTag(): string + { + return 'do'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php new file mode 100644 index 0000000..64b4f29 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/EmbedTokenParser.php @@ -0,0 +1,73 @@ +parser->getStream(); + + $parent = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + $parentToken = $fakeParentToken = new Token(/* Token::STRING_TYPE */ 7, '__parent__', $token->getLine()); + if ($parent instanceof ConstantExpression) { + $parentToken = new Token(/* Token::STRING_TYPE */ 7, $parent->getAttribute('value'), $token->getLine()); + } elseif ($parent instanceof NameExpression) { + $parentToken = new Token(/* Token::NAME_TYPE */ 5, $parent->getAttribute('name'), $token->getLine()); + } + + // inject a fake parent to make the parent() function work + $stream->injectTokens([ + new Token(/* Token::BLOCK_START_TYPE */ 1, '', $token->getLine()), + new Token(/* Token::NAME_TYPE */ 5, 'extends', $token->getLine()), + $parentToken, + new Token(/* Token::BLOCK_END_TYPE */ 3, '', $token->getLine()), + ]); + + $module = $this->parser->parse($stream, [$this, 'decideBlockEnd'], true); + + // override the parent with the correct one + if ($fakeParentToken === $parentToken) { + $module->setNode('parent', $parent); + } + + $this->parser->embedTemplate($module); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new EmbedNode($module->getTemplateName(), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endembed'); + } + + public function getTag(): string + { + return 'embed'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php new file mode 100644 index 0000000..0ca46dd --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php @@ -0,0 +1,52 @@ +parser->getStream(); + + if ($this->parser->peekBlockStack()) { + throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); + } elseif (!$this->parser->isMainScope()) { + throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); + } + + if (null !== $this->parser->getParent()) { + throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); + } + $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new Node(); + } + + public function getTag(): string + { + return 'extends'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/FlushTokenParser.php b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php new file mode 100644 index 0000000..02c74aa --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/FlushTokenParser.php @@ -0,0 +1,38 @@ +parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new FlushNode($token->getLine(), $this->getTag()); + } + + public function getTag(): string + { + return 'flush'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ForTokenParser.php b/vendor/twig/twig/src/TokenParser/ForTokenParser.php new file mode 100644 index 0000000..bac8ba2 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/ForTokenParser.php @@ -0,0 +1,78 @@ + + * {% for user in users %} + *
  • {{ user.username|e }}
  • + * {% endfor %} + * + * + * @internal + */ +final class ForTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); + $stream->expect(/* Token::OPERATOR_TYPE */ 8, 'in'); + $seq = $this->parser->getExpressionParser()->parseExpression(); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $body = $this->parser->subparse([$this, 'decideForFork']); + if ('else' == $stream->next()->getValue()) { + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $else = $this->parser->subparse([$this, 'decideForEnd'], true); + } else { + $else = null; + } + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + if (\count($targets) > 1) { + $keyTarget = $targets->getNode(0); + $keyTarget = new AssignNameExpression($keyTarget->getAttribute('name'), $keyTarget->getTemplateLine()); + $valueTarget = $targets->getNode(1); + } else { + $keyTarget = new AssignNameExpression('_key', $lineno); + $valueTarget = $targets->getNode(0); + } + $valueTarget = new AssignNameExpression($valueTarget->getAttribute('name'), $valueTarget->getTemplateLine()); + + return new ForNode($keyTarget, $valueTarget, $seq, null, $body, $else, $lineno, $this->getTag()); + } + + public function decideForFork(Token $token): bool + { + return $token->test(['else', 'endfor']); + } + + public function decideForEnd(Token $token): bool + { + return $token->test('endfor'); + } + + public function getTag(): string + { + return 'for'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/FromTokenParser.php b/vendor/twig/twig/src/TokenParser/FromTokenParser.php new file mode 100644 index 0000000..35098c2 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/FromTokenParser.php @@ -0,0 +1,66 @@ +parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect(/* Token::NAME_TYPE */ 5, 'import'); + + $targets = []; + do { + $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + } + + $targets[$name] = $alias; + + if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + } while (true); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine()); + $node = new ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); + + foreach ($targets as $name => $alias) { + $this->parser->addImportedSymbol('function', $alias, 'macro_'.$name, $var); + } + + return $node; + } + + public function getTag(): string + { + return 'from'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/IfTokenParser.php b/vendor/twig/twig/src/TokenParser/IfTokenParser.php new file mode 100644 index 0000000..c0fe6df --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/IfTokenParser.php @@ -0,0 +1,89 @@ + + * {% for user in users %} + *
  • {{ user.username|e }}
  • + * {% endfor %} + * + * {% endif %} + * + * @internal + */ +final class IfTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $body = $this->parser->subparse([$this, 'decideIfFork']); + $tests = [$expr, $body]; + $else = null; + + $end = false; + while (!$end) { + switch ($stream->next()->getValue()) { + case 'else': + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $else = $this->parser->subparse([$this, 'decideIfEnd']); + break; + + case 'elseif': + $expr = $this->parser->getExpressionParser()->parseExpression(); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $body = $this->parser->subparse([$this, 'decideIfFork']); + $tests[] = $expr; + $tests[] = $body; + break; + + case 'endif': + $end = true; + break; + + default: + throw new SyntaxError(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new IfNode(new Node($tests), $else, $lineno, $this->getTag()); + } + + public function decideIfFork(Token $token): bool + { + return $token->test(['elseif', 'else', 'endif']); + } + + public function decideIfEnd(Token $token): bool + { + return $token->test(['endif']); + } + + public function getTag(): string + { + return 'if'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ImportTokenParser.php b/vendor/twig/twig/src/TokenParser/ImportTokenParser.php new file mode 100644 index 0000000..44cb4da --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/ImportTokenParser.php @@ -0,0 +1,44 @@ +parser->getExpressionParser()->parseExpression(); + $this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5, 'as'); + $var = new AssignNameExpression($this->parser->getStream()->expect(/* Token::NAME_TYPE */ 5)->getValue(), $token->getLine()); + $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); + + $this->parser->addImportedSymbol('template', $var->getAttribute('name')); + + return new ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope()); + } + + public function getTag(): string + { + return 'import'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php b/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php new file mode 100644 index 0000000..28beb8a --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php @@ -0,0 +1,69 @@ +parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new IncludeNode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + protected function parseArguments() + { + $stream = $this->parser->getStream(); + + $ignoreMissing = false; + if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'ignore')) { + $stream->expect(/* Token::NAME_TYPE */ 5, 'missing'); + + $ignoreMissing = true; + } + + $variables = null; + if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'with')) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + } + + $only = false; + if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'only')) { + $only = true; + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return [$variables, $only, $ignoreMissing]; + } + + public function getTag(): string + { + return 'include'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php new file mode 100644 index 0000000..f584927 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php @@ -0,0 +1,66 @@ + + * {% endmacro %} + * + * @internal + */ +final class MacroTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + + $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $this->parser->pushLocalScope(); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + if ($token = $stream->nextIf(/* Token::NAME_TYPE */ 5)) { + $value = $token->getValue(); + + if ($value != $name) { + throw new SyntaxError(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } + $this->parser->popLocalScope(); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno, $this->getTag())); + + return new Node(); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endmacro'); + } + + public function getTag(): string + { + return 'macro'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php b/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php new file mode 100644 index 0000000..c919556 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/SandboxTokenParser.php @@ -0,0 +1,66 @@ +parser->getStream(); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + $body = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + // in a sandbox tag, only include tags are allowed + if (!$body instanceof IncludeNode) { + foreach ($body as $node) { + if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) { + continue; + } + + if (!$node instanceof IncludeNode) { + throw new SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext()); + } + } + } + + return new SandboxNode($body, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endsandbox'); + } + + public function getTag(): string + { + return 'sandbox'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/SetTokenParser.php b/vendor/twig/twig/src/TokenParser/SetTokenParser.php new file mode 100644 index 0000000..2fbdfe0 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/SetTokenParser.php @@ -0,0 +1,73 @@ +getLine(); + $stream = $this->parser->getStream(); + $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); + + $capture = false; + if ($stream->nextIf(/* Token::OPERATOR_TYPE */ 8, '=')) { + $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + if (\count($names) !== \count($values)) { + throw new SyntaxError('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + } else { + $capture = true; + + if (\count($names) > 1) { + throw new SyntaxError('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $values = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + } + + return new SetNode($capture, $names, $values, $lineno, $this->getTag()); + } + + public function decideBlockEnd(Token $token): bool + { + return $token->test('endset'); + } + + public function getTag(): string + { + return 'set'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/TokenParserInterface.php b/vendor/twig/twig/src/TokenParser/TokenParserInterface.php new file mode 100644 index 0000000..bb8db3e --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/TokenParserInterface.php @@ -0,0 +1,46 @@ + + */ +interface TokenParserInterface +{ + /** + * Sets the parser associated with this token parser. + */ + public function setParser(Parser $parser): void; + + /** + * Parses a token and returns a node. + * + * @return Node + * + * @throws SyntaxError + */ + public function parse(Token $token); + + /** + * Gets the tag name associated with this token parser. + * + * @return string + */ + public function getTag(); +} diff --git a/vendor/twig/twig/src/TokenParser/UseTokenParser.php b/vendor/twig/twig/src/TokenParser/UseTokenParser.php new file mode 100644 index 0000000..d0a2de4 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/UseTokenParser.php @@ -0,0 +1,73 @@ +parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); + + if (!$template instanceof ConstantExpression) { + throw new SyntaxError('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getSourceContext()); + } + + $targets = []; + if ($stream->nextIf('with')) { + do { + $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + + $alias = $name; + if ($stream->nextIf('as')) { + $alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue(); + } + + $targets[$name] = new ConstantExpression($alias, -1); + + if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) { + break; + } + } while (true); + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)])); + + return new Node(); + } + + public function getTag(): string + { + return 'use'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/WithTokenParser.php b/vendor/twig/twig/src/TokenParser/WithTokenParser.php new file mode 100644 index 0000000..7d8cbe2 --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/WithTokenParser.php @@ -0,0 +1,56 @@ + + * + * @internal + */ +final class WithTokenParser extends AbstractTokenParser +{ + public function parse(Token $token): Node + { + $stream = $this->parser->getStream(); + + $variables = null; + $only = false; + if (!$stream->test(/* Token::BLOCK_END_TYPE */ 3)) { + $variables = $this->parser->getExpressionParser()->parseExpression(); + $only = (bool) $stream->nextIf(/* Token::NAME_TYPE */ 5, 'only'); + } + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + $body = $this->parser->subparse([$this, 'decideWithEnd'], true); + + $stream->expect(/* Token::BLOCK_END_TYPE */ 3); + + return new WithNode($body, $variables, $only, $token->getLine(), $this->getTag()); + } + + public function decideWithEnd(Token $token): bool + { + return $token->test('endwith'); + } + + public function getTag(): string + { + return 'with'; + } +} diff --git a/vendor/twig/twig/src/TokenStream.php b/vendor/twig/twig/src/TokenStream.php new file mode 100644 index 0000000..1eac11a --- /dev/null +++ b/vendor/twig/twig/src/TokenStream.php @@ -0,0 +1,132 @@ + + */ +final class TokenStream +{ + private $tokens; + private $current = 0; + private $source; + + public function __construct(array $tokens, Source $source = null) + { + $this->tokens = $tokens; + $this->source = $source ?: new Source('', ''); + } + + public function __toString() + { + return implode("\n", $this->tokens); + } + + public function injectTokens(array $tokens) + { + $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); + } + + /** + * Sets the pointer to the next token and returns the old one. + */ + public function next(): Token + { + if (!isset($this->tokens[++$this->current])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current - 1]; + } + + /** + * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. + * + * @return Token|null The next token if the condition is true, null otherwise + */ + public function nextIf($primary, $secondary = null) + { + if ($this->tokens[$this->current]->test($primary, $secondary)) { + return $this->next(); + } + } + + /** + * Tests a token and returns it or throws a syntax error. + */ + public function expect($type, $value = null, string $message = null): Token + { + $token = $this->tokens[$this->current]; + if (!$token->test($type, $value)) { + $line = $token->getLine(); + throw new SyntaxError(sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', + $message ? $message.'. ' : '', + Token::typeToEnglish($token->getType()), + $token->getValue() ? sprintf(' of value "%s"', $token->getValue()) : '', + Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), + $line, + $this->source + ); + } + $this->next(); + + return $token; + } + + /** + * Looks at the next token. + */ + public function look(int $number = 1): Token + { + if (!isset($this->tokens[$this->current + $number])) { + throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); + } + + return $this->tokens[$this->current + $number]; + } + + /** + * Tests the current token. + */ + public function test($primary, $secondary = null): bool + { + return $this->tokens[$this->current]->test($primary, $secondary); + } + + /** + * Checks if end of stream was reached. + */ + public function isEOF(): bool + { + return /* Token::EOF_TYPE */ -1 === $this->tokens[$this->current]->getType(); + } + + public function getCurrent(): Token + { + return $this->tokens[$this->current]; + } + + /** + * Gets the source associated with this stream. + * + * @internal + */ + public function getSourceContext(): Source + { + return $this->source; + } +} diff --git a/vendor/twig/twig/src/TwigFilter.php b/vendor/twig/twig/src/TwigFilter.php new file mode 100644 index 0000000..94e5f9b --- /dev/null +++ b/vendor/twig/twig/src/TwigFilter.php @@ -0,0 +1,134 @@ + + * + * @see https://twig.symfony.com/doc/templates.html#filters + */ +final class TwigFilter +{ + private $name; + private $callable; + private $options; + private $arguments = []; + + /** + * @param callable|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation. + */ + public function __construct(string $name, $callable = null, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'needs_environment' => false, + 'needs_context' => false, + 'is_variadic' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'pre_escape' => null, + 'preserves_safety' => null, + 'node_class' => FilterExpression::class, + 'deprecated' => false, + 'alternative' => null, + ], $options); + } + + public function getName(): string + { + return $this->name; + } + + /** + * Returns the callable to execute for this filter. + * + * @return callable|null + */ + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass(): string + { + return $this->options['node_class']; + } + + public function setArguments(array $arguments): void + { + $this->arguments = $arguments; + } + + public function getArguments(): array + { + return $this->arguments; + } + + public function needsEnvironment(): bool + { + return $this->options['needs_environment']; + } + + public function needsContext(): bool + { + return $this->options['needs_context']; + } + + public function getSafe(Node $filterArgs): ?array + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return $this->options['is_safe_callback']($filterArgs); + } + + return null; + } + + public function getPreservesSafety(): ?array + { + return $this->options['preserves_safety']; + } + + public function getPreEscape(): ?string + { + return $this->options['pre_escape']; + } + + public function isVariadic(): bool + { + return $this->options['is_variadic']; + } + + public function isDeprecated(): bool + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion(): string + { + return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated']; + } + + public function getAlternative(): ?string + { + return $this->options['alternative']; + } +} diff --git a/vendor/twig/twig/src/TwigFunction.php b/vendor/twig/twig/src/TwigFunction.php new file mode 100644 index 0000000..494d45b --- /dev/null +++ b/vendor/twig/twig/src/TwigFunction.php @@ -0,0 +1,122 @@ + + * + * @see https://twig.symfony.com/doc/templates.html#functions + */ +final class TwigFunction +{ + private $name; + private $callable; + private $options; + private $arguments = []; + + /** + * @param callable|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation. + */ + public function __construct(string $name, $callable = null, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'needs_environment' => false, + 'needs_context' => false, + 'is_variadic' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'node_class' => FunctionExpression::class, + 'deprecated' => false, + 'alternative' => null, + ], $options); + } + + public function getName(): string + { + return $this->name; + } + + /** + * Returns the callable to execute for this function. + * + * @return callable|null + */ + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass(): string + { + return $this->options['node_class']; + } + + public function setArguments(array $arguments): void + { + $this->arguments = $arguments; + } + + public function getArguments(): array + { + return $this->arguments; + } + + public function needsEnvironment(): bool + { + return $this->options['needs_environment']; + } + + public function needsContext(): bool + { + return $this->options['needs_context']; + } + + public function getSafe(Node $functionArgs): ?array + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return $this->options['is_safe_callback']($functionArgs); + } + + return []; + } + + public function isVariadic(): bool + { + return (bool) $this->options['is_variadic']; + } + + public function isDeprecated(): bool + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion(): string + { + return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated']; + } + + public function getAlternative(): ?string + { + return $this->options['alternative']; + } +} diff --git a/vendor/twig/twig/src/TwigTest.php b/vendor/twig/twig/src/TwigTest.php new file mode 100644 index 0000000..4c18632 --- /dev/null +++ b/vendor/twig/twig/src/TwigTest.php @@ -0,0 +1,100 @@ + + * + * @see https://twig.symfony.com/doc/templates.html#test-operator + */ +final class TwigTest +{ + private $name; + private $callable; + private $options; + private $arguments = []; + + /** + * @param callable|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. + */ + public function __construct(string $name, $callable = null, array $options = []) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge([ + 'is_variadic' => false, + 'node_class' => TestExpression::class, + 'deprecated' => false, + 'alternative' => null, + 'one_mandatory_argument' => false, + ], $options); + } + + public function getName(): string + { + return $this->name; + } + + /** + * Returns the callable to execute for this test. + * + * @return callable|null + */ + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass(): string + { + return $this->options['node_class']; + } + + public function setArguments(array $arguments): void + { + $this->arguments = $arguments; + } + + public function getArguments(): array + { + return $this->arguments; + } + + public function isVariadic(): bool + { + return (bool) $this->options['is_variadic']; + } + + public function isDeprecated(): bool + { + return (bool) $this->options['deprecated']; + } + + public function getDeprecatedVersion(): string + { + return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated']; + } + + public function getAlternative(): ?string + { + return $this->options['alternative']; + } + + public function hasOneMandatoryArgument(): bool + { + return (bool) $this->options['one_mandatory_argument']; + } +} diff --git a/vendor/twig/twig/src/Util/DeprecationCollector.php b/vendor/twig/twig/src/Util/DeprecationCollector.php new file mode 100644 index 0000000..378b666 --- /dev/null +++ b/vendor/twig/twig/src/Util/DeprecationCollector.php @@ -0,0 +1,77 @@ + + */ +final class DeprecationCollector +{ + private $twig; + + public function __construct(Environment $twig) + { + $this->twig = $twig; + } + + /** + * Returns deprecations for templates contained in a directory. + * + * @param string $dir A directory where templates are stored + * @param string $ext Limit the loaded templates by extension + * + * @return array An array of deprecations + */ + public function collectDir(string $dir, string $ext = '.twig'): array + { + $iterator = new \RegexIterator( + new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY + ), '{'.preg_quote($ext).'$}' + ); + + return $this->collect(new TemplateDirIterator($iterator)); + } + + /** + * Returns deprecations for passed templates. + * + * @param \Traversable $iterator An iterator of templates (where keys are template names and values the contents of the template) + * + * @return array An array of deprecations + */ + public function collect(\Traversable $iterator): array + { + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { + if (\E_USER_DEPRECATED === $type) { + $deprecations[] = $msg; + } + }); + + foreach ($iterator as $name => $contents) { + try { + $this->twig->parse($this->twig->tokenize(new Source($contents, $name))); + } catch (SyntaxError $e) { + // ignore templates containing syntax errors + } + } + + restore_error_handler(); + + return $deprecations; + } +} diff --git a/vendor/twig/twig/src/Util/TemplateDirIterator.php b/vendor/twig/twig/src/Util/TemplateDirIterator.php new file mode 100644 index 0000000..3bef14b --- /dev/null +++ b/vendor/twig/twig/src/Util/TemplateDirIterator.php @@ -0,0 +1,36 @@ + + */ +class TemplateDirIterator extends \IteratorIterator +{ + /** + * @return mixed + */ + #[\ReturnTypeWillChange] + public function current() + { + return file_get_contents(parent::current()); + } + + /** + * @return mixed + */ + #[\ReturnTypeWillChange] + public function key() + { + return (string) parent::key(); + } +}